@webda/core 4.0.0-beta.2 → 4.0.0-beta.4
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/README.md +252 -0
- package/lib/application/application.d.ts +468 -0
- package/lib/application/application.d.ts.map +1 -0
- package/lib/application/application.js +845 -0
- package/lib/application/application.js.map +1 -0
- package/lib/application/deployment.d.ts +93 -0
- package/lib/application/deployment.d.ts.map +1 -0
- package/lib/application/deployment.js +99 -0
- package/lib/application/deployment.js.map +1 -0
- package/lib/application/hooks.d.ts +34 -0
- package/lib/application/hooks.d.ts.map +1 -0
- package/lib/application/hooks.js +57 -0
- package/lib/application/hooks.js.map +1 -0
- package/lib/application/iapplication.d.ts +43 -0
- package/lib/application/iapplication.d.ts.map +1 -0
- package/lib/application/iapplication.js +2 -0
- package/lib/application/iapplication.js.map +1 -0
- package/lib/application/iconfiguration.d.ts +176 -0
- package/lib/application/iconfiguration.d.ts.map +1 -0
- package/lib/application/iconfiguration.js +8 -0
- package/lib/application/iconfiguration.js.map +1 -0
- package/lib/application/runner.d.ts +8 -0
- package/lib/application/runner.d.ts.map +1 -0
- package/lib/application/runner.js +26 -0
- package/lib/application/runner.js.map +1 -0
- package/lib/{unpackedapplication.d.ts → application/unpackedapplication.d.ts} +43 -23
- package/lib/application/unpackedapplication.d.ts.map +1 -0
- package/lib/application/unpackedapplication.js +500 -0
- package/lib/application/unpackedapplication.js.map +1 -0
- package/lib/bin/cli-phase.d.ts +28 -0
- package/lib/bin/cli-phase.d.ts.map +1 -0
- package/lib/bin/cli-phase.js +44 -0
- package/lib/bin/cli-phase.js.map +1 -0
- package/lib/bin/cli.d.ts +196 -0
- package/lib/bin/cli.d.ts.map +1 -0
- package/lib/bin/cli.js +934 -0
- package/lib/bin/cli.js.map +1 -0
- package/lib/bin/launcher.d.ts +3 -0
- package/lib/bin/launcher.d.ts.map +1 -0
- package/lib/bin/launcher.js +50 -0
- package/lib/bin/launcher.js.map +1 -0
- package/lib/cache/cache.d.ts +33 -0
- package/lib/cache/cache.d.ts.map +1 -0
- package/lib/cache/cache.js +8 -0
- package/lib/cache/cache.js.map +1 -0
- package/lib/{services/configuration.d.ts → configurations/configuration.service.d.ts} +58 -58
- package/lib/configurations/configuration.service.d.ts.map +1 -0
- package/lib/configurations/configuration.service.js +248 -0
- package/lib/configurations/configuration.service.js.map +1 -0
- package/lib/configurations/fileconfiguration.service.d.ts +30 -0
- package/lib/configurations/fileconfiguration.service.d.ts.map +1 -0
- package/lib/configurations/fileconfiguration.service.js +65 -0
- package/lib/configurations/fileconfiguration.service.js.map +1 -0
- package/lib/configurations/kubernetesconfiguration.service.d.ts +43 -0
- package/lib/configurations/kubernetesconfiguration.service.d.ts.map +1 -0
- package/lib/configurations/kubernetesconfiguration.service.js +83 -0
- package/lib/configurations/kubernetesconfiguration.service.js.map +1 -0
- package/lib/contexts/execution.d.ts +33 -0
- package/lib/contexts/execution.d.ts.map +1 -0
- package/lib/contexts/execution.js +73 -0
- package/lib/contexts/execution.js.map +1 -0
- package/lib/contexts/globalcontext.d.ts +29 -0
- package/lib/contexts/globalcontext.d.ts.map +1 -0
- package/lib/contexts/globalcontext.js +38 -0
- package/lib/contexts/globalcontext.js.map +1 -0
- package/lib/{utils → contexts}/httpcontext.d.ts +44 -19
- package/lib/contexts/httpcontext.d.ts.map +1 -0
- package/lib/{utils → contexts}/httpcontext.js +95 -27
- package/lib/contexts/httpcontext.js.map +1 -0
- package/lib/contexts/icontext.d.ts +236 -0
- package/lib/contexts/icontext.d.ts.map +1 -0
- package/lib/contexts/icontext.js +230 -0
- package/lib/contexts/icontext.js.map +1 -0
- package/lib/contexts/operationcontext.d.ts +182 -0
- package/lib/contexts/operationcontext.d.ts.map +1 -0
- package/lib/contexts/operationcontext.js +361 -0
- package/lib/contexts/operationcontext.js.map +1 -0
- package/lib/contexts/simplecontext.d.ts +31 -0
- package/lib/contexts/simplecontext.d.ts.map +1 -0
- package/lib/contexts/simplecontext.js +45 -0
- package/lib/contexts/simplecontext.js.map +1 -0
- package/lib/contexts/webcontext.d.ts +218 -0
- package/lib/contexts/webcontext.d.ts.map +1 -0
- package/lib/contexts/webcontext.js +389 -0
- package/lib/contexts/webcontext.js.map +1 -0
- package/lib/core/authorizer.d.ts +23 -0
- package/lib/core/authorizer.d.ts.map +1 -0
- package/lib/core/authorizer.js +17 -0
- package/lib/core/authorizer.js.map +1 -0
- package/lib/core/core.d.ts +225 -0
- package/lib/core/core.d.ts.map +1 -0
- package/lib/core/core.js +576 -0
- package/lib/core/core.js.map +1 -0
- package/lib/core/hooks.d.ts +94 -0
- package/lib/core/hooks.d.ts.map +1 -0
- package/lib/core/hooks.js +97 -0
- package/lib/core/hooks.js.map +1 -0
- package/lib/core/icore.d.ts +249 -0
- package/lib/core/icore.d.ts.map +1 -0
- package/lib/core/icore.js +15 -0
- package/lib/core/icore.js.map +1 -0
- package/lib/core/instancestorage.d.ts +61 -0
- package/lib/core/instancestorage.d.ts.map +1 -0
- package/lib/core/instancestorage.js +75 -0
- package/lib/core/instancestorage.js.map +1 -0
- package/lib/core/operations.d.ts +181 -0
- package/lib/core/operations.d.ts.map +1 -0
- package/lib/core/operations.js +559 -0
- package/lib/core/operations.js.map +1 -0
- package/lib/deployers/deployer.d.ts +157 -0
- package/lib/deployers/deployer.d.ts.map +1 -0
- package/lib/deployers/deployer.js +81 -0
- package/lib/deployers/deployer.js.map +1 -0
- package/lib/deployers/git.d.ts +27 -0
- package/lib/deployers/git.d.ts.map +1 -0
- package/lib/deployers/git.js +66 -0
- package/lib/deployers/git.js.map +1 -0
- package/lib/deployers/packager.d.ts +85 -0
- package/lib/deployers/packager.d.ts.map +1 -0
- package/lib/deployers/packager.js +259 -0
- package/lib/deployers/packager.js.map +1 -0
- package/lib/errors/errors.d.ts +126 -0
- package/lib/errors/errors.d.ts.map +1 -0
- package/lib/errors/errors.js +165 -0
- package/lib/errors/errors.js.map +1 -0
- package/lib/events/asynceventemitter.d.ts +159 -0
- package/lib/events/asynceventemitter.d.ts.map +1 -0
- package/lib/events/asynceventemitter.js +152 -0
- package/lib/events/asynceventemitter.js.map +1 -0
- package/lib/events/events.d.ts +112 -0
- package/lib/events/events.d.ts.map +1 -0
- package/lib/events/events.js +45 -0
- package/lib/events/events.js.map +1 -0
- package/lib/index.d.ts +88 -54
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +88 -64
- package/lib/index.js.map +1 -1
- package/lib/loggers/console.service.d.ts +24 -0
- package/lib/loggers/console.service.d.ts.map +1 -0
- package/lib/loggers/console.service.js +30 -0
- package/lib/loggers/console.service.js.map +1 -0
- package/lib/loggers/file.service.d.ts +25 -0
- package/lib/loggers/file.service.d.ts.map +1 -0
- package/lib/loggers/file.service.js +33 -0
- package/lib/loggers/file.service.js.map +1 -0
- package/lib/loggers/hooks.d.ts +20 -0
- package/lib/loggers/hooks.d.ts.map +1 -0
- package/lib/loggers/hooks.js +40 -0
- package/lib/loggers/hooks.js.map +1 -0
- package/lib/loggers/ilogger.d.ts +76 -0
- package/lib/loggers/ilogger.d.ts.map +1 -0
- package/lib/loggers/ilogger.js +108 -0
- package/lib/loggers/ilogger.js.map +1 -0
- package/lib/loggers/logger.d.ts +13 -0
- package/lib/loggers/logger.d.ts.map +1 -0
- package/lib/loggers/logger.js +18 -0
- package/lib/loggers/logger.js.map +1 -0
- package/lib/loggers/memory.service.d.ts +18 -0
- package/lib/loggers/memory.service.d.ts.map +1 -0
- package/lib/loggers/memory.service.js +21 -0
- package/lib/loggers/memory.service.js.map +1 -0
- package/lib/loggers/params.d.ts +47 -0
- package/lib/loggers/params.d.ts.map +1 -0
- package/lib/loggers/params.js +56 -0
- package/lib/loggers/params.js.map +1 -0
- package/lib/metrics/metrics.d.ts +25 -0
- package/lib/metrics/metrics.d.ts.map +1 -0
- package/lib/metrics/metrics.js +51 -0
- package/lib/metrics/metrics.js.map +1 -0
- package/lib/models/aclmodel.d.ts +20 -76
- package/lib/models/aclmodel.d.ts.map +1 -1
- package/lib/models/aclmodel.js +27 -203
- package/lib/models/aclmodel.js.map +1 -1
- package/lib/models/coremodel.model.d.ts +5 -0
- package/lib/models/coremodel.model.d.ts.map +1 -0
- package/lib/models/coremodel.model.js +5 -0
- package/lib/models/coremodel.model.js.map +1 -0
- package/lib/models/decorator.d.ts +67 -0
- package/lib/models/decorator.d.ts.map +1 -0
- package/lib/models/decorator.js +67 -0
- package/lib/models/decorator.js.map +1 -0
- package/lib/models/deployment.d.ts +2 -21
- package/lib/models/deployment.d.ts.map +1 -1
- package/lib/models/encrypted.model.d.ts +46 -0
- package/lib/models/encrypted.model.d.ts.map +1 -0
- package/lib/models/encrypted.model.js +87 -0
- package/lib/models/encrypted.model.js.map +1 -0
- package/lib/models/ident.model.d.ts +128 -0
- package/lib/models/ident.model.d.ts.map +1 -0
- package/lib/models/ident.model.js +207 -0
- package/lib/models/ident.model.js.map +1 -0
- package/lib/models/ownermodel.model.d.ts +68 -0
- package/lib/models/ownermodel.model.d.ts.map +1 -0
- package/lib/models/ownermodel.model.js +113 -0
- package/lib/models/ownermodel.model.js.map +1 -0
- package/lib/models/password.model.d.ts +78 -0
- package/lib/models/password.model.d.ts.map +1 -0
- package/lib/models/password.model.js +171 -0
- package/lib/models/password.model.js.map +1 -0
- package/lib/models/refreshtoken.model.d.ts +30 -0
- package/lib/models/refreshtoken.model.d.ts.map +1 -0
- package/lib/models/refreshtoken.model.js +29 -0
- package/lib/models/refreshtoken.model.js.map +1 -0
- package/lib/models/registry.model.d.ts +76 -0
- package/lib/models/registry.model.d.ts.map +1 -0
- package/lib/models/registry.model.js +104 -0
- package/lib/models/registry.model.js.map +1 -0
- package/lib/models/rolemodel.model.d.ts +28 -0
- package/lib/models/rolemodel.model.d.ts.map +1 -0
- package/lib/models/{rolemodel.js → rolemodel.model.js} +23 -5
- package/lib/models/rolemodel.model.js.map +1 -0
- package/lib/models/simpleuser.model.d.ts +78 -0
- package/lib/models/simpleuser.model.d.ts.map +1 -0
- package/lib/models/simpleuser.model.js +124 -0
- package/lib/models/simpleuser.model.js.map +1 -0
- package/lib/models/types.d.ts +113 -0
- package/lib/models/types.d.ts.map +1 -0
- package/lib/models/types.js +2 -0
- package/lib/models/types.js.map +1 -0
- package/lib/models/user.model.d.ts +103 -0
- package/lib/models/user.model.d.ts.map +1 -0
- package/lib/models/user.model.js +164 -0
- package/lib/models/user.model.js.map +1 -0
- package/lib/queues/{memoryqueue.d.ts → memoryqueue.service.d.ts} +26 -13
- package/lib/queues/memoryqueue.service.d.ts.map +1 -0
- package/lib/queues/{memoryqueue.js → memoryqueue.service.js} +55 -31
- package/lib/queues/memoryqueue.service.js.map +1 -0
- package/lib/queues/pubsubservice.d.ts +8 -6
- package/lib/queues/pubsubservice.d.ts.map +1 -1
- package/lib/queues/pubsubservice.js +5 -4
- package/lib/queues/pubsubservice.js.map +1 -1
- package/lib/queues/queueservice.d.ts +9 -11
- package/lib/queues/queueservice.d.ts.map +1 -1
- package/lib/queues/queueservice.js +41 -13
- package/lib/queues/queueservice.js.map +1 -1
- package/lib/rest/hooks.d.ts +8 -0
- package/lib/rest/hooks.d.ts.map +1 -0
- package/lib/rest/hooks.js +10 -0
- package/lib/rest/hooks.js.map +1 -0
- package/lib/rest/irest.d.ts +212 -0
- package/lib/rest/irest.d.ts.map +1 -0
- package/lib/rest/irest.js +39 -0
- package/lib/rest/irest.js.map +1 -0
- package/lib/rest/originfilter.d.ts +38 -0
- package/lib/rest/originfilter.d.ts.map +1 -0
- package/lib/rest/originfilter.js +61 -0
- package/lib/rest/originfilter.js.map +1 -0
- package/lib/rest/restoperationstransport.service.d.ts +193 -0
- package/lib/rest/restoperationstransport.service.d.ts.map +1 -0
- package/lib/rest/restoperationstransport.service.js +780 -0
- package/lib/rest/restoperationstransport.service.js.map +1 -0
- package/lib/rest/router.service.d.ts +244 -0
- package/lib/rest/router.service.d.ts.map +1 -0
- package/lib/rest/router.service.js +843 -0
- package/lib/rest/router.service.js.map +1 -0
- package/lib/schemas/hooks.d.ts +48 -0
- package/lib/schemas/hooks.d.ts.map +1 -0
- package/lib/schemas/hooks.js +152 -0
- package/lib/schemas/hooks.js.map +1 -0
- package/lib/services/audit.model.d.ts +208 -0
- package/lib/services/audit.model.d.ts.map +1 -0
- package/lib/services/audit.model.js +432 -0
- package/lib/services/audit.model.js.map +1 -0
- package/lib/services/binary.service.d.ts +808 -0
- package/lib/services/binary.service.d.ts.map +1 -0
- package/lib/services/binary.service.js +1365 -0
- package/lib/services/binary.service.js.map +1 -0
- package/lib/services/cloudbinary.d.ts +17 -12
- package/lib/services/cloudbinary.d.ts.map +1 -1
- package/lib/services/cloudbinary.js +23 -17
- package/lib/services/cloudbinary.js.map +1 -1
- package/lib/services/command.d.ts +118 -0
- package/lib/services/command.d.ts.map +1 -0
- package/lib/services/command.js +97 -0
- package/lib/services/command.js.map +1 -0
- package/lib/services/cron.service.d.ts +142 -0
- package/lib/services/cron.service.d.ts.map +1 -0
- package/lib/services/cron.service.js +291 -0
- package/lib/services/cron.service.js.map +1 -0
- package/lib/services/{cryptoservice.d.ts → cryptoservice.service.d.ts} +75 -141
- package/lib/services/cryptoservice.service.d.ts.map +1 -0
- package/lib/services/cryptoservice.service.js +527 -0
- package/lib/services/cryptoservice.service.js.map +1 -0
- package/lib/services/debugmailer.service.d.ts +49 -0
- package/lib/services/debugmailer.service.d.ts.map +1 -0
- package/lib/services/{debugmailer.js → debugmailer.service.js} +25 -10
- package/lib/services/debugmailer.service.js.map +1 -0
- package/lib/services/domainservice.service.d.ts +242 -0
- package/lib/services/domainservice.service.d.ts.map +1 -0
- package/lib/services/domainservice.service.js +676 -0
- package/lib/services/domainservice.service.js.map +1 -0
- package/lib/services/httpserver.service.d.ts +248 -0
- package/lib/services/httpserver.service.d.ts.map +1 -0
- package/lib/services/httpserver.service.js +673 -0
- package/lib/services/httpserver.service.js.map +1 -0
- package/lib/services/iauthentication.d.ts +202 -0
- package/lib/services/iauthentication.d.ts.map +1 -0
- package/lib/services/iauthentication.js +2 -0
- package/lib/services/iauthentication.js.map +1 -0
- package/lib/services/icryptoservice.d.ts +127 -0
- package/lib/services/icryptoservice.d.ts.map +1 -0
- package/lib/services/icryptoservice.js +68 -0
- package/lib/services/icryptoservice.js.map +1 -0
- package/lib/services/imailer.d.ts +17 -0
- package/lib/services/imailer.d.ts.map +1 -0
- package/lib/services/imailer.js +2 -0
- package/lib/services/imailer.js.map +1 -0
- package/lib/services/iservice.d.ts +104 -0
- package/lib/services/iservice.d.ts.map +1 -0
- package/lib/services/iservice.js +63 -0
- package/lib/services/iservice.js.map +1 -0
- package/lib/services/mailer.service.d.ts +220 -0
- package/lib/services/mailer.service.d.ts.map +1 -0
- package/lib/services/mailer.service.js +251 -0
- package/lib/services/mailer.service.js.map +1 -0
- package/lib/services/{notificationservice.d.ts → notificationservice.service.d.ts} +10 -11
- package/lib/services/notificationservice.service.d.ts.map +1 -0
- package/lib/services/{notificationservice.js → notificationservice.service.js} +24 -12
- package/lib/services/notificationservice.service.js.map +1 -0
- package/lib/services/operationstransport.d.ts +65 -0
- package/lib/services/operationstransport.d.ts.map +1 -0
- package/lib/services/operationstransport.js +103 -0
- package/lib/services/operationstransport.js.map +1 -0
- package/lib/services/{prometheus.d.ts → prometheus.service.d.ts} +13 -12
- package/lib/services/prometheus.service.d.ts.map +1 -0
- package/lib/services/prometheus.service.js +203 -0
- package/lib/services/prometheus.service.js.map +1 -0
- package/lib/services/{resource.d.ts → resource.service.d.ts} +34 -15
- package/lib/services/resource.service.d.ts.map +1 -0
- package/lib/services/resource.service.js +301 -0
- package/lib/services/resource.service.js.map +1 -0
- package/lib/services/service.d.ts +87 -188
- package/lib/services/service.d.ts.map +1 -1
- package/lib/services/service.js +407 -422
- package/lib/services/service.js.map +1 -1
- package/lib/services/servicecommands.d.ts +99 -0
- package/lib/services/servicecommands.d.ts.map +1 -0
- package/lib/services/servicecommands.js +171 -0
- package/lib/services/servicecommands.js.map +1 -0
- package/lib/services/serviceparameters.d.ts +33 -0
- package/lib/services/serviceparameters.d.ts.map +1 -0
- package/lib/services/serviceparameters.js +79 -0
- package/lib/services/serviceparameters.js.map +1 -0
- package/lib/services/token.service.d.ts +95 -0
- package/lib/services/token.service.d.ts.map +1 -0
- package/lib/services/token.service.js +182 -0
- package/lib/services/token.service.js.map +1 -0
- package/lib/{utils → session}/cookie.d.ts +32 -19
- package/lib/session/cookie.d.ts.map +1 -0
- package/lib/{utils → session}/cookie.js +76 -23
- package/lib/session/cookie.js.map +1 -0
- package/lib/session/manager.model.d.ts +87 -0
- package/lib/session/manager.model.d.ts.map +1 -0
- package/lib/session/manager.model.js +212 -0
- package/lib/session/manager.model.js.map +1 -0
- package/lib/session/session.d.ts +100 -0
- package/lib/session/session.d.ts.map +1 -0
- package/lib/session/session.js +175 -0
- package/lib/session/session.js.map +1 -0
- package/lib/stores/istore.d.ts +99 -0
- package/lib/stores/istore.d.ts.map +1 -0
- package/lib/stores/istore.js +26 -0
- package/lib/stores/istore.js.map +1 -0
- package/lib/stores/memory.service.d.ts +114 -0
- package/lib/stores/memory.service.d.ts.map +1 -0
- package/lib/stores/memory.service.js +344 -0
- package/lib/stores/memory.service.js.map +1 -0
- package/lib/stores/store.d.ts +126 -626
- package/lib/stores/store.d.ts.map +1 -1
- package/lib/stores/store.js +257 -1117
- package/lib/stores/store.js.map +1 -1
- package/lib/templates/templates.d.ts +47 -0
- package/lib/templates/templates.d.ts.map +1 -0
- package/lib/templates/templates.js +101 -0
- package/lib/templates/templates.js.map +1 -0
- package/lib/test/application.d.ts +174 -0
- package/lib/test/application.d.ts.map +1 -0
- package/lib/test/application.js +288 -0
- package/lib/test/application.js.map +1 -0
- package/lib/test/asyncstorage.d.ts +16 -0
- package/lib/test/asyncstorage.d.ts.map +1 -0
- package/lib/test/asyncstorage.js +32 -0
- package/lib/test/asyncstorage.js.map +1 -0
- package/lib/test/behavior-fixture.model.d.ts +30 -0
- package/lib/test/behavior-fixture.model.d.ts.map +1 -0
- package/lib/test/behavior-fixture.model.js +63 -0
- package/lib/test/behavior-fixture.model.js.map +1 -0
- package/lib/test/core.d.ts +63 -0
- package/lib/test/core.d.ts.map +1 -0
- package/lib/test/core.js +190 -0
- package/lib/test/core.js.map +1 -0
- package/lib/test/index.d.ts +7 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +8 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/internal.d.ts +34 -0
- package/lib/test/internal.d.ts.map +1 -0
- package/lib/test/internal.js +156 -0
- package/lib/test/internal.js.map +1 -0
- package/lib/test/legacyident.fixture.model.d.ts +98 -0
- package/lib/test/legacyident.fixture.model.d.ts.map +1 -0
- package/lib/test/legacyident.fixture.model.js +125 -0
- package/lib/test/legacyident.fixture.model.js.map +1 -0
- package/lib/test/objects.d.ts +318 -0
- package/lib/test/objects.d.ts.map +1 -0
- package/lib/test/objects.js +443 -0
- package/lib/test/objects.js.map +1 -0
- package/lib/utils/abstractdeployer.d.ts +4 -2
- package/lib/utils/abstractdeployer.d.ts.map +1 -1
- package/lib/utils/abstractdeployer.js +3 -0
- package/lib/utils/abstractdeployer.js.map +1 -1
- package/package.json +102 -60
- package/test/cachedapp/webda.config.json +1 -5
- package/test/config-cached.json +3 -6
- package/test/config.json +3 -10
- package/test/my-cnf.json +9 -0
- package/webda.module.json +3755 -2496
- package/lib/application.d.ts +0 -888
- package/lib/application.d.ts.map +0 -1
- package/lib/application.js +0 -768
- package/lib/application.js.map +0 -1
- package/lib/application.spec.d.ts +0 -2
- package/lib/application.spec.d.ts.map +0 -1
- package/lib/application.spec.js +0 -248
- package/lib/application.spec.js.map +0 -1
- package/lib/core.d.ts +0 -743
- package/lib/core.d.ts.map +0 -1
- package/lib/core.js +0 -1334
- package/lib/core.js.map +0 -1
- package/lib/core.spec.d.ts +0 -2
- package/lib/core.spec.d.ts.map +0 -1
- package/lib/core.spec.js +0 -790
- package/lib/core.spec.js.map +0 -1
- package/lib/errors.d.ts +0 -64
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js +0 -97
- package/lib/errors.js.map +0 -1
- package/lib/errors.spec.d.ts +0 -2
- package/lib/errors.spec.d.ts.map +0 -1
- package/lib/errors.spec.js +0 -33
- package/lib/errors.spec.js.map +0 -1
- package/lib/models/aclmodel.spec.d.ts +0 -2
- package/lib/models/aclmodel.spec.d.ts.map +0 -1
- package/lib/models/aclmodel.spec.js +0 -187
- package/lib/models/aclmodel.spec.js.map +0 -1
- package/lib/models/coremodel.d.ts +0 -896
- package/lib/models/coremodel.d.ts.map +0 -1
- package/lib/models/coremodel.js +0 -1214
- package/lib/models/coremodel.js.map +0 -1
- package/lib/models/coremodel.spec.d.ts +0 -2
- package/lib/models/coremodel.spec.d.ts.map +0 -1
- package/lib/models/coremodel.spec.js +0 -464
- package/lib/models/coremodel.spec.js.map +0 -1
- package/lib/models/ident.d.ts +0 -68
- package/lib/models/ident.d.ts.map +0 -1
- package/lib/models/ident.js +0 -26
- package/lib/models/ident.js.map +0 -1
- package/lib/models/ident.spec.d.ts +0 -2
- package/lib/models/ident.spec.d.ts.map +0 -1
- package/lib/models/ident.spec.js +0 -24
- package/lib/models/ident.spec.js.map +0 -1
- package/lib/models/ownermodel.d.ts +0 -51
- package/lib/models/ownermodel.d.ts.map +0 -1
- package/lib/models/ownermodel.js +0 -65
- package/lib/models/ownermodel.js.map +0 -1
- package/lib/models/ownermodel.spec.d.ts +0 -2
- package/lib/models/ownermodel.spec.d.ts.map +0 -1
- package/lib/models/ownermodel.spec.js +0 -215
- package/lib/models/ownermodel.spec.js.map +0 -1
- package/lib/models/relations.d.ts +0 -182
- package/lib/models/relations.d.ts.map +0 -1
- package/lib/models/relations.js +0 -157
- package/lib/models/relations.js.map +0 -1
- package/lib/models/relations.spec.d.ts +0 -14
- package/lib/models/relations.spec.d.ts.map +0 -1
- package/lib/models/relations.spec.js +0 -217
- package/lib/models/relations.spec.js.map +0 -1
- package/lib/models/rolemodel.d.ts +0 -11
- package/lib/models/rolemodel.d.ts.map +0 -1
- package/lib/models/rolemodel.js.map +0 -1
- package/lib/models/rolemodel.spec.d.ts +0 -2
- package/lib/models/rolemodel.spec.d.ts.map +0 -1
- package/lib/models/rolemodel.spec.js +0 -90
- package/lib/models/rolemodel.spec.js.map +0 -1
- package/lib/models/simpleuser.d.ts +0 -47
- package/lib/models/simpleuser.d.ts.map +0 -1
- package/lib/models/simpleuser.js +0 -84
- package/lib/models/simpleuser.js.map +0 -1
- package/lib/models/test.d.ts +0 -11
- package/lib/models/test.d.ts.map +0 -1
- package/lib/models/test.js +0 -7
- package/lib/models/test.js.map +0 -1
- package/lib/models/user.d.ts +0 -67
- package/lib/models/user.d.ts.map +0 -1
- package/lib/models/user.js +0 -86
- package/lib/models/user.js.map +0 -1
- package/lib/models/user.spec.d.ts +0 -2
- package/lib/models/user.spec.d.ts.map +0 -1
- package/lib/models/user.spec.js +0 -89
- package/lib/models/user.spec.js.map +0 -1
- package/lib/queues/filequeue.d.ts +0 -59
- package/lib/queues/filequeue.d.ts.map +0 -1
- package/lib/queues/filequeue.js +0 -131
- package/lib/queues/filequeue.js.map +0 -1
- package/lib/queues/filequeue.spec.d.ts +0 -2
- package/lib/queues/filequeue.spec.d.ts.map +0 -1
- package/lib/queues/filequeue.spec.js +0 -84
- package/lib/queues/filequeue.spec.js.map +0 -1
- package/lib/queues/memoryqueue.d.ts.map +0 -1
- package/lib/queues/memoryqueue.js.map +0 -1
- package/lib/queues/memoryqueue.spec.d.ts +0 -2
- package/lib/queues/memoryqueue.spec.d.ts.map +0 -1
- package/lib/queues/memoryqueue.spec.js +0 -203
- package/lib/queues/memoryqueue.spec.js.map +0 -1
- package/lib/queues/queue.spec.d.ts +0 -6
- package/lib/queues/queue.spec.d.ts.map +0 -1
- package/lib/queues/queue.spec.js +0 -55
- package/lib/queues/queue.spec.js.map +0 -1
- package/lib/rest/restdomainservice.d.ts +0 -63
- package/lib/rest/restdomainservice.d.ts.map +0 -1
- package/lib/rest/restdomainservice.js +0 -687
- package/lib/rest/restdomainservice.js.map +0 -1
- package/lib/rest/restdomainservice.spec.d.ts +0 -2
- package/lib/rest/restdomainservice.spec.d.ts.map +0 -1
- package/lib/rest/restdomainservice.spec.js +0 -124
- package/lib/rest/restdomainservice.spec.js.map +0 -1
- package/lib/rest/router.d.ts +0 -174
- package/lib/rest/router.d.ts.map +0 -1
- package/lib/rest/router.js +0 -429
- package/lib/rest/router.js.map +0 -1
- package/lib/rest/router.spec.d.ts +0 -2
- package/lib/rest/router.spec.d.ts.map +0 -1
- package/lib/rest/router.spec.js +0 -255
- package/lib/rest/router.spec.js.map +0 -1
- package/lib/services/asyncevents.d.ts +0 -152
- package/lib/services/asyncevents.d.ts.map +0 -1
- package/lib/services/asyncevents.js +0 -217
- package/lib/services/asyncevents.js.map +0 -1
- package/lib/services/asyncevents.spec.d.ts +0 -2
- package/lib/services/asyncevents.spec.d.ts.map +0 -1
- package/lib/services/asyncevents.spec.js +0 -118
- package/lib/services/asyncevents.spec.js.map +0 -1
- package/lib/services/authentication.d.ts +0 -361
- package/lib/services/authentication.d.ts.map +0 -1
- package/lib/services/authentication.js +0 -773
- package/lib/services/authentication.js.map +0 -1
- package/lib/services/authentication.spec.d.ts +0 -2
- package/lib/services/authentication.spec.d.ts.map +0 -1
- package/lib/services/authentication.spec.js +0 -458
- package/lib/services/authentication.spec.js.map +0 -1
- package/lib/services/binary.d.ts +0 -477
- package/lib/services/binary.d.ts.map +0 -1
- package/lib/services/binary.js +0 -617
- package/lib/services/binary.js.map +0 -1
- package/lib/services/binary.spec.d.ts +0 -41
- package/lib/services/binary.spec.d.ts.map +0 -1
- package/lib/services/binary.spec.js +0 -151
- package/lib/services/binary.spec.js.map +0 -1
- package/lib/services/cloudbinary.spec.d.ts +0 -6
- package/lib/services/cloudbinary.spec.d.ts.map +0 -1
- package/lib/services/cloudbinary.spec.js +0 -66
- package/lib/services/cloudbinary.spec.js.map +0 -1
- package/lib/services/configuration.d.ts.map +0 -1
- package/lib/services/configuration.js +0 -193
- package/lib/services/configuration.js.map +0 -1
- package/lib/services/configuration.spec.d.ts +0 -2
- package/lib/services/configuration.spec.d.ts.map +0 -1
- package/lib/services/configuration.spec.js +0 -130
- package/lib/services/configuration.spec.js.map +0 -1
- package/lib/services/cron.d.ts +0 -74
- package/lib/services/cron.d.ts.map +0 -1
- package/lib/services/cron.js +0 -141
- package/lib/services/cron.js.map +0 -1
- package/lib/services/cron.spec.d.ts +0 -2
- package/lib/services/cron.spec.d.ts.map +0 -1
- package/lib/services/cron.spec.js +0 -76
- package/lib/services/cron.spec.js.map +0 -1
- package/lib/services/cryptoservice.d.ts.map +0 -1
- package/lib/services/cryptoservice.js +0 -433
- package/lib/services/cryptoservice.js.map +0 -1
- package/lib/services/cryptoservice.spec.d.ts +0 -2
- package/lib/services/cryptoservice.spec.d.ts.map +0 -1
- package/lib/services/cryptoservice.spec.js +0 -177
- package/lib/services/cryptoservice.spec.js.map +0 -1
- package/lib/services/debugmailer.d.ts +0 -36
- package/lib/services/debugmailer.d.ts.map +0 -1
- package/lib/services/debugmailer.js.map +0 -1
- package/lib/services/debugmailer.spec.d.ts +0 -2
- package/lib/services/debugmailer.spec.d.ts.map +0 -1
- package/lib/services/debugmailer.spec.js +0 -32
- package/lib/services/debugmailer.spec.js.map +0 -1
- package/lib/services/domainservice.d.ts +0 -272
- package/lib/services/domainservice.d.ts.map +0 -1
- package/lib/services/domainservice.js +0 -651
- package/lib/services/domainservice.js.map +0 -1
- package/lib/services/domainservice.spec.d.ts +0 -2
- package/lib/services/domainservice.spec.d.ts.map +0 -1
- package/lib/services/domainservice.spec.js +0 -592
- package/lib/services/domainservice.spec.js.map +0 -1
- package/lib/services/filebinary.d.ts +0 -136
- package/lib/services/filebinary.d.ts.map +0 -1
- package/lib/services/filebinary.js +0 -373
- package/lib/services/filebinary.js.map +0 -1
- package/lib/services/filebinary.spec.d.ts +0 -25
- package/lib/services/filebinary.spec.d.ts.map +0 -1
- package/lib/services/filebinary.spec.js +0 -428
- package/lib/services/filebinary.spec.js.map +0 -1
- package/lib/services/fileconfiguration.d.ts +0 -23
- package/lib/services/fileconfiguration.d.ts.map +0 -1
- package/lib/services/fileconfiguration.js +0 -48
- package/lib/services/fileconfiguration.js.map +0 -1
- package/lib/services/fileconfiguration.spec.d.ts +0 -2
- package/lib/services/fileconfiguration.spec.d.ts.map +0 -1
- package/lib/services/fileconfiguration.spec.js +0 -215
- package/lib/services/fileconfiguration.spec.js.map +0 -1
- package/lib/services/invitationservice.d.ts +0 -223
- package/lib/services/invitationservice.d.ts.map +0 -1
- package/lib/services/invitationservice.js +0 -529
- package/lib/services/invitationservice.js.map +0 -1
- package/lib/services/invitationservice.spec.d.ts +0 -2
- package/lib/services/invitationservice.spec.d.ts.map +0 -1
- package/lib/services/invitationservice.spec.js +0 -567
- package/lib/services/invitationservice.spec.js.map +0 -1
- package/lib/services/kubernetesconfiguration.d.ts +0 -27
- package/lib/services/kubernetesconfiguration.d.ts.map +0 -1
- package/lib/services/kubernetesconfiguration.js +0 -52
- package/lib/services/kubernetesconfiguration.js.map +0 -1
- package/lib/services/kubernetesconfiguration.spec.d.ts +0 -2
- package/lib/services/kubernetesconfiguration.spec.d.ts.map +0 -1
- package/lib/services/kubernetesconfiguration.spec.js +0 -206
- package/lib/services/kubernetesconfiguration.spec.js.map +0 -1
- package/lib/services/mailer.d.ts +0 -166
- package/lib/services/mailer.d.ts.map +0 -1
- package/lib/services/mailer.js +0 -176
- package/lib/services/mailer.js.map +0 -1
- package/lib/services/mailer.spec.d.ts +0 -2
- package/lib/services/mailer.spec.d.ts.map +0 -1
- package/lib/services/mailer.spec.js +0 -158
- package/lib/services/mailer.spec.js.map +0 -1
- package/lib/services/notificationservice.d.ts.map +0 -1
- package/lib/services/notificationservice.js.map +0 -1
- package/lib/services/notificationservice.spec.d.ts +0 -2
- package/lib/services/notificationservice.spec.d.ts.map +0 -1
- package/lib/services/notificationservice.spec.js +0 -83
- package/lib/services/notificationservice.spec.js.map +0 -1
- package/lib/services/oauth.d.ts +0 -226
- package/lib/services/oauth.d.ts.map +0 -1
- package/lib/services/oauth.js +0 -294
- package/lib/services/oauth.js.map +0 -1
- package/lib/services/oauth.spec.d.ts +0 -2
- package/lib/services/oauth.spec.d.ts.map +0 -1
- package/lib/services/oauth.spec.js +0 -208
- package/lib/services/oauth.spec.js.map +0 -1
- package/lib/services/prometheus.d.ts.map +0 -1
- package/lib/services/prometheus.js +0 -160
- package/lib/services/prometheus.js.map +0 -1
- package/lib/services/prometheus.spec.d.ts +0 -2
- package/lib/services/prometheus.spec.d.ts.map +0 -1
- package/lib/services/prometheus.spec.js +0 -76
- package/lib/services/prometheus.spec.js.map +0 -1
- package/lib/services/resource.d.ts.map +0 -1
- package/lib/services/resource.js +0 -170
- package/lib/services/resource.js.map +0 -1
- package/lib/services/resource.spec.d.ts +0 -2
- package/lib/services/resource.spec.d.ts.map +0 -1
- package/lib/services/resource.spec.js +0 -140
- package/lib/services/resource.spec.js.map +0 -1
- package/lib/services/service.spec.d.ts +0 -2
- package/lib/services/service.spec.d.ts.map +0 -1
- package/lib/services/service.spec.js +0 -286
- package/lib/services/service.spec.js.map +0 -1
- package/lib/stores/aggregator.d.ts +0 -48
- package/lib/stores/aggregator.d.ts.map +0 -1
- package/lib/stores/aggregator.js +0 -80
- package/lib/stores/aggregator.js.map +0 -1
- package/lib/stores/file.d.ts +0 -108
- package/lib/stores/file.d.ts.map +0 -1
- package/lib/stores/file.js +0 -188
- package/lib/stores/file.js.map +0 -1
- package/lib/stores/file.spec.d.ts +0 -13
- package/lib/stores/file.spec.d.ts.map +0 -1
- package/lib/stores/file.spec.js +0 -138
- package/lib/stores/file.spec.js.map +0 -1
- package/lib/stores/mapper.d.ts +0 -150
- package/lib/stores/mapper.d.ts.map +0 -1
- package/lib/stores/mapper.js +0 -293
- package/lib/stores/mapper.js.map +0 -1
- package/lib/stores/mapper.spec.d.ts +0 -2
- package/lib/stores/mapper.spec.d.ts.map +0 -1
- package/lib/stores/mapper.spec.js +0 -167
- package/lib/stores/mapper.spec.js.map +0 -1
- package/lib/stores/memory.d.ts +0 -152
- package/lib/stores/memory.d.ts.map +0 -1
- package/lib/stores/memory.js +0 -371
- package/lib/stores/memory.js.map +0 -1
- package/lib/stores/memory.spec.d.ts +0 -14
- package/lib/stores/memory.spec.d.ts.map +0 -1
- package/lib/stores/memory.spec.js +0 -263
- package/lib/stores/memory.spec.js.map +0 -1
- package/lib/stores/modelmapper.d.ts +0 -62
- package/lib/stores/modelmapper.d.ts.map +0 -1
- package/lib/stores/modelmapper.js +0 -197
- package/lib/stores/modelmapper.js.map +0 -1
- package/lib/stores/store.spec.d.ts +0 -57
- package/lib/stores/store.spec.d.ts.map +0 -1
- package/lib/stores/store.spec.js +0 -737
- package/lib/stores/store.spec.js.map +0 -1
- package/lib/test.d.ts +0 -265
- package/lib/test.d.ts.map +0 -1
- package/lib/test.js +0 -622
- package/lib/test.js.map +0 -1
- package/lib/unpackedapplication.d.ts.map +0 -1
- package/lib/unpackedapplication.js +0 -350
- package/lib/unpackedapplication.js.map +0 -1
- package/lib/utils/abstractdeployer.spec.d.ts +0 -2
- package/lib/utils/abstractdeployer.spec.d.ts.map +0 -1
- package/lib/utils/abstractdeployer.spec.js +0 -21
- package/lib/utils/abstractdeployer.spec.js.map +0 -1
- package/lib/utils/case.d.ts +0 -8
- package/lib/utils/case.d.ts.map +0 -1
- package/lib/utils/case.js +0 -43
- package/lib/utils/case.js.map +0 -1
- package/lib/utils/case.spec.d.ts +0 -2
- package/lib/utils/case.spec.d.ts.map +0 -1
- package/lib/utils/case.spec.js +0 -50
- package/lib/utils/case.spec.js.map +0 -1
- package/lib/utils/context.d.ts +0 -482
- package/lib/utils/context.d.ts.map +0 -1
- package/lib/utils/context.js +0 -739
- package/lib/utils/context.js.map +0 -1
- package/lib/utils/context.spec.d.ts +0 -10
- package/lib/utils/context.spec.d.ts.map +0 -1
- package/lib/utils/context.spec.js +0 -383
- package/lib/utils/context.spec.js.map +0 -1
- package/lib/utils/cookie.d.ts.map +0 -1
- package/lib/utils/cookie.js.map +0 -1
- package/lib/utils/cookie.spec.d.ts +0 -2
- package/lib/utils/cookie.spec.d.ts.map +0 -1
- package/lib/utils/cookie.spec.js +0 -88
- package/lib/utils/cookie.spec.js.map +0 -1
- package/lib/utils/esm.d.ts +0 -14
- package/lib/utils/esm.d.ts.map +0 -1
- package/lib/utils/esm.js +0 -19
- package/lib/utils/esm.js.map +0 -1
- package/lib/utils/httpcontext.d.ts.map +0 -1
- package/lib/utils/httpcontext.js.map +0 -1
- package/lib/utils/httpcontext.spec.d.ts +0 -5
- package/lib/utils/httpcontext.spec.d.ts.map +0 -1
- package/lib/utils/httpcontext.spec.js +0 -77
- package/lib/utils/httpcontext.spec.js.map +0 -1
- package/lib/utils/logger.d.ts +0 -92
- package/lib/utils/logger.d.ts.map +0 -1
- package/lib/utils/logger.js +0 -121
- package/lib/utils/logger.js.map +0 -1
- package/lib/utils/logger.spec.d.ts +0 -2
- package/lib/utils/logger.spec.d.ts.map +0 -1
- package/lib/utils/logger.spec.js +0 -48
- package/lib/utils/logger.spec.js.map +0 -1
- package/lib/utils/serializers.d.ts +0 -162
- package/lib/utils/serializers.d.ts.map +0 -1
- package/lib/utils/serializers.js +0 -420
- package/lib/utils/serializers.js.map +0 -1
- package/lib/utils/serializers.spec.d.ts +0 -2
- package/lib/utils/serializers.spec.d.ts.map +0 -1
- package/lib/utils/serializers.spec.js +0 -311
- package/lib/utils/serializers.spec.js.map +0 -1
- package/lib/utils/session.d.ts +0 -123
- package/lib/utils/session.d.ts.map +0 -1
- package/lib/utils/session.js +0 -156
- package/lib/utils/session.js.map +0 -1
- package/lib/utils/session.spec.d.ts +0 -2
- package/lib/utils/session.spec.d.ts.map +0 -1
- package/lib/utils/session.spec.js +0 -81
- package/lib/utils/session.spec.js.map +0 -1
- package/lib/utils/throttler.d.ts +0 -99
- package/lib/utils/throttler.d.ts.map +0 -1
- package/lib/utils/throttler.js +0 -160
- package/lib/utils/throttler.js.map +0 -1
- package/lib/utils/throttler.spec.d.ts +0 -2
- package/lib/utils/throttler.spec.d.ts.map +0 -1
- package/lib/utils/throttler.spec.js +0 -53
- package/lib/utils/throttler.spec.js.map +0 -1
- package/lib/utils/waiter.d.ts +0 -94
- package/lib/utils/waiter.d.ts.map +0 -1
- package/lib/utils/waiter.js +0 -148
- package/lib/utils/waiter.js.map +0 -1
- package/lib/utils/waiter.spec.d.ts +0 -2
- package/lib/utils/waiter.spec.d.ts.map +0 -1
- package/lib/utils/waiter.spec.js +0 -98
- package/lib/utils/waiter.spec.js.map +0 -1
- package/test/jsonutils/mdocs.yaml +0 -56
- package/test/jsonutils/test.json +0 -3
- package/test/jsonutils/test.yml +0 -5
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Inject, Service } from "../services/service.js";
|
|
36
|
+
import { CookieOptions, SecureCookie } from "./cookie.js";
|
|
37
|
+
import { isWebContext } from "../contexts/icontext.js";
|
|
38
|
+
import { getUuid } from "@webda/utils";
|
|
39
|
+
import { ServiceParameters } from "../services/serviceparameters.js";
|
|
40
|
+
import { Session } from "./session.js";
|
|
41
|
+
import { useService, useUserResolver } from "../core/hooks.js";
|
|
42
|
+
import { runAsSystem } from "../contexts/execution.js";
|
|
43
|
+
import { UuidModel } from "@webda/models";
|
|
44
|
+
/**
|
|
45
|
+
* Manage load and save of sessions
|
|
46
|
+
*/
|
|
47
|
+
export class SessionManager extends Service {
|
|
48
|
+
/**
|
|
49
|
+
* Build a stateless session from an access token (any transport)
|
|
50
|
+
* @param context - the context
|
|
51
|
+
* @param token - access token
|
|
52
|
+
* @returns the session, anonymous when the token is invalid
|
|
53
|
+
*/
|
|
54
|
+
async loadFromToken(context, token) {
|
|
55
|
+
const session = new Session();
|
|
56
|
+
session.stateless = true;
|
|
57
|
+
const claims = await useService("TokenService").verifyAccess(token);
|
|
58
|
+
if (claims) {
|
|
59
|
+
session.login(claims.sub, claims.ident, { provider: claims.provider, amr: claims.amr, mfa: claims.mfa });
|
|
60
|
+
session.roles = claims.roles;
|
|
61
|
+
session.refreshFamily = claims.fam;
|
|
62
|
+
session.authAt = claims.authAt;
|
|
63
|
+
if (await this.isOutdated(session)) {
|
|
64
|
+
session.logout();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return session;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Whether the user of an authenticated session changed their password after the session was authenticated
|
|
71
|
+
*
|
|
72
|
+
* Costs one user read (through the registered user resolver) per load of a session carrying `authAt`. A failing
|
|
73
|
+
* read counts as outdated: the session is then anonymous for that request.
|
|
74
|
+
* @param session - loaded session
|
|
75
|
+
* @returns true when the session must be treated as anonymous
|
|
76
|
+
*/
|
|
77
|
+
async isOutdated(session) {
|
|
78
|
+
if (session.userId === undefined || typeof session.authAt !== "number") {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const user = await runAsSystem(() => useUserResolver().resolve(session.userId));
|
|
83
|
+
const changedAt = user?.password?.changedAt;
|
|
84
|
+
return typeof changedAt === "number" && changedAt > session.authAt;
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
this.log("WARN", "Cannot check the session against the user password, session ignored", err?.message);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Persistent session data stored in a model with a TTL */
|
|
93
|
+
export class SessionModel extends UuidModel {
|
|
94
|
+
ttl;
|
|
95
|
+
session;
|
|
96
|
+
/** Create a new SessionModel
|
|
97
|
+
* @param data - the session data
|
|
98
|
+
*/
|
|
99
|
+
constructor(data) {
|
|
100
|
+
super(data);
|
|
101
|
+
this.ttl = data.ttl || 0;
|
|
102
|
+
this.session = data.session || {};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Parameters for the cookie-based session manager */
|
|
106
|
+
export class CookieSessionParameters extends ServiceParameters {
|
|
107
|
+
/**
|
|
108
|
+
* Options for issue JWT token
|
|
109
|
+
*/
|
|
110
|
+
jwt;
|
|
111
|
+
/**
|
|
112
|
+
* Cookie configuration for session
|
|
113
|
+
*/
|
|
114
|
+
cookie;
|
|
115
|
+
/**
|
|
116
|
+
* Load parameters and initialize cookie options
|
|
117
|
+
* @param params - the service parameters
|
|
118
|
+
* @returns this for chaining
|
|
119
|
+
*/
|
|
120
|
+
load(params = {}) {
|
|
121
|
+
super.load(params);
|
|
122
|
+
this.cookie = new CookieOptions(this.cookie || {});
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* SessionManager that store info in a cookie
|
|
128
|
+
*
|
|
129
|
+
* If SessionStore service exists, only uuid is in the cookie
|
|
130
|
+
* the rest of data is stored within the session store
|
|
131
|
+
*
|
|
132
|
+
* @WebdaModda
|
|
133
|
+
*/
|
|
134
|
+
let CookieSessionManager = (() => {
|
|
135
|
+
let _classSuper = SessionManager;
|
|
136
|
+
let _cryptoService_decorators;
|
|
137
|
+
let _cryptoService_initializers = [];
|
|
138
|
+
let _cryptoService_extraInitializers = [];
|
|
139
|
+
return class CookieSessionManager extends _classSuper {
|
|
140
|
+
static {
|
|
141
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
142
|
+
_cryptoService_decorators = [Inject("CryptoService")];
|
|
143
|
+
__esDecorate(null, null, _cryptoService_decorators, { kind: "field", name: "cryptoService", static: false, private: false, access: { has: obj => "cryptoService" in obj, get: obj => obj.cryptoService, set: (obj, value) => { obj.cryptoService = value; } }, metadata: _metadata }, _cryptoService_initializers, _cryptoService_extraInitializers);
|
|
144
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
145
|
+
}
|
|
146
|
+
cryptoService = __runInitializers(this, _cryptoService_initializers, void 0);
|
|
147
|
+
sessionModel = __runInitializers(this, _cryptoService_extraInitializers);
|
|
148
|
+
/**
|
|
149
|
+
* @override
|
|
150
|
+
*/
|
|
151
|
+
async load(context) {
|
|
152
|
+
if (!isWebContext(context)) {
|
|
153
|
+
return new Session();
|
|
154
|
+
}
|
|
155
|
+
// A Bearer scheme is authoritative: an invalid token yields an anonymous session, never the cookie
|
|
156
|
+
const authorization = context.getHttpContext().getHeader("authorization");
|
|
157
|
+
if (typeof authorization === "string" && /^bearer(\s|$)/i.test(authorization)) {
|
|
158
|
+
return this.loadFromToken(context, authorization.substring(7).trim());
|
|
159
|
+
}
|
|
160
|
+
const session = new Session();
|
|
161
|
+
const cookie = await SecureCookie.load(this.parameters.cookie.name, session, context, this.parameters.jwt);
|
|
162
|
+
if (this.sessionModel) {
|
|
163
|
+
if (cookie.sub) {
|
|
164
|
+
Object.assign(session, (await this.sessionModel.get(cookie.sub))?.session);
|
|
165
|
+
session.uuid = cookie.sub;
|
|
166
|
+
}
|
|
167
|
+
session.uuid ??= getUuid("base64");
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
Object.assign(session, cookie);
|
|
171
|
+
}
|
|
172
|
+
// A password change ends the sessions authenticated before it
|
|
173
|
+
if (await this.isOutdated(session)) {
|
|
174
|
+
session.logout();
|
|
175
|
+
}
|
|
176
|
+
return session;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @override
|
|
180
|
+
*/
|
|
181
|
+
async save(context, session) {
|
|
182
|
+
if (!isWebContext(context)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (session.stateless) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// If store is found session info are stored in db
|
|
189
|
+
if (this.sessionModel) {
|
|
190
|
+
if (await this.sessionModel.exists(session.uuid)) {
|
|
191
|
+
await this.sessionModel.update({
|
|
192
|
+
uuid: session.uuid,
|
|
193
|
+
session,
|
|
194
|
+
ttl: Date.now() + this.parameters.cookie.maxAge * 1000
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
await this.sessionModel.create({
|
|
199
|
+
uuid: session.uuid,
|
|
200
|
+
session,
|
|
201
|
+
ttl: Date.now() + this.parameters.cookie.maxAge * 1000
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
SecureCookie.save(this.parameters.cookie.name, context, {}, { ...this.parameters.jwt, subject: session.uuid.toString() }, this.parameters.cookie);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
SecureCookie.save(this.parameters.cookie.name, context, session, this.parameters.jwt, this.parameters.cookie);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
})();
|
|
211
|
+
export { CookieSessionManager };
|
|
212
|
+
//# sourceMappingURL=manager.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.model.js","sourceRoot":"","sources":["../../src/session/manager.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAW,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAoC,SAAS,EAAE,MAAM,eAAe,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAgB,cAAgE,SAAQ,OAAU;IAatG;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,OAAgB,EAAE,KAA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|
|
2
|
+
* MFA progress of a session
|
|
3
|
+
*/
|
|
4
|
+
export type MfaState = "none" | "pending" | "verified";
|
|
5
|
+
/**
|
|
6
|
+
* Options for {@link Session.login}
|
|
7
|
+
*/
|
|
8
|
+
export interface LoginOptions {
|
|
9
|
+
provider?: string;
|
|
10
|
+
amr?: string[];
|
|
11
|
+
mfa?: MfaState;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Session
|
|
15
|
+
*/
|
|
16
|
+
export declare class Session {
|
|
17
|
+
protected changed: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Session uuid
|
|
20
|
+
*/
|
|
21
|
+
uuid: string;
|
|
22
|
+
/**
|
|
23
|
+
* User id
|
|
24
|
+
*/
|
|
25
|
+
userId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Ident used
|
|
28
|
+
*/
|
|
29
|
+
identUsed: string;
|
|
30
|
+
/**
|
|
31
|
+
* User current roles
|
|
32
|
+
*/
|
|
33
|
+
roles: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Authentication provider used
|
|
36
|
+
*/
|
|
37
|
+
provider?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Authentication methods used
|
|
40
|
+
*/
|
|
41
|
+
amr?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* MFA state of the session
|
|
44
|
+
*/
|
|
45
|
+
mfa?: MfaState;
|
|
46
|
+
/**
|
|
47
|
+
* Refresh token family identifier
|
|
48
|
+
*/
|
|
49
|
+
refreshFamily?: string;
|
|
50
|
+
/**
|
|
51
|
+
* When the session was authenticated (ms timestamp, stamped by the Authentication service): a session older than
|
|
52
|
+
* the last password change of its user is loaded as anonymous
|
|
53
|
+
*/
|
|
54
|
+
authAt?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Session is stateless (not persisted in cookies)
|
|
57
|
+
*/
|
|
58
|
+
stateless?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Login
|
|
61
|
+
* @param userId - the user identifier
|
|
62
|
+
* @param identUsed - the identity used
|
|
63
|
+
* @param options - login options including provider, amr, and mfa state
|
|
64
|
+
*/
|
|
65
|
+
login(userId: string, identUsed: string, options?: LoginOptions): void;
|
|
66
|
+
/**
|
|
67
|
+
* Logout
|
|
68
|
+
*/
|
|
69
|
+
logout(): void;
|
|
70
|
+
/**
|
|
71
|
+
* If session is authenticated
|
|
72
|
+
* @returns true if the condition is met
|
|
73
|
+
*/
|
|
74
|
+
isLogged(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* If session is pending MFA verification
|
|
77
|
+
* @returns true if the condition is met
|
|
78
|
+
*/
|
|
79
|
+
isPending(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Session is dirty and requires save
|
|
82
|
+
* @returns true if the condition is met
|
|
83
|
+
*/
|
|
84
|
+
isDirty(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get the proxy to be able to track modification
|
|
87
|
+
* @returns this for chaining
|
|
88
|
+
*/
|
|
89
|
+
getProxy(): this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Unknown session that allows all keys
|
|
93
|
+
*/
|
|
94
|
+
export declare class UnknownSession extends Session {
|
|
95
|
+
/**
|
|
96
|
+
* Allow any type of fields
|
|
97
|
+
*/
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session/session.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,OAAO;IAElB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAS;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IAEH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,QAMlE;IACD;;OAEG;IACH,MAAM,SASL;IAED;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAElB;IAED;;;OAGG;IACH,SAAS,IAAI,OAAO,CAEnB;IAED;;;OAGG;IACH,OAAO,IAAI,OAAO,CAEjB;IAED;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAef;CACF;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,OAAO;IACzC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { NotEnumerable } from "@webda/tsc-esm";
|
|
36
|
+
/**
|
|
37
|
+
* Session
|
|
38
|
+
*/
|
|
39
|
+
let Session = (() => {
|
|
40
|
+
let _changed_decorators;
|
|
41
|
+
let _changed_initializers = [];
|
|
42
|
+
let _changed_extraInitializers = [];
|
|
43
|
+
let _stateless_decorators;
|
|
44
|
+
let _stateless_initializers = [];
|
|
45
|
+
let _stateless_extraInitializers = [];
|
|
46
|
+
return class Session {
|
|
47
|
+
static {
|
|
48
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
49
|
+
_changed_decorators = [NotEnumerable];
|
|
50
|
+
_stateless_decorators = [NotEnumerable];
|
|
51
|
+
__esDecorate(null, null, _changed_decorators, { kind: "field", name: "changed", static: false, private: false, access: { has: obj => "changed" in obj, get: obj => obj.changed, set: (obj, value) => { obj.changed = value; } }, metadata: _metadata }, _changed_initializers, _changed_extraInitializers);
|
|
52
|
+
__esDecorate(null, null, _stateless_decorators, { kind: "field", name: "stateless", static: false, private: false, access: { has: obj => "stateless" in obj, get: obj => obj.stateless, set: (obj, value) => { obj.stateless = value; } }, metadata: _metadata }, _stateless_initializers, _stateless_extraInitializers);
|
|
53
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
54
|
+
}
|
|
55
|
+
changed = __runInitializers(this, _changed_initializers, false);
|
|
56
|
+
/**
|
|
57
|
+
* Session uuid
|
|
58
|
+
*/
|
|
59
|
+
uuid = __runInitializers(this, _changed_extraInitializers);
|
|
60
|
+
/**
|
|
61
|
+
* User id
|
|
62
|
+
*/
|
|
63
|
+
userId;
|
|
64
|
+
/**
|
|
65
|
+
* Ident used
|
|
66
|
+
*/
|
|
67
|
+
identUsed;
|
|
68
|
+
/**
|
|
69
|
+
* User current roles
|
|
70
|
+
*/
|
|
71
|
+
roles;
|
|
72
|
+
/**
|
|
73
|
+
* Authentication provider used
|
|
74
|
+
*/
|
|
75
|
+
provider;
|
|
76
|
+
/**
|
|
77
|
+
* Authentication methods used
|
|
78
|
+
*/
|
|
79
|
+
amr;
|
|
80
|
+
/**
|
|
81
|
+
* MFA state of the session
|
|
82
|
+
*/
|
|
83
|
+
mfa;
|
|
84
|
+
/**
|
|
85
|
+
* Refresh token family identifier
|
|
86
|
+
*/
|
|
87
|
+
refreshFamily;
|
|
88
|
+
/**
|
|
89
|
+
* When the session was authenticated (ms timestamp, stamped by the Authentication service): a session older than
|
|
90
|
+
* the last password change of its user is loaded as anonymous
|
|
91
|
+
*/
|
|
92
|
+
authAt;
|
|
93
|
+
/**
|
|
94
|
+
* Session is stateless (not persisted in cookies)
|
|
95
|
+
*/
|
|
96
|
+
stateless = __runInitializers(this, _stateless_initializers, void 0);
|
|
97
|
+
/**
|
|
98
|
+
* Login
|
|
99
|
+
* @param userId - the user identifier
|
|
100
|
+
* @param identUsed - the identity used
|
|
101
|
+
* @param options - login options including provider, amr, and mfa state
|
|
102
|
+
*/
|
|
103
|
+
login(userId, identUsed, options = {}) {
|
|
104
|
+
this.userId = userId;
|
|
105
|
+
this.identUsed = identUsed;
|
|
106
|
+
this.provider = options.provider;
|
|
107
|
+
this.amr = options.amr ?? [];
|
|
108
|
+
this.mfa = options.mfa ?? "none";
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Logout
|
|
112
|
+
*/
|
|
113
|
+
logout() {
|
|
114
|
+
delete this.userId;
|
|
115
|
+
delete this.identUsed;
|
|
116
|
+
delete this.roles;
|
|
117
|
+
delete this.provider;
|
|
118
|
+
delete this.amr;
|
|
119
|
+
delete this.mfa;
|
|
120
|
+
delete this.refreshFamily;
|
|
121
|
+
delete this.authAt;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* If session is authenticated
|
|
125
|
+
* @returns true if the condition is met
|
|
126
|
+
*/
|
|
127
|
+
isLogged() {
|
|
128
|
+
return this.userId !== undefined && this.mfa !== "pending";
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* If session is pending MFA verification
|
|
132
|
+
* @returns true if the condition is met
|
|
133
|
+
*/
|
|
134
|
+
isPending() {
|
|
135
|
+
return this.userId !== undefined && this.mfa === "pending";
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Session is dirty and requires save
|
|
139
|
+
* @returns true if the condition is met
|
|
140
|
+
*/
|
|
141
|
+
isDirty() {
|
|
142
|
+
return this.changed;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the proxy to be able to track modification
|
|
146
|
+
* @returns this for chaining
|
|
147
|
+
*/
|
|
148
|
+
getProxy() {
|
|
149
|
+
const proxyHandler = {
|
|
150
|
+
set: (obj, property, value) => {
|
|
151
|
+
this.changed = true;
|
|
152
|
+
obj[property] = value;
|
|
153
|
+
return true;
|
|
154
|
+
},
|
|
155
|
+
get: (obj, property) => {
|
|
156
|
+
if (typeof obj[property] === "object") {
|
|
157
|
+
return new Proxy(obj[property], proxyHandler);
|
|
158
|
+
}
|
|
159
|
+
return obj[property];
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
return new Proxy(this, proxyHandler);
|
|
163
|
+
}
|
|
164
|
+
constructor() {
|
|
165
|
+
__runInitializers(this, _stateless_extraInitializers);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
})();
|
|
169
|
+
export { Session };
|
|
170
|
+
/**
|
|
171
|
+
* Unknown session that allows all keys
|
|
172
|
+
*/
|
|
173
|
+
export class UnknownSession extends Session {
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session/session.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgB/C;;GAEG;IACU,OAAO;;;;;;;iBAAP,OAAO;;;mCACjB,aAAa;qCAiDb,aAAa;YAhDd,uKAAU,OAAO,6BAAP,OAAO,yFAAkB;YAiDnC,6KAAA,SAAS,6BAAT,SAAS,6FAAW;;;QAjDV,OAAO,kDAAY,KAAK,EAAC;QACnC;;WAE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;QAED;;;WAGG;QACH,OAAO;YACL,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED;;;WAGG;QACH,QAAQ;YACN,MAAM,YAAY,GAAG;gBACnB,GAAG,EAAE,CAAC,GAAS,EAAE,QAAgB,EAAE,KAAU,EAAE,EAAE;oBAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;oBACpB,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;oBACtB,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,GAAG,EAAE,CAAC,GAAS,EAAE,QAAgB,EAAE,EAAE;oBACnC,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,EAAE,CAAC;wBACtC,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;oBAChD,CAAC;oBACD,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACvC,CAAC;;;;;;SA3HU,OAAO;AA8HpB;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO;CAK1C"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Attributes, FilterAttributes } from "@webda/tsc-esm";
|
|
2
|
+
import type { WebdaQLString } from "@webda/ql";
|
|
3
|
+
/**
|
|
4
|
+
* This represent the injected methods of Store into the Model
|
|
5
|
+
*/
|
|
6
|
+
export interface StoreHelper<T extends object = object> {
|
|
7
|
+
/**
|
|
8
|
+
* Get data from the store
|
|
9
|
+
* @param uuid
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
get(uuid: string): Promise<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Create data in the store
|
|
15
|
+
* @param uuid
|
|
16
|
+
* @param data
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
create(uuid: string, data: T): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Update data in the store, replacing the object
|
|
22
|
+
* @param uuid
|
|
23
|
+
* @param data
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
update<K extends Attributes<T>>(uuid: string, data: T, conditionField?: K, condition?: T[K]): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Patch data in the store, patching the object
|
|
29
|
+
* @param uuid
|
|
30
|
+
* @param data
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
patch<K extends Attributes<T>>(uuid: string, data: Partial<T>, conditionField?: K, condition?: T[K]): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Query the store
|
|
36
|
+
* @param query
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
query(query: WebdaQLString<T>): Promise<T[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete data from the store
|
|
42
|
+
* @param uuid
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
delete<K extends Attributes<T>>(uuid: string, conditionField?: K, condition?: T[K]): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Verify if the object exists
|
|
48
|
+
* @param uuid
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
exists(uuid: string): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Increment attributes of an object
|
|
54
|
+
* @param uuid
|
|
55
|
+
* @param info
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
incrementAttributes<K extends Attributes<T>, L extends FilterAttributes<T, number>>(uuid: string, info: ({
|
|
59
|
+
property: L;
|
|
60
|
+
value?: number;
|
|
61
|
+
} | L)[], conditionField?: K, condition?: T[K]): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Upsert an item to a collection
|
|
64
|
+
* @param uuid
|
|
65
|
+
* @param collection
|
|
66
|
+
* @param item
|
|
67
|
+
* @param index
|
|
68
|
+
* @param itemWriteCondition
|
|
69
|
+
* @param itemWriteConditionField
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
upsertItemToCollection<K extends FilterAttributes<T, Array<any>>>(uuid: string, collection: K, item: any, index?: number, itemWriteConditionField?: any, itemWriteCondition?: any): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Delete item from a collection
|
|
75
|
+
* @param uuid
|
|
76
|
+
* @param collection
|
|
77
|
+
* @param index
|
|
78
|
+
* @param itemWriteCondition
|
|
79
|
+
* @param itemWriteConditionField
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
deleteItemFromCollection<K extends FilterAttributes<T, Array<any>>>(uuid: string, collection: K, index: number, itemWriteConditionField?: any, itemWriteCondition?: any): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Remove an attribute from an object
|
|
85
|
+
* @param uuid
|
|
86
|
+
* @param attribute
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
removeAttribute<L extends Attributes<T>, K extends Attributes<T>>(uuid: string, attribute: K, conditionField?: L, condition?: T[L]): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A mapping service allow to link two object together
|
|
93
|
+
*
|
|
94
|
+
* Therefore they need to handle the cascadeDelete
|
|
95
|
+
*/
|
|
96
|
+
export interface MappingService<T = any> {
|
|
97
|
+
newModel(object: any): T;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=istore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"istore.d.ts","sourceRoot":"","sources":["../../src/stores/istore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAgB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD;;;;OAIG;IACH,GAAG,CAAC,IAAI,EA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|
1
|
+
export {};
|
|
2
|
+
/*
|
|
3
|
+
export type CRUDHelper<T extends object> = {
|
|
4
|
+
[K in keyof Omit<StoreHelper<T>, "create" | "query" | "get" | "update">]: OmitFirstArg<StoreHelper<T>[K]>;
|
|
5
|
+
} & {
|
|
6
|
+
setAttribute<K extends Attributes<T>, L extends Attributes<T>>(
|
|
7
|
+
property: K,
|
|
8
|
+
value: T[K],
|
|
9
|
+
itemWriteConditionField?: L,
|
|
10
|
+
itemWriteCondition?: T[L]
|
|
11
|
+
): Promise<void>;
|
|
12
|
+
incrementAttribute<K extends FilterAttributes<T, number>, L extends Attributes<T>>(
|
|
13
|
+
property: K,
|
|
14
|
+
value?: number,
|
|
15
|
+
itemWriteConditionField?: L,
|
|
16
|
+
itemWriteCondition?: T[L]
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
upsert(data: T): Promise<T>;
|
|
19
|
+
create(data: T, withSave?: boolean): Promise<T>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CRUDModel<T extends object = object> = Omit<CRUDHelper<T>, "upsert" | "create" | "exists" | "update"> &
|
|
23
|
+
T & { save(full?: boolean | keyof T, ...fields: (keyof T)[]): Promise<T> };
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
//# sourceMappingURL=istore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"istore.js","sourceRoot":"","sources":["../../src/stores/istore.ts"],"names":[],"mappings":";AA0HA;;;;;;;;;;;;;;;;;;;;;;;EAuBE"}
|