@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
package/lib/models/user.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { OperationContext } from "../utils/context.js";
|
|
2
|
-
import { CoreModel } from "./coremodel.js";
|
|
3
|
-
import { Ident } from "./ident.js";
|
|
4
|
-
import { ModelsMapped } from "./relations.js";
|
|
5
|
-
/**
|
|
6
|
-
* First basic model for User
|
|
7
|
-
* @class
|
|
8
|
-
* @WebdaModel
|
|
9
|
-
*/
|
|
10
|
-
export declare class User extends CoreModel {
|
|
11
|
-
/**
|
|
12
|
-
* Password of the user if defined
|
|
13
|
-
*/
|
|
14
|
-
__password?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Display name for this user
|
|
17
|
-
* @optional
|
|
18
|
-
*/
|
|
19
|
-
displayName: string;
|
|
20
|
-
/**
|
|
21
|
-
* Last time the password was recovered
|
|
22
|
-
*/
|
|
23
|
-
_lastPasswordRecovery?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Define the user avatar if exists
|
|
26
|
-
*/
|
|
27
|
-
_avatar?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Contains the locale of the user if known
|
|
30
|
-
*/
|
|
31
|
-
locale?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Contain main user email if exists
|
|
34
|
-
*/
|
|
35
|
-
email?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Return user email if known or guessable
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
getEmail(): string | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Return displayable public entry
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
toPublicEntry(): any;
|
|
46
|
-
getGroups(): string[];
|
|
47
|
-
getRoles(): string[];
|
|
48
|
-
getDisplayName(): string;
|
|
49
|
-
getIdents(): Readonly<Pick<Ident, "_type" | "uuid" | "email">[]>;
|
|
50
|
-
lastPasswordRecoveryBefore(timestamp: number): boolean;
|
|
51
|
-
getPassword(): string;
|
|
52
|
-
setPassword(password: string): void;
|
|
53
|
-
canAct(ctx: OperationContext<any, any>, _action: string): Promise<string | boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* Add a login/logout event
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
static getClientEvents(): string[];
|
|
59
|
-
/**
|
|
60
|
-
* Only current user can see its own events
|
|
61
|
-
* @param _event
|
|
62
|
-
* @param context
|
|
63
|
-
* @param model
|
|
64
|
-
* @returns
|
|
65
|
-
*/
|
|
66
|
-
static authorizeClientEvent(_event: string, context: OperationContext<any, any>, model?: CoreModel): boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Simple user offers groups and roles management
|
|
70
|
-
*
|
|
71
|
-
* Groups and roles are defined just as string, no
|
|
72
|
-
* models
|
|
73
|
-
*/
|
|
74
|
-
export declare class SimpleUser extends User {
|
|
75
|
-
/**
|
|
76
|
-
* Groups for a user
|
|
77
|
-
*/
|
|
78
|
-
_groups: string[];
|
|
79
|
-
/**
|
|
80
|
-
* Roles of the user
|
|
81
|
-
*/
|
|
82
|
-
_roles: string[];
|
|
83
|
-
/**
|
|
84
|
-
* Normal ident
|
|
85
|
-
*/
|
|
86
|
-
_idents: ModelsMapped<Ident, "_user", "_type" | "uuid" | "email">;
|
|
87
|
-
/**
|
|
88
|
-
* Return idents
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
getIdents(): readonly import("./relations").ModelMapLoader<Ident, "uuid" | "email" | "_type">[];
|
|
92
|
-
addGroup(group: string): void;
|
|
93
|
-
inGroup(group: string): boolean;
|
|
94
|
-
removeGroup(group: string): void;
|
|
95
|
-
getGroups(): string[];
|
|
96
|
-
getRoles(): string[];
|
|
97
|
-
addRole(role: string): void;
|
|
98
|
-
hasRole(role: string): boolean;
|
|
99
|
-
removeRole(role: string): void;
|
|
100
|
-
}
|
package/lib/models/user.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { CoreModel } from "./coremodel.js";
|
|
2
|
-
/**
|
|
3
|
-
* First basic model for User
|
|
4
|
-
* @class
|
|
5
|
-
* @WebdaModel
|
|
6
|
-
*/
|
|
7
|
-
export class User extends CoreModel {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
/**
|
|
11
|
-
* Last time the password was recovered
|
|
12
|
-
*/
|
|
13
|
-
this._lastPasswordRecovery = 0;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Return user email if known or guessable
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
getEmail() {
|
|
20
|
-
this.email ?? (this.email = this.getIdents().find(i => {
|
|
21
|
-
return i.email;
|
|
22
|
-
})?.email);
|
|
23
|
-
return this.email;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Return displayable public entry
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
toPublicEntry() {
|
|
30
|
-
const res = {
|
|
31
|
-
displayName: this.displayName,
|
|
32
|
-
uuid: this.getUuid(),
|
|
33
|
-
avatar: this._avatar,
|
|
34
|
-
email: this.getEmail()
|
|
35
|
-
};
|
|
36
|
-
return res;
|
|
37
|
-
}
|
|
38
|
-
getGroups() {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
getRoles() {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
getDisplayName() {
|
|
45
|
-
return this.displayName;
|
|
46
|
-
}
|
|
47
|
-
getIdents() {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
lastPasswordRecoveryBefore(timestamp) {
|
|
51
|
-
return this._lastPasswordRecovery < timestamp;
|
|
52
|
-
}
|
|
53
|
-
getPassword() {
|
|
54
|
-
return this.__password;
|
|
55
|
-
}
|
|
56
|
-
setPassword(password) {
|
|
57
|
-
this.__password = password;
|
|
58
|
-
}
|
|
59
|
-
async canAct(ctx, _action) {
|
|
60
|
-
if (!ctx.getCurrentUserId() || ctx.getCurrentUserId() !== this.getUuid()) {
|
|
61
|
-
return "You can't act on this user";
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Add a login/logout event
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
static getClientEvents() {
|
|
70
|
-
return [...CoreModel.getClientEvents(), "login", "logout"];
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Only current user can see its own events
|
|
74
|
-
* @param _event
|
|
75
|
-
* @param context
|
|
76
|
-
* @param model
|
|
77
|
-
* @returns
|
|
78
|
-
*/
|
|
79
|
-
static authorizeClientEvent(_event, context, model) {
|
|
80
|
-
if (model && model.getUuid() === context.getCurrentUserId()) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Simple user offers groups and roles management
|
|
88
|
-
*
|
|
89
|
-
* Groups and roles are defined just as string, no
|
|
90
|
-
* models
|
|
91
|
-
*/
|
|
92
|
-
export class SimpleUser extends User {
|
|
93
|
-
constructor() {
|
|
94
|
-
super(...arguments);
|
|
95
|
-
/**
|
|
96
|
-
* Groups for a user
|
|
97
|
-
*/
|
|
98
|
-
this._groups = [];
|
|
99
|
-
/**
|
|
100
|
-
* Roles of the user
|
|
101
|
-
*/
|
|
102
|
-
this._roles = [];
|
|
103
|
-
/**
|
|
104
|
-
* Normal ident
|
|
105
|
-
*/
|
|
106
|
-
this._idents = [];
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Return idents
|
|
110
|
-
* @returns
|
|
111
|
-
*/
|
|
112
|
-
getIdents() {
|
|
113
|
-
return this._idents;
|
|
114
|
-
}
|
|
115
|
-
addGroup(group) {
|
|
116
|
-
if (this.inGroup(group)) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this._groups.push(group);
|
|
120
|
-
}
|
|
121
|
-
inGroup(group) {
|
|
122
|
-
if (group === "all" || group === this.getUuid()) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return this._groups.includes(group);
|
|
126
|
-
}
|
|
127
|
-
removeGroup(group) {
|
|
128
|
-
let ind = this._groups.indexOf(group);
|
|
129
|
-
if (ind < 0) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
this._groups.splice(ind, 1);
|
|
133
|
-
}
|
|
134
|
-
getGroups() {
|
|
135
|
-
return this._groups;
|
|
136
|
-
}
|
|
137
|
-
getRoles() {
|
|
138
|
-
return this._roles;
|
|
139
|
-
}
|
|
140
|
-
addRole(role) {
|
|
141
|
-
if (this.hasRole(role)) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this._roles.push(role);
|
|
145
|
-
}
|
|
146
|
-
hasRole(role) {
|
|
147
|
-
return this._roles.indexOf(role) >= 0;
|
|
148
|
-
}
|
|
149
|
-
removeRole(role) {
|
|
150
|
-
let ind = this._roles.indexOf(role);
|
|
151
|
-
if (ind < 0) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this._roles.splice(ind, 1);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
//# sourceMappingURL=user.js.map
|
package/lib/models/user.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/models/user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;GAIG;AACH,MAAM,OAAO,IAAK,SAAQ,SAAS;IAAnC;;QAUE;;WAE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,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/models/user.spec.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { suite, test } from "@testdeck/mocha";
|
|
8
|
-
import * as assert from "assert";
|
|
9
|
-
import { SimpleUser, User } from "./user.js";
|
|
10
|
-
let UserTest = class UserTest {
|
|
11
|
-
groupManagement() {
|
|
12
|
-
let user = new SimpleUser();
|
|
13
|
-
user.addGroup("test");
|
|
14
|
-
assert.strictEqual(user.inGroup("test"), true);
|
|
15
|
-
user.addGroup("test");
|
|
16
|
-
assert.strictEqual(user.inGroup("test"), true);
|
|
17
|
-
user.removeGroup("test");
|
|
18
|
-
assert.strictEqual(user.inGroup("test"), false);
|
|
19
|
-
assert.strictEqual(user.inGroup("all"), true);
|
|
20
|
-
user.removeGroup("unknown");
|
|
21
|
-
}
|
|
22
|
-
roleManagement() {
|
|
23
|
-
let user = new SimpleUser();
|
|
24
|
-
user.addRole("test");
|
|
25
|
-
assert.strictEqual(user.hasRole("test"), true);
|
|
26
|
-
user.addRole("test");
|
|
27
|
-
assert.strictEqual(user.hasRole("test"), true);
|
|
28
|
-
user.removeRole("test");
|
|
29
|
-
assert.strictEqual(user.hasRole("test"), false);
|
|
30
|
-
user.removeRole("unknown");
|
|
31
|
-
}
|
|
32
|
-
userCov() {
|
|
33
|
-
const user = new User();
|
|
34
|
-
assert.deepStrictEqual(user.getRoles(), []);
|
|
35
|
-
}
|
|
36
|
-
password() {
|
|
37
|
-
let user = new User();
|
|
38
|
-
user.setPassword("bouzouf");
|
|
39
|
-
}
|
|
40
|
-
idents() {
|
|
41
|
-
let user = new User();
|
|
42
|
-
assert.deepStrictEqual(user.getIdents(), []);
|
|
43
|
-
}
|
|
44
|
-
emailGetter() {
|
|
45
|
-
let user = new SimpleUser();
|
|
46
|
-
assert.strictEqual(user.getEmail(), undefined);
|
|
47
|
-
assert.deepStrictEqual(user.toPublicEntry(), {
|
|
48
|
-
avatar: undefined,
|
|
49
|
-
displayName: undefined,
|
|
50
|
-
uuid: undefined,
|
|
51
|
-
email: undefined
|
|
52
|
-
});
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
user.load({ _idents: [{}, { email: "testIdent@test.com" }] }, true);
|
|
55
|
-
assert.strictEqual(user.getEmail(), "testIdent@test.com");
|
|
56
|
-
user.load({ email: "test@test.com", displayName: "Top" });
|
|
57
|
-
assert.strictEqual(user.getEmail(), "test@test.com");
|
|
58
|
-
assert.strictEqual(user.getDisplayName(), "Top");
|
|
59
|
-
assert.deepStrictEqual(user.toPublicEntry(), {
|
|
60
|
-
avatar: undefined,
|
|
61
|
-
displayName: "Top",
|
|
62
|
-
email: "test@test.com",
|
|
63
|
-
uuid: user.getUuid()
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
__decorate([
|
|
68
|
-
test("Verify groups in user")
|
|
69
|
-
], UserTest.prototype, "groupManagement", null);
|
|
70
|
-
__decorate([
|
|
71
|
-
test("Verify roles in user")
|
|
72
|
-
], UserTest.prototype, "roleManagement", null);
|
|
73
|
-
__decorate([
|
|
74
|
-
test
|
|
75
|
-
], UserTest.prototype, "userCov", null);
|
|
76
|
-
__decorate([
|
|
77
|
-
test
|
|
78
|
-
], UserTest.prototype, "password", null);
|
|
79
|
-
__decorate([
|
|
80
|
-
test
|
|
81
|
-
], UserTest.prototype, "idents", null);
|
|
82
|
-
__decorate([
|
|
83
|
-
test
|
|
84
|
-
], UserTest.prototype, "emailGetter", null);
|
|
85
|
-
UserTest = __decorate([
|
|
86
|
-
suite
|
|
87
|
-
], UserTest);
|
|
88
|
-
//# sourceMappingURL=user.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.spec.js","sourceRoot":"","sources":["../../src/models/user.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG1C,IAAM,QAAQ,GAAd,MAAM,QAAQ;IACmB,eAAe;QAC5C,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;YACjB,WAAW,EAAE,KAAK;YAClB,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;SACrB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAhEgC;IAA9B,IAAI,CAAC,uBAAuB,CAAC;+CAU7B;AAE6B;IAA7B,IAAI,CAAC,sBAAsB,CAAC;8CAS5B;AAGD;IADC,IAAI;uCAIJ;AAGD;IADC,IAAI;wCAIJ;AAGD;IADC,IAAI;sCAIJ;AAGD;IADC,IAAI;2CAsBJ;AAhEG,QAAQ;IADb,KAAK;GACA,QAAQ,CAiEb"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ServiceParameters } from "../services/service.js";
|
|
2
|
-
import { MessageReceipt, Queue, QueueParameters } from "./queueservice.js";
|
|
3
|
-
export declare class FileQueueParameters extends QueueParameters {
|
|
4
|
-
/**
|
|
5
|
-
* Number of seconds before droping message
|
|
6
|
-
*
|
|
7
|
-
* @default 30
|
|
8
|
-
*/
|
|
9
|
-
expire?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Where to store the queue
|
|
12
|
-
*/
|
|
13
|
-
folder: string;
|
|
14
|
-
constructor(params: any);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* FIFO Queue on filesystem
|
|
18
|
-
* @category CoreServices
|
|
19
|
-
* @WebdaModda
|
|
20
|
-
*/
|
|
21
|
-
export declare class FileQueue<T = any, K extends FileQueueParameters = FileQueueParameters> extends Queue<T, K> {
|
|
22
|
-
/**
|
|
23
|
-
* @inheritdoc
|
|
24
|
-
*/
|
|
25
|
-
loadParameters(params: any): ServiceParameters;
|
|
26
|
-
/**
|
|
27
|
-
* Create the storage folder if does not exist
|
|
28
|
-
*/
|
|
29
|
-
computeParameters(): void;
|
|
30
|
-
/**
|
|
31
|
-
* @inheritdoc
|
|
32
|
-
*/
|
|
33
|
-
size(): Promise<number>;
|
|
34
|
-
/**
|
|
35
|
-
* Return file
|
|
36
|
-
* @param uid
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
getFile(uid: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* @inheritdoc
|
|
42
|
-
*/
|
|
43
|
-
sendMessage(params: any): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* @inheritdoc
|
|
46
|
-
*/
|
|
47
|
-
receiveMessage<L>(proto?: {
|
|
48
|
-
new (): L;
|
|
49
|
-
}): Promise<MessageReceipt<L>[]>;
|
|
50
|
-
/**
|
|
51
|
-
* @inheritdoc
|
|
52
|
-
*/
|
|
53
|
-
deleteMessage(receipt: any): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* @inheritdoc
|
|
56
|
-
*/
|
|
57
|
-
__clean(): Promise<void>;
|
|
58
|
-
}
|
package/lib/queues/filequeue.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
import * as uuid from "uuid";
|
|
4
|
-
import { JSONUtils } from "../utils/serializers.js";
|
|
5
|
-
import { Queue, QueueParameters } from "./queueservice.js";
|
|
6
|
-
export class FileQueueParameters extends QueueParameters {
|
|
7
|
-
constructor(params) {
|
|
8
|
-
super(params);
|
|
9
|
-
this.expire = this.expire ?? 30;
|
|
10
|
-
this.expire *= 1000;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* FIFO Queue on filesystem
|
|
15
|
-
* @category CoreServices
|
|
16
|
-
* @WebdaModda
|
|
17
|
-
*/
|
|
18
|
-
export class FileQueue extends Queue {
|
|
19
|
-
/**
|
|
20
|
-
* @inheritdoc
|
|
21
|
-
*/
|
|
22
|
-
loadParameters(params) {
|
|
23
|
-
return new FileQueueParameters(params);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Create the storage folder if does not exist
|
|
27
|
-
*/
|
|
28
|
-
computeParameters() {
|
|
29
|
-
super.computeParameters();
|
|
30
|
-
if (!fs.existsSync(this.parameters.folder)) {
|
|
31
|
-
fs.mkdirSync(this.parameters.folder);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @inheritdoc
|
|
36
|
-
*/
|
|
37
|
-
async size() {
|
|
38
|
-
return fs.readdirSync(this.parameters.folder).filter(f => f.endsWith(".json")).length;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Return file
|
|
42
|
-
* @param uid
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
getFile(uid) {
|
|
46
|
-
return join(this.parameters.folder, `${uid}.json`);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @inheritdoc
|
|
50
|
-
*/
|
|
51
|
-
async sendMessage(params) {
|
|
52
|
-
let uid = uuid.v4();
|
|
53
|
-
let file = this.getFile(uid);
|
|
54
|
-
// Avoid duplication
|
|
55
|
-
while (fs.existsSync(file)) {
|
|
56
|
-
uid = uuid.v4();
|
|
57
|
-
file = this.getFile(uid);
|
|
58
|
-
}
|
|
59
|
-
JSONUtils.saveFile(params, file);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @inheritdoc
|
|
63
|
-
*/
|
|
64
|
-
async receiveMessage(proto) {
|
|
65
|
-
const files = fs
|
|
66
|
-
.readdirSync(this.parameters.folder)
|
|
67
|
-
.filter(f => f.endsWith(".json"))
|
|
68
|
-
.map(f => {
|
|
69
|
-
const lockFile = join(this.parameters.folder, f + ".lock");
|
|
70
|
-
let res = {
|
|
71
|
-
...fs.lstatSync(join(this.parameters.folder, f)),
|
|
72
|
-
path: join(this.parameters.folder, f),
|
|
73
|
-
hasLock: fs.existsSync(lockFile),
|
|
74
|
-
uid: f.substring(0, f.length - 5)
|
|
75
|
-
};
|
|
76
|
-
if (res.hasLock) {
|
|
77
|
-
const lock = fs.lstatSync(lockFile);
|
|
78
|
-
if (lock.birthtimeMs < Date.now() - this.parameters.expire) {
|
|
79
|
-
res.hasLock = false;
|
|
80
|
-
fs.unlinkSync(lockFile);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return res;
|
|
84
|
-
})
|
|
85
|
-
.filter(f => !f.hasLock)
|
|
86
|
-
.sort((a, b) => {
|
|
87
|
-
// It is not relevant as it is fs based
|
|
88
|
-
/* c8 ignore next 4 */
|
|
89
|
-
if (a.birthtimeMs > b.birthtimeMs) {
|
|
90
|
-
return 1;
|
|
91
|
-
}
|
|
92
|
-
return -1;
|
|
93
|
-
});
|
|
94
|
-
if (files.length) {
|
|
95
|
-
let el = files.shift();
|
|
96
|
-
// Create the lock
|
|
97
|
-
fs.writeFileSync(el.path + ".lock", "");
|
|
98
|
-
return [
|
|
99
|
-
{
|
|
100
|
-
ReceiptHandle: el.uid,
|
|
101
|
-
Message: this.unserialize(fs.readFileSync(el.path).toString(), proto)
|
|
102
|
-
}
|
|
103
|
-
];
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
107
|
-
}
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @inheritdoc
|
|
112
|
-
*/
|
|
113
|
-
async deleteMessage(receipt) {
|
|
114
|
-
const file = this.getFile(receipt);
|
|
115
|
-
if (fs.existsSync(file)) {
|
|
116
|
-
fs.unlinkSync(file);
|
|
117
|
-
if (fs.existsSync(file + ".lock")) {
|
|
118
|
-
fs.unlinkSync(file + ".lock");
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @inheritdoc
|
|
124
|
-
*/
|
|
125
|
-
async __clean() {
|
|
126
|
-
// Use require on purpose to avoid adding fs-extra as runtime dep
|
|
127
|
-
// The __clean method is only used by unit test
|
|
128
|
-
(await import("fs-extra")).emptyDirSync(this.parameters.folder);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=filequeue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,OAAO;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACpB,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC;gBAClC,EAAE,CAAC,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,iEAAiE;QACjE,+CAA+C;QAC/C,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { suite, test } from "@testdeck/mocha";
|
|
8
|
-
import * as assert from "assert";
|
|
9
|
-
import * as fs from "fs";
|
|
10
|
-
import { unlinkSync } from "fs";
|
|
11
|
-
import { emptyDirSync } from "fs-extra";
|
|
12
|
-
import { FileQueue } from "./filequeue.js";
|
|
13
|
-
import { QueueTest } from "./queue.spec.js";
|
|
14
|
-
let FileQueueTest = class FileQueueTest extends QueueTest {
|
|
15
|
-
async basic() {
|
|
16
|
-
let queue = this.getService("FileQueue");
|
|
17
|
-
await queue.__clean();
|
|
18
|
-
await this.simple(queue);
|
|
19
|
-
}
|
|
20
|
-
async lock() {
|
|
21
|
-
let queue = this.getService("FileQueue");
|
|
22
|
-
await queue.__clean();
|
|
23
|
-
// Try to receive one message only
|
|
24
|
-
await queue.sendMessage({ test: "plop" });
|
|
25
|
-
let msg = await queue.receiveMessage();
|
|
26
|
-
let msg2 = await queue.receiveMessage();
|
|
27
|
-
assert.strictEqual(msg.length, 1);
|
|
28
|
-
// Check if there is no more message left
|
|
29
|
-
assert.strictEqual(msg2.length, 0);
|
|
30
|
-
// Wait for the lock to expire, as it is set at 1 second in config file
|
|
31
|
-
await this.sleep(1000);
|
|
32
|
-
await queue.sendMessage({ test: "plop2" });
|
|
33
|
-
msg2 = await queue.receiveMessage();
|
|
34
|
-
assert.strictEqual(msg2.length, 1);
|
|
35
|
-
assert.deepStrictEqual(msg2[0], msg[0]);
|
|
36
|
-
// Check if the deletion is not crashing even if the lock file is removed
|
|
37
|
-
unlinkSync(`${queue.getParameters().folder}/${msg[0].ReceiptHandle}.json.lock`);
|
|
38
|
-
await queue.deleteMessage(msg[0].ReceiptHandle);
|
|
39
|
-
msg2 = await queue.receiveMessage();
|
|
40
|
-
// Check if the deletion is not crashing even if the content file is removed
|
|
41
|
-
unlinkSync(`${queue.getParameters().folder}/${msg2[0].ReceiptHandle}.json`);
|
|
42
|
-
await queue.deleteMessage(msg2[0].ReceiptHandle);
|
|
43
|
-
// Check if default parameter is correctly set
|
|
44
|
-
queue = new FileQueue(this.webda, "q", {});
|
|
45
|
-
assert.strictEqual(queue.getParameters().expire, 30000);
|
|
46
|
-
}
|
|
47
|
-
async sendMessage() {
|
|
48
|
-
let queue = this.getService("FileQueue");
|
|
49
|
-
let firstCall = true;
|
|
50
|
-
queue.getFile = (uid) => {
|
|
51
|
-
if (firstCall) {
|
|
52
|
-
fs.writeFileSync(`${queue.getParameters().folder}/${uid}.json`, "{}");
|
|
53
|
-
firstCall = false;
|
|
54
|
-
}
|
|
55
|
-
return `${queue.getParameters().folder}/${uid}.json`;
|
|
56
|
-
};
|
|
57
|
-
await queue.sendMessage({ plop: "test" });
|
|
58
|
-
emptyDirSync(queue.getParameters().folder);
|
|
59
|
-
fs.rmdirSync(queue.getParameters().folder);
|
|
60
|
-
assert.ok(!fs.existsSync(queue.getParameters().folder));
|
|
61
|
-
queue.computeParameters();
|
|
62
|
-
assert.ok(fs.existsSync(queue.getParameters().folder));
|
|
63
|
-
queue.computeParameters();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
__decorate([
|
|
67
|
-
test
|
|
68
|
-
], FileQueueTest.prototype, "basic", null);
|
|
69
|
-
__decorate([
|
|
70
|
-
test
|
|
71
|
-
], FileQueueTest.prototype, "lock", null);
|
|
72
|
-
__decorate([
|
|
73
|
-
test
|
|
74
|
-
], FileQueueTest.prototype, "sendMessage", null);
|
|
75
|
-
FileQueueTest = __decorate([
|
|
76
|
-
suite
|
|
77
|
-
], FileQueueTest);
|
|
78
|
-
//# sourceMappingURL=filequeue.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filequeue.spec.js","sourceRoot":"","sources":["../../src/queues/filequeue.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAQ,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAA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