@webda/core 4.0.0-beta.1 → 4.0.0-beta.3
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 +437 -0
- package/lib/application/application.d.ts.map +1 -0
- package/lib/application/application.js +792 -0
- package/lib/application/application.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/application/unpackedapplication.d.ts +104 -0
- package/lib/application/unpackedapplication.d.ts.map +1 -0
- package/lib/application/unpackedapplication.js +492 -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 +161 -0
- package/lib/bin/cli.d.ts.map +1 -0
- package/lib/bin/cli.js +828 -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 -49
- 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 +45 -19
- package/lib/contexts/httpcontext.d.ts.map +1 -0
- package/lib/{utils → contexts}/httpcontext.js +102 -34
- 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 +179 -0
- package/lib/contexts/operationcontext.d.ts.map +1 -0
- package/lib/contexts/operationcontext.js +358 -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 +72 -0
- package/lib/core/hooks.d.ts.map +1 -0
- package/lib/core/hooks.js +73 -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/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 +84 -51
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +82 -59
- 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 +21 -77
- package/lib/models/aclmodel.d.ts.map +1 -0
- package/lib/models/aclmodel.js +27 -204
- 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 +63 -0
- package/lib/models/decorator.d.ts.map +1 -0
- package/lib/models/decorator.js +63 -0
- package/lib/models/decorator.js.map +1 -0
- package/lib/models/deployment.d.ts +2 -1
- package/lib/models/deployment.d.ts.map +1 -0
- package/lib/models/ident.model.d.ts +89 -0
- package/lib/models/ident.model.d.ts.map +1 -0
- package/lib/models/ident.model.js +115 -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 +112 -0
- package/lib/models/ownermodel.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.model.js +53 -0
- 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 +123 -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 +125 -0
- package/lib/models/user.model.js.map +1 -0
- package/lib/queues/memoryqueue.service.d.ts +72 -0
- package/lib/queues/memoryqueue.service.d.ts.map +1 -0
- package/lib/queues/memoryqueue.service.js +136 -0
- package/lib/queues/memoryqueue.service.js.map +1 -0
- package/lib/queues/pubsubservice.d.ts +9 -6
- package/lib/queues/pubsubservice.d.ts.map +1 -0
- package/lib/queues/pubsubservice.js +5 -4
- package/lib/queues/pubsubservice.js.map +1 -1
- package/lib/queues/queueservice.d.ts +10 -11
- package/lib/queues/queueservice.d.ts.map +1 -0
- package/lib/queues/queueservice.js +48 -20
- 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 +431 -0
- package/lib/services/audit.model.js.map +1 -0
- package/lib/services/{authentication.d.ts → authentication.service.d.ts} +140 -58
- package/lib/services/authentication.service.d.ts.map +1 -0
- package/lib/services/authentication.service.js +932 -0
- package/lib/services/authentication.service.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 +19 -13
- package/lib/services/cloudbinary.d.ts.map +1 -0
- package/lib/services/cloudbinary.js +24 -18
- 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} +77 -142
- 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.service.js +66 -0
- package/lib/services/debugmailer.service.js.map +1 -0
- package/lib/services/domainservice.service.d.ts +203 -0
- package/lib/services/domainservice.service.d.ts.map +1 -0
- package/lib/services/domainservice.service.js +600 -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 +9 -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 -10
- 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/oauth.d.ts +58 -31
- package/lib/services/oauth.d.ts.map +1 -0
- package/lib/services/oauth.js +365 -251
- package/lib/services/oauth.js.map +1 -1
- 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 -11
- 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.service.d.ts +121 -0
- 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 +88 -189
- package/lib/services/service.d.ts.map +1 -0
- package/lib/services/service.js +407 -432
- 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 +165 -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/{utils → session}/cookie.d.ts +32 -18
- 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 +71 -0
- package/lib/session/manager.model.d.ts.map +1 -0
- package/lib/session/manager.model.js +155 -0
- package/lib/session/manager.model.js.map +1 -0
- package/lib/session/session.d.ts +57 -0
- package/lib/session/session.d.ts.map +1 -0
- package/lib/session/session.js +126 -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 +343 -0
- package/lib/stores/memory.service.js.map +1 -0
- package/lib/stores/store.d.ts +127 -768
- package/lib/stores/store.d.ts.map +1 -0
- package/lib/stores/store.js +258 -1718
- package/lib/stores/store.js.map +1 -1
- package/lib/templates/templates.d.ts +39 -0
- package/lib/templates/templates.d.ts.map +1 -0
- package/lib/templates/templates.js +92 -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/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/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 +5 -2
- package/lib/utils/abstractdeployer.d.ts.map +1 -0
- package/lib/utils/abstractdeployer.js +3 -0
- package/lib/utils/abstractdeployer.js.map +1 -1
- package/package.json +85 -56
- package/test/cachedapp/webda.config.json +1 -5
- package/test/config-cached.json +1 -5
- package/test/config.json +6 -99
- package/test/data/.env +1 -0
- package/test/my-cnf.json +9 -0
- package/webda.module.json +3462 -2231
- package/lib/application.d.ts +0 -876
- package/lib/application.js +0 -741
- package/lib/application.js.map +0 -1
- package/lib/application.spec.d.ts +0 -1
- package/lib/application.spec.js +0 -234
- package/lib/application.spec.js.map +0 -1
- package/lib/core.d.ts +0 -740
- package/lib/core.js +0 -1310
- package/lib/core.js.map +0 -1
- package/lib/core.spec.d.ts +0 -1
- package/lib/core.spec.js +0 -761
- package/lib/core.spec.js.map +0 -1
- package/lib/errors.d.ts +0 -65
- package/lib/errors.js +0 -113
- package/lib/errors.js.map +0 -1
- package/lib/errors.spec.d.ts +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 -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 -887
- package/lib/models/coremodel.js +0 -1208
- package/lib/models/coremodel.js.map +0 -1
- package/lib/models/coremodel.spec.d.ts +0 -1
- package/lib/models/coremodel.spec.js +0 -462
- package/lib/models/coremodel.spec.js.map +0 -1
- package/lib/models/ident.d.ts +0 -53
- package/lib/models/ident.js +0 -40
- package/lib/models/ident.js.map +0 -1
- package/lib/models/ident.spec.d.ts +0 -1
- package/lib/models/ident.spec.js +0 -43
- package/lib/models/ident.spec.js.map +0 -1
- package/lib/models/ownermodel.d.ts +0 -50
- package/lib/models/ownermodel.js +0 -65
- package/lib/models/ownermodel.js.map +0 -1
- package/lib/models/ownermodel.spec.d.ts +0 -1
- package/lib/models/ownermodel.spec.js +0 -191
- package/lib/models/ownermodel.spec.js.map +0 -1
- package/lib/models/relations.d.ts +0 -181
- package/lib/models/relations.js +0 -157
- package/lib/models/relations.js.map +0 -1
- package/lib/models/relations.spec.d.ts +0 -12
- package/lib/models/relations.spec.js +0 -224
- package/lib/models/relations.spec.js.map +0 -1
- package/lib/models/rolemodel.d.ts +0 -10
- package/lib/models/rolemodel.js +0 -35
- package/lib/models/rolemodel.js.map +0 -1
- package/lib/models/rolemodel.spec.d.ts +0 -1
- package/lib/models/rolemodel.spec.js +0 -86
- package/lib/models/rolemodel.spec.js.map +0 -1
- package/lib/models/user.d.ts +0 -100
- package/lib/models/user.js +0 -157
- package/lib/models/user.js.map +0 -1
- package/lib/models/user.spec.d.ts +0 -1
- package/lib/models/user.spec.js +0 -88
- package/lib/models/user.spec.js.map +0 -1
- package/lib/queues/filequeue.d.ts +0 -58
- package/lib/queues/filequeue.js +0 -131
- package/lib/queues/filequeue.js.map +0 -1
- package/lib/queues/filequeue.spec.d.ts +0 -1
- package/lib/queues/filequeue.spec.js +0 -78
- package/lib/queues/filequeue.spec.js.map +0 -1
- package/lib/queues/memoryqueue.d.ts +0 -45
- package/lib/queues/memoryqueue.js +0 -81
- package/lib/queues/memoryqueue.js.map +0 -1
- package/lib/queues/memoryqueue.spec.d.ts +0 -1
- package/lib/queues/memoryqueue.spec.js +0 -192
- package/lib/queues/memoryqueue.spec.js.map +0 -1
- package/lib/queues/queue.spec.d.ts +0 -5
- package/lib/queues/queue.spec.js +0 -55
- package/lib/queues/queue.spec.js.map +0 -1
- package/lib/router.d.ts +0 -172
- package/lib/router.js +0 -419
- package/lib/router.js.map +0 -1
- package/lib/router.spec.d.ts +0 -1
- package/lib/router.spec.js +0 -229
- package/lib/router.spec.js.map +0 -1
- package/lib/services/asyncevents.d.ts +0 -151
- package/lib/services/asyncevents.js +0 -217
- package/lib/services/asyncevents.js.map +0 -1
- package/lib/services/asyncevents.spec.d.ts +0 -1
- package/lib/services/asyncevents.spec.js +0 -118
- package/lib/services/asyncevents.spec.js.map +0 -1
- package/lib/services/authentication.js +0 -772
- package/lib/services/authentication.js.map +0 -1
- package/lib/services/authentication.spec.d.ts +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 -549
- package/lib/services/binary.js +0 -986
- package/lib/services/binary.js.map +0 -1
- package/lib/services/binary.spec.d.ts +0 -44
- package/lib/services/binary.spec.js +0 -438
- package/lib/services/binary.spec.js.map +0 -1
- package/lib/services/cloudbinary.spec.d.ts +0 -13
- package/lib/services/cloudbinary.spec.js +0 -192
- package/lib/services/cloudbinary.spec.js.map +0 -1
- package/lib/services/configuration.js +0 -178
- package/lib/services/configuration.js.map +0 -1
- package/lib/services/configuration.spec.d.ts +0 -1
- package/lib/services/configuration.spec.js +0 -87
- package/lib/services/configuration.spec.js.map +0 -1
- package/lib/services/cron.d.ts +0 -73
- package/lib/services/cron.js +0 -141
- package/lib/services/cron.js.map +0 -1
- package/lib/services/cron.spec.d.ts +0 -1
- package/lib/services/cron.spec.js +0 -76
- package/lib/services/cron.spec.js.map +0 -1
- package/lib/services/cryptoservice.js +0 -434
- package/lib/services/cryptoservice.js.map +0 -1
- package/lib/services/cryptoservice.spec.d.ts +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.js +0 -52
- package/lib/services/debugmailer.js.map +0 -1
- package/lib/services/debugmailer.spec.d.ts +0 -1
- package/lib/services/debugmailer.spec.js +0 -29
- package/lib/services/debugmailer.spec.js.map +0 -1
- package/lib/services/domainservice.d.ts +0 -152
- package/lib/services/domainservice.js +0 -881
- package/lib/services/domainservice.js.map +0 -1
- package/lib/services/domainservice.spec.d.ts +0 -1
- package/lib/services/domainservice.spec.js +0 -401
- package/lib/services/domainservice.spec.js.map +0 -1
- package/lib/services/filebinary.d.ts +0 -133
- package/lib/services/filebinary.js +0 -371
- package/lib/services/filebinary.js.map +0 -1
- package/lib/services/filebinary.spec.d.ts +0 -21
- package/lib/services/filebinary.spec.js +0 -415
- package/lib/services/filebinary.spec.js.map +0 -1
- package/lib/services/fileconfiguration.d.ts +0 -22
- package/lib/services/fileconfiguration.js +0 -48
- package/lib/services/fileconfiguration.js.map +0 -1
- package/lib/services/fileconfiguration.spec.d.ts +0 -1
- package/lib/services/fileconfiguration.spec.js +0 -177
- package/lib/services/fileconfiguration.spec.js.map +0 -1
- package/lib/services/invitationservice.d.ts +0 -222
- package/lib/services/invitationservice.js +0 -526
- package/lib/services/invitationservice.js.map +0 -1
- package/lib/services/invitationservice.spec.d.ts +0 -1
- package/lib/services/invitationservice.spec.js +0 -516
- package/lib/services/invitationservice.spec.js.map +0 -1
- package/lib/services/kubernetesconfiguration.d.ts +0 -26
- package/lib/services/kubernetesconfiguration.js +0 -54
- package/lib/services/kubernetesconfiguration.js.map +0 -1
- package/lib/services/kubernetesconfiguration.spec.d.ts +0 -1
- package/lib/services/kubernetesconfiguration.spec.js +0 -147
- package/lib/services/kubernetesconfiguration.spec.js.map +0 -1
- package/lib/services/mailer.d.ts +0 -165
- package/lib/services/mailer.js +0 -176
- package/lib/services/mailer.js.map +0 -1
- package/lib/services/mailer.spec.d.ts +0 -1
- package/lib/services/mailer.spec.js +0 -144
- package/lib/services/mailer.spec.js.map +0 -1
- package/lib/services/notificationservice.js.map +0 -1
- package/lib/services/notificationservice.spec.d.ts +0 -1
- package/lib/services/notificationservice.spec.js +0 -78
- package/lib/services/notificationservice.spec.js.map +0 -1
- package/lib/services/oauth.spec.d.ts +0 -1
- package/lib/services/oauth.spec.js +0 -184
- package/lib/services/oauth.spec.js.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 -1
- package/lib/services/prometheus.spec.js +0 -57
- package/lib/services/prometheus.spec.js.map +0 -1
- package/lib/services/resource.d.ts +0 -87
- package/lib/services/resource.js +0 -156
- package/lib/services/resource.js.map +0 -1
- package/lib/services/resource.spec.d.ts +0 -1
- package/lib/services/resource.spec.js +0 -122
- package/lib/services/resource.spec.js.map +0 -1
- package/lib/services/service.spec.d.ts +0 -1
- package/lib/services/service.spec.js +0 -268
- package/lib/services/service.spec.js.map +0 -1
- package/lib/stores/aggregator.d.ts +0 -41
- package/lib/stores/aggregator.js +0 -80
- package/lib/stores/aggregator.js.map +0 -1
- package/lib/stores/aliasstore.d.ts +0 -108
- package/lib/stores/aliasstore.js +0 -168
- package/lib/stores/aliasstore.js.map +0 -1
- package/lib/stores/aliasstore.spec.d.ts +0 -11
- package/lib/stores/aliasstore.spec.js +0 -89
- package/lib/stores/aliasstore.spec.js.map +0 -1
- package/lib/stores/file.d.ts +0 -107
- package/lib/stores/file.js +0 -188
- package/lib/stores/file.js.map +0 -1
- package/lib/stores/file.spec.d.ts +0 -19
- package/lib/stores/file.spec.js +0 -232
- package/lib/stores/file.spec.js.map +0 -1
- package/lib/stores/mapper.d.ts +0 -149
- package/lib/stores/mapper.js +0 -293
- package/lib/stores/mapper.js.map +0 -1
- package/lib/stores/mapper.spec.d.ts +0 -1
- package/lib/stores/mapper.spec.js +0 -160
- package/lib/stores/mapper.spec.js.map +0 -1
- package/lib/stores/memory.d.ts +0 -151
- package/lib/stores/memory.js +0 -371
- package/lib/stores/memory.js.map +0 -1
- package/lib/stores/memory.spec.d.ts +0 -20
- package/lib/stores/memory.spec.js +0 -328
- package/lib/stores/memory.spec.js.map +0 -1
- package/lib/stores/modelmapper.d.ts +0 -61
- package/lib/stores/modelmapper.js +0 -199
- package/lib/stores/modelmapper.js.map +0 -1
- package/lib/stores/store.spec.d.ts +0 -65
- package/lib/stores/store.spec.js +0 -906
- package/lib/stores/store.spec.js.map +0 -1
- package/lib/test.d.ts +0 -162
- package/lib/test.js +0 -399
- package/lib/test.js.map +0 -1
- package/lib/unpackedapplication.d.ts +0 -76
- package/lib/unpackedapplication.js +0 -299
- package/lib/unpackedapplication.js.map +0 -1
- package/lib/utils/abstractdeployer.spec.d.ts +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 -7
- package/lib/utils/case.js +0 -43
- package/lib/utils/case.js.map +0 -1
- package/lib/utils/case.spec.d.ts +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 -462
- package/lib/utils/context.js +0 -732
- package/lib/utils/context.js.map +0 -1
- package/lib/utils/context.spec.d.ts +0 -9
- package/lib/utils/context.spec.js +0 -372
- package/lib/utils/context.spec.js.map +0 -1
- package/lib/utils/cookie.js.map +0 -1
- package/lib/utils/cookie.spec.d.ts +0 -1
- package/lib/utils/cookie.spec.js +0 -78
- package/lib/utils/cookie.spec.js.map +0 -1
- package/lib/utils/esm.d.ts +0 -13
- package/lib/utils/esm.js +0 -19
- package/lib/utils/esm.js.map +0 -1
- package/lib/utils/httpcontext.js.map +0 -1
- package/lib/utils/httpcontext.spec.d.ts +0 -4
- package/lib/utils/httpcontext.spec.js +0 -77
- package/lib/utils/httpcontext.spec.js.map +0 -1
- package/lib/utils/logger.d.ts +0 -91
- package/lib/utils/logger.js +0 -121
- package/lib/utils/logger.js.map +0 -1
- package/lib/utils/logger.spec.d.ts +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 -161
- package/lib/utils/serializers.js +0 -420
- package/lib/utils/serializers.js.map +0 -1
- package/lib/utils/serializers.spec.d.ts +0 -1
- package/lib/utils/serializers.spec.js +0 -313
- package/lib/utils/serializers.spec.js.map +0 -1
- package/lib/utils/session.d.ts +0 -126
- package/lib/utils/session.js +0 -166
- package/lib/utils/session.js.map +0 -1
- package/lib/utils/session.spec.d.ts +0 -1
- package/lib/utils/session.spec.js +0 -71
- package/lib/utils/session.spec.js.map +0 -1
- package/lib/utils/throttler.d.ts +0 -102
- package/lib/utils/throttler.js +0 -168
- package/lib/utils/throttler.js.map +0 -1
- package/lib/utils/throttler.spec.d.ts +0 -1
- package/lib/utils/throttler.spec.js +0 -55
- package/lib/utils/throttler.spec.js.map +0 -1
- package/lib/utils/waiter.d.ts +0 -93
- package/lib/utils/waiter.js +0 -148
- package/lib/utils/waiter.js.map +0 -1
- package/lib/utils/waiter.spec.d.ts +0 -1
- package/lib/utils/waiter.spec.js +0 -98
- package/lib/utils/waiter.spec.js.map +0 -1
- package/test/config-file-missing-file-no-default.json +0 -44
- package/test/config-file-missing-file.json +0 -55
- package/test/config-file-no-reload.json +0 -69
- package/test/config-file-reload.json +0 -68
- package/test/config-invitation.json +0 -63
- package/test/config-kube-reload.json +0 -68
- package/test/config-reload.json +0 -66
- package/test/config.old.json +0 -152
- package/test/jsonutils/mdocs.yaml +0 -56
- package/test/jsonutils/test.json +0 -3
- package/test/jsonutils/test.yml +0 -5
- package/test/moddas/annotatedservice.js +0 -23
- package/test/moddas/debugmailer.js +0 -13
- package/test/moddas/fakeservice.js +0 -4
- package/test/moddas/voidstore.js +0 -66
- package/test/models/ident.js +0 -36
- package/test/models/task.js +0 -42
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error with a code
|
|
3
|
+
*/
|
|
4
|
+
export declare class CodeError extends Error {
|
|
5
|
+
code: string;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param code - the status code
|
|
9
|
+
* @param message - the message
|
|
10
|
+
*/
|
|
11
|
+
constructor(code: string, message: string);
|
|
12
|
+
/**
|
|
13
|
+
* Return error code
|
|
14
|
+
* @returns the result
|
|
15
|
+
*/
|
|
16
|
+
getCode(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Http response code
|
|
19
|
+
* @returns the result
|
|
20
|
+
*/
|
|
21
|
+
getResponseCode(): number;
|
|
22
|
+
}
|
|
23
|
+
/** HTTP error with a status code, auto-generating the error code from the class name */
|
|
24
|
+
export declare class HttpError extends CodeError {
|
|
25
|
+
statusCode: number;
|
|
26
|
+
/**
|
|
27
|
+
* Optional structured details for the client. Validation errors put the
|
|
28
|
+
* AJV `errors[]` here so consumers can map field-level failures to the UI
|
|
29
|
+
* without parsing the human-readable message.
|
|
30
|
+
*/
|
|
31
|
+
details?: any;
|
|
32
|
+
/** Create a new HttpError
|
|
33
|
+
* @param message - error message
|
|
34
|
+
* @param statusCode - HTTP status code
|
|
35
|
+
* @param details - optional structured details (e.g. validation errors)
|
|
36
|
+
*/
|
|
37
|
+
constructor(message: string, statusCode?: number, details?: any);
|
|
38
|
+
/**
|
|
39
|
+
* Get the HTTP status code for this error
|
|
40
|
+
* @returns the result number
|
|
41
|
+
*/
|
|
42
|
+
getResponseCode(): number;
|
|
43
|
+
}
|
|
44
|
+
/** HTTP 401 Unauthorized error */
|
|
45
|
+
export declare class Unauthorized extends HttpError {
|
|
46
|
+
/** Create a new Unauthorized
|
|
47
|
+
* @param message - error message
|
|
48
|
+
*/
|
|
49
|
+
constructor(message: string);
|
|
50
|
+
}
|
|
51
|
+
/** HTTP 403 Forbidden error */
|
|
52
|
+
export declare class Forbidden extends HttpError {
|
|
53
|
+
/** Create a new Forbidden
|
|
54
|
+
* @param message - error message
|
|
55
|
+
*/
|
|
56
|
+
constructor(message: string);
|
|
57
|
+
}
|
|
58
|
+
/** HTTP 404 Not Found error */
|
|
59
|
+
export declare class NotFound extends HttpError {
|
|
60
|
+
/** Create a new NotFound
|
|
61
|
+
* @param message - error message
|
|
62
|
+
*/
|
|
63
|
+
constructor(message: string);
|
|
64
|
+
}
|
|
65
|
+
/** HTTP 400 Bad Request error */
|
|
66
|
+
export declare class BadRequest extends HttpError {
|
|
67
|
+
/** Create a new BadRequest
|
|
68
|
+
* @param message - error message
|
|
69
|
+
* @param details - optional structured details (e.g. AJV validation errors)
|
|
70
|
+
*/
|
|
71
|
+
constructor(message: string, details?: any);
|
|
72
|
+
}
|
|
73
|
+
/** HTTP 409 Conflict error */
|
|
74
|
+
export declare class Conflict extends HttpError {
|
|
75
|
+
/** Create a new Conflict
|
|
76
|
+
* @param message - error message
|
|
77
|
+
*/
|
|
78
|
+
constructor(message: string);
|
|
79
|
+
}
|
|
80
|
+
/** HTTP 501 Not Implemented error */
|
|
81
|
+
export declare class NotImplemented extends HttpError {
|
|
82
|
+
/** Create a new NotImplemented
|
|
83
|
+
* @param message - error message
|
|
84
|
+
*/
|
|
85
|
+
constructor(message: string);
|
|
86
|
+
}
|
|
87
|
+
/** HTTP 503 Service Unavailable error */
|
|
88
|
+
export declare class ServiceUnavailable extends HttpError {
|
|
89
|
+
/** Create a new ServiceUnavailable
|
|
90
|
+
* @param message - error message
|
|
91
|
+
*/
|
|
92
|
+
constructor(message: string);
|
|
93
|
+
}
|
|
94
|
+
/** HTTP 429 Too Many Requests error */
|
|
95
|
+
export declare class TooManyRequests extends HttpError {
|
|
96
|
+
/** Create a new TooManyRequests
|
|
97
|
+
* @param message - error message
|
|
98
|
+
*/
|
|
99
|
+
constructor(message: string);
|
|
100
|
+
}
|
|
101
|
+
/** HTTP 410 Gone error */
|
|
102
|
+
export declare class Gone extends HttpError {
|
|
103
|
+
/** Create a new Gone
|
|
104
|
+
* @param message - error message
|
|
105
|
+
*/
|
|
106
|
+
constructor(message: string);
|
|
107
|
+
}
|
|
108
|
+
/** HTTP 412 Precondition Failed error */
|
|
109
|
+
export declare class PreconditionFailed extends HttpError {
|
|
110
|
+
/** Create a new PreconditionFailed
|
|
111
|
+
* @param message - error message
|
|
112
|
+
*/
|
|
113
|
+
constructor(message: string);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Can be used to redirect the user
|
|
117
|
+
*/
|
|
118
|
+
export declare class Redirect extends HttpError {
|
|
119
|
+
location: string;
|
|
120
|
+
/** Create a new Redirect
|
|
121
|
+
* @param message - error message
|
|
122
|
+
* @param location - URL to redirect to
|
|
123
|
+
*/
|
|
124
|
+
constructor(message: string, location: string);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAGxC;IAED;;;OAGG;IACH,OAAO,WAEN;IAED;;;OAGG;IACH,eAAe,WAEd;CACF;AAED,wFAAwF;AACxF,qBAAa,SAAU,SAAQ,SAAS;IAe7B,UAAU,EAAE,MAAM;IAd3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,GAAG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,SAAQ,SAAS;IAO5B,QAAQ,EAAE,MAAM;IANzB;;;OAGG;IACH,YACE,OAAO,EAAE,MAAM,EACR,QAAQ,EAAE,MAAM,EAGxB;CACF"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error with a code
|
|
3
|
+
*/
|
|
4
|
+
export class CodeError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param code - the status code
|
|
9
|
+
* @param message - the message
|
|
10
|
+
*/
|
|
11
|
+
constructor(code, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Return error code
|
|
17
|
+
* @returns the result
|
|
18
|
+
*/
|
|
19
|
+
getCode() {
|
|
20
|
+
return this.code;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Http response code
|
|
24
|
+
* @returns the result
|
|
25
|
+
*/
|
|
26
|
+
getResponseCode() {
|
|
27
|
+
return 500;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** HTTP error with a status code, auto-generating the error code from the class name */
|
|
31
|
+
export class HttpError extends CodeError {
|
|
32
|
+
statusCode;
|
|
33
|
+
/**
|
|
34
|
+
* Optional structured details for the client. Validation errors put the
|
|
35
|
+
* AJV `errors[]` here so consumers can map field-level failures to the UI
|
|
36
|
+
* without parsing the human-readable message.
|
|
37
|
+
*/
|
|
38
|
+
details;
|
|
39
|
+
/** Create a new HttpError
|
|
40
|
+
* @param message - error message
|
|
41
|
+
* @param statusCode - HTTP status code
|
|
42
|
+
* @param details - optional structured details (e.g. validation errors)
|
|
43
|
+
*/
|
|
44
|
+
constructor(message, statusCode = 500, details) {
|
|
45
|
+
super("", message);
|
|
46
|
+
this.statusCode = statusCode;
|
|
47
|
+
this.code = this.constructor.name.replace(/([a-z])([A-Z])/g, "$1_$2").toUpperCase();
|
|
48
|
+
if (details !== undefined) {
|
|
49
|
+
this.details = details;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the HTTP status code for this error
|
|
54
|
+
* @returns the result number
|
|
55
|
+
*/
|
|
56
|
+
getResponseCode() {
|
|
57
|
+
return this.statusCode;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** HTTP 401 Unauthorized error */
|
|
61
|
+
export class Unauthorized extends HttpError {
|
|
62
|
+
/** Create a new Unauthorized
|
|
63
|
+
* @param message - error message
|
|
64
|
+
*/
|
|
65
|
+
constructor(message) {
|
|
66
|
+
super(message, 401);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** HTTP 403 Forbidden error */
|
|
70
|
+
export class Forbidden extends HttpError {
|
|
71
|
+
/** Create a new Forbidden
|
|
72
|
+
* @param message - error message
|
|
73
|
+
*/
|
|
74
|
+
constructor(message) {
|
|
75
|
+
super(message, 403);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** HTTP 404 Not Found error */
|
|
79
|
+
export class NotFound extends HttpError {
|
|
80
|
+
/** Create a new NotFound
|
|
81
|
+
* @param message - error message
|
|
82
|
+
*/
|
|
83
|
+
constructor(message) {
|
|
84
|
+
super(message, 404);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** HTTP 400 Bad Request error */
|
|
88
|
+
export class BadRequest extends HttpError {
|
|
89
|
+
/** Create a new BadRequest
|
|
90
|
+
* @param message - error message
|
|
91
|
+
* @param details - optional structured details (e.g. AJV validation errors)
|
|
92
|
+
*/
|
|
93
|
+
constructor(message, details) {
|
|
94
|
+
super(message, 400, details);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** HTTP 409 Conflict error */
|
|
98
|
+
export class Conflict extends HttpError {
|
|
99
|
+
/** Create a new Conflict
|
|
100
|
+
* @param message - error message
|
|
101
|
+
*/
|
|
102
|
+
constructor(message) {
|
|
103
|
+
super(message, 409);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** HTTP 501 Not Implemented error */
|
|
107
|
+
export class NotImplemented extends HttpError {
|
|
108
|
+
/** Create a new NotImplemented
|
|
109
|
+
* @param message - error message
|
|
110
|
+
*/
|
|
111
|
+
constructor(message) {
|
|
112
|
+
super(message, 501);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** HTTP 503 Service Unavailable error */
|
|
116
|
+
export class ServiceUnavailable extends HttpError {
|
|
117
|
+
/** Create a new ServiceUnavailable
|
|
118
|
+
* @param message - error message
|
|
119
|
+
*/
|
|
120
|
+
constructor(message) {
|
|
121
|
+
super(message, 503);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** HTTP 429 Too Many Requests error */
|
|
125
|
+
export class TooManyRequests extends HttpError {
|
|
126
|
+
/** Create a new TooManyRequests
|
|
127
|
+
* @param message - error message
|
|
128
|
+
*/
|
|
129
|
+
constructor(message) {
|
|
130
|
+
super(message, 429);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** HTTP 410 Gone error */
|
|
134
|
+
export class Gone extends HttpError {
|
|
135
|
+
/** Create a new Gone
|
|
136
|
+
* @param message - error message
|
|
137
|
+
*/
|
|
138
|
+
constructor(message) {
|
|
139
|
+
super(message, 410);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** HTTP 412 Precondition Failed error */
|
|
143
|
+
export class PreconditionFailed extends HttpError {
|
|
144
|
+
/** Create a new PreconditionFailed
|
|
145
|
+
* @param message - error message
|
|
146
|
+
*/
|
|
147
|
+
constructor(message) {
|
|
148
|
+
super(message, 412);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Can be used to redirect the user
|
|
153
|
+
*/
|
|
154
|
+
export class Redirect extends HttpError {
|
|
155
|
+
location;
|
|
156
|
+
/** Create a new Redirect
|
|
157
|
+
* @param message - error message
|
|
158
|
+
* @param location - URL to redirect to
|
|
159
|
+
*/
|
|
160
|
+
constructor(message, location) {
|
|
161
|
+
super(message, 302);
|
|
162
|
+
this.location = location;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAS;IAEb;;;;OAIG;IACH,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,wFAAwF;AACxF,MAAM,OAAO,SAAU,SAAQ,SAAS;IAe7B,UAAU;IAdnB;;;;OAIG;IACH,OAAO,CAAO;IAEd;;;;OAIG;IACH,YACE,OAAe,EACR,UAAU,GAAW,GAAG,EAC/B,OAAa;QAEb,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;0BAHZ,UAAU;QAIjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACpF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAED,kCAAkC;AAClC,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC;;OAEG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,CAAC;CACF;AAED,+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AmB,SAAQ,SAAS;IAC/C;;OAEG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IAO5B,QAAQ;IANjB;;;OAGG;IACH,YACE,OAAe,EACR,QAAgB;QAEvB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;wBAFb,QAAQ;IAGjB,CAAC;CACF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { WorkerLogLevel } from "@webda/workout";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
/**
|
|
4
|
+
* AsyncEventUnknown is a type that represents an object with string keys and unknown values
|
|
5
|
+
*/
|
|
6
|
+
export type AsyncEventUnknown = {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Similar to EventEmitter but emit returns a Promise
|
|
11
|
+
* so you can decide to wait for the event to be processed or not
|
|
12
|
+
*/
|
|
13
|
+
export interface AsyncEventEmitter<E extends AsyncEventUnknown = AsyncEventUnknown> {
|
|
14
|
+
/**
|
|
15
|
+
* EventEmitter interface
|
|
16
|
+
* @param event
|
|
17
|
+
* @param listener
|
|
18
|
+
*/
|
|
19
|
+
addListener<Key extends keyof E>(event: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
20
|
+
/**
|
|
21
|
+
* EventEmitter interface
|
|
22
|
+
* @param event
|
|
23
|
+
* @param listener
|
|
24
|
+
*/
|
|
25
|
+
once<Key extends keyof E>(event: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
26
|
+
/**
|
|
27
|
+
* EventEmitter interface
|
|
28
|
+
* @param event
|
|
29
|
+
* @param listener
|
|
30
|
+
*/
|
|
31
|
+
on<Key extends keyof E>(event: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
32
|
+
/**
|
|
33
|
+
* EventEmitter interface
|
|
34
|
+
* @param event
|
|
35
|
+
* @param listener
|
|
36
|
+
*/
|
|
37
|
+
removeListener<Key extends keyof E>(event: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
38
|
+
/**
|
|
39
|
+
* EventEmitter interface
|
|
40
|
+
* @param event
|
|
41
|
+
* @param listener
|
|
42
|
+
*/
|
|
43
|
+
off<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
44
|
+
/**
|
|
45
|
+
* EventEmitter interface
|
|
46
|
+
* @param event
|
|
47
|
+
* @param listener
|
|
48
|
+
*/
|
|
49
|
+
removeAllListeners(eventName?: keyof E): this;
|
|
50
|
+
/**
|
|
51
|
+
* Emit an event for this class
|
|
52
|
+
* @param this
|
|
53
|
+
* @param event
|
|
54
|
+
* @param evt
|
|
55
|
+
*/
|
|
56
|
+
emit<Key extends keyof E>(eventName: keyof E, event: E[Key]): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param eventName
|
|
60
|
+
*/
|
|
61
|
+
listeners(eventName: keyof E): Function[];
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
*/
|
|
65
|
+
setMaxListeners(n: number): this;
|
|
66
|
+
/**
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
getMaxListeners(): number;
|
|
70
|
+
}
|
|
71
|
+
/** Concrete implementation of AsyncEventEmitter that wraps Node.js EventEmitter with async support */
|
|
72
|
+
export declare class AsyncEventEmitterImpl<E extends AsyncEventUnknown = AsyncEventUnknown> implements AsyncEventEmitter<E> {
|
|
73
|
+
private emitter;
|
|
74
|
+
/**
|
|
75
|
+
* @see EventEmitter.addListener
|
|
76
|
+
* @param eventName - the event name
|
|
77
|
+
* @param listener - the event listener
|
|
78
|
+
* @returns this for chaining
|
|
79
|
+
*/
|
|
80
|
+
addListener<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void | Promise<void>): this;
|
|
81
|
+
/**
|
|
82
|
+
* @override
|
|
83
|
+
*/
|
|
84
|
+
getMaxListeners(): number;
|
|
85
|
+
/**
|
|
86
|
+
* @override
|
|
87
|
+
*/
|
|
88
|
+
setMaxListeners(n: number): this;
|
|
89
|
+
/**
|
|
90
|
+
* @see EventEmitter.once
|
|
91
|
+
* @param eventName - the event name
|
|
92
|
+
* @param listener - the event listener
|
|
93
|
+
* @returns this for chaining
|
|
94
|
+
*/
|
|
95
|
+
once<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void): this;
|
|
96
|
+
/**
|
|
97
|
+
* @see EventEmitter.once
|
|
98
|
+
* @param eventName - the event name
|
|
99
|
+
* @param listener - the event listener
|
|
100
|
+
* @returns this for chaining
|
|
101
|
+
*/
|
|
102
|
+
on<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void): this;
|
|
103
|
+
/**
|
|
104
|
+
* @see EventEmitter.removeListener
|
|
105
|
+
* @param eventName - the event name
|
|
106
|
+
* @param listener - the event listener
|
|
107
|
+
* @returns this for chaining
|
|
108
|
+
*/
|
|
109
|
+
removeListener<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void): this;
|
|
110
|
+
/**
|
|
111
|
+
* @see EventEmitter.off
|
|
112
|
+
* @param eventName - the event name
|
|
113
|
+
* @param listener - the event listener
|
|
114
|
+
* @returns this for chaining
|
|
115
|
+
*/
|
|
116
|
+
off<Key extends keyof E>(eventName: Key, listener: (event: E[Key]) => void): this;
|
|
117
|
+
/**
|
|
118
|
+
* @see EventEmitter.removeAllListeners
|
|
119
|
+
* @param eventName - the event name
|
|
120
|
+
* @returns this for chaining
|
|
121
|
+
*/
|
|
122
|
+
removeAllListeners<Key extends keyof E>(eventName?: Key): this;
|
|
123
|
+
/**
|
|
124
|
+
* Emit an event for this class
|
|
125
|
+
*
|
|
126
|
+
* Instead of returning a boolean, this method returns a Promise
|
|
127
|
+
* so you can decide to wait for the event to be processed or not
|
|
128
|
+
*
|
|
129
|
+
* @see EventEmitter.emit
|
|
130
|
+
* @param eventName - the event name
|
|
131
|
+
* @param event - the event name
|
|
132
|
+
*/
|
|
133
|
+
emit<Key extends keyof E>(eventName: Key, event: E[Key]): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Get all listeners for an event
|
|
136
|
+
* @param eventName - the event name
|
|
137
|
+
* @returns the list of results
|
|
138
|
+
*/
|
|
139
|
+
listeners(eventName: keyof E): Function[];
|
|
140
|
+
/**
|
|
141
|
+
* Constructor
|
|
142
|
+
*/
|
|
143
|
+
protected constructor();
|
|
144
|
+
}
|
|
145
|
+
/** Utility class for emitting events and awaiting all listeners */
|
|
146
|
+
export declare class EventEmitterUtils {
|
|
147
|
+
/**
|
|
148
|
+
* Emit an event and wait for all listeners to finish
|
|
149
|
+
* @param eventEmitter - the event emitter
|
|
150
|
+
* @param event - the event name
|
|
151
|
+
* @param data - the data to process
|
|
152
|
+
* @param log - the logger instance
|
|
153
|
+
* @param longListenerThreshold - threshold for long listener warnings
|
|
154
|
+
* @returns the result number
|
|
155
|
+
*/
|
|
156
|
+
static emit(eventEmitter: EventEmitter | AsyncEventEmitter, event: string | number | symbol, data: any, log: (level: WorkerLogLevel, ...args: any[]) => void, longListenerThreshold?: number): Promise<any[]>;
|
|
157
|
+
}
|
|
158
|
+
export type ModelEmitter<T extends AsyncEventUnknown> = Pick<AsyncEventEmitter<T>, "on" | "emit" | "removeAllListeners" | "once" | "off">;
|
|
159
|
+
//# sourceMappingURL=asynceventemitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asynceventemitter.d.ts","sourceRoot":"","sources":["../../src/events/asynceventemitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE3D;;;GAGG;AAE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,CAAC,KAAK,IAAI,GAAG,IAAI,CAG3F;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,IAAI,CAEhF;IAED;;;;OAIG;IACH,kBAAkB,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,IAAI,CAG7D;IAED;;;;;;;;;OASG;IACG,IAAI,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAW5E;IAED;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,QAAQ,EAAE,CAExC;IAED;;OAEG;IACH,SAAS,eAER;CACF;AAED,mEAAmE;AACnE,qBAAa,iBAAiB;IAC5B;;;;;;;;OAQG;IACH,OAAa,IAAI,CACf,YAAY,EAAE,YAAY,GAAG,iBAAiB,EAC9C,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAC/B,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EACpD,qBAAqB,GAAE,MAAY,kBA4BpC;CACF;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,IAAI,CAC1D,iBAAiB,CAAC,CAAC,CAAC,EACpB,IAAI,GAAG,MAAM,GAAG,oBAAoB,GAAG,MAAM,GAAG,KAAK,CACtD,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
/** Concrete implementation of AsyncEventEmitter that wraps Node.js EventEmitter with async support */
|
|
3
|
+
export class AsyncEventEmitterImpl {
|
|
4
|
+
emitter;
|
|
5
|
+
/**
|
|
6
|
+
* @see EventEmitter.addListener
|
|
7
|
+
* @param eventName - the event name
|
|
8
|
+
* @param listener - the event listener
|
|
9
|
+
* @returns this for chaining
|
|
10
|
+
*/
|
|
11
|
+
addListener(eventName, listener) {
|
|
12
|
+
this.emitter.addListener(eventName, listener);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @override
|
|
17
|
+
*/
|
|
18
|
+
getMaxListeners() {
|
|
19
|
+
return this.emitter.getMaxListeners();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
setMaxListeners(n) {
|
|
25
|
+
this.emitter.setMaxListeners(n);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @see EventEmitter.once
|
|
30
|
+
* @param eventName - the event name
|
|
31
|
+
* @param listener - the event listener
|
|
32
|
+
* @returns this for chaining
|
|
33
|
+
*/
|
|
34
|
+
once(eventName, listener) {
|
|
35
|
+
this.emitter.once(eventName, listener);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @see EventEmitter.once
|
|
40
|
+
* @param eventName - the event name
|
|
41
|
+
* @param listener - the event listener
|
|
42
|
+
* @returns this for chaining
|
|
43
|
+
*/
|
|
44
|
+
on(eventName, listener) {
|
|
45
|
+
this.emitter.on(eventName, listener);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @see EventEmitter.removeListener
|
|
50
|
+
* @param eventName - the event name
|
|
51
|
+
* @param listener - the event listener
|
|
52
|
+
* @returns this for chaining
|
|
53
|
+
*/
|
|
54
|
+
removeListener(eventName, listener) {
|
|
55
|
+
this.emitter.removeListener(eventName, listener);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @see EventEmitter.off
|
|
60
|
+
* @param eventName - the event name
|
|
61
|
+
* @param listener - the event listener
|
|
62
|
+
* @returns this for chaining
|
|
63
|
+
*/
|
|
64
|
+
off(eventName, listener) {
|
|
65
|
+
return this.removeListener(eventName, listener);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @see EventEmitter.removeAllListeners
|
|
69
|
+
* @param eventName - the event name
|
|
70
|
+
* @returns this for chaining
|
|
71
|
+
*/
|
|
72
|
+
removeAllListeners(eventName) {
|
|
73
|
+
this.emitter.removeAllListeners(eventName);
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Emit an event for this class
|
|
78
|
+
*
|
|
79
|
+
* Instead of returning a boolean, this method returns a Promise
|
|
80
|
+
* so you can decide to wait for the event to be processed or not
|
|
81
|
+
*
|
|
82
|
+
* @see EventEmitter.emit
|
|
83
|
+
* @param eventName - the event name
|
|
84
|
+
* @param event - the event name
|
|
85
|
+
*/
|
|
86
|
+
async emit(eventName, event) {
|
|
87
|
+
let result;
|
|
88
|
+
const promises = [];
|
|
89
|
+
const listeners = this.emitter.listeners(eventName);
|
|
90
|
+
for (const listener of listeners) {
|
|
91
|
+
result = listener(event);
|
|
92
|
+
if (result instanceof Promise) {
|
|
93
|
+
promises.push(result);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
await Promise.all(promises);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get all listeners for an event
|
|
100
|
+
* @param eventName - the event name
|
|
101
|
+
* @returns the list of results
|
|
102
|
+
*/
|
|
103
|
+
listeners(eventName) {
|
|
104
|
+
return this.emitter.listeners(eventName);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Constructor
|
|
108
|
+
*/
|
|
109
|
+
constructor() {
|
|
110
|
+
this.emitter = new EventEmitter();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Utility class for emitting events and awaiting all listeners */
|
|
114
|
+
export class EventEmitterUtils {
|
|
115
|
+
/**
|
|
116
|
+
* Emit an event and wait for all listeners to finish
|
|
117
|
+
* @param eventEmitter - the event emitter
|
|
118
|
+
* @param event - the event name
|
|
119
|
+
* @param data - the data to process
|
|
120
|
+
* @param log - the logger instance
|
|
121
|
+
* @param longListenerThreshold - threshold for long listener warnings
|
|
122
|
+
* @returns the result number
|
|
123
|
+
*/
|
|
124
|
+
static async emit(eventEmitter, event, data, log, longListenerThreshold = 100) {
|
|
125
|
+
const promises = [];
|
|
126
|
+
const elapse = start => {
|
|
127
|
+
const elapsed = Date.now() - start;
|
|
128
|
+
if (elapsed > longListenerThreshold) {
|
|
129
|
+
log("INFO", "Long listener", elapsed, "ms");
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
for (const listener of eventEmitter.listeners(event)) {
|
|
133
|
+
const start = Date.now();
|
|
134
|
+
const result = listener(data);
|
|
135
|
+
if (result instanceof Promise) {
|
|
136
|
+
promises.push(result
|
|
137
|
+
.finally(() => {
|
|
138
|
+
elapse(start);
|
|
139
|
+
})
|
|
140
|
+
.catch(err => {
|
|
141
|
+
log("ERROR", "Listener error", err);
|
|
142
|
+
throw err;
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
elapse(start);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return Promise.all(promises);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=asynceventemitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asynceventemitter.js","sourceRoot":"","sources":["../../src/events/asynceventemitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuE3C,sGAAsG;AACtG,MAAM,OAAO,qBAAqB;IACxB,OAAO,CAAe;IAE9B;;;;;OAKG;IACH,WAAW,CAAsB,SAAc,EAAE,QAAiD;QAChG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAS,SAAS,EAAE,QAAQ,CAA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