From b8cfd1bbcf3e2580c1e344ae577c2c65541507ce Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Mon, 2 Jan 2023 12:50:47 +0100 Subject: [PATCH 01/50] Build: next version for SNAPSHOT 1.1.2 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 59ad109a1..993a053d2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,8 @@ buildscript { ext { // Version used for submodule artifacts. // Snapshot publishing changes (or adds) the suffix after '-' with 'SNAPSHOT' prior to publishing. - globalVersion = '1.1.1' - clientsVersion = '1.1.1-alpha.1' // The clients subsystem is still expected to change drastically. + globalVersion = '1.1.2' + clientsVersion = '1.1.2-alpha.1' // The clients subsystem is still expected to change drastically. versions = [ // Kotlin multiplatform versions. From dadbc22d8333b03f050dae98b8d3af9b5b7e4279 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Mon, 2 Jan 2023 14:48:45 +0100 Subject: [PATCH 02/50] Build: upgrade to Gradle 7.6 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3aa8743a8..eac3c4641 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue Sep 03 11:02:31 CEST 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists From a0ee82f726d36e6229240efed8629cdf1e96012a Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Fri, 6 Jan 2023 10:50:23 +0100 Subject: [PATCH 03/50] Doc: add release management --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eaf29d86e..f74292a57 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,9 @@ Two key **design goals** differentiate this project from similar projects: - [Stub classes](#stub-classes) - [Usage](#usage) - [Example](#example) -- [Building the project](#building-the-project) +- [Development](#development) - [Gradle tasks](#gradle-tasks) + - [Release management](#release-management) - [Development checklists](#development-checklists) ## Architecture @@ -359,7 +360,7 @@ if ( status is StudyStatus.RegisteringDevices ) } ``` -## Building the project +## Development In case you want to contribute, please follow our [contribution guidelines](https://github.com/cph-cachet/carp.core-kotlin/blob/develop/CONTRIBUTING.md). @@ -384,6 +385,29 @@ For `carp.core-kotlin`: Preface with `setSnapshotVersion` task to publish to the snapshot repository, substituting the suffix of the version specified in `ext.globalVersion` with `-SNAPSHOT`. See main `build.gradle` for details. +### Release management + +[Semantic versioning](https://semver.org/) is used for releases. +Backwards compatibility is assessed from the perspective of clients using an implementation of the framework, +as opposed to developers using the framework to implement an infrastructure. +In other words, versioning is based on the exposed API (`application` namespaces), but not the domain used to implement infrastructures (`domain` namespaces). +Breaking changes between `minor` versions can occur in domain objects, including the need to do database migrations. + +Module versions are configured in the main `build.gradle` in `ext.globalVersion` and `ext.clientsVersion`. + +Workflows: +- Each push to `develop` triggers a snapshot release of the currently configured version. +- Each push to `master` triggers a release to Maven using the currently configured version. + +Releases require a couple of manual steps: +- Before merging into `master`, make sure new versions are set in `build.gradle`. + This should be done already in the last step, but you may decide to make a bigger version increment. +- Merge into master; **don't rebase**. Rebasing causes branch commit histories to diverge which complicates later releases and messes up the visible commit history with duplicate commits. +- Create a release tag on `master` with release notes. +- Add `javascript-typescript-sources.zip` and `rpc-examples.zip` assets to release. + This should be automated in the future: [#371](https://github.com/imotions/carp.core-kotlin/issues/371) and [#416](https://github.com/imotions/carp.core-kotlin/issues/416) respectively. +- Bump versions on `develop` so that snapshot releases target the next version. + ### Development checklists When changes are made to CARP Core, various parts in the codebase sometimes need to be updated accordingly. From 9469ae550eaba920a0ab13464ebbcbfe1263d2ba Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Tue, 31 Jan 2023 15:40:08 +0100 Subject: [PATCH 04/50] Doc: repo transferred back to cph-cachet --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f74292a57..aef743523 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ CARP Core is a software framework to help developers build research platforms to It provides modules to define, deploy, and monitor research studies, and to collect data from multiple devices at multiple locations. It is the result of a collaboration between [iMotions](https://imotions.com/) and the [Copenhagen Center for Health Technology (CACHET)](https://www.cachet.dk/). -Both use CARP Core to implement their respective research platforms: the [iMotions Mobile Research Platform](https://imotions.com/mobile-platform-landing-page-submissions/) and the [Copenhagen Research Platform (CARP)](https://carp.cachet.dk/). -CARP Core is now maintained fully by iMotions (since 1.0), but [still part of CARP](https://carp.cachet.dk/core/) as an ongoing collaboration. +Both use CARP Core to implement their respective research platforms: the [iMotions Mobile Research Platform](https://imotions.com/products/imotions-mobile/) and the [Copenhagen Research Platform (CARP)](https://carp.cachet.dk/). Following [domain-driven design](https://en.wikipedia.org/wiki/Domain-driven_design), this project contains all domain models and application services for all CARP subsystems ([depicted below](#architecture)), not having any dependencies on concrete infrastructure. As such, this project defines an **open standard for distributed data collection**, [available for Kotlin, the Java runtime, and JavaScript](#usage), which others can build upon to create their own infrastructure. @@ -405,7 +404,7 @@ Releases require a couple of manual steps: - Merge into master; **don't rebase**. Rebasing causes branch commit histories to diverge which complicates later releases and messes up the visible commit history with duplicate commits. - Create a release tag on `master` with release notes. - Add `javascript-typescript-sources.zip` and `rpc-examples.zip` assets to release. - This should be automated in the future: [#371](https://github.com/imotions/carp.core-kotlin/issues/371) and [#416](https://github.com/imotions/carp.core-kotlin/issues/416) respectively. + This should be automated in the future: [#371](https://github.com/cph-cachet/carp.core-kotlin/issues/371) and [#416](https://github.com/cph-cachet/carp.core-kotlin/issues/416) respectively. - Bump versions on `develop` so that snapshot releases target the next version. ### Development checklists From 83814710e31a03142b901e95fb68561ff3dc953a Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 18 Feb 2023 18:07:18 +0100 Subject: [PATCH 05/50] Add `ApplicationServiceDecorator` --- .../services/ApplicationServiceDecorator.kt | 40 ++++++++++++ .../ApplicationServiceDecoratorTest.kt | 62 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt create mode 100644 carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt new file mode 100644 index 000000000..e1494aa88 --- /dev/null +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt @@ -0,0 +1,40 @@ +package dk.cachet.carp.common.infrastructure.services + +import dk.cachet.carp.common.application.services.ApplicationService + + +/** + * Base class to help apply a [requestDecorator] on all requests of a [service]. + * Extend from this class and implement the application service interface by + * redirecting all requests to [invoke] and initializing the matching [TRequest]. + */ +abstract class ApplicationServiceDecorator< + TService : ApplicationService, + TRequest : ApplicationServiceRequest +>( + private val service: TService, + private val requestDecorator: (Command) -> Command +) : Command +{ + private val invokeService = + object : Command + { + @Suppress( "UNCHECKED_CAST" ) + override suspend fun invoke( request: TRequest ): TReturn = + request.invokeOnService( service ) as TReturn + } + + protected abstract suspend fun TRequest.invokeOnService( service: TService ): Any? + + override suspend fun invoke( request: TRequest ): TReturn = + requestDecorator( invokeService ).invoke( request ) as TReturn +} + + +/** + * Supports invocation of a [TRequest] on a service. + */ +interface Command +{ + suspend fun invoke( request: TRequest ): TReturn +} diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt new file mode 100644 index 000000000..3ae7adf5c --- /dev/null +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt @@ -0,0 +1,62 @@ +package dk.cachet.carp.common.infrastructure.services + +import kotlinx.coroutines.test.runTest +import kotlin.test.Test +import kotlin.test.assertEquals + + +private typealias TestService = ApplicationServiceRequestTest.TestService +private typealias TestServiceRequest = ApplicationServiceRequestTest.TestServiceRequest<*> + +class ApplicationServiceDecoratorTest +{ + class TestServiceDecorator( + service: TestService, + requestDecorator: (Command) -> Command + ) : ApplicationServiceDecorator( service, requestDecorator ), + TestService + { + override suspend fun operation( parameter: Int ): Int = invoke( + ApplicationServiceRequestTest.TestServiceRequest.Operation( parameter ) + ) + + override suspend fun TestServiceRequest.invokeOnService( service: TestService ): Any? = + when ( this ) + { + is ApplicationServiceRequestTest.TestServiceRequest.Operation -> service.operation( parameter ) + } + } + + + @Test + fun can_add_multiple_decorators() = runTest { + val invokedDecorators = mutableListOf() + + class Decorator( val name: String, val decoratee: Command ) : Command + { + override suspend fun invoke( request: TRequest ): TReturn + { + invokedDecorators.add( name ) + return decoratee.invoke( request ) + } + } + + + val host = + object : TestService + { + override suspend fun operation( parameter: Int ): Int = parameter + } + val decorator = TestServiceDecorator( host ) + { + Decorator( + "first", + Decorator( "second", it ), + ) + } + + val result = decorator.operation( 42 ) + assertEquals( 42, result ) + assertEquals( listOf( "first", "second" ), invokedDecorators ) + } +} From 993946c7421e040218e95e0d8bec0a217caf2063 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 18 Feb 2023 18:07:34 +0100 Subject: [PATCH 06/50] Add protocol subsystem service decorators --- .../ProtocolFactoryServiceDecorator.kt | 31 ++++++++++ .../ProtocolServiceDecorator.kt | 57 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt create mode 100644 carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt new file mode 100644 index 000000000..a3b8bfb2f --- /dev/null +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt @@ -0,0 +1,31 @@ +package dk.cachet.carp.protocols.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.protocols.application.ProtocolFactoryService +import dk.cachet.carp.protocols.application.StudyProtocolSnapshot + + +class ProtocolFactoryServiceDecorator( + service: ProtocolFactoryService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + ProtocolFactoryService +{ + override suspend fun createCustomProtocol( + ownerId: UUID, + name: String, + customProtocol: String, + description: String? + ): StudyProtocolSnapshot = invoke( + ProtocolFactoryServiceRequest.CreateCustomProtocol( ownerId, name, customProtocol, description ) + ) + + override suspend fun ProtocolFactoryServiceRequest<*>.invokeOnService( service: ProtocolFactoryService ): Any = + when ( this ) + { + is ProtocolFactoryServiceRequest.CreateCustomProtocol -> + service.createCustomProtocol( ownerId, name, customProtocol, description ) + } +} diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt new file mode 100644 index 000000000..961543b06 --- /dev/null +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt @@ -0,0 +1,57 @@ +package dk.cachet.carp.protocols.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.application.users.ExpectedParticipantData +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.protocols.application.ProtocolService +import dk.cachet.carp.protocols.application.ProtocolVersion +import dk.cachet.carp.protocols.application.StudyProtocolSnapshot + + +class ProtocolServiceDecorator( + service: ProtocolService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + ProtocolService +{ + override suspend fun add( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = invoke( + ProtocolServiceRequest.Add( protocol, versionTag ) + ) + + override suspend fun addVersion( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = invoke( + ProtocolServiceRequest.AddVersion( protocol, versionTag ) + ) + + override suspend fun updateParticipantDataConfiguration( + protocolId: UUID, + versionTag: String, + expectedParticipantData: Set + ): StudyProtocolSnapshot = invoke( + ProtocolServiceRequest.UpdateParticipantDataConfiguration( protocolId, versionTag, expectedParticipantData ) + ) + + override suspend fun getBy( protocolId: UUID, versionTag: String? ): StudyProtocolSnapshot = invoke( + ProtocolServiceRequest.GetBy( protocolId, versionTag ) + ) + + override suspend fun getAllForOwner( ownerId: UUID ): List = invoke( + ProtocolServiceRequest.GetAllForOwner( ownerId ) + ) + + override suspend fun getVersionHistoryFor( protocolId: UUID ): List = invoke( + ProtocolServiceRequest.GetVersionHistoryFor( protocolId ) + ) + + override suspend fun ProtocolServiceRequest<*>.invokeOnService( service: ProtocolService ): Any = + when ( this ) + { + is ProtocolServiceRequest.Add -> service.add( protocol, versionTag ) + is ProtocolServiceRequest.AddVersion -> service.addVersion( protocol, versionTag ) + is ProtocolServiceRequest.UpdateParticipantDataConfiguration -> + service.updateParticipantDataConfiguration( protocolId, versionTag, expectedParticipantData ) + is ProtocolServiceRequest.GetBy -> service.getBy( protocolId, versionTag ) + is ProtocolServiceRequest.GetAllForOwner -> service.getAllForOwner( ownerId ) + is ProtocolServiceRequest.GetVersionHistoryFor -> service.getVersionHistoryFor( protocolId ) + } +} From 105a6e364aec2f083ef98afb9d338f0cce5bc7b4 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 19 Feb 2023 17:30:14 +0100 Subject: [PATCH 07/50] Refactor: protocol services logging using decorator To allow intermediate refactoring in which not all application services have a decorator, an intermediate `ApplicationServiceLogger` was introduced. This potentially can be refactored/removed once all application services have decorators. --- .../ApplicationServiceRequestsTest.kt | 4 +- .../versioning/OutputTestRequests.kt | 10 +-- .../ApplicationServiceLoggingProxy.kt | 63 +++++++++++++++++-- .../ApplicationServiceRequestLogger.kt | 46 ++++++++++++++ .../DataStreamServiceRequestsTest.kt | 3 +- .../OutputDataStreamServiceTestRequests.kt | 2 +- .../DeploymentServiceRequestsTest.kt | 3 +- .../ParticipationServiceRequestsTest.kt | 3 +- .../OutputDeploymentServiceTestRequests.kt | 2 +- .../OutputParticipationServiceTestRequests.kt | 2 +- .../ProtocolFactoryServiceLoggingProxy.kt | 38 ----------- .../ProtocolServiceLoggingProxy.kt | 55 ---------------- .../ProtocolFactoryServiceRequestsTest.kt | 18 ++++-- .../ProtocolServiceRequestsTest.kt | 18 ++++-- ...utputProtocolFactoryServiceTestRequests.kt | 18 ++++-- .../OutputProtocolServiceTestRequests.kt | 18 ++++-- .../RecruitmentServiceRequestsTest.kt | 3 +- .../StudyServiceRequestsTest.kt | 3 +- .../OutputRecruitmentServiceTestRequests.kt | 2 +- .../OutputStudyServiceTestRequests.kt | 2 +- 20 files changed, 176 insertions(+), 137 deletions(-) create mode 100644 carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt delete mode 100644 carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceLoggingProxy.kt delete mode 100644 carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceLoggingProxy.kt diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt index e26477654..162b5c4de 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt @@ -1,7 +1,7 @@ package dk.cachet.carp.common.test.infrastructure import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger import dk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -26,7 +26,7 @@ abstract class ApplicationServiceRequestsTest< private val requests: List ) { - abstract fun createServiceLoggingProxy(): ApplicationServiceLoggingProxy + abstract fun createServiceLoggingProxy(): ApplicationServiceLogger @ExperimentalSerializationApi diff --git a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt index 9de9fc8df..64434eb67 100644 --- a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt +++ b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt @@ -2,7 +2,7 @@ package dk.cachet.carp.common.test.infrastructure.versioning import dk.cachet.carp.common.application.ApplicationServiceInfo import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.Json @@ -18,15 +18,15 @@ val TEST_REQUESTS_FOLDER = File( "build/test-requests/" ) /** - * Outputs all logged requests of a [loggedService] while running unit tests to the build folder. + * Outputs all logged requests of a [serviceLogger] while running unit tests to the build folder. * * Extend from this base class along with a test interface for which to log requests, - * and implement `createService` by returning a logging service proxy and setting [loggedService]. + * and implement `createService` by returning a logging service proxy and setting [serviceLogger]. */ open class OutputTestRequests>( applicationServiceKlass: KClass ) { @Suppress( "UNCHECKED_CAST" ) - protected var loggedService: ApplicationServiceLoggingProxy? = null + protected var serviceLogger: ApplicationServiceLogger? = null private val applicationServiceInfo = ApplicationServiceInfo.of( applicationServiceKlass.java ) companion object @@ -50,7 +50,7 @@ open class OutputTestRequests>( appli @AfterTest fun outputLoggedRequests( info: TestInfo ) { - val service = checkNotNull( loggedService ) + val service = checkNotNull( serviceLogger ) { "`loggedService` needs to be set in `createService`." } // Serialize requests as json. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt index eabcc31e7..6274a54ab 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt @@ -21,10 +21,10 @@ open class ApplicationServiceLoggingProxy< private val service: TService, private val eventBusLog: EventBusLog, private val log: (LoggedRequest) -> Unit = { } -) +) : ApplicationServiceLogger { private val _loggedRequests: MutableList> = mutableListOf() - val loggedRequests: List> + override val loggedRequests: List> get() = _loggedRequests.toList() /** @@ -65,13 +65,68 @@ open class ApplicationServiceLoggingProxy< /** * Determines whether the given [request] is present in [loggedRequests]. */ - fun wasCalled( request: ApplicationServiceRequest ): Boolean = + override fun wasCalled( request: ApplicationServiceRequest ): Boolean = _loggedRequests.map { it.request }.contains( request ) /** * Clear the current [loggedRequests]. */ - fun clear() = _loggedRequests.clear() + override fun clear() = _loggedRequests.clear() +} + + +/** + * Access [loggedRequests] of an [ApplicationService]. + */ +interface ApplicationServiceLogger< + TService : ApplicationService, + TEvent : IntegrationEvent +> +{ + val loggedRequests: List> + + /** + * Determines whether the given [request] is present in [loggedRequests]. + */ + fun wasCalled( request: ApplicationServiceRequest ): Boolean + + /** + * Clear the current [loggedRequests]. + */ + fun clear() +} + + +/** + * Decorate [service] using [decoratedServiceConstructor] with an [ApplicationServiceLogger]. + * Returns the decorated service and logger. + */ +inline fun < + reified TService : ApplicationService, + TRequest : ApplicationServiceRequest, + reified TEvent : IntegrationEvent +> createLoggedApplicationService( + service: TService, + decoratedServiceConstructor: + (TService, (Command) -> Command) -> TService +): Pair> +{ + val eventBus = SingleThreadedEventBus() + val eventBusLog = EventBusLog( eventBus, EventBusLog.Subscription( TService::class, TEvent::class ) ) + val loggedRequests: MutableList> = mutableListOf() + val loggedService = decoratedServiceConstructor( service ) + { ApplicationServiceRequestLogger( eventBusLog, loggedRequests::add, it ) } + + val logger = + object : ApplicationServiceLogger + { + override val loggedRequests: List> get() = loggedRequests.toList() + override fun clear() = loggedRequests.clear() + override fun wasCalled( request: ApplicationServiceRequest ): Boolean = + loggedRequests.map { it.request }.contains( request ) + } + + return Pair( loggedService, logger ) } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt new file mode 100644 index 000000000..e24644db8 --- /dev/null +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt @@ -0,0 +1,46 @@ +package dk.cachet.carp.common.infrastructure.services + +import dk.cachet.carp.common.application.services.ApplicationService +import dk.cachet.carp.common.application.services.IntegrationEvent + + +/** + * Notifies of incoming requests and responses through [log], + * as well as events preceding the request and fired as a result of the request. + */ +class ApplicationServiceRequestLogger< + TService : ApplicationService, + TEvent : IntegrationEvent, + TRequest : ApplicationServiceRequest +>( + private val eventBusLog: EventBusLog, + private val log: (LoggedRequest) -> Unit = { }, + private val decoratee: Command +) : Command +{ + override suspend fun invoke( request: TRequest ): TReturn + { + @Suppress( "UNCHECKED_CAST" ) + fun getCurrentEvents() = eventBusLog.retrieveAndEmptyLog() as List + val precedingEvents = getCurrentEvents() + + @Suppress( "TooGenericExceptionCaught" ) + val response = + try { decoratee.invoke( request ) as TReturn } + catch ( ex: Exception ) + { + val failed = LoggedRequest.Failed( + request, + precedingEvents, + getCurrentEvents(), + ex::class.simpleName!! + ) + log( failed ) + throw ex + } + + log( LoggedRequest.Succeeded( request, precedingEvents, getCurrentEvents(), response ) ) + + return response + } +} diff --git a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt index 8399f56a9..1d781bf39 100644 --- a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt +++ b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt @@ -2,7 +2,6 @@ package dk.cachet.carp.data.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.data.application.DataStreamId @@ -31,6 +30,6 @@ class DataStreamServiceRequestsTest : ApplicationServiceRequestsTest = + override fun createServiceLoggingProxy() = DataStreamServiceLoggingProxy( InMemoryDataStreamService(), SingleThreadedEventBus() ) } diff --git a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt index c553b3405..83a2decc5 100644 --- a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt +++ b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt @@ -14,5 +14,5 @@ class OutputDataStreamServiceTestRequests : { override fun createService(): DataStreamService = DataStreamServiceLoggingProxy( InMemoryDataStreamService(), SingleThreadedEventBus() ) - .also { loggedService = it } + .also { serviceLogger = it } } diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt index 83b7de317..a6cdc7011 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt @@ -2,7 +2,6 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.devices.DefaultDeviceRegistration -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest @@ -34,7 +33,7 @@ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest = + override fun createServiceLoggingProxy() = DeploymentServiceHostTest .createSUT() .let { DeploymentServiceLoggingProxy( it.deploymentService, it.eventBus ) } diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt index 6f461f4c2..0ecfc3976 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt @@ -3,7 +3,6 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.input.CarpInputDataTypes import dk.cachet.carp.common.application.data.input.Sex -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.ParticipationServiceHostTest @@ -31,7 +30,7 @@ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest = + override fun createServiceLoggingProxy() = ParticipationServiceHostTest .createSUT() .let { ParticipationServiceLoggingProxy( it.participationService, it.eventBus ) } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt index 8ade66c40..73ce1b16a 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt @@ -15,7 +15,7 @@ class OutputDeploymentServiceTestRequests : { val services = DeploymentServiceHostTest.createSUT() val service = DeploymentServiceLoggingProxy( services.deploymentService, services.eventBus ) - loggedService = service + serviceLogger = service return DeploymentServiceTest.SUT( service, services.eventBus ) } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt index 272e66b44..a4e875c6c 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt @@ -15,7 +15,7 @@ class OutputParticipationServiceTestRequests : { val services = ParticipationServiceHostTest.createSUT() val service = ParticipationServiceLoggingProxy( services.participationService, services.eventBus ) - loggedService = service + serviceLogger = service return ParticipationServiceTest.SUT( service, diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceLoggingProxy.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceLoggingProxy.kt deleted file mode 100644 index 9773dbfbd..000000000 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceLoggingProxy.kt +++ /dev/null @@ -1,38 +0,0 @@ -package dk.cachet.carp.protocols.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.protocols.application.ProtocolFactoryService -import dk.cachet.carp.protocols.application.StudyProtocolSnapshot - - -/** - * A proxy for a protocol factory [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests in [loggedRequests]. - */ -class ProtocolFactoryServiceLoggingProxy( - service: ProtocolFactoryService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( ProtocolFactoryService::class, ProtocolFactoryService.Event::class ) - ), - log - ), - ProtocolFactoryService -{ - override suspend fun createCustomProtocol( - ownerId: UUID, - name: String, - customProtocol: String, - description: String? - ): StudyProtocolSnapshot = - log( ProtocolFactoryServiceRequest.CreateCustomProtocol( ownerId, name, customProtocol, description ) ) -} diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceLoggingProxy.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceLoggingProxy.kt deleted file mode 100644 index e0d844875..000000000 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceLoggingProxy.kt +++ /dev/null @@ -1,55 +0,0 @@ -package dk.cachet.carp.protocols.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.application.users.ExpectedParticipantData -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.protocols.application.ProtocolService -import dk.cachet.carp.protocols.application.ProtocolVersion -import dk.cachet.carp.protocols.application.StudyProtocolSnapshot - - -/** - * A proxy for a protocol [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class ProtocolServiceLoggingProxy( - service: ProtocolService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( ProtocolService::class, ProtocolService.Event::class ) - ), - log - ), - ProtocolService -{ - override suspend fun add( protocol: StudyProtocolSnapshot, versionTag: String ) = - log( ProtocolServiceRequest.Add( protocol, versionTag ) ) - - override suspend fun addVersion( protocol: StudyProtocolSnapshot, versionTag: String ) = - log( ProtocolServiceRequest.AddVersion( protocol, versionTag) ) - - override suspend fun updateParticipantDataConfiguration( - protocolId: UUID, - versionTag: String, - expectedParticipantData: Set - ): StudyProtocolSnapshot = log( - ProtocolServiceRequest.UpdateParticipantDataConfiguration( protocolId, versionTag, expectedParticipantData ) - ) - - override suspend fun getBy( protocolId: UUID, versionTag: String? ): StudyProtocolSnapshot = - log( ProtocolServiceRequest.GetBy( protocolId, versionTag ) ) - - override suspend fun getAllForOwner( ownerId: UUID ): List = - log( ProtocolServiceRequest.GetAllForOwner( ownerId ) ) - - override suspend fun getVersionHistoryFor( protocolId: UUID ): List = - log( ProtocolServiceRequest.GetVersionHistoryFor( protocolId ) ) -} diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt index 6c55807f5..2d4c80d4a 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt @@ -1,8 +1,8 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest @@ -24,6 +24,16 @@ class ProtocolFactoryServiceRequestsTest : ApplicationServiceRequestsTest = - ProtocolFactoryServiceLoggingProxy( ProtocolFactoryServiceHostTest.createService(), SingleThreadedEventBus() ) + override fun createServiceLoggingProxy(): ApplicationServiceLogger + { + val (loggedService, logger) = createLoggedApplicationService( + ProtocolFactoryServiceHostTest.createService(), + ::ProtocolFactoryServiceDecorator + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + ProtocolFactoryService by loggedService { } + } } diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt index 130c8fafe..812d2c456 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt @@ -1,8 +1,8 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolServiceHostTest @@ -30,6 +30,16 @@ class ProtocolServiceRequestsTest : ApplicationServiceRequestsTest = - ProtocolServiceLoggingProxy( ProtocolServiceHostTest.createService(), SingleThreadedEventBus() ) + override fun createServiceLoggingProxy(): ApplicationServiceLogger + { + val (loggedService, logger) = createLoggedApplicationService( + ProtocolServiceHostTest.createService(), + ::ProtocolServiceDecorator + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + ProtocolService by loggedService { } + } } diff --git a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt index fef97a086..3d06bfa48 100644 --- a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt +++ b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt @@ -1,18 +1,26 @@ package dk.cachet.carp.protocols.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest import dk.cachet.carp.protocols.application.ProtocolFactoryServiceTest -import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceLoggingProxy +import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceDecorator class OutputProtocolFactoryServiceTestRequests : OutputTestRequests( ProtocolFactoryService::class ), ProtocolFactoryServiceTest { - override fun createService(): ProtocolFactoryService = - ProtocolFactoryServiceLoggingProxy( ProtocolFactoryServiceHostTest.createService(), SingleThreadedEventBus() ) - .also { loggedService = it } + override fun createService(): ProtocolFactoryService + { + val (loggedService, logger) = createLoggedApplicationService( + ProtocolFactoryServiceHostTest.createService(), + ::ProtocolFactoryServiceDecorator + ) + + serviceLogger = logger + + return loggedService + } } diff --git a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt index a941b86ee..79bc8f748 100644 --- a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt +++ b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt @@ -1,18 +1,26 @@ package dk.cachet.carp.protocols.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolServiceHostTest import dk.cachet.carp.protocols.application.ProtocolServiceTest -import dk.cachet.carp.protocols.infrastructure.ProtocolServiceLoggingProxy +import dk.cachet.carp.protocols.infrastructure.ProtocolServiceDecorator class OutputProtocolServiceTestRequests : OutputTestRequests( ProtocolService::class ), ProtocolServiceTest { - override fun createService(): ProtocolService = - ProtocolServiceLoggingProxy( ProtocolServiceHostTest.createService(), SingleThreadedEventBus() ) - .also { loggedService = it } + override fun createService(): ProtocolService + { + val (loggedService, logger) = createLoggedApplicationService( + ProtocolServiceHostTest.createService(), + ::ProtocolServiceDecorator + ) + + serviceLogger = logger + + return loggedService + } } diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt index 133e407d9..01220ad89 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt @@ -2,7 +2,6 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.EmailAddress import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest @@ -31,7 +30,7 @@ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest = + override fun createServiceLoggingProxy() = RecruitmentServiceHostTest .createSUT() .let { RecruitmentServiceLoggingProxy( it.recruitmentService, it.eventBus ) } diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt index 287fe93e5..a87dc4b89 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt @@ -1,7 +1,6 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.domain.StudyProtocol @@ -36,6 +35,6 @@ class StudyServiceRequestsTest : ApplicationServiceRequestsTest = + override fun createServiceLoggingProxy() = StudyServiceHostTest.createService().let { StudyServiceLoggingProxy( it.first, it.second ) } } diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt index 73639be92..05933aff3 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt @@ -15,7 +15,7 @@ class OutputRecruitmentServiceTestRequests : { val services = RecruitmentServiceHostTest.createSUT() val service = RecruitmentServiceLoggingProxy( services.recruitmentService, services.eventBus ) - loggedService = service + serviceLogger = service return RecruitmentServiceTest.SUT( service, diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt index d9539e31c..3c89e5209 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt @@ -16,6 +16,6 @@ class OutputStudyServiceTestRequests : val services = StudyServiceHostTest.createService() return StudyServiceLoggingProxy( services.first, services.second ) - .also { loggedService = it } + .also { serviceLogger = it } } } From 03770b00deb8cc8c74c2ddda5ee84c60c1702dd2 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 19 Feb 2023 20:01:11 +0100 Subject: [PATCH 08/50] Refactor: data service logging using decorator --- .../DataStreamServiceDecorator.kt | 52 +++++++++++++++++++ .../DataStreamServiceLoggingProxy.kt | 51 ------------------ .../DataStreamServiceRequestsTest.kt | 16 +++++- .../OutputDataStreamServiceTestRequests.kt | 18 +++++-- 4 files changed, 79 insertions(+), 58 deletions(-) create mode 100644 carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt delete mode 100644 carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceLoggingProxy.kt diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt new file mode 100644 index 000000000..892d78cb2 --- /dev/null +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt @@ -0,0 +1,52 @@ +package dk.cachet.carp.data.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.data.application.DataStreamBatch +import dk.cachet.carp.data.application.DataStreamId +import dk.cachet.carp.data.application.DataStreamService +import dk.cachet.carp.data.application.DataStreamsConfiguration + + +class DataStreamServiceDecorator( + service: DataStreamService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + DataStreamService +{ + override suspend fun openDataStreams( configuration: DataStreamsConfiguration ): Unit = invoke( + DataStreamServiceRequest.OpenDataStreams( configuration ) + ) + + override suspend fun appendToDataStreams( studyDeploymentId: UUID, batch: DataStreamBatch ): Unit = invoke( + DataStreamServiceRequest.AppendToDataStreams( studyDeploymentId, batch ) + ) + + override suspend fun getDataStream( + dataStream: DataStreamId, + fromSequenceId: Long, + toSequenceIdInclusive: Long? + ): DataStreamBatch = invoke( + DataStreamServiceRequest.GetDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) + ) + + override suspend fun closeDataStreams( studyDeploymentIds: Set ): Unit = invoke( + DataStreamServiceRequest.CloseDataStreams( studyDeploymentIds ) + ) + + override suspend fun removeDataStreams( studyDeploymentIds: Set ): Set = invoke( + DataStreamServiceRequest.RemoveDataStreams( studyDeploymentIds ) + ) + + override suspend fun DataStreamServiceRequest<*>.invokeOnService( service: DataStreamService ): Any = + when ( this ) + { + is DataStreamServiceRequest.OpenDataStreams -> service.openDataStreams( configuration ) + is DataStreamServiceRequest.AppendToDataStreams -> service.appendToDataStreams( studyDeploymentId, batch ) + is DataStreamServiceRequest.GetDataStream -> + service.getDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) + is DataStreamServiceRequest.CloseDataStreams -> service.closeDataStreams( studyDeploymentIds ) + is DataStreamServiceRequest.RemoveDataStreams -> service.removeDataStreams( studyDeploymentIds ) + } +} diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceLoggingProxy.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceLoggingProxy.kt deleted file mode 100644 index 322de5530..000000000 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceLoggingProxy.kt +++ /dev/null @@ -1,51 +0,0 @@ -package dk.cachet.carp.data.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.data.application.DataStreamBatch -import dk.cachet.carp.data.application.DataStreamId -import dk.cachet.carp.data.application.DataStreamService -import dk.cachet.carp.data.application.DataStreamsConfiguration - - -/** - * A proxy for a data stream [service] which notifies of incoming requests, responses, and events through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class DataStreamServiceLoggingProxy( - service: DataStreamService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( DataStreamService::class, DataStreamService.Event::class ) - ), - log - ), - DataStreamService -{ - override suspend fun openDataStreams( configuration: DataStreamsConfiguration ) = - log( DataStreamServiceRequest.OpenDataStreams( configuration ) ) - - override suspend fun appendToDataStreams( studyDeploymentId: UUID, batch: DataStreamBatch ) = - log( DataStreamServiceRequest.AppendToDataStreams( studyDeploymentId, batch ) ) - - override suspend fun getDataStream( - dataStream: DataStreamId, - fromSequenceId: Long, - toSequenceIdInclusive: Long? - ): DataStreamBatch = - log( DataStreamServiceRequest.GetDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) ) - - override suspend fun closeDataStreams( studyDeploymentIds: Set ) = - log( DataStreamServiceRequest.CloseDataStreams( studyDeploymentIds ) ) - - override suspend fun removeDataStreams( studyDeploymentIds: Set ) = - log( DataStreamServiceRequest.RemoveDataStreams( studyDeploymentIds ) ) -} diff --git a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt index 1d781bf39..76aa1f580 100644 --- a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt +++ b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt @@ -2,7 +2,9 @@ package dk.cachet.carp.data.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.data.application.DataStreamId import dk.cachet.carp.data.application.DataStreamService @@ -30,6 +32,16 @@ class DataStreamServiceRequestsTest : ApplicationServiceRequestsTest + { + val (loggedService, logger) = createLoggedApplicationService( + InMemoryDataStreamService(), + ::DataStreamServiceDecorator + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + DataStreamService by loggedService { } + } } diff --git a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt index 83a2decc5..4a019c434 100644 --- a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt +++ b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt @@ -1,10 +1,10 @@ package dk.cachet.carp.data.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.data.application.DataStreamService import dk.cachet.carp.data.application.DataStreamServiceTest -import dk.cachet.carp.data.infrastructure.DataStreamServiceLoggingProxy +import dk.cachet.carp.data.infrastructure.DataStreamServiceDecorator import dk.cachet.carp.data.infrastructure.InMemoryDataStreamService @@ -12,7 +12,15 @@ class OutputDataStreamServiceTestRequests : OutputTestRequests( DataStreamService::class ), DataStreamServiceTest { - override fun createService(): DataStreamService = - DataStreamServiceLoggingProxy( InMemoryDataStreamService(), SingleThreadedEventBus() ) - .also { serviceLogger = it } + override fun createService(): DataStreamService + { + val (loggedService, logger) = createLoggedApplicationService( + InMemoryDataStreamService(), + ::DataStreamServiceDecorator + ) + + serviceLogger = logger + + return loggedService + } } From 5a6a213a0927a6049ef18e1fc6e6de92bd84e76e Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 19 Feb 2023 21:01:59 +0100 Subject: [PATCH 09/50] Refactor: deployment services logging using decorator --- .../ApplicationServiceLoggingProxy.kt | 10 +- .../DeploymentServiceDecorator.kt | 95 +++++++++++++++++++ .../DeploymentServiceLoggingProxy.kt | 84 ---------------- .../ParticipationServiceDecorator.kt | 53 +++++++++++ .../ParticipationServiceLoggingProxy.kt | 51 ---------- .../DeploymentServiceRequestsTest.kt | 26 ++++- .../ParticipationServiceRequestsTest.kt | 28 +++++- .../OutputDeploymentServiceTestRequests.kt | 21 +++- .../OutputParticipationServiceTestRequests.kt | 29 +++--- 9 files changed, 234 insertions(+), 163 deletions(-) create mode 100644 carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt delete mode 100644 carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceLoggingProxy.kt create mode 100644 carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt delete mode 100644 carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceLoggingProxy.kt diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt index 6274a54ab..536781dc9 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.infrastructure.services import dk.cachet.carp.common.application.services.ApplicationService +import dk.cachet.carp.common.application.services.EventBus import dk.cachet.carp.common.application.services.IntegrationEvent import dk.cachet.carp.common.infrastructure.reflect.AccessInternals import kotlinx.serialization.* @@ -100,6 +101,7 @@ interface ApplicationServiceLogger< /** * Decorate [service] using [decoratedServiceConstructor] with an [ApplicationServiceLogger]. * Returns the decorated service and logger. + * In case additional events of integrating services need to be logged, be sure to pass a custom [eventBusLog]. */ inline fun < reified TService : ApplicationService, @@ -108,11 +110,13 @@ inline fun < > createLoggedApplicationService( service: TService, decoratedServiceConstructor: - (TService, (Command) -> Command) -> TService + (TService, (Command) -> Command) -> TService, + eventBusLog: EventBusLog = EventBusLog( + SingleThreadedEventBus(), + EventBusLog.Subscription( TService::class, TEvent::class ) + ) ): Pair> { - val eventBus = SingleThreadedEventBus() - val eventBusLog = EventBusLog( eventBus, EventBusLog.Subscription( TService::class, TEvent::class ) ) val loggedRequests: MutableList> = mutableListOf() val loggedService = decoratedServiceConstructor( service ) { ApplicationServiceRequestLogger( eventBusLog, loggedRequests::add, it ) } diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt new file mode 100644 index 000000000..c414a1d09 --- /dev/null +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt @@ -0,0 +1,95 @@ +package dk.cachet.carp.deployments.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.application.devices.DeviceRegistration +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.deployments.application.DeploymentService +import dk.cachet.carp.deployments.application.PrimaryDeviceDeployment +import dk.cachet.carp.deployments.application.StudyDeploymentStatus +import dk.cachet.carp.deployments.application.users.ParticipantInvitation +import dk.cachet.carp.protocols.application.StudyProtocolSnapshot +import kotlinx.datetime.Instant + + +class DeploymentServiceDecorator( + service: DeploymentService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + DeploymentService +{ + override suspend fun createStudyDeployment( + id: UUID, + protocol: StudyProtocolSnapshot, + invitations: List, + connectedDevicePreregistrations: Map + ): StudyDeploymentStatus = invoke( + DeploymentServiceRequest.CreateStudyDeployment( id, protocol, invitations, connectedDevicePreregistrations ) + ) + + override suspend fun removeStudyDeployments( studyDeploymentIds: Set ): Set = + invoke( DeploymentServiceRequest.RemoveStudyDeployments( studyDeploymentIds ) ) + + override suspend fun getStudyDeploymentStatus( studyDeploymentId: UUID ): StudyDeploymentStatus = + invoke( DeploymentServiceRequest.GetStudyDeploymentStatus( studyDeploymentId ) ) + + override suspend fun getStudyDeploymentStatusList( studyDeploymentIds: Set ): List = + invoke( DeploymentServiceRequest.GetStudyDeploymentStatusList( studyDeploymentIds ) ) + + override suspend fun registerDevice( + studyDeploymentId: UUID, + deviceRoleName: String, + registration: DeviceRegistration + ): StudyDeploymentStatus = + invoke( DeploymentServiceRequest.RegisterDevice( studyDeploymentId, deviceRoleName, registration ) ) + + override suspend fun unregisterDevice( + studyDeploymentId: UUID, + deviceRoleName: String + ): StudyDeploymentStatus = + invoke( DeploymentServiceRequest.UnregisterDevice( studyDeploymentId, deviceRoleName ) ) + + override suspend fun getDeviceDeploymentFor( + studyDeploymentId: UUID, + primaryDeviceRoleName: String + ): PrimaryDeviceDeployment = + invoke( DeploymentServiceRequest.GetDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) ) + + override suspend fun deviceDeployed( + studyDeploymentId: UUID, + primaryDeviceRoleName: String, + deviceDeploymentLastUpdatedOn: Instant + ): StudyDeploymentStatus = invoke( + DeploymentServiceRequest.DeviceDeployed( + studyDeploymentId, + primaryDeviceRoleName, + deviceDeploymentLastUpdatedOn + ) + ) + + override suspend fun stop( studyDeploymentId: UUID ): StudyDeploymentStatus = + invoke( DeploymentServiceRequest.Stop( studyDeploymentId ) ) + + override suspend fun DeploymentServiceRequest<*>.invokeOnService( service: DeploymentService ): Any = + when ( this ) + { + is DeploymentServiceRequest.CreateStudyDeployment -> + service.createStudyDeployment( id, protocol, invitations, connectedDevicePreregistrations ) + is DeploymentServiceRequest.RemoveStudyDeployments -> + service.removeStudyDeployments( studyDeploymentIds ) + is DeploymentServiceRequest.GetStudyDeploymentStatus -> + service.getStudyDeploymentStatus( studyDeploymentId ) + is DeploymentServiceRequest.GetStudyDeploymentStatusList -> + service.getStudyDeploymentStatusList( studyDeploymentIds ) + is DeploymentServiceRequest.RegisterDevice -> + service.registerDevice( studyDeploymentId, deviceRoleName, registration ) + is DeploymentServiceRequest.UnregisterDevice -> + service.unregisterDevice( studyDeploymentId, deviceRoleName ) + is DeploymentServiceRequest.GetDeviceDeploymentFor -> + service.getDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) + is DeploymentServiceRequest.DeviceDeployed -> + service.deviceDeployed( studyDeploymentId, primaryDeviceRoleName, deviceDeploymentLastUpdatedOn ) + is DeploymentServiceRequest.Stop -> + service.stop( studyDeploymentId ) + } +} diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceLoggingProxy.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceLoggingProxy.kt deleted file mode 100644 index 1dd380f0a..000000000 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceLoggingProxy.kt +++ /dev/null @@ -1,84 +0,0 @@ -package dk.cachet.carp.deployments.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.devices.DeviceRegistration -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.deployments.application.DeploymentService -import dk.cachet.carp.deployments.application.PrimaryDeviceDeployment -import dk.cachet.carp.deployments.application.StudyDeploymentStatus -import dk.cachet.carp.deployments.application.users.ParticipantInvitation -import dk.cachet.carp.protocols.application.StudyProtocolSnapshot -import kotlinx.datetime.Instant - - -/** - * A proxy for a deployment [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class DeploymentServiceLoggingProxy( - service: DeploymentService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ), - log - ), - DeploymentService -{ - override suspend fun createStudyDeployment( - id: UUID, - protocol: StudyProtocolSnapshot, - invitations: List, - connectedDevicePreregistrations: Map - ): StudyDeploymentStatus = log( - DeploymentServiceRequest.CreateStudyDeployment( id, protocol, invitations, connectedDevicePreregistrations ) - ) - - override suspend fun removeStudyDeployments( studyDeploymentIds: Set ): Set = - log( DeploymentServiceRequest.RemoveStudyDeployments( studyDeploymentIds ) ) - - override suspend fun getStudyDeploymentStatus( studyDeploymentId: UUID ): StudyDeploymentStatus = - log( DeploymentServiceRequest.GetStudyDeploymentStatus( studyDeploymentId ) ) - - override suspend fun getStudyDeploymentStatusList( studyDeploymentIds: Set ): List = - log( DeploymentServiceRequest.GetStudyDeploymentStatusList( studyDeploymentIds ) ) - - override suspend fun registerDevice( - studyDeploymentId: UUID, - deviceRoleName: String, - registration: DeviceRegistration - ): StudyDeploymentStatus = - log( DeploymentServiceRequest.RegisterDevice( studyDeploymentId, deviceRoleName, registration) ) - - override suspend fun unregisterDevice( studyDeploymentId: UUID, deviceRoleName: String ): StudyDeploymentStatus = - log( DeploymentServiceRequest.UnregisterDevice( studyDeploymentId, deviceRoleName ) ) - - override suspend fun getDeviceDeploymentFor( - studyDeploymentId: UUID, - primaryDeviceRoleName: String - ): PrimaryDeviceDeployment = - log( DeploymentServiceRequest.GetDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) ) - - override suspend fun deviceDeployed( - studyDeploymentId: UUID, - primaryDeviceRoleName: String, - deviceDeploymentLastUpdatedOn: Instant - ): StudyDeploymentStatus = log( - DeploymentServiceRequest.DeviceDeployed( - studyDeploymentId, - primaryDeviceRoleName, - deviceDeploymentLastUpdatedOn - ) - ) - - override suspend fun stop( studyDeploymentId: UUID ): StudyDeploymentStatus = - log( DeploymentServiceRequest.Stop( studyDeploymentId ) ) -} diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt new file mode 100644 index 000000000..96e349b27 --- /dev/null +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt @@ -0,0 +1,53 @@ +package dk.cachet.carp.deployments.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.application.data.Data +import dk.cachet.carp.common.application.data.input.InputDataType +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.deployments.application.ParticipationService +import dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation +import dk.cachet.carp.deployments.application.users.ParticipantData + + +class ParticipationServiceDecorator( + service: ParticipationService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + ParticipationService +{ + override suspend fun getActiveParticipationInvitations( + accountId: UUID + ): Set = invoke( + ParticipationServiceRequest.GetActiveParticipationInvitations( accountId ) + ) + + override suspend fun getParticipantData( studyDeploymentId: UUID ): ParticipantData = invoke( + ParticipationServiceRequest.GetParticipantData( studyDeploymentId ) + ) + + override suspend fun getParticipantDataList( studyDeploymentIds: Set ): List = invoke( + ParticipationServiceRequest.GetParticipantDataList( studyDeploymentIds ) + ) + + override suspend fun setParticipantData( + studyDeploymentId: UUID, + data: Map, + inputByParticipantRole: String? + ): ParticipantData = invoke( + ParticipationServiceRequest.SetParticipantData( studyDeploymentId, data, inputByParticipantRole ) + ) + + override suspend fun ParticipationServiceRequest<*>.invokeOnService( service: ParticipationService ): Any = + when ( this ) + { + is ParticipationServiceRequest.GetActiveParticipationInvitations -> + service.getActiveParticipationInvitations( accountId ) + is ParticipationServiceRequest.GetParticipantData -> + service.getParticipantData( studyDeploymentId ) + is ParticipationServiceRequest.GetParticipantDataList -> + service.getParticipantDataList( studyDeploymentIds ) + is ParticipationServiceRequest.SetParticipantData -> + service.setParticipantData( studyDeploymentId, data, inputByParticipantRole ) + } +} diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceLoggingProxy.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceLoggingProxy.kt deleted file mode 100644 index da4936205..000000000 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceLoggingProxy.kt +++ /dev/null @@ -1,51 +0,0 @@ -package dk.cachet.carp.deployments.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.data.Data -import dk.cachet.carp.common.application.data.input.InputDataType -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.deployments.application.DeploymentService -import dk.cachet.carp.deployments.application.ParticipationService -import dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation -import dk.cachet.carp.deployments.application.users.ParticipantData - - -/** - * A proxy for a participation [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class ParticipationServiceLoggingProxy( - service: ParticipationService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( ParticipationService::class, ParticipationService.Event::class ), - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ), - log - ), - ParticipationService -{ - override suspend fun getActiveParticipationInvitations( accountId: UUID ): Set = - log( ParticipationServiceRequest.GetActiveParticipationInvitations( accountId ) ) - - override suspend fun getParticipantData( studyDeploymentId: UUID ): ParticipantData = - log( ParticipationServiceRequest.GetParticipantData( studyDeploymentId ) ) - - override suspend fun getParticipantDataList( studyDeploymentIds: Set ): List = - log( ParticipationServiceRequest.GetParticipantDataList( studyDeploymentIds ) ) - - override suspend fun setParticipantData( - studyDeploymentId: UUID, - data: Map, - inputByParticipantRole: String? - ): ParticipantData = - log( ParticipationServiceRequest.SetParticipantData( studyDeploymentId, data, inputByParticipantRole ) ) -} diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt index a6cdc7011..48472d60c 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt @@ -2,6 +2,10 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.devices.DefaultDeviceRegistration +import dk.cachet.carp.common.application.services.EventBus +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest @@ -33,8 +37,22 @@ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest + { + val (service, eventBus) = DeploymentServiceHostTest.createSUT() + + val (loggedService, logger) = createLoggedApplicationService( + service, + ::DeploymentServiceDecorator, + EventBusLog( + eventBus, + EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) + ) + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + DeploymentService by loggedService { } + } } diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt index 0ecfc3976..e17df5ac8 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt @@ -3,7 +3,12 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.input.CarpInputDataTypes import dk.cachet.carp.common.application.data.input.Sex +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest +import dk.cachet.carp.deployments.application.DeploymentService +import dk.cachet.carp.deployments.application.DeploymentServiceHostTest import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.ParticipationServiceHostTest @@ -30,8 +35,23 @@ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest + { + val sut = ParticipationServiceHostTest.createSUT() + + val (loggedService, logger) = createLoggedApplicationService( + sut.participationService, + ::ParticipationServiceDecorator, + EventBusLog( + sut.eventBus, + EventBusLog.Subscription( ParticipationService::class, ParticipationService.Event::class ), + EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) + ) + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + ParticipationService by loggedService { } + } } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt index 73ce1b16a..877361289 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt @@ -1,10 +1,12 @@ package dk.cachet.carp.deployments.infrastructure.versioning +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest import dk.cachet.carp.deployments.application.DeploymentServiceTest -import dk.cachet.carp.deployments.infrastructure.DeploymentServiceLoggingProxy +import dk.cachet.carp.deployments.infrastructure.DeploymentServiceDecorator class OutputDeploymentServiceTestRequests : @@ -13,10 +15,19 @@ class OutputDeploymentServiceTestRequests : { override fun createSUT(): DeploymentServiceTest.SUT { - val services = DeploymentServiceHostTest.createSUT() - val service = DeploymentServiceLoggingProxy( services.deploymentService, services.eventBus ) - serviceLogger = service + val (service, eventBus) = DeploymentServiceHostTest.createSUT() - return DeploymentServiceTest.SUT( service, services.eventBus ) + val (loggedService, logger) = createLoggedApplicationService( + service, + ::DeploymentServiceDecorator, + EventBusLog( + eventBus, + EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) + ) + ) + + serviceLogger = logger + + return DeploymentServiceTest.SUT( loggedService, eventBus ) } } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt index a4e875c6c..02de2506e 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt @@ -1,10 +1,10 @@ package dk.cachet.carp.deployments.infrastructure.versioning +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests -import dk.cachet.carp.deployments.application.ParticipationService -import dk.cachet.carp.deployments.application.ParticipationServiceHostTest -import dk.cachet.carp.deployments.application.ParticipationServiceTest -import dk.cachet.carp.deployments.infrastructure.ParticipationServiceLoggingProxy +import dk.cachet.carp.deployments.application.* +import dk.cachet.carp.deployments.infrastructure.ParticipationServiceDecorator class OutputParticipationServiceTestRequests : @@ -13,15 +13,20 @@ class OutputParticipationServiceTestRequests : { override fun createSUT(): ParticipationServiceTest.SUT { - val services = ParticipationServiceHostTest.createSUT() - val service = ParticipationServiceLoggingProxy( services.participationService, services.eventBus ) - serviceLogger = service + val sut = ParticipationServiceHostTest.createSUT() - return ParticipationServiceTest.SUT( - service, - services.deploymentService, - services.accountService, - services.eventBus + val (loggedService, logger) = createLoggedApplicationService( + sut.participationService, + ::ParticipationServiceDecorator, + EventBusLog( + sut.eventBus, + EventBusLog.Subscription( ParticipationService::class, ParticipationService.Event::class ), + EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) + ) ) + + serviceLogger = logger + + return ParticipationServiceTest.SUT( loggedService, sut.deploymentService, sut.accountService, sut.eventBus ) } } From 63a40b900626c0d6d1b314bae9cf62ac6872d3ca Mon Sep 17 00:00:00 2001 From: Whathecode Date: Mon, 20 Feb 2023 20:57:12 +0100 Subject: [PATCH 10/50] Refactor: study services logging using decorator --- .../RecruitmentServiceDecorator.kt | 58 +++++++++++++ .../RecruitmentServiceLoggingProxy.kt | 56 ------------- .../infrastructure/StudyServiceDecorator.kt | 84 +++++++++++++++++++ .../StudyServiceLoggingProxy.kt | 68 --------------- .../RecruitmentServiceRequestsTest.kt | 27 +++++- .../StudyServiceRequestsTest.kt | 23 ++++- .../OutputRecruitmentServiceTestRequests.kt | 25 ++++-- .../OutputStudyServiceTestRequests.kt | 20 ++++- 8 files changed, 219 insertions(+), 142 deletions(-) create mode 100644 carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt delete mode 100644 carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceLoggingProxy.kt create mode 100644 carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt delete mode 100644 carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceLoggingProxy.kt diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt new file mode 100644 index 000000000..866ac7540 --- /dev/null +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt @@ -0,0 +1,58 @@ +package dk.cachet.carp.studies.infrastructure + +import dk.cachet.carp.common.application.EmailAddress +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.studies.application.RecruitmentService +import dk.cachet.carp.studies.application.users.AssignedParticipantRoles +import dk.cachet.carp.studies.application.users.Participant +import dk.cachet.carp.studies.application.users.ParticipantGroupStatus + + +class RecruitmentServiceDecorator( + service: RecruitmentService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + RecruitmentService +{ + override suspend fun addParticipant( studyId: UUID, email: EmailAddress ): Participant = invoke( + RecruitmentServiceRequest.AddParticipant( studyId, email ) + ) + + override suspend fun getParticipant( studyId: UUID, participantId: UUID ): Participant = invoke( + RecruitmentServiceRequest.GetParticipant( studyId, participantId ) + ) + + override suspend fun getParticipants( studyId: UUID ): List = invoke( + RecruitmentServiceRequest.GetParticipants( studyId ) + ) + + override suspend fun inviteNewParticipantGroup( + studyId: UUID, + group: Set + ): ParticipantGroupStatus = invoke( + RecruitmentServiceRequest.InviteNewParticipantGroup( studyId, group ) + ) + + override suspend fun getParticipantGroupStatusList( studyId: UUID ): List = invoke( + RecruitmentServiceRequest.GetParticipantGroupStatusList( studyId ) + ) + + override suspend fun stopParticipantGroup( studyId: UUID, groupId: UUID ): ParticipantGroupStatus = invoke( + RecruitmentServiceRequest.StopParticipantGroup( studyId, groupId ) + ) + + override suspend fun RecruitmentServiceRequest<*>.invokeOnService( service: RecruitmentService ): Any? = + when ( this ) + { + is RecruitmentServiceRequest.AddParticipant -> service.addParticipant( studyId, email ) + is RecruitmentServiceRequest.GetParticipant -> service.getParticipant( studyId, participantId ) + is RecruitmentServiceRequest.GetParticipants -> service.getParticipants( studyId ) + is RecruitmentServiceRequest.InviteNewParticipantGroup -> + service.inviteNewParticipantGroup( studyId, group ) + is RecruitmentServiceRequest.GetParticipantGroupStatusList -> + service.getParticipantGroupStatusList( studyId ) + is RecruitmentServiceRequest.StopParticipantGroup -> service.stopParticipantGroup( studyId, groupId ) + } +} diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceLoggingProxy.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceLoggingProxy.kt deleted file mode 100644 index 7746ca142..000000000 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceLoggingProxy.kt +++ /dev/null @@ -1,56 +0,0 @@ -package dk.cachet.carp.studies.infrastructure - -import dk.cachet.carp.common.application.EmailAddress -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.studies.application.RecruitmentService -import dk.cachet.carp.studies.application.StudyService -import dk.cachet.carp.studies.application.users.AssignedParticipantRoles -import dk.cachet.carp.studies.application.users.Participant -import dk.cachet.carp.studies.application.users.ParticipantGroupStatus - - -/** - * A proxy for a recruitment [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class RecruitmentServiceLoggingProxy( - service: RecruitmentService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( RecruitmentService::class, RecruitmentService.Event::class ), - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ), - log - ), - RecruitmentService -{ - override suspend fun addParticipant( studyId: UUID, email: EmailAddress ): Participant = - log( RecruitmentServiceRequest.AddParticipant( studyId, email ) ) - - override suspend fun getParticipant( studyId: UUID, participantId: UUID ): Participant = - log( RecruitmentServiceRequest.GetParticipant( studyId, participantId ) ) - - override suspend fun getParticipants( studyId: UUID ): List = - log( RecruitmentServiceRequest.GetParticipants( studyId ) ) - - override suspend fun inviteNewParticipantGroup( - studyId: UUID, - group: Set - ): ParticipantGroupStatus = - log( RecruitmentServiceRequest.InviteNewParticipantGroup( studyId, group ) ) - - override suspend fun getParticipantGroupStatusList( studyId: UUID ): List = - log( RecruitmentServiceRequest.GetParticipantGroupStatusList( studyId ) ) - - override suspend fun stopParticipantGroup( studyId: UUID, groupId: UUID ): ParticipantGroupStatus = - log( RecruitmentServiceRequest.StopParticipantGroup( studyId, groupId ) ) -} diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt new file mode 100644 index 000000000..f79a249dc --- /dev/null +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt @@ -0,0 +1,84 @@ +package dk.cachet.carp.studies.infrastructure + +import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.Command +import dk.cachet.carp.deployments.application.users.StudyInvitation +import dk.cachet.carp.protocols.application.StudyProtocolSnapshot +import dk.cachet.carp.studies.application.StudyDetails +import dk.cachet.carp.studies.application.StudyService +import dk.cachet.carp.studies.application.StudyStatus + + +@Suppress( "TooManyFunctions" ) +class StudyServiceDecorator( + service: StudyService, + requestDecorator: (Command>) -> Command> +) : ApplicationServiceDecorator>( service, requestDecorator ), + StudyService +{ + override suspend fun createStudy( + ownerId: UUID, + name: String, + description: String?, + invitation: StudyInvitation? + ): StudyStatus = invoke( + StudyServiceRequest.CreateStudy( ownerId, name, description, invitation ) + ) + + override suspend fun setInternalDescription( + studyId: UUID, + name: String, + description: String? + ): StudyStatus = invoke( + StudyServiceRequest.SetInternalDescription( studyId, name, description ) + ) + + override suspend fun getStudyDetails( studyId: UUID ): StudyDetails = invoke( + StudyServiceRequest.GetStudyDetails( studyId ) + ) + + override suspend fun getStudyStatus( studyId: UUID ): StudyStatus = invoke( + StudyServiceRequest.GetStudyStatus( studyId ) + ) + + override suspend fun getStudiesOverview( ownerId: UUID ): List = invoke( + StudyServiceRequest.GetStudiesOverview( ownerId ) + ) + + override suspend fun setInvitation( studyId: UUID, invitation: StudyInvitation ): StudyStatus = invoke( + StudyServiceRequest.SetInvitation( studyId, invitation ) + ) + + override suspend fun setProtocol( studyId: UUID, protocol: StudyProtocolSnapshot ): StudyStatus = invoke( + StudyServiceRequest.SetProtocol( studyId, protocol ) + ) + + override suspend fun removeProtocol( studyId: UUID ): StudyStatus = invoke( + StudyServiceRequest.RemoveProtocol( studyId ) + ) + + override suspend fun goLive( studyId: UUID ): StudyStatus = invoke( + StudyServiceRequest.GoLive( studyId ) + ) + + override suspend fun remove( studyId: UUID ): Boolean = invoke( + StudyServiceRequest.Remove( studyId ) + ) + + override suspend fun StudyServiceRequest<*>.invokeOnService( service: StudyService ): Any? = + when ( this ) + { + is StudyServiceRequest.CreateStudy -> service.createStudy( ownerId, name, description, invitation ) + is StudyServiceRequest.SetInternalDescription -> + service.setInternalDescription( studyId, name, description ) + is StudyServiceRequest.GetStudyDetails -> service.getStudyDetails( studyId ) + is StudyServiceRequest.GetStudyStatus -> service.getStudyStatus( studyId ) + is StudyServiceRequest.GetStudiesOverview -> service.getStudiesOverview( ownerId ) + is StudyServiceRequest.SetInvitation -> service.setInvitation( studyId, invitation ) + is StudyServiceRequest.SetProtocol -> service.setProtocol( studyId, protocol ) + is StudyServiceRequest.RemoveProtocol -> service.removeProtocol( studyId ) + is StudyServiceRequest.GoLive -> service.goLive( studyId ) + is StudyServiceRequest.Remove -> service.remove( studyId ) + } +} diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceLoggingProxy.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceLoggingProxy.kt deleted file mode 100644 index be673abf3..000000000 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceLoggingProxy.kt +++ /dev/null @@ -1,68 +0,0 @@ -package dk.cachet.carp.studies.infrastructure - -import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLoggingProxy -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.LoggedRequest -import dk.cachet.carp.deployments.application.users.StudyInvitation -import dk.cachet.carp.protocols.application.StudyProtocolSnapshot -import dk.cachet.carp.studies.application.StudyDetails -import dk.cachet.carp.studies.application.StudyService -import dk.cachet.carp.studies.application.StudyStatus - - -/** - * A proxy for a study [service] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. - */ -class StudyServiceLoggingProxy( - service: StudyService, - eventBus: EventBus, - log: (LoggedRequest) -> Unit = { } -) : - ApplicationServiceLoggingProxy( - service, - EventBusLog( - eventBus, - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ), - log - ), - StudyService -{ - override suspend fun createStudy( - ownerId: UUID, - name: String, - description: String?, - invitation: StudyInvitation? - ): StudyStatus = - log( StudyServiceRequest.CreateStudy( ownerId, name, description, invitation ) ) - - override suspend fun setInternalDescription( studyId: UUID, name: String, description: String? ): StudyStatus = - log( StudyServiceRequest.SetInternalDescription( studyId, name, description ) ) - - override suspend fun getStudyDetails( studyId: UUID ): StudyDetails = - log( StudyServiceRequest.GetStudyDetails( studyId ) ) - - override suspend fun getStudyStatus( studyId: UUID ): StudyStatus = - log( StudyServiceRequest.GetStudyStatus( studyId ) ) - - override suspend fun getStudiesOverview( ownerId: UUID ): List = - log( StudyServiceRequest.GetStudiesOverview( ownerId ) ) - - override suspend fun setInvitation( studyId: UUID, invitation: StudyInvitation ): StudyStatus = - log( StudyServiceRequest.SetInvitation( studyId, invitation ) ) - - override suspend fun setProtocol( studyId: UUID, protocol: StudyProtocolSnapshot ): StudyStatus = - log( StudyServiceRequest.SetProtocol( studyId, protocol ) ) - - override suspend fun removeProtocol( studyId: UUID ): StudyStatus = - log( StudyServiceRequest.RemoveProtocol( studyId ) ) - - override suspend fun goLive( studyId: UUID ): StudyStatus = - log( StudyServiceRequest.GoLive( studyId ) ) - - override suspend fun remove( studyId: UUID ): Boolean = - log( StudyServiceRequest.Remove( studyId ) ) -} diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt index 01220ad89..27d41c834 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt @@ -2,9 +2,13 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.EmailAddress import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest +import dk.cachet.carp.studies.application.StudyService /** @@ -30,8 +34,23 @@ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest + { + val sut = RecruitmentServiceHostTest.createSUT() + + val (loggedService, logger) = createLoggedApplicationService( + sut.recruitmentService, + ::RecruitmentServiceDecorator, + EventBusLog( + sut.eventBus, + EventBusLog.Subscription( RecruitmentService::class, RecruitmentService.Event::class ), + EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) + ) + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + RecruitmentService by loggedService { } + } } diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt index a87dc4b89..1c6f79f26 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt @@ -1,6 +1,9 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.domain.StudyProtocol @@ -35,6 +38,22 @@ class StudyServiceRequestsTest : ApplicationServiceRequestsTest + { + val (service, eventBus) = StudyServiceHostTest.createService() + + val (loggedService, logger) = createLoggedApplicationService( + service, + ::StudyServiceDecorator, + EventBusLog( + eventBus, + EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) + ) + ) + + // TODO: The base class relies on the proxied service also be a logger. + return object : + ApplicationServiceLogger by logger, + StudyService by loggedService { } + } } diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt index 05933aff3..9ba5df889 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt @@ -1,10 +1,13 @@ package dk.cachet.carp.studies.infrastructure.versioning +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest import dk.cachet.carp.studies.application.RecruitmentServiceTest -import dk.cachet.carp.studies.infrastructure.RecruitmentServiceLoggingProxy +import dk.cachet.carp.studies.application.StudyService +import dk.cachet.carp.studies.infrastructure.RecruitmentServiceDecorator class OutputRecruitmentServiceTestRequests : @@ -13,14 +16,20 @@ class OutputRecruitmentServiceTestRequests : { override fun createSUT(): RecruitmentServiceTest.SUT { - val services = RecruitmentServiceHostTest.createSUT() - val service = RecruitmentServiceLoggingProxy( services.recruitmentService, services.eventBus ) - serviceLogger = service + val sut = RecruitmentServiceHostTest.createSUT() - return RecruitmentServiceTest.SUT( - service, - services.studyService, - services.eventBus + val (loggedService, logger) = createLoggedApplicationService( + sut.recruitmentService, + ::RecruitmentServiceDecorator, + EventBusLog( + sut.eventBus, + EventBusLog.Subscription( RecruitmentService::class, RecruitmentService.Event::class ), + EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) + ) ) + + serviceLogger = logger + + return RecruitmentServiceTest.SUT( loggedService, sut.studyService, sut.eventBus ) } } diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt index 3c89e5209..12b26d2d4 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt @@ -1,10 +1,12 @@ package dk.cachet.carp.studies.infrastructure.versioning +import dk.cachet.carp.common.infrastructure.services.EventBusLog +import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyServiceHostTest import dk.cachet.carp.studies.application.StudyServiceTest -import dk.cachet.carp.studies.infrastructure.StudyServiceLoggingProxy +import dk.cachet.carp.studies.infrastructure.StudyServiceDecorator class OutputStudyServiceTestRequests : @@ -13,9 +15,19 @@ class OutputStudyServiceTestRequests : { override fun createService(): StudyService { - val services = StudyServiceHostTest.createService() + val (service, eventBus) = StudyServiceHostTest.createService() - return StudyServiceLoggingProxy( services.first, services.second ) - .also { serviceLogger = it } + val (loggedService, logger) = createLoggedApplicationService( + service, + ::StudyServiceDecorator, + EventBusLog( + eventBus, + EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) + ) + ) + + serviceLogger = logger + + return loggedService } } From 9401752e38da760e0faa25dd034d13293c6c302d Mon Sep 17 00:00:00 2001 From: Whathecode Date: Wed, 22 Feb 2023 20:10:59 +0100 Subject: [PATCH 11/50] Refactor: replace `ApplicationServiceLoggingProxy` with concrete `ApplicationServiceLogger` `ApplicationServiceLoggingProxy` is unused with the previous decorator refactoring, and there was no longer a need for an `ApplicationServiceLogger` interface. --- .../ApplicationServiceRequestsTest.kt | 18 +-- .../versioning/OutputTestRequests.kt | 44 ++++++- ...ngProxy.kt => ApplicationServiceLogger.kt} | 111 ++---------------- ...est.kt => ApplicationServiceLoggerTest.kt} | 4 +- .../DataStreamServiceRequestsTest.kt | 17 +-- .../OutputDataStreamServiceTestRequests.kt | 21 ++-- .../DeploymentServiceRequestsTest.kt | 24 +--- .../ParticipationServiceRequestsTest.kt | 26 +--- .../OutputDeploymentServiceTestRequests.kt | 20 +--- .../OutputParticipationServiceTestRequests.kt | 21 +--- .../ProtocolFactoryServiceRequestsTest.kt | 19 +-- .../ProtocolServiceRequestsTest.kt | 16 +-- ...utputProtocolFactoryServiceTestRequests.kt | 21 ++-- .../OutputProtocolServiceTestRequests.kt | 21 ++-- .../RecruitmentServiceRequestsTest.kt | 25 +--- .../StudyServiceRequestsTest.kt | 23 +--- .../OutputRecruitmentServiceTestRequests.kt | 22 +--- .../OutputStudyServiceTestRequests.kt | 22 +--- 18 files changed, 122 insertions(+), 353 deletions(-) rename carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/{ApplicationServiceLoggingProxy.kt => ApplicationServiceLogger.kt} (74%) rename carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/{ApplicationServiceLoggingProxyTest.kt => ApplicationServiceLoggerTest.kt} (94%) diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt index 162b5c4de..abdeed055 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt @@ -1,8 +1,7 @@ package dk.cachet.carp.common.test.infrastructure import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest +import dk.cachet.carp.common.infrastructure.services.* import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest @@ -22,11 +21,12 @@ abstract class ApplicationServiceRequestsTest< TService : ApplicationService, TRequest : ApplicationServiceRequest >( + private val decoratedServiceConstructor: (TService, (Command) -> Command) -> TService, private val requestSerializer: KSerializer, private val requests: List ) { - abstract fun createServiceLoggingProxy(): ApplicationServiceLogger + abstract fun createService(): TService @ExperimentalSerializationApi @@ -45,14 +45,18 @@ abstract class ApplicationServiceRequestsTest< @Suppress( "UNCHECKED_CAST" ) @Test fun invokeOn_requests_call_service() = runTest { - val serviceLog = createServiceLoggingProxy() + // Create logged service. Events can safely be ignored since they go unused. + val eventBusLog = EventBusLog( SingleThreadedEventBus() ) + val logger = ApplicationServiceLogger() + val loggedService = decoratedServiceConstructor( createService() ) + { ApplicationServiceRequestLogger( eventBusLog, logger::addLog, it ) } requests.forEach { request -> - try { request.invokeOn( serviceLog as TService ) } + try { request.invokeOn( loggedService ) } catch ( ignore: Exception ) { } // Requests do not have to succeed to verify request arrived. - assertTrue( serviceLog.wasCalled( request ) ) + assertTrue( logger.wasCalled( request ) ) - serviceLog.clear() + logger.clear() } } diff --git a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt index 64434eb67..11d992775 100644 --- a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt +++ b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/OutputTestRequests.kt @@ -2,7 +2,9 @@ package dk.cachet.carp.common.test.infrastructure.versioning import dk.cachet.carp.common.application.ApplicationServiceInfo import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger +import dk.cachet.carp.common.application.services.EventBus +import dk.cachet.carp.common.application.services.IntegrationEvent +import dk.cachet.carp.common.infrastructure.services.* import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.Json @@ -21,12 +23,18 @@ val TEST_REQUESTS_FOLDER = File( "build/test-requests/" ) * Outputs all logged requests of a [serviceLogger] while running unit tests to the build folder. * * Extend from this base class along with a test interface for which to log requests, - * and implement `createService` by returning a logging service proxy and setting [serviceLogger]. + * and implement `createService` by returning a wrapped service using [createLoggedApplicationService]. */ -open class OutputTestRequests>( applicationServiceKlass: KClass ) +open class OutputTestRequests< + TService : ApplicationService, + TEvent : IntegrationEvent, + TRequest : ApplicationServiceRequest, +>( + applicationServiceKlass: KClass, + private val decoratedServiceConstructor: (TService, (Command) -> Command) -> TService +) { - @Suppress( "UNCHECKED_CAST" ) - protected var serviceLogger: ApplicationServiceLogger? = null + private var serviceLogger: ApplicationServiceLogger? = null private val applicationServiceInfo = ApplicationServiceInfo.of( applicationServiceKlass.java ) companion object @@ -47,11 +55,35 @@ open class OutputTestRequests>( appli } } + protected fun createLoggedApplicationService( + service: TService, + eventBus: EventBus + ): TService + { + // Create event bus log which subscribes to all events of this service and its dependent services. + val subscribeToServices = applicationServiceInfo.dependentServices + applicationServiceInfo.serviceKlass + @Suppress( "UNCHECKED_CAST" ) + val toObserve = subscribeToServices.map { + val serviceKlass = it.kotlin as KClass + val eventKlass = ApplicationServiceInfo.of( it ).eventClass.kotlin as KClass + EventBusLog.Subscription( serviceKlass, eventKlass ) + }.toTypedArray() + val eventBusLog = EventBusLog( eventBus, *toObserve ) + + // Decorate service by applying a logger from which requests are retrieved after each test. + val logger = ApplicationServiceLogger() + val loggedService = decoratedServiceConstructor( service ) + { ApplicationServiceRequestLogger( eventBusLog, logger::addLog, it ) } + serviceLogger = logger + + return loggedService + } + @AfterTest fun outputLoggedRequests( info: TestInfo ) { val service = checkNotNull( serviceLogger ) - { "`loggedService` needs to be set in `createService`." } + { "`createLoggedApplicationService` needs to be called in `createService`." } // Serialize requests as json. val requests = service.loggedRequests diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt similarity index 74% rename from carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt rename to carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt index 536781dc9..93f1091b0 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxy.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt @@ -1,7 +1,6 @@ package dk.cachet.carp.common.infrastructure.services import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.application.services.EventBus import dk.cachet.carp.common.application.services.IntegrationEvent import dk.cachet.carp.common.infrastructure.reflect.AccessInternals import kotlinx.serialization.* @@ -12,125 +11,29 @@ import kotlinx.serialization.json.JsonClassDiscriminator /** - * A proxy for [ApplicationService] which notifies of incoming requests and responses through [log] - * and keeps a history of requests and published events in [loggedRequests]. + * Access [loggedRequests] of an [ApplicationService]. */ -open class ApplicationServiceLoggingProxy< +class ApplicationServiceLogger< TService : ApplicationService, TEvent : IntegrationEvent ->( - private val service: TService, - private val eventBusLog: EventBusLog, - private val log: (LoggedRequest) -> Unit = { } -) : ApplicationServiceLogger +> { private val _loggedRequests: MutableList> = mutableListOf() - override val loggedRequests: List> + val loggedRequests: List> get() = _loggedRequests.toList() - /** - * Execute the [request] and log it including the response. - */ - protected suspend fun log( request: ApplicationServiceRequest ): TReturn - { - @Suppress( "UNCHECKED_CAST" ) - fun getCurrentEvents() = eventBusLog.retrieveAndEmptyLog() as List - val precedingEvents = getCurrentEvents() - - @Suppress( "TooGenericExceptionCaught" ) - val response = - try { request.invokeOn( service ) } - catch ( ex: Exception ) - { - val failed = LoggedRequest.Failed( - request, - precedingEvents, - getCurrentEvents(), - ex::class.simpleName!! - ) - addLog( failed ) - throw ex - } - - addLog( LoggedRequest.Succeeded( request, precedingEvents, getCurrentEvents(), response ) ) - - return response - } - - private fun addLog( loggedRequest: LoggedRequest ) - { - _loggedRequests.add( loggedRequest ) - log( loggedRequest ) - } + fun addLog( loggedRequest: LoggedRequest ) = _loggedRequests.add( loggedRequest ) /** * Determines whether the given [request] is present in [loggedRequests]. */ - override fun wasCalled( request: ApplicationServiceRequest ): Boolean = + fun wasCalled( request: ApplicationServiceRequest ): Boolean = _loggedRequests.map { it.request }.contains( request ) /** * Clear the current [loggedRequests]. */ - override fun clear() = _loggedRequests.clear() -} - - -/** - * Access [loggedRequests] of an [ApplicationService]. - */ -interface ApplicationServiceLogger< - TService : ApplicationService, - TEvent : IntegrationEvent -> -{ - val loggedRequests: List> - - /** - * Determines whether the given [request] is present in [loggedRequests]. - */ - fun wasCalled( request: ApplicationServiceRequest ): Boolean - - /** - * Clear the current [loggedRequests]. - */ - fun clear() -} - - -/** - * Decorate [service] using [decoratedServiceConstructor] with an [ApplicationServiceLogger]. - * Returns the decorated service and logger. - * In case additional events of integrating services need to be logged, be sure to pass a custom [eventBusLog]. - */ -inline fun < - reified TService : ApplicationService, - TRequest : ApplicationServiceRequest, - reified TEvent : IntegrationEvent -> createLoggedApplicationService( - service: TService, - decoratedServiceConstructor: - (TService, (Command) -> Command) -> TService, - eventBusLog: EventBusLog = EventBusLog( - SingleThreadedEventBus(), - EventBusLog.Subscription( TService::class, TEvent::class ) - ) -): Pair> -{ - val loggedRequests: MutableList> = mutableListOf() - val loggedService = decoratedServiceConstructor( service ) - { ApplicationServiceRequestLogger( eventBusLog, loggedRequests::add, it ) } - - val logger = - object : ApplicationServiceLogger - { - override val loggedRequests: List> get() = loggedRequests.toList() - override fun clear() = loggedRequests.clear() - override fun wasCalled( request: ApplicationServiceRequest ): Boolean = - loggedRequests.map { it.request }.contains( request ) - } - - return Pair( loggedService, logger ) + fun clear() = _loggedRequests.clear() } diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxyTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt similarity index 94% rename from carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxyTest.kt rename to carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt index 44b24d0d5..df91dc4c7 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggingProxyTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt @@ -7,9 +7,9 @@ import kotlin.test.* /** - * Tests for [ApplicationServiceLoggingProxy] relying on core infrastructure. + * Tests for [ApplicationServiceLogger]. */ -class ApplicationServiceLoggingProxyTest +class ApplicationServiceLoggerTest { @Test fun can_serialize_and_deserialize_LoggedRequest_Succeeded() diff --git a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt index 76aa1f580..d8987fba4 100644 --- a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt +++ b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt @@ -2,9 +2,6 @@ package dk.cachet.carp.data.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.data.application.DataStreamId import dk.cachet.carp.data.application.DataStreamService @@ -13,6 +10,7 @@ import dk.cachet.carp.data.application.MutableDataStreamBatch class DataStreamServiceRequestsTest : ApplicationServiceRequestsTest>( + ::DataStreamServiceDecorator, DataStreamServiceRequest.Serializer, REQUESTS ) @@ -32,16 +30,5 @@ class DataStreamServiceRequestsTest : ApplicationServiceRequestsTest - { - val (loggedService, logger) = createLoggedApplicationService( - InMemoryDataStreamService(), - ::DataStreamServiceDecorator - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - DataStreamService by loggedService { } - } + override fun createService() = InMemoryDataStreamService() } diff --git a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt index 4a019c434..b19b32cb6 100644 --- a/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt +++ b/carp.data.core/src/jvmTest/kotlin/dk/cachet/carp/data/infrastructure/versioning/OutputDataStreamServiceTestRequests.kt @@ -1,26 +1,21 @@ package dk.cachet.carp.data.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService +import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.data.application.DataStreamService import dk.cachet.carp.data.application.DataStreamServiceTest import dk.cachet.carp.data.infrastructure.DataStreamServiceDecorator +import dk.cachet.carp.data.infrastructure.DataStreamServiceRequest import dk.cachet.carp.data.infrastructure.InMemoryDataStreamService class OutputDataStreamServiceTestRequests : - OutputTestRequests( DataStreamService::class ), + OutputTestRequests>( + DataStreamService::class, + ::DataStreamServiceDecorator + ), DataStreamServiceTest { - override fun createService(): DataStreamService - { - val (loggedService, logger) = createLoggedApplicationService( - InMemoryDataStreamService(), - ::DataStreamServiceDecorator - ) - - serviceLogger = logger - - return loggedService - } + override fun createService(): DataStreamService = + createLoggedApplicationService( InMemoryDataStreamService(), SingleThreadedEventBus() ) } diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt index 48472d60c..7efb7fe44 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt @@ -2,10 +2,6 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.devices.DefaultDeviceRegistration -import dk.cachet.carp.common.application.services.EventBus -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest @@ -17,6 +13,7 @@ import kotlinx.datetime.Clock * Tests for [DeploymentServiceRequest]'s. */ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest>( + ::DeploymentServiceDecorator, DeploymentServiceRequest.Serializer, REQUESTS ) @@ -37,22 +34,5 @@ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest - { - val (service, eventBus) = DeploymentServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - service, - ::DeploymentServiceDecorator, - EventBusLog( - eventBus, - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ) - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - DeploymentService by loggedService { } - } + override fun createService() = DeploymentServiceHostTest.createSUT().deploymentService } diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt index e17df5ac8..9b80e50f3 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt @@ -3,12 +3,7 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.input.CarpInputDataTypes import dk.cachet.carp.common.application.data.input.Sex -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest -import dk.cachet.carp.deployments.application.DeploymentService -import dk.cachet.carp.deployments.application.DeploymentServiceHostTest import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.ParticipationServiceHostTest @@ -17,6 +12,7 @@ import dk.cachet.carp.deployments.application.ParticipationServiceHostTest * Tests for [ParticipationServiceRequest]'s. */ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest>( + ::ParticipationServiceDecorator, ParticipationServiceRequest.Serializer, REQUESTS ) @@ -35,23 +31,5 @@ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest - { - val sut = ParticipationServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - sut.participationService, - ::ParticipationServiceDecorator, - EventBusLog( - sut.eventBus, - EventBusLog.Subscription( ParticipationService::class, ParticipationService.Event::class ), - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ) - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - ParticipationService by loggedService { } - } + override fun createService() = ParticipationServiceHostTest.createSUT().participationService } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt index 877361289..002422200 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputDeploymentServiceTestRequests.kt @@ -1,32 +1,24 @@ package dk.cachet.carp.deployments.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest import dk.cachet.carp.deployments.application.DeploymentServiceTest import dk.cachet.carp.deployments.infrastructure.DeploymentServiceDecorator +import dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest class OutputDeploymentServiceTestRequests : - OutputTestRequests( DeploymentService::class ), + OutputTestRequests>( + DeploymentService::class, + ::DeploymentServiceDecorator + ), DeploymentServiceTest { override fun createSUT(): DeploymentServiceTest.SUT { val (service, eventBus) = DeploymentServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - service, - ::DeploymentServiceDecorator, - EventBusLog( - eventBus, - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ) - ) - - serviceLogger = logger + val loggedService = createLoggedApplicationService( service, eventBus ) return DeploymentServiceTest.SUT( loggedService, eventBus ) } diff --git a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt index 02de2506e..82678af7d 100644 --- a/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt +++ b/carp.deployments.core/src/jvmTest/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/OutputParticipationServiceTestRequests.kt @@ -1,31 +1,22 @@ package dk.cachet.carp.deployments.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.deployments.application.* import dk.cachet.carp.deployments.infrastructure.ParticipationServiceDecorator +import dk.cachet.carp.deployments.infrastructure.ParticipationServiceRequest class OutputParticipationServiceTestRequests : - OutputTestRequests( ParticipationService::class ), + OutputTestRequests>( + ParticipationService::class, + ::ParticipationServiceDecorator + ), ParticipationServiceTest { override fun createSUT(): ParticipationServiceTest.SUT { val sut = ParticipationServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - sut.participationService, - ::ParticipationServiceDecorator, - EventBusLog( - sut.eventBus, - EventBusLog.Subscription( ParticipationService::class, ParticipationService.Event::class ), - EventBusLog.Subscription( DeploymentService::class, DeploymentService.Event::class ) - ) - ) - - serviceLogger = logger + val loggedService = createLoggedApplicationService( sut.participationService, sut.eventBus ) return ParticipationServiceTest.SUT( loggedService, sut.deploymentService, sut.accountService, sut.eventBus ) } diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt index 2d4c80d4a..f867671f4 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt @@ -1,8 +1,6 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest @@ -11,7 +9,9 @@ import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest /** * Tests for [ProtocolFactoryServiceRequest]'s. */ -class ProtocolFactoryServiceRequestsTest : ApplicationServiceRequestsTest>( +class ProtocolFactoryServiceRequestsTest : + ApplicationServiceRequestsTest>( + ::ProtocolFactoryServiceDecorator, ProtocolFactoryServiceRequest.Serializer, REQUESTS ) @@ -24,16 +24,5 @@ class ProtocolFactoryServiceRequestsTest : ApplicationServiceRequestsTest - { - val (loggedService, logger) = createLoggedApplicationService( - ProtocolFactoryServiceHostTest.createService(), - ::ProtocolFactoryServiceDecorator - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - ProtocolFactoryService by loggedService { } - } + override fun createService() = ProtocolFactoryServiceHostTest.createService() } diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt index 812d2c456..42df42671 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt @@ -1,8 +1,6 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolServiceHostTest @@ -13,6 +11,7 @@ import dk.cachet.carp.protocols.infrastructure.test.createComplexProtocol * Tests for [ProtocolServiceRequest]'s. */ class ProtocolServiceRequestsTest : ApplicationServiceRequestsTest>( + ::ProtocolServiceDecorator, ProtocolServiceRequest.Serializer, REQUESTS ) @@ -30,16 +29,5 @@ class ProtocolServiceRequestsTest : ApplicationServiceRequestsTest - { - val (loggedService, logger) = createLoggedApplicationService( - ProtocolServiceHostTest.createService(), - ::ProtocolServiceDecorator - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - ProtocolService by loggedService { } - } + override fun createService() = ProtocolServiceHostTest.createService() } diff --git a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt index 3d06bfa48..990a4f492 100644 --- a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt +++ b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolFactoryServiceTestRequests.kt @@ -1,26 +1,21 @@ package dk.cachet.carp.protocols.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService +import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest import dk.cachet.carp.protocols.application.ProtocolFactoryServiceTest import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceDecorator +import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceRequest class OutputProtocolFactoryServiceTestRequests : - OutputTestRequests( ProtocolFactoryService::class ), + OutputTestRequests>( + ProtocolFactoryService::class, + ::ProtocolFactoryServiceDecorator + ), ProtocolFactoryServiceTest { - override fun createService(): ProtocolFactoryService - { - val (loggedService, logger) = createLoggedApplicationService( - ProtocolFactoryServiceHostTest.createService(), - ::ProtocolFactoryServiceDecorator - ) - - serviceLogger = logger - - return loggedService - } + override fun createService(): ProtocolFactoryService = + createLoggedApplicationService( ProtocolFactoryServiceHostTest.createService(), SingleThreadedEventBus() ) } diff --git a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt index 79bc8f748..e3db12d63 100644 --- a/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt +++ b/carp.protocols.core/src/jvmTest/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/OutputProtocolServiceTestRequests.kt @@ -1,26 +1,21 @@ package dk.cachet.carp.protocols.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService +import dk.cachet.carp.common.infrastructure.services.SingleThreadedEventBus import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolServiceHostTest import dk.cachet.carp.protocols.application.ProtocolServiceTest import dk.cachet.carp.protocols.infrastructure.ProtocolServiceDecorator +import dk.cachet.carp.protocols.infrastructure.ProtocolServiceRequest class OutputProtocolServiceTestRequests : - OutputTestRequests( ProtocolService::class ), + OutputTestRequests>( + ProtocolService::class, + ::ProtocolServiceDecorator + ), ProtocolServiceTest { - override fun createService(): ProtocolService - { - val (loggedService, logger) = createLoggedApplicationService( - ProtocolServiceHostTest.createService(), - ::ProtocolServiceDecorator - ) - - serviceLogger = logger - - return loggedService - } + override fun createService(): ProtocolService = + createLoggedApplicationService( ProtocolServiceHostTest.createService(), SingleThreadedEventBus() ) } diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt index 27d41c834..b22e88548 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt @@ -2,19 +2,16 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.EmailAddress import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest -import dk.cachet.carp.studies.application.StudyService /** * Tests for [RecruitmentServiceRequest]'s. */ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest>( + ::RecruitmentServiceDecorator, RecruitmentServiceRequest.Serializer, REQUESTS ) @@ -34,23 +31,5 @@ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest - { - val sut = RecruitmentServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - sut.recruitmentService, - ::RecruitmentServiceDecorator, - EventBusLog( - sut.eventBus, - EventBusLog.Subscription( RecruitmentService::class, RecruitmentService.Event::class ), - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ) - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - RecruitmentService by loggedService { } - } + override fun createService() = RecruitmentServiceHostTest.createSUT().recruitmentService } diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt index 1c6f79f26..72c7475c9 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt @@ -1,9 +1,6 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.UUID -import dk.cachet.carp.common.infrastructure.services.ApplicationServiceLogger -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.domain.StudyProtocol @@ -15,6 +12,7 @@ import dk.cachet.carp.studies.application.StudyServiceHostTest * Tests for [StudyServiceRequest]'s. */ class StudyServiceRequestsTest : ApplicationServiceRequestsTest>( + ::StudyServiceDecorator, StudyServiceRequest.Serializer, REQUESTS ) @@ -38,22 +36,5 @@ class StudyServiceRequestsTest : ApplicationServiceRequestsTest - { - val (service, eventBus) = StudyServiceHostTest.createService() - - val (loggedService, logger) = createLoggedApplicationService( - service, - ::StudyServiceDecorator, - EventBusLog( - eventBus, - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ) - ) - - // TODO: The base class relies on the proxied service also be a logger. - return object : - ApplicationServiceLogger by logger, - StudyService by loggedService { } - } + override fun createService() = StudyServiceHostTest.createService().first } diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt index 9ba5df889..fac4181ae 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputRecruitmentServiceTestRequests.kt @@ -1,34 +1,24 @@ package dk.cachet.carp.studies.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest import dk.cachet.carp.studies.application.RecruitmentServiceTest -import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.infrastructure.RecruitmentServiceDecorator +import dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest class OutputRecruitmentServiceTestRequests : - OutputTestRequests( RecruitmentService::class ), + OutputTestRequests>( + RecruitmentService::class, + ::RecruitmentServiceDecorator + ), RecruitmentServiceTest { override fun createSUT(): RecruitmentServiceTest.SUT { val sut = RecruitmentServiceHostTest.createSUT() - - val (loggedService, logger) = createLoggedApplicationService( - sut.recruitmentService, - ::RecruitmentServiceDecorator, - EventBusLog( - sut.eventBus, - EventBusLog.Subscription( RecruitmentService::class, RecruitmentService.Event::class ), - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ) - ) - - serviceLogger = logger + val loggedService = createLoggedApplicationService( sut.recruitmentService, sut.eventBus ) return RecruitmentServiceTest.SUT( loggedService, sut.studyService, sut.eventBus ) } diff --git a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt index 12b26d2d4..16de7a985 100644 --- a/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt +++ b/carp.studies.core/src/jvmTest/kotlin/dk/cachet/carp/studies/infrastructure/versioning/OutputStudyServiceTestRequests.kt @@ -1,33 +1,23 @@ package dk.cachet.carp.studies.infrastructure.versioning -import dk.cachet.carp.common.infrastructure.services.EventBusLog -import dk.cachet.carp.common.infrastructure.services.createLoggedApplicationService import dk.cachet.carp.common.test.infrastructure.versioning.OutputTestRequests import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyServiceHostTest import dk.cachet.carp.studies.application.StudyServiceTest import dk.cachet.carp.studies.infrastructure.StudyServiceDecorator +import dk.cachet.carp.studies.infrastructure.StudyServiceRequest class OutputStudyServiceTestRequests : - OutputTestRequests( StudyService::class ), + OutputTestRequests>( + StudyService::class, + ::StudyServiceDecorator + ), StudyServiceTest { override fun createService(): StudyService { val (service, eventBus) = StudyServiceHostTest.createService() - - val (loggedService, logger) = createLoggedApplicationService( - service, - ::StudyServiceDecorator, - EventBusLog( - eventBus, - EventBusLog.Subscription( StudyService::class, StudyService.Event::class ) - ) - ) - - serviceLogger = logger - - return loggedService + return createLoggedApplicationService( service, eventBus ) } } From e9c02e9db555f0333ea1283fa1a055f07ce92943 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 25 Feb 2023 15:14:35 +0100 Subject: [PATCH 12/50] Decouple application service request invokers from decorators This allows them to be used in `MigratedRequest` as well, removing the reliance on `invokeOn` suspend methods on request objects. These may be removed later so that these types can be exported to JS. --- .../versioning/BackwardsCompatibilityTest.kt | 2 +- .../services/ApplicationServiceDecorator.kt | 9 ++++---- .../services/ApplicationServiceInvoker.kt | 16 +++++++++++++ .../ApplicationServiceApiMigrator.kt | 23 +++++++++++++------ .../ApplicationServiceDecoratorTest.kt | 7 ++++-- .../ApplicationServiceApiMigratorTest.kt | 11 +++++++++ .../application/ApplicationServiceInfo.kt | 4 ++-- .../DataStreamServiceDecorator.kt | 13 +++++++++-- .../DataStreamServiceApiMigrator.kt | 2 ++ .../DeploymentServiceDecorator.kt | 13 +++++++++-- .../ParticipationServiceDecorator.kt | 13 +++++++++-- .../DeploymentServiceApiMigrator.kt | 2 ++ .../ParticipationServiceApiMigrator.kt | 2 ++ .../ProtocolFactoryServiceDecorator.kt | 14 +++++++++-- .../ProtocolServiceDecorator.kt | 13 +++++++++-- .../ProtocolFactoryServiceApiMigrator.kt | 2 ++ .../versioning/ProtocolServiceApiMigrator.kt | 2 ++ .../RecruitmentServiceDecorator.kt | 13 +++++++++-- .../infrastructure/StudyServiceDecorator.kt | 9 ++++++-- .../RecruitmentServiceApiMigrator.kt | 2 ++ .../versioning/StudyServiceApiMigrator.kt | 2 ++ 21 files changed, 143 insertions(+), 31 deletions(-) create mode 100644 carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceInvoker.kt diff --git a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/BackwardsCompatibilityTest.kt b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/BackwardsCompatibilityTest.kt index 552d42cbc..6227b7314 100644 --- a/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/BackwardsCompatibilityTest.kt +++ b/carp.common.test/src/jvmMain/kotlin/dk/cachet/carp/common/test/infrastructure/versioning/BackwardsCompatibilityTest.kt @@ -118,7 +118,7 @@ abstract class BackwardsCompatibilityTest ) { val (service, eventBus) = createService() - val apiMigrator = serviceInfo.apiMigrator as ApplicationServiceApiMigrator + val apiMigrator = serviceInfo.apiMigrator as ApplicationServiceApiMigrator loggedRequests.forEachIndexed { index, logged -> val replayErrorBase = "Couldn't replay requests in: $fileName. Request #${index + 1}" diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt index e1494aa88..a96bd85e9 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt @@ -8,11 +8,12 @@ import dk.cachet.carp.common.application.services.ApplicationService * Extend from this class and implement the application service interface by * redirecting all requests to [invoke] and initializing the matching [TRequest]. */ -abstract class ApplicationServiceDecorator< +open class ApplicationServiceDecorator< TService : ApplicationService, TRequest : ApplicationServiceRequest >( private val service: TService, + private val requestInvoker: ApplicationServiceInvoker, private val requestDecorator: (Command) -> Command ) : Command { @@ -21,18 +22,16 @@ abstract class ApplicationServiceDecorator< { @Suppress( "UNCHECKED_CAST" ) override suspend fun invoke( request: TRequest ): TReturn = - request.invokeOnService( service ) as TReturn + requestInvoker.invokeOnService( request, service ) as TReturn } - protected abstract suspend fun TRequest.invokeOnService( service: TService ): Any? - override suspend fun invoke( request: TRequest ): TReturn = requestDecorator( invokeService ).invoke( request ) as TReturn } /** - * Supports invocation of a [TRequest] on a service. + * Supports invocation of a [TRequest] on a predefined service. */ interface Command { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceInvoker.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceInvoker.kt new file mode 100644 index 000000000..c8fb3cb10 --- /dev/null +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceInvoker.kt @@ -0,0 +1,16 @@ +package dk.cachet.carp.common.infrastructure.services + +import dk.cachet.carp.common.application.services.ApplicationService + + +/** + * Support invoking [TRequest] on a specified [TService]. + */ +interface ApplicationServiceInvoker< + TService : ApplicationService, + TRequest : ApplicationServiceRequest +> +{ + suspend fun TRequest.invoke( service: TService ): Any? + suspend fun invokeOnService( request: TRequest, service: TService ) = request.invoke( service ) +} diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigrator.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigrator.kt index a66b612cd..6b5360333 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigrator.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigrator.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.common.infrastructure.versioning import dk.cachet.carp.common.application.services.ApiVersion import dk.cachet.carp.common.application.services.ApplicationService import dk.cachet.carp.common.application.services.IntegrationEvent +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest import kotlinx.serialization.KSerializer import kotlinx.serialization.json.Json @@ -14,9 +15,13 @@ import kotlinx.serialization.json.jsonPrimitive /** * Supports transforming between different API versions of [ApplicationServiceRequest] and [IntegrationEvent] objects. */ -class ApplicationServiceApiMigrator>( +class ApplicationServiceApiMigrator< + TService : ApplicationService, + TRequest : ApplicationServiceRequest +>( val runtimeVersion: ApiVersion, - val requestObjectSerializer: KSerializer>, + val requestInvoker: ApplicationServiceInvoker, + val requestObjectSerializer: KSerializer, val eventSerializer: KSerializer>, migrations: List = emptyList() ) @@ -47,7 +52,7 @@ class ApplicationServiceApiMigrator>( * - the [request] version is more recent than the runtime version * - the runtime version is a later major version than the [request] version */ - fun migrateRequest( json: Json, request: JsonObject ): MigratedRequest + fun migrateRequest( json: Json, request: JsonObject ): MigratedRequest { val requestVersion = getAndValidateApiVersion( request ) @@ -67,7 +72,7 @@ class ApplicationServiceApiMigrator>( } val decodedRequest = json.decodeFromJsonElement( requestObjectSerializer, updatedRequest ) - return MigratedRequest( json, decodedRequest, ::downgradeResponse ) + return MigratedRequest( json, decodedRequest, requestInvoker, ::downgradeResponse ) } /** @@ -107,9 +112,13 @@ class ApplicationServiceApiMigrator>( /** * A [request] which can be invoked using [invokeOn] which will return the response expected by the version of the caller. */ -class MigratedRequest>( +class MigratedRequest< + TService : ApplicationService, + TRequest : ApplicationServiceRequest +>( val json: Json, - val request: ApplicationServiceRequest, + val request: TRequest, + private val requestInvoker: ApplicationServiceInvoker, private val downgradeResponse: (JsonElement?, Exception?) -> JsonElement ) { @@ -120,7 +129,7 @@ class MigratedRequest>( { @Suppress( "TooGenericExceptionCaught" ) val response = - try { request.invokeOn( service ) } + try { requestInvoker.invokeOnService( request, service ) } catch ( ex: Exception ) { return downgradeResponse( null, ex ) } @Suppress( "UNCHECKED_CAST" ) diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt index 3ae7adf5c..435c98116 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt @@ -13,14 +13,17 @@ class ApplicationServiceDecoratorTest class TestServiceDecorator( service: TestService, requestDecorator: (Command) -> Command - ) : ApplicationServiceDecorator( service, requestDecorator ), + ) : ApplicationServiceDecorator( service, TestServiceInvoker, requestDecorator ), TestService { override suspend fun operation( parameter: Int ): Int = invoke( ApplicationServiceRequestTest.TestServiceRequest.Operation( parameter ) ) + } - override suspend fun TestServiceRequest.invokeOnService( service: TestService ): Any? = + object TestServiceInvoker : ApplicationServiceInvoker + { + override suspend fun TestServiceRequest.invoke( service: TestService ): Any? = when ( this ) { is ApplicationServiceRequestTest.TestServiceRequest.Operation -> service.operation( parameter ) diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt index 651aa63ca..2d68c8087 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.common.application.services.ApiVersion import dk.cachet.carp.common.application.services.ApplicationService import dk.cachet.carp.common.application.services.IntegrationEvent import dk.cachet.carp.common.infrastructure.serialization.ignoreTypeParameters +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.coroutines.test.runTest @@ -53,10 +54,20 @@ class ApplicationServiceApiMigratorTest } } + object TestServiceInvoker : ApplicationServiceInvoker> + { + override suspend fun TestServiceRequest<*>.invoke( service: TestService ): Any = + when ( this ) + { + is TestServiceRequest.GetAnswer -> service.getAnswer( question ) + } + } + private fun createTestApiMigrator( runtimeVersion: ApiVersion, migrations: List ) = ApplicationServiceApiMigrator( runtimeVersion, + TestServiceInvoker, TestServiceRequest.Serializer, TestService.ServiceEvent.serializer(), migrations diff --git a/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt b/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt index cd07bfcf6..d7799d44f 100644 --- a/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt +++ b/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt @@ -105,7 +105,7 @@ class ApplicationServiceInfo private constructor( val serviceKlass: ServiceClass val requestObjectSerializer: KSerializer> val eventSerializer: KSerializer> val loggedRequestSerializer: KSerializer> - val apiMigrator: ApplicationServiceApiMigrator<*> + val apiMigrator: ApplicationServiceApiMigrator<*, *> val requestSchemaUri: URI @@ -190,7 +190,7 @@ class ApplicationServiceInfo private constructor( val serviceKlass: ServiceClass try { Class.forName( apiMigratorFullName ) } catch ( _: ClassNotFoundException ) { null } val apiMigratorLookup = apiMigratorClass?.declaredMethods - ?.firstOrNull { it.name == "get$apiMigratorName" }?.invoke( null ) as? ApplicationServiceApiMigrator<*> + ?.firstOrNull { it.name == "get$apiMigratorName" }?.invoke( null ) as? ApplicationServiceApiMigrator<*, *> apiMigrator = checkNotNull( apiMigratorLookup ) { "Could not find API migrator for \"${serviceKlass.name}\". " + diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt index 892d78cb2..ddc1feb48 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.data.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.data.application.DataStreamBatch import dk.cachet.carp.data.application.DataStreamId @@ -12,7 +13,11 @@ import dk.cachet.carp.data.application.DataStreamsConfiguration class DataStreamServiceDecorator( service: DataStreamService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + DataStreamServiceInvoker, + requestDecorator + ), DataStreamService { override suspend fun openDataStreams( configuration: DataStreamsConfiguration ): Unit = invoke( @@ -38,8 +43,12 @@ class DataStreamServiceDecorator( override suspend fun removeDataStreams( studyDeploymentIds: Set ): Set = invoke( DataStreamServiceRequest.RemoveDataStreams( studyDeploymentIds ) ) +} + - override suspend fun DataStreamServiceRequest<*>.invokeOnService( service: DataStreamService ): Any = +object DataStreamServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun DataStreamServiceRequest<*>.invoke( service: DataStreamService ): Any = when ( this ) { is DataStreamServiceRequest.OpenDataStreams -> service.openDataStreams( configuration ) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/versioning/DataStreamServiceApiMigrator.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/versioning/DataStreamServiceApiMigrator.kt index b584b30a5..89bc895c3 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/versioning/DataStreamServiceApiMigrator.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/versioning/DataStreamServiceApiMigrator.kt @@ -7,6 +7,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigr import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration import dk.cachet.carp.common.infrastructure.versioning.getType import dk.cachet.carp.data.application.DataStreamService +import dk.cachet.carp.data.infrastructure.DataStreamServiceInvoker import dk.cachet.carp.data.infrastructure.DataStreamServiceRequest import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.JsonObject @@ -45,6 +46,7 @@ private val major1Minor0To1Migration = val DataStreamServiceApiMigrator = ApplicationServiceApiMigrator( DataStreamService.API_VERSION, + DataStreamServiceInvoker, DataStreamServiceRequest.Serializer, DataStreamService.Event.serializer(), listOf( major1Minor0To1Migration ) diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt index c414a1d09..1c56ebf57 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.devices.DeviceRegistration import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.PrimaryDeviceDeployment @@ -15,7 +16,11 @@ import kotlinx.datetime.Instant class DeploymentServiceDecorator( service: DeploymentService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + DeploymentServiceInvoker, + requestDecorator + ), DeploymentService { override suspend fun createStudyDeployment( @@ -69,8 +74,12 @@ class DeploymentServiceDecorator( override suspend fun stop( studyDeploymentId: UUID ): StudyDeploymentStatus = invoke( DeploymentServiceRequest.Stop( studyDeploymentId ) ) +} + - override suspend fun DeploymentServiceRequest<*>.invokeOnService( service: DeploymentService ): Any = +object DeploymentServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun DeploymentServiceRequest<*>.invoke( service: DeploymentService ): Any = when ( this ) { is DeploymentServiceRequest.CreateStudyDeployment -> diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt index 96e349b27..8fbbd77b9 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.input.InputDataType import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation @@ -13,7 +14,11 @@ import dk.cachet.carp.deployments.application.users.ParticipantData class ParticipationServiceDecorator( service: ParticipationService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + ParticipationServiceInvoker, + requestDecorator + ), ParticipationService { override suspend fun getActiveParticipationInvitations( @@ -37,8 +42,12 @@ class ParticipationServiceDecorator( ): ParticipantData = invoke( ParticipationServiceRequest.SetParticipantData( studyDeploymentId, data, inputByParticipantRole ) ) +} + - override suspend fun ParticipationServiceRequest<*>.invokeOnService( service: ParticipationService ): Any = +object ParticipationServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun ParticipationServiceRequest<*>.invoke( service: ParticipationService ): Any = when ( this ) { is ParticipationServiceRequest.GetActiveParticipationInvitations -> diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt index 22cc6e3d3..81ec8b679 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/DeploymentServiceApiMigrator.kt @@ -5,6 +5,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApiResponse import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigrator import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration import dk.cachet.carp.deployments.application.DeploymentService +import dk.cachet.carp.deployments.infrastructure.DeploymentServiceInvoker import dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest import kotlinx.serialization.json.JsonObject @@ -30,6 +31,7 @@ private val major1Minor0To1Migration = val DeploymentServiceApiMigrator = ApplicationServiceApiMigrator( DeploymentService.API_VERSION, + DeploymentServiceInvoker, DeploymentServiceRequest.Serializer, DeploymentService.Event.serializer(), listOf( major1Minor0To1Migration ) diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/ParticipationServiceApiMigrator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/ParticipationServiceApiMigrator.kt index 6f60f9407..3c16ee45c 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/ParticipationServiceApiMigrator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/versioning/ParticipationServiceApiMigrator.kt @@ -2,11 +2,13 @@ package dk.cachet.carp.deployments.infrastructure.versioning import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigrator import dk.cachet.carp.deployments.application.ParticipationService +import dk.cachet.carp.deployments.infrastructure.ParticipationServiceInvoker import dk.cachet.carp.deployments.infrastructure.ParticipationServiceRequest val ParticipationServiceApiMigrator = ApplicationServiceApiMigrator( ParticipationService.API_VERSION, + ParticipationServiceInvoker, ParticipationServiceRequest.Serializer, ParticipationService.Event.serializer() ) diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt index a3b8bfb2f..1541a3131 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.StudyProtocolSnapshot @@ -10,7 +11,11 @@ import dk.cachet.carp.protocols.application.StudyProtocolSnapshot class ProtocolFactoryServiceDecorator( service: ProtocolFactoryService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + ProtocolFactoryServiceInvoker, + requestDecorator + ), ProtocolFactoryService { override suspend fun createCustomProtocol( @@ -21,8 +26,13 @@ class ProtocolFactoryServiceDecorator( ): StudyProtocolSnapshot = invoke( ProtocolFactoryServiceRequest.CreateCustomProtocol( ownerId, name, customProtocol, description ) ) +} + - override suspend fun ProtocolFactoryServiceRequest<*>.invokeOnService( service: ProtocolFactoryService ): Any = +object ProtocolFactoryServiceInvoker : + ApplicationServiceInvoker> +{ + override suspend fun ProtocolFactoryServiceRequest<*>.invoke( service: ProtocolFactoryService ): Any = when ( this ) { is ProtocolFactoryServiceRequest.CreateCustomProtocol -> diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt index 961543b06..2646c22c9 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.ExpectedParticipantData import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolVersion @@ -12,7 +13,11 @@ import dk.cachet.carp.protocols.application.StudyProtocolSnapshot class ProtocolServiceDecorator( service: ProtocolService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + ProtocolServiceInvoker, + requestDecorator + ), ProtocolService { override suspend fun add( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = invoke( @@ -42,8 +47,12 @@ class ProtocolServiceDecorator( override suspend fun getVersionHistoryFor( protocolId: UUID ): List = invoke( ProtocolServiceRequest.GetVersionHistoryFor( protocolId ) ) +} + - override suspend fun ProtocolServiceRequest<*>.invokeOnService( service: ProtocolService ): Any = +object ProtocolServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun ProtocolServiceRequest<*>.invoke( service: ProtocolService ): Any = when ( this ) { is ProtocolServiceRequest.Add -> service.add( protocol, versionTag ) diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolFactoryServiceApiMigrator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolFactoryServiceApiMigrator.kt index 8eaad91bf..d905d508c 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolFactoryServiceApiMigrator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolFactoryServiceApiMigrator.kt @@ -6,6 +6,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigr import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration import dk.cachet.carp.common.infrastructure.versioning.getType import dk.cachet.carp.protocols.application.ProtocolFactoryService +import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceInvoker import dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceRequest import kotlinx.serialization.json.* @@ -36,6 +37,7 @@ private val major1Minor0To1Migration = val ProtocolFactoryServiceApiMigrator = ApplicationServiceApiMigrator( ProtocolFactoryService.API_VERSION, + ProtocolFactoryServiceInvoker, ProtocolFactoryServiceRequest.Serializer, ProtocolFactoryService.Event.serializer(), listOf( major1Minor0To1Migration ) diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolServiceApiMigrator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolServiceApiMigrator.kt index c63bd7389..89fcb7e3f 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolServiceApiMigrator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/versioning/ProtocolServiceApiMigrator.kt @@ -6,6 +6,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigr import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration import dk.cachet.carp.common.infrastructure.versioning.getType import dk.cachet.carp.protocols.application.ProtocolService +import dk.cachet.carp.protocols.infrastructure.ProtocolServiceInvoker import dk.cachet.carp.protocols.infrastructure.ProtocolServiceRequest import kotlinx.serialization.json.* @@ -58,6 +59,7 @@ private val major1Minor0To1Migration = val ProtocolServiceApiMigrator = ApplicationServiceApiMigrator( ProtocolService.API_VERSION, + ProtocolServiceInvoker, ProtocolServiceRequest.Serializer, ProtocolService.Event.serializer(), listOf( major1Minor0To1Migration ) diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt index 866ac7540..e4b3f4268 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.EmailAddress import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.users.AssignedParticipantRoles @@ -13,7 +14,11 @@ import dk.cachet.carp.studies.application.users.ParticipantGroupStatus class RecruitmentServiceDecorator( service: RecruitmentService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( + service, + RecruitmentServiceInvoker, + requestDecorator + ), RecruitmentService { override suspend fun addParticipant( studyId: UUID, email: EmailAddress ): Participant = invoke( @@ -42,8 +47,12 @@ class RecruitmentServiceDecorator( override suspend fun stopParticipantGroup( studyId: UUID, groupId: UUID ): ParticipantGroupStatus = invoke( RecruitmentServiceRequest.StopParticipantGroup( studyId, groupId ) ) +} + - override suspend fun RecruitmentServiceRequest<*>.invokeOnService( service: RecruitmentService ): Any? = +object RecruitmentServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun RecruitmentServiceRequest<*>.invoke( service: RecruitmentService ): Any = when ( this ) { is RecruitmentServiceRequest.AddParticipant -> service.addParticipant( studyId, email ) diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt index f79a249dc..743a9ec6d 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator +import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.application.StudyProtocolSnapshot @@ -14,7 +15,7 @@ import dk.cachet.carp.studies.application.StudyStatus class StudyServiceDecorator( service: StudyService, requestDecorator: (Command>) -> Command> -) : ApplicationServiceDecorator>( service, requestDecorator ), +) : ApplicationServiceDecorator>( service, StudyServiceInvoker, requestDecorator ), StudyService { override suspend fun createStudy( @@ -65,8 +66,12 @@ class StudyServiceDecorator( override suspend fun remove( studyId: UUID ): Boolean = invoke( StudyServiceRequest.Remove( studyId ) ) +} + - override suspend fun StudyServiceRequest<*>.invokeOnService( service: StudyService ): Any? = +object StudyServiceInvoker : ApplicationServiceInvoker> +{ + override suspend fun StudyServiceRequest<*>.invoke( service: StudyService ): Any? = when ( this ) { is StudyServiceRequest.CreateStudy -> service.createStudy( ownerId, name, description, invitation ) diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/RecruitmentServiceApiMigrator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/RecruitmentServiceApiMigrator.kt index afcc9db26..fc96a6f2c 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/RecruitmentServiceApiMigrator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/RecruitmentServiceApiMigrator.kt @@ -2,11 +2,13 @@ package dk.cachet.carp.studies.infrastructure.versioning import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigrator import dk.cachet.carp.studies.application.RecruitmentService +import dk.cachet.carp.studies.infrastructure.RecruitmentServiceInvoker import dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest val RecruitmentServiceApiMigrator = ApplicationServiceApiMigrator( RecruitmentService.API_VERSION, + RecruitmentServiceInvoker, RecruitmentServiceRequest.Serializer, RecruitmentService.Event.serializer() ) diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/StudyServiceApiMigrator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/StudyServiceApiMigrator.kt index b6d313ff2..7fcde4bdd 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/StudyServiceApiMigrator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/versioning/StudyServiceApiMigrator.kt @@ -6,6 +6,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigr import dk.cachet.carp.common.infrastructure.versioning.Major1Minor0To1Migration import dk.cachet.carp.common.infrastructure.versioning.getType import dk.cachet.carp.studies.application.StudyService +import dk.cachet.carp.studies.infrastructure.StudyServiceInvoker import dk.cachet.carp.studies.infrastructure.StudyServiceRequest import kotlinx.serialization.json.* @@ -53,6 +54,7 @@ private val major1Minor0To1Migration = val StudyServiceApiMigrator = ApplicationServiceApiMigrator( StudyService.API_VERSION, + StudyServiceInvoker, StudyServiceRequest.Serializer, StudyService.Event.serializer(), listOf( major1Minor0To1Migration ) From 403cf1b0c3c845af2049e2f7717e97220818c904 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 26 Feb 2023 17:14:03 +0100 Subject: [PATCH 13/50] Add tests for application service decorators --- .../ApplicationServiceDecoratorTest.kt | 56 +++++++++++++++++++ .../ApplicationServiceRequestsTest.kt | 4 +- ...=> DataStreamServiceInfrastructureTest.kt} | 8 +++ ...=> DeploymentServiceInfrastructureTest.kt} | 11 +++- ...ParticipationServiceInfrastructureTest.kt} | 11 +++- ...otocolFactoryServiceInfrastructureTest.kt} | 11 +++- ...t => ProtocolServiceInfrastructureTest.kt} | 11 +++- ...> RecruitmentServiceInfrastructureTest.kt} | 11 +++- ...t.kt => StudyServiceInfrastructureTest.kt} | 11 +++- 9 files changed, 114 insertions(+), 20 deletions(-) create mode 100644 carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt rename carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/{DataStreamServiceRequestsTest.kt => DataStreamServiceInfrastructureTest.kt} (81%) rename carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/{DeploymentServiceRequestsTest.kt => DeploymentServiceInfrastructureTest.kt} (85%) rename carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/{ParticipationServiceRequestsTest.kt => ParticipationServiceInfrastructureTest.kt} (79%) rename carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/{ProtocolFactoryServiceRequestsTest.kt => ProtocolFactoryServiceInfrastructureTest.kt} (71%) rename carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/{ProtocolServiceRequestsTest.kt => ProtocolServiceInfrastructureTest.kt} (81%) rename carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/{RecruitmentServiceRequestsTest.kt => RecruitmentServiceInfrastructureTest.kt} (80%) rename carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/{StudyServiceRequestsTest.kt => StudyServiceInfrastructureTest.kt} (85%) diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt new file mode 100644 index 000000000..d75194d78 --- /dev/null +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt @@ -0,0 +1,56 @@ +package dk.cachet.carp.common.test.infrastructure + +import dk.cachet.carp.common.application.services.ApplicationService +import dk.cachet.carp.common.application.services.IntegrationEvent +import dk.cachet.carp.common.infrastructure.services.* +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.runTest +import kotlin.test.Test +import kotlin.test.assertTrue + + +/** + * Base class to test whether an application service decorator correctly invokes the decorated service. + */ +@ExperimentalCoroutinesApi +@Suppress( + "FunctionName", + "UnnecessaryAbstractClass" // Prevent test being picked up by test runner. +) +abstract class ApplicationServiceDecoratorTest< + TService : ApplicationService, + TEvent : IntegrationEvent, + TRequest : ApplicationServiceRequest +>( + private val requestsTest: ApplicationServiceRequestsTest, + private val serviceInvoker: ApplicationServiceInvoker +) +{ + @Test + fun request_invoker_calls_service() = runTest { + // Create logged service. + val service = requestsTest.createService() + val logger = ApplicationServiceLogger() + val eventBusLog = EventBusLog( SingleThreadedEventBus() ) // Ignore events. + val ignoreServiceInvocation = + object : Command + { + // The returned result goes unused in tests, so this cast never fails. + @Suppress( "UNCHECKED_CAST" ) + override suspend fun invoke( request: TRequest ): TReturn = null as TReturn + } + val loggedService = requestsTest.decoratedServiceConstructor( service ) + { ApplicationServiceRequestLogger( eventBusLog, logger::addLog, ignoreServiceInvocation ) } + + // Test whether each invoked method on the decorated service is converted back into the same request object. + // `requestTest` guarantees a request for each call is available. + requestsTest.requests.forEach { + serviceInvoker.invokeOnService( it, loggedService ) + assertTrue( + logger.wasCalled( it ), + "Service wasn't called or parameters of called request don't match: $it" + ) + logger.clear() + } + } +} diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt index abdeed055..6da52f68b 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt @@ -21,9 +21,9 @@ abstract class ApplicationServiceRequestsTest< TService : ApplicationService, TRequest : ApplicationServiceRequest >( - private val decoratedServiceConstructor: (TService, (Command) -> Command) -> TService, + val decoratedServiceConstructor: (TService, (Command) -> Command) -> TService, private val requestSerializer: KSerializer, - private val requests: List + val requests: List ) { abstract fun createService(): TService diff --git a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceInfrastructureTest.kt similarity index 81% rename from carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt rename to carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceInfrastructureTest.kt index d8987fba4..bc244bb1f 100644 --- a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequestsTest.kt +++ b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceInfrastructureTest.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.data.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.data.application.DataStreamId import dk.cachet.carp.data.application.DataStreamService @@ -32,3 +33,10 @@ class DataStreamServiceRequestsTest : ApplicationServiceRequestsTest>( + DataStreamServiceRequestsTest(), + DataStreamServiceInvoker + ) diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceInfrastructureTest.kt similarity index 85% rename from carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt rename to carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceInfrastructureTest.kt index 7efb7fe44..4a6110401 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceInfrastructureTest.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.devices.DefaultDeviceRegistration +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.DeploymentService import dk.cachet.carp.deployments.application.DeploymentServiceHostTest @@ -9,9 +10,6 @@ import dk.cachet.carp.protocols.infrastructure.test.createEmptyProtocol import kotlinx.datetime.Clock -/** - * Tests for [DeploymentServiceRequest]'s. - */ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest>( ::DeploymentServiceDecorator, DeploymentServiceRequest.Serializer, @@ -36,3 +34,10 @@ class DeploymentServiceRequestsTest : ApplicationServiceRequestsTest>( + DeploymentServiceRequestsTest(), + DeploymentServiceInvoker + ) diff --git a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceInfrastructureTest.kt similarity index 79% rename from carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt rename to carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceInfrastructureTest.kt index 9b80e50f3..12b92fc29 100644 --- a/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequestsTest.kt +++ b/carp.deployments.core/src/commonTest/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceInfrastructureTest.kt @@ -3,14 +3,12 @@ package dk.cachet.carp.deployments.infrastructure import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.input.CarpInputDataTypes import dk.cachet.carp.common.application.data.input.Sex +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.ParticipationServiceHostTest -/** - * Tests for [ParticipationServiceRequest]'s. - */ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest>( ::ParticipationServiceDecorator, ParticipationServiceRequest.Serializer, @@ -33,3 +31,10 @@ class ParticipationServiceRequestsTest : ApplicationServiceRequestsTest>( + ParticipationServiceRequestsTest(), + ParticipationServiceInvoker + ) diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceInfrastructureTest.kt similarity index 71% rename from carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt rename to carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceInfrastructureTest.kt index f867671f4..43897c2a2 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceInfrastructureTest.kt @@ -1,14 +1,12 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.ProtocolFactoryServiceHostTest -/** - * Tests for [ProtocolFactoryServiceRequest]'s. - */ class ProtocolFactoryServiceRequestsTest : ApplicationServiceRequestsTest>( ::ProtocolFactoryServiceDecorator, @@ -26,3 +24,10 @@ class ProtocolFactoryServiceRequestsTest : override fun createService() = ProtocolFactoryServiceHostTest.createService() } + + +class ProtocolFactoryServiceDecoratorTest : + ApplicationServiceDecoratorTest>( + ProtocolFactoryServiceRequestsTest(), + ProtocolFactoryServiceInvoker + ) diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceInfrastructureTest.kt similarity index 81% rename from carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt rename to carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceInfrastructureTest.kt index 42df42671..d64eccff2 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequestsTest.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceInfrastructureTest.kt @@ -1,15 +1,13 @@ package dk.cachet.carp.protocols.infrastructure import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.protocols.application.ProtocolService import dk.cachet.carp.protocols.application.ProtocolServiceHostTest import dk.cachet.carp.protocols.infrastructure.test.createComplexProtocol -/** - * Tests for [ProtocolServiceRequest]'s. - */ class ProtocolServiceRequestsTest : ApplicationServiceRequestsTest>( ::ProtocolServiceDecorator, ProtocolServiceRequest.Serializer, @@ -31,3 +29,10 @@ class ProtocolServiceRequestsTest : ApplicationServiceRequestsTest>( + ProtocolServiceRequestsTest(), + ProtocolServiceInvoker + ) diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceInfrastructureTest.kt similarity index 80% rename from carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt rename to carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceInfrastructureTest.kt index b22e88548..307cfd906 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceInfrastructureTest.kt @@ -2,14 +2,12 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.EmailAddress import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.RecruitmentServiceHostTest -/** - * Tests for [RecruitmentServiceRequest]'s. - */ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest>( ::RecruitmentServiceDecorator, RecruitmentServiceRequest.Serializer, @@ -33,3 +31,10 @@ class RecruitmentServiceRequestsTest : ApplicationServiceRequestsTest>( + RecruitmentServiceRequestsTest(), + RecruitmentServiceInvoker + ) diff --git a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceInfrastructureTest.kt similarity index 85% rename from carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt rename to carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceInfrastructureTest.kt index 72c7475c9..3ce317935 100644 --- a/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequestsTest.kt +++ b/carp.studies.core/src/commonTest/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceInfrastructureTest.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.studies.infrastructure import dk.cachet.carp.common.application.UUID +import dk.cachet.carp.common.test.infrastructure.ApplicationServiceDecoratorTest import dk.cachet.carp.common.test.infrastructure.ApplicationServiceRequestsTest import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.domain.StudyProtocol @@ -8,9 +9,6 @@ import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyServiceHostTest -/** - * Tests for [StudyServiceRequest]'s. - */ class StudyServiceRequestsTest : ApplicationServiceRequestsTest>( ::StudyServiceDecorator, StudyServiceRequest.Serializer, @@ -38,3 +36,10 @@ class StudyServiceRequestsTest : ApplicationServiceRequestsTest>( + StudyServiceRequestsTest(), + StudyServiceInvoker + ) From 9e1cb78b45c0719f502eb163178983c817eaedd0 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Fri, 3 Mar 2023 21:42:54 +0100 Subject: [PATCH 14/50] Use return type inference for `ApplicationServiceDecorator.invoke` --- .../ApplicationServiceDecoratorTest.kt | 5 +-- .../ApplicationServiceRequestsTest.kt | 1 - .../services/ApplicationServiceDecorator.kt | 13 +++--- .../ApplicationServiceRequestLogger.kt | 4 +- .../ApplicationServiceDecoratorTest.kt | 7 ++- .../DataStreamServiceDecorator.kt | 24 ++++------ .../DeploymentServiceDecorator.kt | 24 ++++------ .../ParticipationServiceDecorator.kt | 23 +++------- .../ProtocolFactoryServiceDecorator.kt | 5 +-- .../ProtocolServiceDecorator.kt | 28 +++++------- .../RecruitmentServiceDecorator.kt | 31 +++++-------- .../infrastructure/StudyServiceDecorator.kt | 45 ++++++------------- 12 files changed, 74 insertions(+), 136 deletions(-) diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt index d75194d78..62b6e0622 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceDecoratorTest.kt @@ -35,9 +35,8 @@ abstract class ApplicationServiceDecoratorTest< val ignoreServiceInvocation = object : Command { - // The returned result goes unused in tests, so this cast never fails. - @Suppress( "UNCHECKED_CAST" ) - override suspend fun invoke( request: TRequest ): TReturn = null as TReturn + // The returned result goes unused in this test, so just return null. + override suspend fun invoke( request: TRequest ): Any? = null } val loggedService = requestsTest.decoratedServiceConstructor( service ) { ApplicationServiceRequestLogger( eventBusLog, logger::addLog, ignoreServiceInvocation ) } diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt index 6da52f68b..c180557c6 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt @@ -42,7 +42,6 @@ abstract class ApplicationServiceRequestsTest< assertEquals( allRequestObjects, testedRequestObjects ) } - @Suppress( "UNCHECKED_CAST" ) @Test fun invokeOn_requests_call_service() = runTest { // Create logged service. Events can safely be ignored since they go unused. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt index a96bd85e9..a5ff23170 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecorator.kt @@ -15,18 +15,17 @@ open class ApplicationServiceDecorator< private val service: TService, private val requestInvoker: ApplicationServiceInvoker, private val requestDecorator: (Command) -> Command -) : Command +) { private val invokeService = object : Command { - @Suppress( "UNCHECKED_CAST" ) - override suspend fun invoke( request: TRequest ): TReturn = - requestInvoker.invokeOnService( request, service ) as TReturn + override suspend fun invoke( request: TRequest ) = requestInvoker.invokeOnService( request, service ) } - override suspend fun invoke( request: TRequest ): TReturn = - requestDecorator( invokeService ).invoke( request ) as TReturn + @Suppress( "UNCHECKED_CAST" ) // While less strict than TRequest, this supports type inference for TReturn. + suspend fun invoke( request: ApplicationServiceRequest ): TReturn = + requestDecorator( invokeService ).invoke( request as TRequest ) as TReturn } @@ -35,5 +34,5 @@ open class ApplicationServiceDecorator< */ interface Command { - suspend fun invoke( request: TRequest ): TReturn + suspend fun invoke( request: TRequest ): Any? } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt index e24644db8..9c21d8ae3 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt @@ -18,7 +18,7 @@ class ApplicationServiceRequestLogger< private val decoratee: Command ) : Command { - override suspend fun invoke( request: TRequest ): TReturn + override suspend fun invoke( request: TRequest ): Any? { @Suppress( "UNCHECKED_CAST" ) fun getCurrentEvents() = eventBusLog.retrieveAndEmptyLog() as List @@ -26,7 +26,7 @@ class ApplicationServiceRequestLogger< @Suppress( "TooGenericExceptionCaught" ) val response = - try { decoratee.invoke( request ) as TReturn } + try { decoratee.invoke( request ) } catch ( ex: Exception ) { val failed = LoggedRequest.Failed( diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt index 435c98116..90abd8eb2 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceDecoratorTest.kt @@ -16,9 +16,8 @@ class ApplicationServiceDecoratorTest ) : ApplicationServiceDecorator( service, TestServiceInvoker, requestDecorator ), TestService { - override suspend fun operation( parameter: Int ): Int = invoke( - ApplicationServiceRequestTest.TestServiceRequest.Operation( parameter ) - ) + override suspend fun operation( parameter: Int ) = + invoke( ApplicationServiceRequestTest.TestServiceRequest.Operation( parameter ) ) } object TestServiceInvoker : ApplicationServiceInvoker @@ -37,7 +36,7 @@ class ApplicationServiceDecoratorTest class Decorator( val name: String, val decoratee: Command ) : Command { - override suspend fun invoke( request: TRequest ): TReturn + override suspend fun invoke( request: TRequest ): Any? { invokedDecorators.add( name ) return decoratee.invoke( request ) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt index ddc1feb48..cab4d76d6 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceDecorator.kt @@ -20,29 +20,23 @@ class DataStreamServiceDecorator( ), DataStreamService { - override suspend fun openDataStreams( configuration: DataStreamsConfiguration ): Unit = invoke( - DataStreamServiceRequest.OpenDataStreams( configuration ) - ) + override suspend fun openDataStreams( configuration: DataStreamsConfiguration ) = + invoke( DataStreamServiceRequest.OpenDataStreams( configuration ) ) - override suspend fun appendToDataStreams( studyDeploymentId: UUID, batch: DataStreamBatch ): Unit = invoke( - DataStreamServiceRequest.AppendToDataStreams( studyDeploymentId, batch ) - ) + override suspend fun appendToDataStreams( studyDeploymentId: UUID, batch: DataStreamBatch ) = + invoke( DataStreamServiceRequest.AppendToDataStreams( studyDeploymentId, batch ) ) override suspend fun getDataStream( dataStream: DataStreamId, fromSequenceId: Long, toSequenceIdInclusive: Long? - ): DataStreamBatch = invoke( - DataStreamServiceRequest.GetDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) - ) + ) = invoke( DataStreamServiceRequest.GetDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) ) - override suspend fun closeDataStreams( studyDeploymentIds: Set ): Unit = invoke( - DataStreamServiceRequest.CloseDataStreams( studyDeploymentIds ) - ) + override suspend fun closeDataStreams( studyDeploymentIds: Set ) = + invoke( DataStreamServiceRequest.CloseDataStreams( studyDeploymentIds ) ) - override suspend fun removeDataStreams( studyDeploymentIds: Set ): Set = invoke( - DataStreamServiceRequest.RemoveDataStreams( studyDeploymentIds ) - ) + override suspend fun removeDataStreams( studyDeploymentIds: Set ) = + invoke( DataStreamServiceRequest.RemoveDataStreams( studyDeploymentIds ) ) } diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt index 1c56ebf57..5a3a0b3f4 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceDecorator.kt @@ -6,8 +6,6 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.DeploymentService -import dk.cachet.carp.deployments.application.PrimaryDeviceDeployment -import dk.cachet.carp.deployments.application.StudyDeploymentStatus import dk.cachet.carp.deployments.application.users.ParticipantInvitation import dk.cachet.carp.protocols.application.StudyProtocolSnapshot import kotlinx.datetime.Instant @@ -28,43 +26,40 @@ class DeploymentServiceDecorator( protocol: StudyProtocolSnapshot, invitations: List, connectedDevicePreregistrations: Map - ): StudyDeploymentStatus = invoke( + ) = invoke( DeploymentServiceRequest.CreateStudyDeployment( id, protocol, invitations, connectedDevicePreregistrations ) ) - override suspend fun removeStudyDeployments( studyDeploymentIds: Set ): Set = + override suspend fun removeStudyDeployments( studyDeploymentIds: Set ) = invoke( DeploymentServiceRequest.RemoveStudyDeployments( studyDeploymentIds ) ) - override suspend fun getStudyDeploymentStatus( studyDeploymentId: UUID ): StudyDeploymentStatus = + override suspend fun getStudyDeploymentStatus( studyDeploymentId: UUID ) = invoke( DeploymentServiceRequest.GetStudyDeploymentStatus( studyDeploymentId ) ) - override suspend fun getStudyDeploymentStatusList( studyDeploymentIds: Set ): List = + override suspend fun getStudyDeploymentStatusList( studyDeploymentIds: Set ) = invoke( DeploymentServiceRequest.GetStudyDeploymentStatusList( studyDeploymentIds ) ) override suspend fun registerDevice( studyDeploymentId: UUID, deviceRoleName: String, registration: DeviceRegistration - ): StudyDeploymentStatus = - invoke( DeploymentServiceRequest.RegisterDevice( studyDeploymentId, deviceRoleName, registration ) ) + ) = invoke( DeploymentServiceRequest.RegisterDevice( studyDeploymentId, deviceRoleName, registration ) ) override suspend fun unregisterDevice( studyDeploymentId: UUID, deviceRoleName: String - ): StudyDeploymentStatus = - invoke( DeploymentServiceRequest.UnregisterDevice( studyDeploymentId, deviceRoleName ) ) + ) = invoke( DeploymentServiceRequest.UnregisterDevice( studyDeploymentId, deviceRoleName ) ) override suspend fun getDeviceDeploymentFor( studyDeploymentId: UUID, primaryDeviceRoleName: String - ): PrimaryDeviceDeployment = - invoke( DeploymentServiceRequest.GetDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) ) + ) = invoke( DeploymentServiceRequest.GetDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) ) override suspend fun deviceDeployed( studyDeploymentId: UUID, primaryDeviceRoleName: String, deviceDeploymentLastUpdatedOn: Instant - ): StudyDeploymentStatus = invoke( + ) = invoke( DeploymentServiceRequest.DeviceDeployed( studyDeploymentId, primaryDeviceRoleName, @@ -72,8 +67,7 @@ class DeploymentServiceDecorator( ) ) - override suspend fun stop( studyDeploymentId: UUID ): StudyDeploymentStatus = - invoke( DeploymentServiceRequest.Stop( studyDeploymentId ) ) + override suspend fun stop( studyDeploymentId: UUID ) = invoke( DeploymentServiceRequest.Stop( studyDeploymentId ) ) } diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt index 8fbbd77b9..13a9a9a75 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceDecorator.kt @@ -7,8 +7,6 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.ParticipationService -import dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation -import dk.cachet.carp.deployments.application.users.ParticipantData class ParticipationServiceDecorator( @@ -21,27 +19,20 @@ class ParticipationServiceDecorator( ), ParticipationService { - override suspend fun getActiveParticipationInvitations( - accountId: UUID - ): Set = invoke( - ParticipationServiceRequest.GetActiveParticipationInvitations( accountId ) - ) + override suspend fun getActiveParticipationInvitations( accountId: UUID ) = + invoke( ParticipationServiceRequest.GetActiveParticipationInvitations( accountId ) ) - override suspend fun getParticipantData( studyDeploymentId: UUID ): ParticipantData = invoke( - ParticipationServiceRequest.GetParticipantData( studyDeploymentId ) - ) + override suspend fun getParticipantData( studyDeploymentId: UUID ) = + invoke( ParticipationServiceRequest.GetParticipantData( studyDeploymentId ) ) - override suspend fun getParticipantDataList( studyDeploymentIds: Set ): List = invoke( - ParticipationServiceRequest.GetParticipantDataList( studyDeploymentIds ) - ) + override suspend fun getParticipantDataList( studyDeploymentIds: Set ) = + invoke( ParticipationServiceRequest.GetParticipantDataList( studyDeploymentIds ) ) override suspend fun setParticipantData( studyDeploymentId: UUID, data: Map, inputByParticipantRole: String? - ): ParticipantData = invoke( - ParticipationServiceRequest.SetParticipantData( studyDeploymentId, data, inputByParticipantRole ) - ) + ) = invoke( ParticipationServiceRequest.SetParticipantData( studyDeploymentId, data, inputByParticipantRole ) ) } diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt index 1541a3131..934a98391 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceDecorator.kt @@ -5,7 +5,6 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.protocols.application.ProtocolFactoryService -import dk.cachet.carp.protocols.application.StudyProtocolSnapshot class ProtocolFactoryServiceDecorator( @@ -23,9 +22,7 @@ class ProtocolFactoryServiceDecorator( name: String, customProtocol: String, description: String? - ): StudyProtocolSnapshot = invoke( - ProtocolFactoryServiceRequest.CreateCustomProtocol( ownerId, name, customProtocol, description ) - ) + ) = invoke( ProtocolFactoryServiceRequest.CreateCustomProtocol( ownerId, name, customProtocol, description ) ) } diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt index 2646c22c9..337f370ae 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceDecorator.kt @@ -6,7 +6,6 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceDecorator import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.protocols.application.ProtocolService -import dk.cachet.carp.protocols.application.ProtocolVersion import dk.cachet.carp.protocols.application.StudyProtocolSnapshot @@ -20,33 +19,28 @@ class ProtocolServiceDecorator( ), ProtocolService { - override suspend fun add( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = invoke( - ProtocolServiceRequest.Add( protocol, versionTag ) - ) + override suspend fun add( protocol: StudyProtocolSnapshot, versionTag: String ) = + invoke( ProtocolServiceRequest.Add( protocol, versionTag ) ) - override suspend fun addVersion( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = invoke( - ProtocolServiceRequest.AddVersion( protocol, versionTag ) - ) + override suspend fun addVersion( protocol: StudyProtocolSnapshot, versionTag: String ): Unit = + invoke( ProtocolServiceRequest.AddVersion( protocol, versionTag ) ) override suspend fun updateParticipantDataConfiguration( protocolId: UUID, versionTag: String, expectedParticipantData: Set - ): StudyProtocolSnapshot = invoke( + ) = invoke( ProtocolServiceRequest.UpdateParticipantDataConfiguration( protocolId, versionTag, expectedParticipantData ) ) - override suspend fun getBy( protocolId: UUID, versionTag: String? ): StudyProtocolSnapshot = invoke( - ProtocolServiceRequest.GetBy( protocolId, versionTag ) - ) + override suspend fun getBy( protocolId: UUID, versionTag: String? ) = + invoke( ProtocolServiceRequest.GetBy( protocolId, versionTag ) ) - override suspend fun getAllForOwner( ownerId: UUID ): List = invoke( - ProtocolServiceRequest.GetAllForOwner( ownerId ) - ) + override suspend fun getAllForOwner( ownerId: UUID ) = + invoke( ProtocolServiceRequest.GetAllForOwner( ownerId ) ) - override suspend fun getVersionHistoryFor( protocolId: UUID ): List = invoke( - ProtocolServiceRequest.GetVersionHistoryFor( protocolId ) - ) + override suspend fun getVersionHistoryFor( protocolId: UUID ) = + invoke( ProtocolServiceRequest.GetVersionHistoryFor( protocolId ) ) } diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt index e4b3f4268..e1d601154 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceDecorator.kt @@ -7,8 +7,6 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.studies.application.RecruitmentService import dk.cachet.carp.studies.application.users.AssignedParticipantRoles -import dk.cachet.carp.studies.application.users.Participant -import dk.cachet.carp.studies.application.users.ParticipantGroupStatus class RecruitmentServiceDecorator( @@ -21,32 +19,25 @@ class RecruitmentServiceDecorator( ), RecruitmentService { - override suspend fun addParticipant( studyId: UUID, email: EmailAddress ): Participant = invoke( - RecruitmentServiceRequest.AddParticipant( studyId, email ) - ) + override suspend fun addParticipant( studyId: UUID, email: EmailAddress ) = + invoke( RecruitmentServiceRequest.AddParticipant( studyId, email ) ) - override suspend fun getParticipant( studyId: UUID, participantId: UUID ): Participant = invoke( - RecruitmentServiceRequest.GetParticipant( studyId, participantId ) - ) + override suspend fun getParticipant( studyId: UUID, participantId: UUID ) = + invoke( RecruitmentServiceRequest.GetParticipant( studyId, participantId ) ) - override suspend fun getParticipants( studyId: UUID ): List = invoke( - RecruitmentServiceRequest.GetParticipants( studyId ) - ) + override suspend fun getParticipants( studyId: UUID ) = + invoke( RecruitmentServiceRequest.GetParticipants( studyId ) ) override suspend fun inviteNewParticipantGroup( studyId: UUID, group: Set - ): ParticipantGroupStatus = invoke( - RecruitmentServiceRequest.InviteNewParticipantGroup( studyId, group ) - ) + ) = invoke( RecruitmentServiceRequest.InviteNewParticipantGroup( studyId, group ) ) - override suspend fun getParticipantGroupStatusList( studyId: UUID ): List = invoke( - RecruitmentServiceRequest.GetParticipantGroupStatusList( studyId ) - ) + override suspend fun getParticipantGroupStatusList( studyId: UUID ) = + invoke( RecruitmentServiceRequest.GetParticipantGroupStatusList( studyId ) ) - override suspend fun stopParticipantGroup( studyId: UUID, groupId: UUID ): ParticipantGroupStatus = invoke( - RecruitmentServiceRequest.StopParticipantGroup( studyId, groupId ) - ) + override suspend fun stopParticipantGroup( studyId: UUID, groupId: UUID ) = + invoke( RecruitmentServiceRequest.StopParticipantGroup( studyId, groupId ) ) } diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt index 743a9ec6d..852fcef69 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceDecorator.kt @@ -6,9 +6,7 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceInvoker import dk.cachet.carp.common.infrastructure.services.Command import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.application.StudyProtocolSnapshot -import dk.cachet.carp.studies.application.StudyDetails import dk.cachet.carp.studies.application.StudyService -import dk.cachet.carp.studies.application.StudyStatus @Suppress( "TooManyFunctions" ) @@ -23,49 +21,32 @@ class StudyServiceDecorator( name: String, description: String?, invitation: StudyInvitation? - ): StudyStatus = invoke( - StudyServiceRequest.CreateStudy( ownerId, name, description, invitation ) - ) + ) = invoke( StudyServiceRequest.CreateStudy( ownerId, name, description, invitation ) ) override suspend fun setInternalDescription( studyId: UUID, name: String, description: String? - ): StudyStatus = invoke( - StudyServiceRequest.SetInternalDescription( studyId, name, description ) - ) + ) = invoke( StudyServiceRequest.SetInternalDescription( studyId, name, description ) ) - override suspend fun getStudyDetails( studyId: UUID ): StudyDetails = invoke( - StudyServiceRequest.GetStudyDetails( studyId ) - ) + override suspend fun getStudyDetails( studyId: UUID ) = invoke( StudyServiceRequest.GetStudyDetails( studyId ) ) - override suspend fun getStudyStatus( studyId: UUID ): StudyStatus = invoke( - StudyServiceRequest.GetStudyStatus( studyId ) - ) + override suspend fun getStudyStatus( studyId: UUID ) = invoke( StudyServiceRequest.GetStudyStatus( studyId ) ) - override suspend fun getStudiesOverview( ownerId: UUID ): List = invoke( - StudyServiceRequest.GetStudiesOverview( ownerId ) - ) + override suspend fun getStudiesOverview( ownerId: UUID ) = + invoke( StudyServiceRequest.GetStudiesOverview( ownerId ) ) - override suspend fun setInvitation( studyId: UUID, invitation: StudyInvitation ): StudyStatus = invoke( - StudyServiceRequest.SetInvitation( studyId, invitation ) - ) + override suspend fun setInvitation( studyId: UUID, invitation: StudyInvitation ) = + invoke( StudyServiceRequest.SetInvitation( studyId, invitation ) ) - override suspend fun setProtocol( studyId: UUID, protocol: StudyProtocolSnapshot ): StudyStatus = invoke( - StudyServiceRequest.SetProtocol( studyId, protocol ) - ) + override suspend fun setProtocol( studyId: UUID, protocol: StudyProtocolSnapshot ) = + invoke( StudyServiceRequest.SetProtocol( studyId, protocol ) ) - override suspend fun removeProtocol( studyId: UUID ): StudyStatus = invoke( - StudyServiceRequest.RemoveProtocol( studyId ) - ) + override suspend fun removeProtocol( studyId: UUID ) = invoke( StudyServiceRequest.RemoveProtocol( studyId ) ) - override suspend fun goLive( studyId: UUID ): StudyStatus = invoke( - StudyServiceRequest.GoLive( studyId ) - ) + override suspend fun goLive( studyId: UUID ) = invoke( StudyServiceRequest.GoLive( studyId ) ) - override suspend fun remove( studyId: UUID ): Boolean = invoke( - StudyServiceRequest.Remove( studyId ) - ) + override suspend fun remove( studyId: UUID ) = invoke( StudyServiceRequest.Remove( studyId ) ) } From e35020f708074500d80290e662f7b814103bd3a9 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Fri, 3 Mar 2023 22:42:39 +0100 Subject: [PATCH 15/50] Fix: remove incorrect LoggedRequest event type parameter This generic type parameter was superfluous, and even wrong. Preceding events were never of type `TEvent`, and for published events there was no real guarantee no other events would be captured by `EventBusLog`. Removing the type parameter is more honest, makes the code a bit more readable, and still provides sufficient type safety. --- .../services/ApplicationServiceLogger.kt | 76 +++++++++---------- .../ApplicationServiceRequestLogger.kt | 9 +-- .../services/ApplicationServiceLoggerTest.kt | 4 +- .../application/ApplicationServiceInfo.kt | 2 +- .../carp/rpc/GenerateExampleRequests.kt | 2 +- 5 files changed, 44 insertions(+), 49 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt index 93f1091b0..17454dc62 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLogger.kt @@ -18,11 +18,11 @@ class ApplicationServiceLogger< TEvent : IntegrationEvent > { - private val _loggedRequests: MutableList> = mutableListOf() - val loggedRequests: List> + private val _loggedRequests: MutableList> = mutableListOf() + val loggedRequests: List> get() = _loggedRequests.toList() - fun addLog( loggedRequest: LoggedRequest ) = _loggedRequests.add( loggedRequest ) + fun addLog( loggedRequest: LoggedRequest ) = _loggedRequests.add( loggedRequest ) /** * Determines whether the given [request] is present in [loggedRequests]. @@ -40,31 +40,31 @@ class ApplicationServiceLogger< /** * An intercepted [request] and response to an application service [TService]. */ -sealed interface LoggedRequest, TEvent : IntegrationEvent> +sealed interface LoggedRequest> { val request: ApplicationServiceRequest - val precedingEvents: List - val publishedEvents: List + val precedingEvents: List> + val publishedEvents: List> /** * The intercepted [request] succeeded and returned [response]. */ - data class Succeeded, TEvent : IntegrationEvent>( + data class Succeeded>( override val request: ApplicationServiceRequest, - override val precedingEvents: List, - override val publishedEvents: List, + override val precedingEvents: List>, + override val publishedEvents: List>, val response: Any? - ) : LoggedRequest + ) : LoggedRequest /** * The intercepted [request] failed with an exception of [exceptionType]. */ - data class Failed, TEvent : IntegrationEvent>( + data class Failed>( override val request: ApplicationServiceRequest, - override val precedingEvents: List, - override val publishedEvents: List, + override val precedingEvents: List>, + override val publishedEvents: List>, val exceptionType: String - ) : LoggedRequest + ) : LoggedRequest } @@ -72,7 +72,7 @@ sealed interface LoggedRequest, * Serializer for [LoggedRequest]s of [TService]. */ @OptIn( ExperimentalSerializationApi::class, InternalSerializationApi::class ) -class LoggedRequestSerializer, TEvent : IntegrationEvent>( +class LoggedRequestSerializer>( /** * The request serializer for [TService] which can polymorphically serialize any of its requests. */ @@ -80,14 +80,14 @@ class LoggedRequestSerializer, T /** * A serializer for any of the events that may be received or are published by [TService]. */ - eventSerializer: KSerializer -) : KSerializer> + eventSerializer: KSerializer> +) : KSerializer> { private val eventsSerializer = ListSerializer( eventSerializer ) @Suppress( "MagicNumber" ) private val succeededSerializer = - object : KSerializer> + object : KSerializer> { private val responseSerialDescriptor = buildClassSerialDescriptor( "${LoggedRequestSerializer::class.simpleName!!}\$Response" @@ -96,14 +96,14 @@ class LoggedRequestSerializer, T override val descriptor: SerialDescriptor = buildClassSerialDescriptor( LoggedRequest.Succeeded::class.simpleName!! ) { - element( LoggedRequest<*, *>::request.name, requestSerializer.descriptor ) - element( LoggedRequest<*, *>::precedingEvents.name, eventsSerializer.descriptor ) - element( LoggedRequest<*, *>::publishedEvents.name, eventsSerializer.descriptor ) - element( LoggedRequest.Succeeded<*, *>::response.name, responseSerialDescriptor ) + element( LoggedRequest<*>::request.name, requestSerializer.descriptor ) + element( LoggedRequest<*>::precedingEvents.name, eventsSerializer.descriptor ) + element( LoggedRequest<*>::publishedEvents.name, eventsSerializer.descriptor ) + element( LoggedRequest.Succeeded<*>::response.name, responseSerialDescriptor ) } @Suppress( "UNCHECKED_CAST" ) - override fun serialize( encoder: Encoder, value: LoggedRequest.Succeeded<*, *> ) + override fun serialize( encoder: Encoder, value: LoggedRequest.Succeeded<*> ) { val responseSerializer = value.request.getResponseSerializer() as KSerializer val anyEventsSerializer = eventsSerializer as KSerializer @@ -117,13 +117,12 @@ class LoggedRequestSerializer, T } } - @Suppress( "UNCHECKED_CAST" ) - override fun deserialize( decoder: Decoder ): LoggedRequest.Succeeded<*, *> = + override fun deserialize( decoder: Decoder ): LoggedRequest.Succeeded<*> = decoder.decodeStructure( descriptor ) { var request: ApplicationServiceRequest? = null - var precedingEvents: List? = null - var publishedEvents: List? = null + var precedingEvents: List>? = null + var publishedEvents: List>? = null var response: Any? = null var decoding = true @@ -155,21 +154,21 @@ class LoggedRequestSerializer, T @Suppress( "MagicNumber" ) private val failedSerializer = - object : KSerializer> + object : KSerializer> { private val exceptionSerializer = serializer() override val descriptor: SerialDescriptor = buildClassSerialDescriptor( LoggedRequest.Failed::class.simpleName!! ) { - element( LoggedRequest<*, *>::request.name, requestSerializer.descriptor ) - element( LoggedRequest<*, *>::precedingEvents.name, eventsSerializer.descriptor ) - element( LoggedRequest<*, *>::publishedEvents.name, eventsSerializer.descriptor ) - element( LoggedRequest.Failed<*, *>::exceptionType.name, exceptionSerializer.descriptor ) + element( LoggedRequest<*>::request.name, requestSerializer.descriptor ) + element( LoggedRequest<*>::precedingEvents.name, eventsSerializer.descriptor ) + element( LoggedRequest<*>::publishedEvents.name, eventsSerializer.descriptor ) + element( LoggedRequest.Failed<*>::exceptionType.name, exceptionSerializer.descriptor ) } @Suppress( "UNCHECKED_CAST" ) - override fun serialize( encoder: Encoder, value: LoggedRequest.Failed<*, *> ) + override fun serialize( encoder: Encoder, value: LoggedRequest.Failed<*> ) { val anyEventsSerializer = eventsSerializer as KSerializer @@ -182,13 +181,12 @@ class LoggedRequestSerializer, T } } - @Suppress( "UNCHECKED_CAST" ) - override fun deserialize( decoder: Decoder ): LoggedRequest.Failed<*, *> = + override fun deserialize( decoder: Decoder ): LoggedRequest.Failed<*> = decoder.decodeStructure( descriptor ) { var request: ApplicationServiceRequest? = null - var precedingEvents: List? = null - var publishedEvents: List? = null + var precedingEvents: List>? = null + var publishedEvents: List>? = null var exceptionType: String? = null var decoding = true @@ -228,9 +226,9 @@ class LoggedRequestSerializer, T override val descriptor: SerialDescriptor = sealedSerializer.descriptor - override fun serialize( encoder: Encoder, value: LoggedRequest<*, *> ) = + override fun serialize( encoder: Encoder, value: LoggedRequest<*> ) = encoder.encodeSerializableValue( sealedSerializer, value ) - override fun deserialize( decoder: Decoder ): LoggedRequest<*, *> = + override fun deserialize( decoder: Decoder ): LoggedRequest<*> = decoder.decodeSerializableValue( sealedSerializer ) } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt index 9c21d8ae3..86b33405c 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestLogger.kt @@ -1,7 +1,6 @@ package dk.cachet.carp.common.infrastructure.services import dk.cachet.carp.common.application.services.ApplicationService -import dk.cachet.carp.common.application.services.IntegrationEvent /** @@ -9,19 +8,17 @@ import dk.cachet.carp.common.application.services.IntegrationEvent * as well as events preceding the request and fired as a result of the request. */ class ApplicationServiceRequestLogger< - TService : ApplicationService, - TEvent : IntegrationEvent, + TService : ApplicationService, TRequest : ApplicationServiceRequest >( private val eventBusLog: EventBusLog, - private val log: (LoggedRequest) -> Unit = { }, + private val log: (LoggedRequest) -> Unit = { }, private val decoratee: Command ) : Command { override suspend fun invoke( request: TRequest ): Any? { - @Suppress( "UNCHECKED_CAST" ) - fun getCurrentEvents() = eventBusLog.retrieveAndEmptyLog() as List + fun getCurrentEvents() = eventBusLog.retrieveAndEmptyLog() val precedingEvents = getCurrentEvents() @Suppress( "TooGenericExceptionCaught" ) diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt index df91dc4c7..cb242f415 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceLoggerTest.kt @@ -14,7 +14,7 @@ class ApplicationServiceLoggerTest @Test fun can_serialize_and_deserialize_LoggedRequest_Succeeded() { - val request: LoggedRequest<*, *> = LoggedRequest.Succeeded( + val request: LoggedRequest = LoggedRequest.Succeeded( request = TestServiceRequest.Operation( 42 ), // Preceding events would normally be of different application services. precedingEvents = listOf( TestService.Event.OperationOccurred( 0 ) ), @@ -33,7 +33,7 @@ class ApplicationServiceLoggerTest @Test fun can_serialize_and_deserialize_LoggedRequest_Failed() { - val request: LoggedRequest<*, *> = LoggedRequest.Failed( + val request: LoggedRequest = LoggedRequest.Failed( request = TestServiceRequest.Operation( 10 ), // Preceding events would normally be of different application services. precedingEvents = listOf( TestService.Event.OperationOccurred( 0 ) ), diff --git a/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt b/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt index d7799d44f..adeee2ec8 100644 --- a/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt +++ b/carp.common/src/jvmMain/kotlin/dk/cachet/carp/common/application/ApplicationServiceInfo.kt @@ -104,7 +104,7 @@ class ApplicationServiceInfo private constructor( val serviceKlass: ServiceClass val requestObjectSerializer: KSerializer> val eventSerializer: KSerializer> - val loggedRequestSerializer: KSerializer> + val loggedRequestSerializer: KSerializer> val apiMigrator: ApplicationServiceApiMigrator<*, *> val requestSchemaUri: URI diff --git a/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt b/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt index b8dcb5228..0ffa854bd 100644 --- a/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt +++ b/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt @@ -277,7 +277,7 @@ fun , TResponse> example( response: Any? = Unit ) = LoggedRequest.Succeeded( request, emptyList(), emptyList(), response ) -private val exampleRequests: Map, LoggedRequest.Succeeded<*, *>> = mapOf( +private val exampleRequests: Map, LoggedRequest.Succeeded<*>> = mapOf( // ProtocolService ProtocolService::add to example( request = ProtocolServiceRequest.Add( phoneProtocol, "Version 1" ) From 4e836cf874acda387e3ec06d117f33cf1eef6205 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Mon, 9 Jan 2023 18:30:09 +0100 Subject: [PATCH 16/50] Use JS IR backend; add Kotlin stdlib TypeScript facade All TypeScript declarations and unit tests were removed since they need to be rewritten to match the new JS backend. This is already done for the Kotlin stdlib. But, to make this work on the IR backend, a facade for the Kotlin standard library is included, along with a build setup to hack into the generated Javascript sources to make this work. --- build.gradle | 71 +++- kotlin-js-store/yarn.lock | 5 + publish-npm-packages/build.gradle | 13 + .../src/commonMain/kotlin/KotlinExport.kt | 34 ++ .../forced-exports/kotlin-kotlin-stdlib-js-ir | 5 + settings.gradle.kts | 3 +- .../index.d.ts | 24 -- .../carp.core-kotlin-carp.common/index.d.ts | 365 ------------------ .../index.d.ts | 327 ---------------- .../index.d.ts | 118 ------ .../index.d.ts | 270 ------------- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 33 ++ .../@types/kotlin/index.d.ts | 67 ---- .../index.d.ts | 9 - .../index.d.ts | 11 - typescript-declarations/src/kotlin.ts | 85 ++++ typescript-declarations/tests/VerifyModule.ts | 4 + typescript-declarations/tests/carp.common.ts | 162 -------- .../tests/carp.deployments.core.ts | 84 ---- .../tests/carp.protocols.core.ts | 63 --- .../tests/carp.studies.core.ts | 169 -------- typescript-declarations/tests/kotlin-test.ts | 102 +++++ typescript-declarations/tests/kotlin.ts | 75 ---- .../tests/kotlinx-datetime.ts | 39 -- .../tests/kotlinx-serialization.ts | 24 -- typescript-declarations/tsconfig.json | 1 + 26 files changed, 334 insertions(+), 1829 deletions(-) create mode 100644 publish-npm-packages/build.gradle create mode 100644 publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt create mode 100644 publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir delete mode 100644 typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-legacy/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts create mode 100644 typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts delete mode 100644 typescript-declarations/@types/kotlin/index.d.ts delete mode 100644 typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-legacy/index.d.ts delete mode 100644 typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-legacy/index.d.ts create mode 100644 typescript-declarations/src/kotlin.ts delete mode 100644 typescript-declarations/tests/carp.common.ts delete mode 100644 typescript-declarations/tests/carp.deployments.core.ts delete mode 100644 typescript-declarations/tests/carp.protocols.core.ts delete mode 100644 typescript-declarations/tests/carp.studies.core.ts create mode 100644 typescript-declarations/tests/kotlin-test.ts delete mode 100644 typescript-declarations/tests/kotlin.ts delete mode 100644 typescript-declarations/tests/kotlinx-datetime.ts delete mode 100644 typescript-declarations/tests/kotlinx-serialization.ts diff --git a/build.gradle b/build.gradle index 993a053d2..2f911e535 100644 --- a/build.gradle +++ b/build.gradle @@ -82,8 +82,8 @@ configure( subprojects - devOpsModules ) { useJUnitPlatform() } } - js(LEGACY) { - binaries.executable() + js(IR) { + binaries.executable() // Export JS/TypeScript files. browser() } @@ -114,6 +114,7 @@ configure( subprojects - devOpsModules ) { // We do not mind being early adopters of Jetbrains APIs likely to change in the future. optIn('kotlin.RequiresOptIn') optIn('kotlin.time.ExperimentalTime') + optIn('kotlin.js.ExperimentalJsExport') if (isTestSourceSet) { optIn('kotlinx.coroutines.ExperimentalCoroutinesApi') @@ -234,31 +235,59 @@ task setupTsProject(type: NpmTask) { args = ['install'] } task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { - // Make sure no old imported packages are left behind. - def importedPackages = file("$rootDir/build/js/packages_imported") - if (importedPackages.exists()) importedPackages.eachFile { it.delete() } - - // Compile all subprojects which compile to JS. - // TODO: Can the compiled sources be copied from the tasks of which we want to test the output directly? - // We only need main sources of coreModules and commonModules since these are the only ones tested. - // But, only adding dependencies on those triggers warnings since other outputs exist in `/build//js/packages`. + // Compile production sources for all subprojects that compile to JS. def projects = subprojects - devOpsModules projects.each { def project = it.name - dependsOn("$project:jsBrowserDistribution") - dependsOn("$project:compileTestKotlinJs") + dependsOn("$project:jsProductionExecutableCompileSync") + } + + // Copy compiled JS and TypeScript sources to test project's node_modules. + from("$rootDir/build/js/packages/carp.core-kotlin-publish-npm-packages") { + include "**/*.js" } + from("$rootDir/build/js/packages") { + // Use individually generated TypeScript declarations to exclude publish-npm-packages exports. + include "**/*.d.ts" + includeEmptyDirs = false + } + eachFile { file -> + // Compiled sources have the name of the module they represent, followed by ".js" and ".d.ts". + // To be recognized by node, place them as "index.js" and "index.d.ts" in "node_modules/". + def fileMatch = file.name =~ /(.+)\.(js|d\.ts)/ + def moduleName = fileMatch[0][1] + def extension = fileMatch[0][2] + file.relativePath = new RelativePath(true, moduleName, "index.$extension") + + // Modify sources to act like modules with exported named members. + file.filter { line -> + // Compiled sources refer to other modules as adjacent .js source files. + // Change these to the named modules created in the previous step. + def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'\$1'") - // Copy compiled sources and dependencies to test project node_modules. - from "$rootDir/build/js/packages" - exclude '**/node_modules/**' - from(importedPackages) { - eachFile { - def path = it.path - if (path == ".visited") return // We don't need this file. + // Unscramble generated import/export names. + def fixedExport = namedModules.replaceAll( + ~/(\_\.\$\_\$\.).+? = (.+?);/, + "\$1\$2 = \$2" + ) + def fixedImport = fixedExport.replaceAll( + ~/var (.+?) = (kotlin\_kotlin\.\$\_\$\.)(.+);/, + "var \$1 = \$2\$1;" + ) - // Remove intermediate version directory: e.g. "kotlin/1.5.10/kotlin.js" - it.path = path.replaceFirst(/\d+\.\d+.\d+(-.+)?\//, "") + // By default, only types used across modules are exported for internal use. + // Therefore, add additional configured exports to ensure they are present. + def toExport = [] + def forcedExportsFile = new File("$rootDir/publish-npm-packages/src/forced-exports/$moduleName") + if (forcedExportsFile.exists()) { + forcedExportsFile.eachLine { type -> toExport << type } + } + def toExportList = toExport.collect { "_.\\\$_\\\$.$it = $it\n " } + def additionalExports = fixedImport.replaceAll( + ~/return \_;/, + toExportList.join() + "return _;" + ) + additionalExports } } into "./$typescriptFolder/node_modules" diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index cd304a547..3cd7f20fe 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -2507,6 +2507,11 @@ typescript@3.9.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +typescript@4.7.4: + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== + ua-parser-js@^0.7.30: version "0.7.32" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211" diff --git a/publish-npm-packages/build.gradle b/publish-npm-packages/build.gradle new file mode 100644 index 000000000..ab9e9d351 --- /dev/null +++ b/publish-npm-packages/build.gradle @@ -0,0 +1,13 @@ +kotlin { + sourceSets { + commonMain { + dependencies { + api project(':carp.common') + api project(':carp.data.core') + api project(':carp.deployments.core') + api project(':carp.protocols.core') + api project(':carp.studies.core') + } + } + } +} diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt new file mode 100644 index 000000000..034d4ab8d --- /dev/null +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt @@ -0,0 +1,34 @@ +@file:Suppress( + "MagicNumber", + "NON_EXPORTABLE_TYPE", + "UNUSED_VARIABLE" // The variable names show up in generated JS sources which is useful to look up mangled names. +) + +import kotlin.js.JsExport + +/** + * Refers to types/methods in the kotlin standard library to ensure they aren't removed from compiled sources + * as part of the JS IR backend's compiler optimizations. + * The exported JS sources for this class can also be used to look up mangled method names. + */ +@JsExport +class KotlinExport +{ + private val int = 42 + val toLong = int.toLong() // Needs to be loaded from field to be exported. + + fun long( long: Long ) + { + val toNumber = long.toInt() + } + + fun collection( collection: Collection ) + { + val contains = collection.contains( 42 ) + val size = collection.size + } + + // Two values needed to ensure export which takes an array and unpacks it. + val list = listOf( 42, 42 ) + val set = setOf( 42, 42 ) +} diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir new file mode 100644 index 000000000..e2764f32f --- /dev/null +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -0,0 +1,5 @@ +Long +EmptyList +AbstractMutableList +HashSet +EmptySet \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 6ef1410c6..cd7137c30 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,4 +15,5 @@ include( "carp.data.core" ) include( "carp.studies.core" ) include( "carp.deployments.core" ) include( "carp.clients.core" ) -include( "rpc" ) \ No newline at end of file +include( "rpc" ) +include( "publish-npm-packages" ) diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-legacy/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-legacy/index.d.ts deleted file mode 100644 index 816db8956..000000000 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-legacy/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' -{ - import { Long } from 'kotlin' - - namespace kotlinx.datetime - { - class Clock - { - static get System(): Clock$System - } - interface Clock$System - { - now(): Instant - } - - class Instant - { - static get Companion(): Instant$Companion - - toEpochMilliseconds(): Long - } - interface Instant$Companion { serializer(): any } - } -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts deleted file mode 100644 index d59bdf980..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts +++ /dev/null @@ -1,365 +0,0 @@ -declare module 'carp.core-kotlin-carp.common' -{ - import { kotlin } from 'kotlin' - import HashMap = kotlin.collections.HashMap - import HashSet = kotlin.collections.HashSet - import Duration = kotlin.time.Duration - - import { kotlinx } from 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' - import Json = kotlinx.serialization.json.Json - - import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' - import Instant = kxd.datetime.Instant - - - namespace dk.cachet.carp.common.application - { - class EmailAddress - { - constructor( address: string ) - - static get Companion(): EmailAddress$Companion - - readonly address: string - } - interface EmailAddress$Companion { serializer(): any } - - class NamespacedId - { - constructor( namespace: string, name: string ) - - static get Companion(): NamespacedId$Companion - - readonly namespace: string - readonly name: string - } - interface NamespacedId$Companion { serializer(): any } - - class RecurrenceRule - { - static get Companion(): RecurrenceRule$Companion - - toString(): string - } - interface RecurrenceRule$Companion - { - serializer(): any - fromString_61zpoe$( rrule: string ): RecurrenceRule - } - - class TimeOfDay - { - constructor( hour: number, minutes: number, seconds: number ) - - static get Companion(): TimeOfDay$Companion - } - interface TimeOfDay$Companion { serializer(): any } - - class Trilean - { - static readonly TRUE: Trilean - static readonly FALSE: Trilean - static readonly UNKNOWN: Trilean - static values(): Array - } - function toTrilean_1v8dcc$( bool: boolean ): Trilean - - class UUID - { - constructor( stringRepresentation: string ) - - static get Companion(): UUID$Companion - - readonly stringRepresentation: string - } - interface UUID$Companion - { - serializer(): any; - randomUUID(): UUID; - } - } - - - namespace dk.cachet.carp.common.application.devices - { - abstract class DeviceConfiguration - { - readonly roleName: string - } - - abstract class PrimaryDeviceConfiguration extends DeviceConfiguration - { - readonly isPrimaryDevice_8be2vx$: boolean - } - - abstract class DeviceRegistration - { - static get Companion(): DeviceRegistration$Companion - - readonly deviceId: string - readonly deviceDisplayName: string | null; - readonly registrationCreatedOn: Instant - } - interface DeviceRegistration$Companion { serializer(): any } - - class DefaultDeviceRegistration extends DeviceRegistration - { - constructor( deviceId?: string ) - } - - class Smartphone extends PrimaryDeviceConfiguration - { - constructor( roleName: string, defaultSamplingConfiguration: HashMap ) - } - } - - - namespace dk.cachet.carp.common.application.tasks - { - abstract class TaskConfiguration - { - readonly name: string - readonly description: string | null; - } - - class WebTask extends TaskConfiguration - { - constructor( name: string, measures: any, description: string, url: string ) - - static get Companion(): WebTask$Companion - - readonly url: string - } - interface WebTask$Companion { serializer(): any } - } - - - namespace dk.cachet.carp.common.application.triggers - { - abstract class TriggerConfiguration - { - readonly requiresPrimaryDevice: boolean - readonly sourceDeviceRoleName: string - } - - class ElapsedTimeTrigger extends TriggerConfiguration - { - constructor( sourceDeviceRoleName: string, elapsedTime: Duration ) - - readonly elapsedTime: Duration - - } - - class ManualTrigger extends TriggerConfiguration - { - constructor( sourceDeviceRoleName: string, label: string, description?: string | null ) - - readonly label: string - readonly description: string | null; - } - - class ScheduledTrigger extends TriggerConfiguration - { - constructor( sourceDeviceRoleName: string, time: TimeOfDay, recurrenceRule: RecurrenceRule ) - - readonly time: TimeOfDay - readonly recurrenceRule: RecurrenceRule - } - - class TaskControl - { - constructor( triggerId: number, taskName: string, destinationDeviceRoleName: string, control: number ) - - readonly triggerId: number - readonly taskName: string - readonly destinationDeviceRoleName: string - readonly control: number - } - } - - - namespace dk.cachet.carp.common.application.users - { - import InputElement = dk.cachet.carp.common.application.data.input.elements.InputElement - import InputDataTypeList = dk.cachet.carp.common.application.data.input.InputDataTypeList - - - class Username - { - constructor( name: string ) - - static get Companion(): Username$Companion - - readonly name: string - } - interface Username$Companion { serializer(): any } - - abstract class AccountIdentity - { - static get Factory(): AccountIdentity$Factory - } - interface AccountIdentity$Factory - { - fromEmailAddress_61zpoe$( emailAddress: string ): EmailAccountIdentity; - fromUsername_61zpoe$( username: string ): UsernameAccountIdentity; - } - - class EmailAccountIdentity extends AccountIdentity - { - constructor( emailAddress: EmailAddress ) - - static get Companion(): EmailAccountIdentity$Companion - - readonly emailAddress: EmailAddress - } - function EmailAccountIdentity_init_61zpoe$( emailAddress: string ): EmailAccountIdentity - interface EmailAccountIdentity$Companion { serializer(): any } - - class UsernameAccountIdentity extends AccountIdentity - { - constructor( username: Username ) - - static get Companion(): UsernameAccountIdentity$Companion - - readonly username: Username - } - function UsernameAccountIdentity_init_61zpoe$( username: string ): UsernameAccountIdentity - interface UsernameAccountIdentity$Companion { serializer(): any } - - - abstract class ParticipantAttribute - { - static get Companion(): ParticipantAttribute$Companion - - readonly inputDataType: NamespacedId - - getInputElement_6eo89k$( registeredInputDataTypes: InputDataTypeList ): InputElement - isValidInput_etkzhw$( registeredInputDataTypes: InputDataTypeList, input: any ): boolean - inputToData_etkzhw$( registeredInputDataTypes: InputDataTypeList, input: any ): any - isValidData_bq34fz$( registeredInputDataTypes: InputDataTypeList, data: any ): boolean - dataToInput_bq34fz$( registeredInputDataTypes: InputDataTypeList, data: any ): any - } - interface ParticipantAttribute$Companion { serializer(): any } - - namespace ParticipantAttribute - { - class DefaultParticipantAttribute extends ParticipantAttribute - { - constructor( inputDataType: NamespacedId ) - } - - class CustomParticipantAttribute extends ParticipantAttribute - { - constructor( input: InputElement ) - } - } - - - class ParticipantRole - { - constructor( role: string, isOptional: boolean ) - - static get Companion(): ParticipantRole$Companion - - readonly role: string - readonly isOptional: boolean - } - interface ParticipantRole$Companion { serializer(): any } - - - class ExpectedParticipantData - { - constructor( attribute: ParticipantAttribute, assignedTo?: AssignedTo ) - - static get Companion(): ExpectedParticipantData$Companion - - readonly attribute: ParticipantAttribute - } - interface ExpectedParticipantData$Companion { serializer(): any } - - - abstract class AssignedTo - { - static get Companion(): AssignedTo$Companion - static get All(): any - } - interface AssignedTo$Companion { serializer(): any } - - namespace AssignedTo - { - class Roles extends AssignedTo - { - constructor( roleNames: HashSet ) - } - } - } - - - namespace dk.cachet.carp.common.application.data.input - { - // No need to initialize this from TypeScript right now. Access to `CarpInputDataTypes` is sufficient. - class InputDataTypeList { constructor() } - const CarpInputDataTypes: InputDataTypeList - } - - namespace dk.cachet.carp.common.application.data.input.elements - { - interface InputElement - { - readonly prompt: string - - isValid_trkh7z$( input: any ): boolean - } - - class Text implements InputElement - { - constructor( name: string ) - - static get Companion(): Text$Companion - - readonly prompt: string - isValid_trkh7z$( input: any ): boolean - } - interface Text$Companion { serializer(): any } - - class SelectOne implements InputElement - { - constructor( name: string, options: HashSet ) - - static get Companion(): SelectOne$Companion - - readonly prompt: string - readonly options: HashSet - isValid_trkh7z$( input: any ): boolean - } - interface SelectOne$Companion { serializer(): any } - } - - - namespace dk.cachet.carp.common.infrastructure.serialization - { - function createDefaultJSON_18xi4u$(): Json - } - - - namespace dk.cachet.carp.common.application.services - { - class ApiVersion - { - constructor( major: number, minor: number ) - - readonly major: number - readonly minor: number - } - } - - namespace dk.cachet.carp.common.infrastructure.services - { - import ApiVersion = dk.cachet.carp.common.application.services.ApiVersion - - interface ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - } - } -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts deleted file mode 100644 index 676c785bf..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts +++ /dev/null @@ -1,327 +0,0 @@ -declare module 'carp.core-kotlin-carp.deployments.core' -{ - import { kotlin } from 'kotlin' - import ArrayList = kotlin.collections.ArrayList - import HashMap = kotlin.collections.HashMap - import HashSet = kotlin.collections.HashSet - - import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' - import Instant = kxd.datetime.Instant - - import { dk as cdk } from 'carp.core-kotlin-carp.common' - import NamespacedId = cdk.cachet.carp.common.application.NamespacedId - import UUID = cdk.cachet.carp.common.application.UUID - import DeviceRegistration = cdk.cachet.carp.common.application.devices.DeviceRegistration - import AccountIdentity = cdk.cachet.carp.common.application.users.AccountIdentity - import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo - import ExpectedParticipantData = cdk.cachet.carp.common.application.users.ExpectedParticipantData - import ApplicationServiceRequest = cdk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest - import ApiVersion = cdk.cachet.carp.common.application.services.ApiVersion - - import { dk as pdk } from 'carp.core-kotlin-carp.protocols.core' - import StudyProtocolSnapshot = pdk.cachet.carp.protocols.application.StudyProtocolSnapshot - - - namespace dk.cachet.carp.deployments.application - { - import ParticipantStatus = dk.cachet.carp.deployments.application.users.ParticipantStatus - - - abstract class DeviceDeploymentStatus - { - readonly device: any - readonly canBeDeployed: boolean - readonly canObtainDeviceDeployment: boolean - - static get Companion(): DeviceDeploymentStatus$Companion - } - interface DeviceDeploymentStatus$Companion { serializer(): any } - - namespace DeviceDeploymentStatus - { - abstract class NotDeployed extends DeviceDeploymentStatus - { - readonly isReadyForDeployment: boolean - readonly remainingDevicesToRegisterToObtainDeployment: HashSet - readonly remainingDevicesToRegisterBeforeDeployment: HashSet - - } - class Unregistered extends NotDeployed - { - constructor( - device: any, - canBeDeployed: boolean, - remainingDevicesToRegisterToObtainDeployment: HashSet, - remainingDevicesToRegisterBeforeDeployment: HashSet ) - } - class Registered extends NotDeployed - { - constructor( - device: any, - canBeDeployed: boolean, - remainingDevicesToRegisterToObtainDeployment: HashSet, - remainingDevicesToRegisterBeforeDeployment: HashSet ) - } - class Deployed extends DeviceDeploymentStatus - { - constructor( device: any ) - } - class NeedsRedeployment extends NotDeployed - { - constructor( - device: any, - remainingDevicesToRegisterToObtainDeployment: HashSet, - remainingDevicesToRegisterBeforeDeployment: HashSet ) - } - } - - - class PrimaryDeviceDeployment - { - constructor( - deviceConfiguration: any, - registration: DeviceRegistration, - connectedDevices?: HashSet, - connectedDeviceConfigurations?: HashMap, - tasks?: HashSet, - triggers?: HashMap, - taskControls?: HashSet, - expectedParticipantData?: HashSet, - applicationData?: string | null ) - - static get Companion(): PrimaryDeviceDeployment$Companion - - readonly deviceConfiguration: any - readonly registration: DeviceRegistration - readonly connectedDevices: HashSet - readonly connectedDeviceRegistrations: HashMap - readonly tasks: HashSet - readonly triggers: HashMap - readonly taskControls: HashSet - readonly expectedParticipantData: HashSet - readonly applicationData: string | null - } - interface PrimaryDeviceDeployment$Companion { serializer(): any } - - - abstract class StudyDeploymentStatus - { - readonly createdOn: Instant - readonly studyDeploymentId: UUID - readonly deviceStatusList: ArrayList - readonly participantStatusList: ArrayList - readonly startedOn: Instant | null - - static get Companion(): StudyDeploymentStatus$Companion - } - interface StudyDeploymentStatus$Companion { serializer(): any } - - namespace StudyDeploymentStatus - { - class Invited extends StudyDeploymentStatus - { - constructor( createdOn: Instant, studyDeploymentId: UUID, deviceStatusList: ArrayList, participantStatusList: ArrayList, startedOn: Instant | null ) - } - class DeployingDevices extends StudyDeploymentStatus - { - constructor( createdOn: Instant, studyDeploymentId: UUID, deviceStatusList: ArrayList, participantStatusList: ArrayList, startedOn: Instant | null ) - } - class Running extends StudyDeploymentStatus - { - constructor( createdOn: Instant, studyDeploymentId: UUID, deviceStatusList: ArrayList, participantStatusList: ArrayList, startedOn: Instant ) - } - class Stopped extends StudyDeploymentStatus - { - constructor( createdOn: Instant, studyDeploymentId: UUID, deviceStatusList: ArrayList, participantStatusList: ArrayList, startedOn: Instant | null, stoppedOn: Instant ) - - readonly stoppedOn: Instant - } - } - } - - - namespace dk.cachet.carp.deployments.application.users - { - import RoleData = dk.cachet.carp.deployments.application.users.ParticipantData.RoleData - - - class ActiveParticipationInvitation - { - constructor( participation: Participation, invitation: StudyInvitation, assignedDevices: HashSet ) - - static get Companion(): ActiveParticipationInvitation$Companion - - readonly participation: Participation - readonly invitation: StudyInvitation - readonly assignedDevices: HashSet - } - interface ActiveParticipationInvitation$Companion { serializer(): any } - - class AssignedPrimaryDevice - { - constructor( device: any, registration: DeviceRegistration | null ) - - static get Companion(): AssignedPrimaryDevice$Companion - - readonly device: any - readonly registration: DeviceRegistration | null - } - interface AssignedPrimaryDevice$Companion { serializer(): any } - - class Participation - { - constructor( studyDeploymentId: UUID, assignedRoles?: AssignedTo, participantId?: UUID ) - - static get Companion(): Participation$Companion - - readonly studyDeploymentId: UUID - readonly assignedRoles: AssignedTo - readonly participantId: UUID - } - interface Participation$Companion { serializer(): any } - - class ParticipantData - { - constructor( studyDeploymentId: UUID, common: HashMap, roles: ArrayList ) - - static get Companion(): ParticipantData$Companion - - readonly studyDeploymentId: UUID - readonly common: HashMap - readonly roles: ArrayList - } - interface ParticipantData$Companion { serializer(): any } - - namespace ParticipantData - { - class RoleData - { - constructor( roleName: string, data: HashMap ) - - static get Companion(): ParticipantData$RoleData$Companion - - readonly roleName: string - readonly data: HashMap - } - interface ParticipantData$RoleData$Companion { serializer(): any } - } - - class ParticipantInvitation - { - constructor( participantId: UUID, assignedRoles: AssignedTo, identity: AccountIdentity, invitation: StudyInvitation ) - - readonly participantId: UUID - readonly assignedRoles: AssignedTo - readonly identity: AccountIdentity - readonly invitation: StudyInvitation - - static get Companion(): ParticipantInvitation$Companion - } - interface ParticipantInvitation$Companion { serializer(): any } - - class ParticipantStatus - { - constructor( participantId: UUID, assignedParticipantRoles: AssignedTo, assignedPrimaryDeviceRoleNames: HashSet ) - - readonly participantId: UUID - readonly assignedParticipantRoles: AssignedTo - readonly assignedPrimaryDeviceRoleNames: HashSet - - static get Companion(): ParticipantStatus$Companion - } - interface ParticipantStatus$Companion { serializer(): any } - - class StudyInvitation - { - constructor( name: string, description?: string | null, applicationData?: string | null ) - - static get Companion(): StudyInvitation$Companion - - readonly name: string - readonly description: string | null - readonly applicationData: string | null - } - interface StudyInvitation$Companion - { - serializer(): any; - } - } - - - namespace dk.cachet.carp.deployments.infrastructure - { - import ParticipantInvitation = dk.cachet.carp.deployments.application.users.ParticipantInvitation - - - abstract class DeploymentServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace DeploymentServiceRequest - { - class CreateStudyDeployment extends DeploymentServiceRequest - { - constructor( protocol: StudyProtocolSnapshot, invitations: ArrayList, connectedDevicePreregistrations?: HashMap ) - } - class GetStudyDeploymentStatus extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID ) - } - class GetStudyDeploymentStatusList extends DeploymentServiceRequest - { - constructor( studyDeploymentIds: HashSet ) - } - class RegisterDevice extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID, deviceRoleName: string, registration: DeviceRegistration ) - } - class UnregisterDevice extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID, deviceRoleName: string ) - } - class GetDeviceDeploymentFor extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID, primaryDeviceRoleName: string ) - } - class DeviceDeployed extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID, primaryDeviceRoleName: string, deviceDeploymentLastUpdatedOn: Instant ) - } - class Stop extends DeploymentServiceRequest - { - constructor( studyDeploymentId: UUID ) - } - } - - - abstract class ParticipationServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace ParticipationServiceRequest - { - class GetActiveParticipationInvitations extends ParticipationServiceRequest - { - constructor( accountId: UUID ) - } - class GetParticipantData extends ParticipationServiceRequest - { - constructor( studyDeploymentId: UUID ) - } - class GetParticipantDataList extends ParticipationServiceRequest - { - constructor( studyDeploymentIds: HashSet ) - } - class SetParticipantData extends ParticipationServiceRequest - { - constructor( studyDeploymentId: UUID, data: HashMap, inputByParticipantRole?: string | null ) - } - } - } -} \ No newline at end of file diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts deleted file mode 100644 index ef7d94650..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -declare module 'carp.core-kotlin-carp.protocols.core' -{ - import { kotlin } from 'kotlin' - import HashSet = kotlin.collections.HashSet - import HashMap = kotlin.collections.HashMap - - import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' - import Instant = kxd.datetime.Instant - - import { dk as cdk } from 'carp.core-kotlin-carp.common' - import UUID = cdk.cachet.carp.common.application.UUID - import DeviceConfiguration = cdk.cachet.carp.common.application.devices.DeviceConfiguration - import ParticipantAttribute = cdk.cachet.carp.common.application.users.ParticipantAttribute - import ParticipantRole = cdk.cachet.carp.common.application.users.ParticipantRole - import ExpectedParticipantData = cdk.cachet.carp.common.application.users.ExpectedParticipantData - import TaskConfiguration = cdk.cachet.carp.common.application.tasks.TaskConfiguration - import TaskControl = cdk.cachet.carp.common.application.triggers.TaskControl - import TriggerConfiguration = cdk.cachet.carp.common.application.triggers.TriggerConfiguration - import ApplicationServiceRequest = cdk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest - import ApiVersion = cdk.cachet.carp.common.application.services.ApiVersion - - - namespace dk.cachet.carp.protocols.application - { - class ProtocolVersion - { - constructor( tag: string, date?: Instant ) - - static get Companion(): ProtocolVersion$Companion - - readonly tag: string - readonly date: Instant - } - interface ProtocolVersion$Companion { serializer(): any } - - - class StudyProtocolSnapshot - { - // No manual initialization needed in TypeScript. Serialization should be used. - private constructor() - - static get Companion(): StudyProtocolSnapshot$Companion - - readonly id: UUID - readonly createdOn: Instant - readonly version: number - readonly ownerId: UUID - readonly name: string - readonly description: string - readonly primaryDevices: HashSet - readonly tasks: HashSet - readonly triggers: HashMap - readonly taskControls: Set - readonly participantRoles: Set - readonly assignedDevices: HashMap> - readonly expectedParticipantData: HashSet - } - interface StudyProtocolSnapshot$Companion { serializer(): any } - } - - - namespace dk.cachet.carp.protocols.infrastructure - { - import StudyProtocolSnapshot = dk.cachet.carp.protocols.application.StudyProtocolSnapshot - - - abstract class ProtocolServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace ProtocolServiceRequest - { - class Add extends ProtocolServiceRequest - { - constructor( protocol: StudyProtocolSnapshot, versionTag?: string ) - } - class AddVersion extends ProtocolServiceRequest - { - constructor( protocol: StudyProtocolSnapshot, versionTag?: string ) - } - class UpdateParticipantDataConfiguration extends ProtocolServiceRequest - { - constructor( protocolId: UUID, versionTag: string, expectedParticipantData: HashSet ) - } - class GetBy extends ProtocolServiceRequest - { - constructor( protocolId: UUID, versionTag?: string ) - } - class GetAllForOwner extends ProtocolServiceRequest - { - constructor( ownerId: UUID ) - } - class GetVersionHistoryFor extends ProtocolServiceRequest - { - constructor( protocolId: UUID ) - } - } - - - abstract class ProtocolFactoryServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace ProtocolFactoryServiceRequest - { - class CreateCustomProtocol extends ProtocolFactoryServiceRequest - { - constructor( ownerId: UUID, name: string, customProtocol: string, description?: string | null ) - } - } - } -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts deleted file mode 100644 index 7b2019dd2..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts +++ /dev/null @@ -1,270 +0,0 @@ -declare module 'carp.core-kotlin-carp.studies.core' -{ - import { kotlin } from 'kotlin' - import ArrayList = kotlin.collections.ArrayList - import HashSet = kotlin.collections.HashSet - - import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' - import Instant = kxd.datetime.Instant - - import { dk as cdk } from 'carp.core-kotlin-carp.common' - import EmailAddress = cdk.cachet.carp.common.application.EmailAddress - import UUID = cdk.cachet.carp.common.application.UUID - import AccountIdentity = cdk.cachet.carp.common.application.users.AccountIdentity - import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo - import ApplicationServiceRequest = cdk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest - import ApiVersion = cdk.cachet.carp.common.application.services.ApiVersion - - import { dk as ddk } from 'carp.core-kotlin-carp.deployments.core' - import StudyDeploymentStatus = ddk.cachet.carp.deployments.application.StudyDeploymentStatus - import StudyInvitation = ddk.cachet.carp.deployments.application.users.StudyInvitation - - import { dk as pdk } from 'carp.core-kotlin-carp.protocols.core' - import StudyProtocolSnapshot = pdk.cachet.carp.protocols.application.StudyProtocolSnapshot - - - namespace dk.cachet.carp.studies.application - { - class StudyDetails - { - constructor( - studyId: UUID, ownerId: UUID, name: string, createdOn: Instant, - description: string | null, - invitation: StudyInvitation, - protocolSnapshot: StudyProtocolSnapshot | null ) - - static get Companion(): StudyDetails$Companion - - readonly studyId: UUID - readonly ownerId: UUID - readonly name: string - readonly createdOn: Instant - readonly description: string | null - readonly invitation: StudyInvitation - readonly protocolSnapshot: StudyProtocolSnapshot | null - } - interface StudyDetails$Companion { serializer(): any } - - - abstract class StudyStatus - { - readonly studyId: UUID - readonly name: string - readonly createdOn: Instant - readonly studyProtocolId: UUID | null - readonly canSetInvitation: boolean - readonly canSetStudyProtocol: boolean - readonly canDeployToParticipants: boolean - - static get Companion(): StudyStatus$Companion - } - interface StudyStatus$Companion { serializer(): any } - - namespace StudyStatus - { - class Configuring extends StudyStatus - { - constructor( - studyId: UUID, - name: string, - createdOn: Instant, - studyProtocolId: UUID | null, - canSetInvitation: boolean, - canSetStudyProtocol: boolean, - canDeployToParticipants: boolean, - canGoLive: boolean ) - - readonly canGoLive: boolean - } - class Live extends StudyStatus - { - constructor( - studyId: UUID, - name: string, - createdOn: Instant, - studyProtocolId: UUID | null, - canSetInvitation: boolean, - canSetStudyProtocol: boolean, - canDeployToParticipants: boolean ) - } - } - } - - - namespace dk.cachet.carp.studies.application.users - { - class AssignedParticipantRoles - { - constructor( participantId: UUID, assignedRoles: AssignedTo ) - - static get Companion(): AssignedParticipantRoles$Companion - - readonly participantId: UUID - readonly assignedRoles: AssignedTo - } - function participantIds_skpkn2$( assignedGroup: ArrayList ): HashSet - function participantRoles_skpkn2$( assignedGroup: ArrayList ): HashSet - interface AssignedParticipantRoles$Companion { serializer(): any } - - - class Participant - { - constructor( accountIdentity: AccountIdentity, id?: UUID ) - - static get Companion(): Participant$Companion - - readonly accountIdentity: AccountIdentity - readonly id: UUID - } - interface Participant$Companion { serializer(): any } - - - abstract class ParticipantGroupStatus - { - static get Companion(): ParticipantGroupStatus$Companion - - readonly id: UUID - readonly participants: HashSet - } - interface ParticipantGroupStatus$Companion { serializer(): any } - - namespace ParticipantGroupStatus - { - class Staged extends ParticipantGroupStatus - { - constructor( id: UUID, participants: HashSet ) - } - abstract class InDeployment extends ParticipantGroupStatus - { - readonly invitedOn: Instant - readonly studyDeploymentStatus: StudyDeploymentStatus - } - class Invited extends InDeployment - { - constructor( - id: UUID, - participants: HashSet, - invitedOn: Instant, - studyDeploymentStatus: StudyDeploymentStatus ) - } - class Running extends InDeployment - { - constructor( - id: UUID, - participants: HashSet, - invitedOn: Instant, - studyDeploymentStatus: StudyDeploymentStatus, - startedOn: Instant ) - - readonly startedOn: Instant - } - class Stopped extends InDeployment - { - constructor( - id: UUID, - participants: HashSet, - invitedOn: Instant, - studyDeploymentStatus: StudyDeploymentStatus, - startedOn: Instant | null, - stoppedOn: Instant ) - - readonly startedOn: Instant | null - readonly stoppedOn: Instant - } - } - } - - - namespace dk.cachet.carp.studies.infrastructure - { - import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles - - - abstract class StudyServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace StudyServiceRequest - { - class CreateStudy extends StudyServiceRequest - { - constructor( ownerId: UUID, name: string, description?: string | null, invitation?: StudyInvitation | null ) - } - class SetInternalDescription extends StudyServiceRequest - { - constructor( studyId: UUID, name: string, description: string | null ) - } - class GetStudyDetails extends StudyServiceRequest - { - constructor( studyId: UUID ) - } - class GetStudyStatus extends StudyServiceRequest - { - constructor( studyId: UUID ) - } - class GetStudiesOverview extends StudyServiceRequest - { - constructor( ownerId: UUID ) - } - class SetInvitation extends StudyServiceRequest - { - constructor( studyId: UUID, invitation: StudyInvitation ) - } - class SetProtocol extends StudyServiceRequest - { - constructor( studyId: UUID, protocol: StudyProtocolSnapshot ) - } - class RemoveProtocol extends StudyServiceRequest - { - constructor( studyId: UUID ) - } - class GoLive extends StudyServiceRequest - { - constructor( studyId: UUID ) - } - class Remove extends StudyServiceRequest - { - constructor( studyId: UUID ) - } - } - - - abstract class RecruitmentServiceRequest implements ApplicationServiceRequest - { - readonly apiVersion: ApiVersion - - static get Serializer(): any - } - - namespace RecruitmentServiceRequest - { - class AddParticipant extends RecruitmentServiceRequest - { - constructor( studyId: UUID, email: EmailAddress ) - } - class GetParticipant extends RecruitmentServiceRequest - { - constructor( studyId: UUID, participantId: UUID ) - } - class GetParticipants extends RecruitmentServiceRequest - { - constructor( studyId: UUID ) - } - class InviteNewParticipantGroup extends RecruitmentServiceRequest - { - constructor( studyId: UUID, group: HashSet ) - } - class GetParticipantGroupStatusList extends RecruitmentServiceRequest - { - constructor( studyId: UUID ) - } - class StopParticipantGroup extends RecruitmentServiceRequest - { - constructor( studyId: UUID, groupId: UUID ) - } - } - } -} diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts new file mode 100644 index 000000000..1e34ae79b --- /dev/null +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -0,0 +1,33 @@ +declare module "kotlin-kotlin-stdlib-js-ir" +{ + namespace $_$ + { + interface Long + { + // toNumber + x4(): number + } + function toLong( number: number ): Long + + interface Collection + { + // contains + g( value: T ): boolean + + // size + f(): number + + toArray(): Array + } + + interface List extends Collection {} + interface EmptyList extends List {} + interface AbstractMutableList extends List {} + function listOf( elements: T[] ): List + + interface Set extends Collection {} + interface EmptySet extends Set {} + interface HashSet extends Set {} + function setOf( elements: T[] ): Set + } +} diff --git a/typescript-declarations/@types/kotlin/index.d.ts b/typescript-declarations/@types/kotlin/index.d.ts deleted file mode 100644 index 4fce61af7..000000000 --- a/typescript-declarations/@types/kotlin/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -declare module 'kotlin' -{ - class Long - { - static fromNumber( value: number ): Long - - toNumber(): number - } - - - namespace kotlin - { - class Pair - { - constructor( first: TFirst, second: TSecond ) - - readonly first: TFirst - readonly second: TSecond - } - } - - - namespace kotlin.collections - { - import Pair = kotlin.Pair - - - class AbstractCollection - { - toArray(): T[] - } - - class ArrayList extends AbstractCollection - { - constructor( array: T[] ) - - readonly size: number - - get_za3lpa$( index: number ): T - } - function toList_us0mfu$( array: T[] ): ArrayList - - class HashSet extends AbstractCollection - { - contains_11rb$( element: T ): boolean - } - function toSet_us0mfu$( array: T[] ): HashSet - - class HashMap {} - function toMap_v2dak7$( pairs: Pair[] ): HashMap - } - - - namespace kotlin.time - { - class Duration - { - static get Companion(): Duration$Companion - } - interface Duration$Companion - { - readonly ZERO: Duration - readonly INFINITE: Duration - readonly NEG_INFINITE_8be2vx$: Duration - } - } -} diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-legacy/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-legacy/index.d.ts deleted file mode 100644 index ff8e60b90..000000000 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-legacy/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare module 'kotlinx-serialization-kotlinx-serialization-core-js-legacy' -{ - namespace kotlinx.serialization.builtins - { - function ListSerializer_swdriu$( serializer: any ): any - function SetSerializer_swdriu$( serializer: any ): any - function MapSerializer_2yqygg$( serializer: any ): any - } -} diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-legacy/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-legacy/index.d.ts deleted file mode 100644 index 3cd154d7b..000000000 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-legacy/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare module 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' -{ - namespace kotlinx.serialization.json - { - class Json - { - encodeToString_tf03ej$( serializer: any, obj: any ): string - decodeFromString_awif5v$( deserializer: any, string: string ): any - } - } -} diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts new file mode 100644 index 000000000..32107d2c4 --- /dev/null +++ b/typescript-declarations/src/kotlin.ts @@ -0,0 +1,85 @@ +import * as kotlinStdLib from "kotlin-kotlin-stdlib-js-ir" + + +declare module "kotlin-kotlin-stdlib-js-ir" +{ + // Base interfaces with better method names for internal types. + namespace kotlin + { + interface Long + { + toNumber(): number + } + } + namespace kotlin.collections + { + interface Collection + { + contains( value: T ): boolean + size(): number + toArray(): Array + } + interface List extends Collection {} + interface Set extends Collection {} + } + + // Augment internal types to implement desired base interfaces. + namespace $_$ + { + abstract class Long implements kotlin.Long + { + toNumber(): number + } + interface Collection extends kotlin.collections.Collection {} + interface List extends kotlin.collections.List {} + abstract class EmptyList implements kotlin.collections.List + { + contains( value: T ): boolean + size(): number + } + abstract class AbstractMutableList implements kotlin.collections.List + { + contains( value: T ): boolean + size(): number + } + interface Set extends kotlin.collections.Set {} + abstract class EmptySet implements kotlin.collections.Set + { + contains( value: T ): boolean + size(): number + } + abstract class HashSet implements kotlin.collections.Set + { + contains( value: T ): boolean + size(): number + } + } +} + +// Implement base interfaces in internal types. +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.x4(); }; +kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } +kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } +kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } +kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.g( value ); } +kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.f(); } +kotlinStdLib.$_$.EmptySet.prototype.contains = function( value: T ): boolean { return false; } +kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } +kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } +kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.g( value ); } +kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } + +// Export facade. +export namespace kotlin +{ + export type Long = kotlinStdLib.kotlin.Long + export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong +} +export namespace kotlin.collections +{ + export type Collection = kotlinStdLib.kotlin.collections.Collection + export type List = kotlinStdLib.kotlin.collections.List + export const listOf: (array: T[]) => List = kotlinStdLib.$_$.listOf + export type Set = kotlinStdLib.kotlin.collections.Set + export const setOf: (array: T[]) => Set = kotlinStdLib.$_$.setOf +} diff --git a/typescript-declarations/tests/VerifyModule.ts b/typescript-declarations/tests/VerifyModule.ts index c8f6c02b5..f3a73d405 100644 --- a/typescript-declarations/tests/VerifyModule.ts +++ b/typescript-declarations/tests/VerifyModule.ts @@ -84,6 +84,10 @@ export default class VerifyModule case AST_NODE_TYPES.TSImportEqualsDeclaration: // Skip. break; + case AST_NODE_TYPES.ExportNamedDeclaration: + case AST_NODE_TYPES.TSTypeAliasDeclaration: + // These are newly exported types and type aliases in TypeScript that aren't present in JS. + break; default: throw( Error( `verifyStatement: Verifying valid declaration of '${statement.type}' is not implemented.` ) ) } diff --git a/typescript-declarations/tests/carp.common.ts b/typescript-declarations/tests/carp.common.ts deleted file mode 100644 index a856ed523..000000000 --- a/typescript-declarations/tests/carp.common.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { expect } from 'chai' -import VerifyModule from './VerifyModule' - -import { kotlin } from 'kotlin' -import toSet = kotlin.collections.toSet_us0mfu$; -import Duration = kotlin.time.Duration; - -import { kotlinx } from 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' -import Json = kotlinx.serialization.json.Json - -import { dk } from 'carp.core-kotlin-carp.common' -import EmailAddress = dk.cachet.carp.common.application.EmailAddress; -import NamespacedId = dk.cachet.carp.common.application.NamespacedId; -import RecurrenceRule = dk.cachet.carp.common.application.RecurrenceRule; -import TimeOfDay = dk.cachet.carp.common.application.TimeOfDay; -import Trilean = dk.cachet.carp.common.application.Trilean; -import UUID = dk.cachet.carp.common.application.UUID; -import toTrilean = dk.cachet.carp.common.application.toTrilean_1v8dcc$; -import DefaultDeviceRegistration = dk.cachet.carp.common.application.devices.DefaultDeviceRegistration; -import DeviceRegistration = dk.cachet.carp.common.application.devices.DeviceRegistration; -import Smartphone = dk.cachet.carp.common.application.devices.Smartphone; -import WebTask = dk.cachet.carp.common.application.tasks.WebTask; -import ElapsedTimeTrigger = dk.cachet.carp.common.application.triggers.ElapsedTimeTrigger; -import ManualTrigger = dk.cachet.carp.common.application.triggers.ManualTrigger; -import ScheduledTrigger = dk.cachet.carp.common.application.triggers.ScheduledTrigger; -import TaskControl = dk.cachet.carp.common.application.triggers.TaskControl; -import CarpInputDataTypes = dk.cachet.carp.common.application.data.input.CarpInputDataTypes; -import SelectOne = dk.cachet.carp.common.application.data.input.elements.SelectOne; -import Text = dk.cachet.carp.common.application.data.input.elements.Text; -import AccountIdentity = dk.cachet.carp.common.application.users.AccountIdentity; -import EmailAccountIdentity = dk.cachet.carp.common.application.users.EmailAccountIdentity; -import ParticipantAttribute = dk.cachet.carp.common.application.users.ParticipantAttribute; -import ParticipantRole = dk.cachet.carp.common.application.users.ParticipantRole -import ExpectedParticipantData = dk.cachet.carp.common.application.users.ExpectedParticipantData -import AssignedTo = dk.cachet.carp.common.application.users.AssignedTo -import Roles = dk.cachet.carp.common.application.users.AssignedTo.Roles -import Username = dk.cachet.carp.common.application.users.Username; -import UsernameAccountIdentity = dk.cachet.carp.common.application.users.UsernameAccountIdentity; -import emailAccountIdentityFromString = dk.cachet.carp.common.application.users.EmailAccountIdentity_init_61zpoe$; -import ApiVersion = dk.cachet.carp.common.application.services.ApiVersion -import createDefaultJSON = dk.cachet.carp.common.infrastructure.serialization.createDefaultJSON_18xi4u$ - -import { dk as ddk } from 'carp.core-kotlin-carp.deployments.core' -import DeploymentServiceRequest = ddk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest - - -describe( "carp.common", () => { - it( "verify module declarations", async () => { - const username = new Username( "Test" ) - const smartphone = new Smartphone( "Role", toSet( [] ) ) - - const instances = [ - new EmailAddress( "test@test.com" ), - EmailAddress.Companion, - new NamespacedId( "namespace", "type" ), - NamespacedId.Companion, - RecurrenceRule.Companion.fromString_61zpoe$( "RRULE:FREQ=WEEKLY;COUNT=10" ), - RecurrenceRule.Companion, - TimeOfDay.Companion, - UUID.Companion.randomUUID(), - UUID.Companion, - [ "InputElement", new Text( "How are you feeling?" ) ], - new SelectOne( "Sex", toSet( [ "Male", "Female" ] ) ), - SelectOne.Companion, - new Text( "How are you feeling?" ), - Text.Companion, - [ "DeviceConfiguration", smartphone ], - [ "PrimaryDeviceConfiguration", smartphone ], - [ "DeviceRegistration", new DefaultDeviceRegistration() ], - DeviceRegistration.Companion, - [ "TaskConfiguration", new WebTask( "name", undefined, "", "url.com" ) ], - new WebTask( "name", undefined, "", "url.com" ), - WebTask.Companion, - [ "TriggerConfiguration", new ElapsedTimeTrigger( "device", Duration.Companion.INFINITE ) ], - new ElapsedTimeTrigger( "device", Duration.Companion.INFINITE ), - new ManualTrigger( "device", "manual", "" ), - new ScheduledTrigger( - "device", - new TimeOfDay( 10, 10, 10 ), - RecurrenceRule.Companion.fromString_61zpoe$( "RRULE:FREQ=WEEKLY;COUNT=10" ) - ), - new TaskControl( 1, "name", "destination", 1 ), - AccountIdentity.Factory, - new EmailAccountIdentity( new EmailAddress( "test@test.com" ) ), - EmailAccountIdentity.Companion, - username, - Username.Companion, - new UsernameAccountIdentity( username ), - UsernameAccountIdentity.Companion, - [ "ParticipantAttribute", new ParticipantAttribute.DefaultParticipantAttribute( new NamespacedId( "namespace", "type" ) ) ], - ParticipantAttribute.Companion, - new ParticipantRole( "Role", false ), - ParticipantRole.Companion, - new ExpectedParticipantData( new ParticipantAttribute.DefaultParticipantAttribute( new NamespacedId( "namespace", "type" ) ) ), - ExpectedParticipantData.Companion, - AssignedTo.Companion, - AssignedTo.All, - new ApiVersion( 1, 0 ), - [ "ApplicationServiceRequest", new DeploymentServiceRequest.GetStudyDeploymentStatus( UUID.Companion.randomUUID() ) ] - ] - - const moduleVerifier = new VerifyModule( 'carp.core-kotlin-carp.common', instances ) - await moduleVerifier.verify() - } ) - - - describe( "Trilean", () => { - it( "has values TRUE, FALSE, UNKNOWN", () => { - const values = Trilean.values() - expect( values ).to.have.members( [ Trilean.TRUE, Trilean.FALSE, Trilean.UNKNOWN ] ) - } ) - - it ( "toTrilean works", () => { - expect( toTrilean( true ) ).equals( Trilean.TRUE ) - expect( toTrilean( false ) ).equals( Trilean.FALSE ) - } ) - } ) - - - describe( "EmailAccountIdentity", () => { - it( "can initialize from string", () => { - const identity = emailAccountIdentityFromString( "test@test.com" ) - expect( identity.emailAddress ).instanceOf( EmailAddress ) - } ) - } ) - - describe( "ParticipantAttribute", () => { - const attribute = new ParticipantAttribute.CustomParticipantAttribute( new Text( "Name" ) ) - - it( "getInputElement works", () => { - const inputElement = attribute.getInputElement_6eo89k$( CarpInputDataTypes ) - expect( inputElement ).instanceOf( Text ) - } ) - - it( "isValidInput works", () => { - const isNumberValid = attribute.isValidInput_etkzhw$( CarpInputDataTypes, 42 ) - expect( isNumberValid ).is.false - - const isStringValid = attribute.isValidInput_etkzhw$( CarpInputDataTypes, "Steven" ) - expect( isStringValid ).is.true - } ) - - it( "inputToData works", () => { - const data = attribute.inputToData_etkzhw$( CarpInputDataTypes, "Steven" ) - expect( data ).is.not.undefined - } ) - } ) - - describe( "ExpectedParticipantData", () => { - it( "can serialize polymorphic InputBy", () => { - const expectedData = new ExpectedParticipantData( - new ParticipantAttribute.DefaultParticipantAttribute( new NamespacedId( "namespace", "type" ) ), - new Roles( toSet( [ "Roles are added" ] ) ) - ) - - const json: Json = createDefaultJSON() - const serializer = ExpectedParticipantData.Companion.serializer() - const serialized = json.encodeToString_tf03ej$( serializer, expectedData ) - expect( serialized ).has.string( "Roles are added" ) - } ) - } ) -} ) diff --git a/typescript-declarations/tests/carp.deployments.core.ts b/typescript-declarations/tests/carp.deployments.core.ts deleted file mode 100644 index aab5afbb3..000000000 --- a/typescript-declarations/tests/carp.deployments.core.ts +++ /dev/null @@ -1,84 +0,0 @@ -import VerifyModule from './VerifyModule' - -import { kotlin } from 'kotlin' -import ArrayList = kotlin.collections.ArrayList -import toMap = kotlin.collections.toMap_v2dak7$ -import toSet = kotlin.collections.toSet_us0mfu$ -import toList = kotlin.collections.toList_us0mfu$ - -import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' -import Clock = kxd.datetime.Clock - -import { dk as dkc } from 'carp.core-kotlin-carp.common' -import UUID = dkc.cachet.carp.common.application.UUID -import DefaultDeviceRegistration = dkc.cachet.carp.common.application.devices.DefaultDeviceRegistration -import Smartphone = dkc.cachet.carp.common.application.devices.Smartphone -import Username = dkc.cachet.carp.common.application.users.Username -import UsernameAccountIdentity = dkc.cachet.carp.common.application.users.UsernameAccountIdentity -import AssignedTo = dkc.cachet.carp.common.application.users.AssignedTo - -import { dk } from 'carp.core-kotlin-carp.deployments.core' -import DeviceDeploymentStatus = dk.cachet.carp.deployments.application.DeviceDeploymentStatus -import PrimaryDeviceDeployment = dk.cachet.carp.deployments.application.PrimaryDeviceDeployment -import StudyDeploymentStatus = dk.cachet.carp.deployments.application.StudyDeploymentStatus -import ActiveParticipationInvitation = dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation -import AssignedPrimaryDevice = dk.cachet.carp.deployments.application.users.AssignedPrimaryDevice -import ParticipantData = dk.cachet.carp.deployments.application.users.ParticipantData -import RoleData = dk.cachet.carp.deployments.application.users.ParticipantData.RoleData -import Participation = dk.cachet.carp.deployments.application.users.Participation -import ParticipantInvitation = dk.cachet.carp.deployments.application.users.ParticipantInvitation -import ParticipantStatus = dk.cachet.carp.deployments.application.users.ParticipantStatus -import StudyInvitation = dk.cachet.carp.deployments.application.users.StudyInvitation -import DeploymentServiceRequest = dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest -import ParticipationServiceRequest = dk.cachet.carp.deployments.infrastructure.ParticipationServiceRequest - - -describe( "carp.deployments.core", () => { - it( "verify module declarations", async () => { - const now = Clock.System.now() - const exampleDevice = new Smartphone( "test", toMap( [] ) ) - const studyInvitation = new StudyInvitation( "Some study" ) - - const instances = [ - DeviceDeploymentStatus.Companion, - [ "DeviceDeploymentStatus", new DeviceDeploymentStatus.Unregistered( null, true, toSet( [] ), toSet( [] ) ) ], - new DeviceDeploymentStatus.Unregistered( null, true, toSet( [] ), toSet( [] ) ), - new DeviceDeploymentStatus.Registered( null, true, toSet( [] ), toSet( [] ) ), - new DeviceDeploymentStatus.Deployed( null ), - new DeviceDeploymentStatus.NeedsRedeployment( null, toSet( [] ), toSet( [] ) ), - [ "DeviceDeploymentStatus$NotDeployed", new DeviceDeploymentStatus.Unregistered( null, true, toSet( [] ), toSet( [] ) ) ], - new PrimaryDeviceDeployment( - exampleDevice, - new DefaultDeviceRegistration( "some role" ), - toSet( [] ), toMap( [] ), toSet( [] ), toMap( [] ), toSet( [] ), toSet( [] ), "" ), - PrimaryDeviceDeployment.Companion, - [ "StudyDeploymentStatus", new StudyDeploymentStatus.Invited( now, UUID.Companion.randomUUID(), new ArrayList( [] ), new ArrayList( [] ), null ) ], - new StudyDeploymentStatus.Invited( now, UUID.Companion.randomUUID(), new ArrayList( [] ), new ArrayList( [] ), null ), - new StudyDeploymentStatus.DeployingDevices( now, UUID.Companion.randomUUID(), new ArrayList( [] ), new ArrayList( [] ), null ), - new StudyDeploymentStatus.Running( now, UUID.Companion.randomUUID(), new ArrayList( [] ), new ArrayList( [] ), now ), - new StudyDeploymentStatus.Stopped( now, UUID.Companion.randomUUID(), new ArrayList( [] ), new ArrayList( [] ), null, now ), - StudyDeploymentStatus.Companion, - new ActiveParticipationInvitation( new Participation( UUID.Companion.randomUUID() ), studyInvitation, toSet( [] ) ), - ActiveParticipationInvitation.Companion, - new AssignedPrimaryDevice( exampleDevice, null ), - AssignedPrimaryDevice.Companion, - new ParticipantData( UUID.Companion.randomUUID(), toMap( [] ), toList( [] ) ), - ParticipantData.Companion, - new RoleData( "some role", toMap( [] ) ), - RoleData.Companion, - new ParticipantInvitation( UUID.Companion.randomUUID(), toSet( [] ), new UsernameAccountIdentity( new Username( "Test" ) ), studyInvitation ), - ParticipantInvitation.Companion, - new ParticipantStatus( UUID.Companion.randomUUID(), AssignedTo.All, toSet( [] ) ), - ParticipantStatus.Companion, - new Participation( UUID.Companion.randomUUID() ), - Participation.Companion, - studyInvitation, - StudyInvitation.Companion, - [ "DeploymentServiceRequest", new DeploymentServiceRequest.Stop( UUID.Companion.randomUUID() ) ], - [ "ParticipationServiceRequest", new ParticipationServiceRequest.GetParticipantData( UUID.Companion.randomUUID() ) ] - ] - - const moduleVerifier = new VerifyModule( 'carp.core-kotlin-carp.deployments.core', instances ) - await moduleVerifier.verify() - } ) -} ) diff --git a/typescript-declarations/tests/carp.protocols.core.ts b/typescript-declarations/tests/carp.protocols.core.ts deleted file mode 100644 index f7b027a39..000000000 --- a/typescript-declarations/tests/carp.protocols.core.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expect } from 'chai' -import VerifyModule from './VerifyModule' - -import { kotlin } from 'kotlin' -import toSet = kotlin.collections.toSet_us0mfu$ - -import { kotlinx } from 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' -import Json = kotlinx.serialization.json.Json - -import { dk as cdk } from 'carp.core-kotlin-carp.common' -import UUID = cdk.cachet.carp.common.application.UUID -import createDefaultJSON = cdk.cachet.carp.common.infrastructure.serialization.createDefaultJSON_18xi4u$ - -import { dk } from 'carp.core-kotlin-carp.protocols.core' -import ProtocolVersion = dk.cachet.carp.protocols.application.ProtocolVersion -import StudyProtocolSnapshot = dk.cachet.carp.protocols.application.StudyProtocolSnapshot -import ProtocolFactoryServiceRequest = dk.cachet.carp.protocols.infrastructure.ProtocolFactoryServiceRequest -import ProtocolServiceRequest = dk.cachet.carp.protocols.infrastructure.ProtocolServiceRequest - -const serializedSnapshot = `{"id":"27879e75-ccc1-4866-9ab3-4ece1b735052","ownerId":"9586f572-58fd-11ec-bf63-0242ac130002","name":"Test protocol","description":"Test description","createdOn":"2021-06-18T14:28:14.229Z","version":0,"primaryDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Stub primary device","defaultSamplingConfiguration":{}}],"connectedDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Stub device","defaultSamplingConfiguration":{}},{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Chained primary","defaultSamplingConfiguration":{}},{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Chained connected","defaultSamplingConfiguration":{}}],"connections":[{"roleName":"Stub device","connectedToRoleName":"Stub primary device"},{"roleName":"Chained primary","connectedToRoleName":"Stub primary device"},{"roleName":"Chained connected","connectedToRoleName":"Chained primary"}],"tasks":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubTaskConfiguration","name":"Task","measures":[{"__type":"dk.cachet.carp.common.application.tasks.Measure.DataStream","type":"dk.cachet.carp.stub","overrideSamplingConfiguration":null}],"description":null}],"triggers":{"0":{"__type":"dk.cachet.carp.common.infrastructure.test.StubTriggerConfiguration","sourceDeviceRoleName":"Stub device","uniqueProperty":"Unique"}},"taskControls":[{"triggerId":0,"taskName":"Task","destinationDeviceRoleName":"Stub primary device","control":"Start"}],"expectedParticipantData":[{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"some.type"}}],"applicationData":""}` - - -describe( "carp.protocols.core", () => { - it( "verify module declarations", async () => { - // Create `StudyProtocolSnapshot` instance. - const json: Json = createDefaultJSON() - const serializer = StudyProtocolSnapshot.Companion.serializer() - const studyProtocolSnapshot = json.decodeFromString_awif5v$( serializer, serializedSnapshot ) - - const instances = [ - new ProtocolVersion( "Version" ), - ProtocolVersion.Companion, - studyProtocolSnapshot, - StudyProtocolSnapshot.Companion, - [ "ProtocolServiceRequest", new ProtocolServiceRequest.GetAllForOwner( UUID.Companion.randomUUID() ) ], - [ "ProtocolFactoryServiceRequest", new ProtocolFactoryServiceRequest.CreateCustomProtocol( UUID.Companion.randomUUID(), "", "" ) ] - ] - - const moduleVerifier = new VerifyModule( 'carp.core-kotlin-carp.protocols.core', instances ) - await moduleVerifier.verify() - } ) - - describe( "StudyProtocolSnapshot", () => { - it( "can deserialize", () => { - const json: Json = createDefaultJSON() - const serializer = StudyProtocolSnapshot.Companion.serializer() - const parsed = json.decodeFromString_awif5v$( serializer, serializedSnapshot ) - expect( parsed ).is.instanceOf( StudyProtocolSnapshot ) - } ) - } ) - - describe( "ProtocolServiceRequest", () => { - it( "add request has default version tag", () => { - const json: Json = createDefaultJSON() - const serializer = StudyProtocolSnapshot.Companion.serializer() - const snapshot = json.decodeFromString_awif5v$( serializer, serializedSnapshot ) - - const addProtocol = new ProtocolServiceRequest.Add( snapshot ) - const versionTag = (addProtocol as any).versionTag - expect( versionTag ).equals( "Initial" ) - } ) - }) -} ) diff --git a/typescript-declarations/tests/carp.studies.core.ts b/typescript-declarations/tests/carp.studies.core.ts deleted file mode 100644 index f6ba40182..000000000 --- a/typescript-declarations/tests/carp.studies.core.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { expect } from 'chai' -import VerifyModule from './VerifyModule' - -import { kotlin } from 'kotlin' -import ArrayList = kotlin.collections.ArrayList -import HashSet = kotlin.collections.HashSet -import toSet = kotlin.collections.toSet_us0mfu$ - -import { kotlinx } from 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' -import Json = kotlinx.serialization.json.Json -import { kotlinx as kotlinxcore } from 'kotlinx-serialization-kotlinx-serialization-core-js-legacy' -import ListSerializer = kotlinxcore.serialization.builtins.ListSerializer_swdriu$ - -import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' -import Clock = kxd.datetime.Clock - -import { dk as cdk } from 'carp.core-kotlin-carp.common' -import UUID = cdk.cachet.carp.common.application.UUID -import CarpInputDataTypes = cdk.cachet.carp.common.application.data.input.CarpInputDataTypes -import Username = cdk.cachet.carp.common.application.users.Username -import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo -import UsernameAccountIdentity = cdk.cachet.carp.common.application.users.UsernameAccountIdentity -import createDefaultJSON = cdk.cachet.carp.common.infrastructure.serialization.createDefaultJSON_18xi4u$ - -import { dk as ddk } from 'carp.core-kotlin-carp.deployments.core' -import DeviceDeploymentStatus = ddk.cachet.carp.deployments.application.DeviceDeploymentStatus -import StudyDeploymentStatus = ddk.cachet.carp.deployments.application.StudyDeploymentStatus -import ParticipantStatus = ddk.cachet.carp.deployments.application.users.ParticipantStatus -import StudyInvitation = ddk.cachet.carp.deployments.application.users.StudyInvitation - -import { dk } from 'carp.core-kotlin-carp.studies.core' -import StudyDetails = dk.cachet.carp.studies.application.StudyDetails -import StudyStatus = dk.cachet.carp.studies.application.StudyStatus -import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles -import Participant = dk.cachet.carp.studies.application.users.Participant -import ParticipantGroupStatus = dk.cachet.carp.studies.application.users.ParticipantGroupStatus -import getAssignedParticipantIds = dk.cachet.carp.studies.application.users.participantIds_skpkn2$ -import getAssignedParticipantRoles = dk.cachet.carp.studies.application.users.participantRoles_skpkn2$ -import RecruitmentServiceRequest = dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest -import StudyServiceRequest = dk.cachet.carp.studies.infrastructure.StudyServiceRequest - - -describe( "carp.studies.core", () => { - it( "verify module declarations", async () => { - const deploymentId = UUID.Companion.randomUUID() - const now = Clock.System.now() - const invitedDeploymentStatus = new StudyDeploymentStatus.Invited( now, deploymentId, new ArrayList( [] ), new ArrayList( [] ), null ) - - const instances = [ - new StudyDetails( UUID.Companion.randomUUID(), UUID.Companion.randomUUID(), "Name", Clock.System.now(), "Description", new StudyInvitation( "Some study" ), null ), - StudyDetails.Companion, - [ "StudyStatus", new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ) ], - new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ), - new StudyStatus.Live( UUID.Companion.randomUUID(), "Test", Clock.System.now(), UUID.Companion.randomUUID(), false, false, true ), - StudyStatus.Companion, - new AssignedParticipantRoles( UUID.Companion.randomUUID(), AssignedTo.All ), - AssignedParticipantRoles.Companion, - new Participant( new UsernameAccountIdentity( new Username( "Test" ) ) ), - Participant.Companion, - [ "ParticipantGroupStatus", new ParticipantGroupStatus.Staged( deploymentId, new HashSet() ) ], - new ParticipantGroupStatus.Staged( deploymentId, new HashSet() ), - [ "ParticipantGroupStatus$InDeployment", new ParticipantGroupStatus.Invited( deploymentId, new HashSet(), now, invitedDeploymentStatus ) ], - new ParticipantGroupStatus.Invited( deploymentId, new HashSet(), now, invitedDeploymentStatus ), - new ParticipantGroupStatus.Running( deploymentId, new HashSet(), now, invitedDeploymentStatus, now ), - new ParticipantGroupStatus.Stopped( deploymentId, new HashSet(), now, invitedDeploymentStatus, null, now ), - ParticipantGroupStatus.Companion, - [ "StudyServiceRequest", new StudyServiceRequest.Remove( UUID.Companion.randomUUID() ) ], - [ "RecruitmentServiceRequest", new RecruitmentServiceRequest.GetParticipants( UUID.Companion.randomUUID() ) ] - ] - - const moduleVerifier = new VerifyModule( 'carp.core-kotlin-carp.studies.core', instances ) - await moduleVerifier.verify() - } ) - - - describe( "AssignedParticipantRoles", () => { - it( "getAssigned participantIds and participantRoles works", () => { - const participant1 = UUID.Companion.randomUUID() - const participant2 = UUID.Companion.randomUUID() - const assigned1 = new AssignedParticipantRoles( participant1, new AssignedTo.Roles( toSet( [ "Test" ] ) ) ) - const assigned2 = new AssignedParticipantRoles( participant2, AssignedTo.All ) - const assignedGroup = new ArrayList( [ assigned1, assigned2 ] ) - expect( getAssignedParticipantIds( assignedGroup ) ).instanceof( HashSet ) - expect( getAssignedParticipantRoles( assignedGroup ) ).instanceof( HashSet ) - } ) - } ) - - - describe( "StudyStatus", () => { - it ( "can typecheck StudyStatus", () => { - const configuring = new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ) - const configuringStatus: StudyStatus = configuring - expect( configuringStatus instanceof StudyStatus.Configuring ).is.true - expect( configuringStatus instanceof StudyStatus.Live ).is.false - - const live = new StudyStatus.Live( UUID.Companion.randomUUID(), "Test", Clock.System.now(), UUID.Companion.randomUUID(), false, false, true ) - const liveStatus: StudyStatus = live - expect( liveStatus instanceof StudyStatus.Live ).is.true - expect( liveStatus instanceof StudyStatus.Configuring ).is.false - } ) - } ) - - - describe( "StudyServiceRequest", () => { - it( "can serialize requests with polymorphic serializer", () => { - const createStudy = new StudyServiceRequest.CreateStudy( - UUID.Companion.randomUUID(), - "Test study", - "This is a study description", - new StudyInvitation( "Some study" ) - ) - - const json: Json = createDefaultJSON() - const serializer = StudyServiceRequest.Serializer - const serialized = json.encodeToString_tf03ej$( serializer, createStudy ) - expect( serialized ).has.string( "dk.cachet.carp.studies.infrastructure.StudyServiceRequest.CreateStudy" ) - } ) - - it( "can serialize getStudiesOverview response", () => { - const status = new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ) - const statusList = new ArrayList( [ status ] ) - - const json: Json = createDefaultJSON() - const serializer = ListSerializer( StudyStatus.Companion.serializer() ) - expect( serializer ).is.not.undefined - const serialized = json.encodeToString_tf03ej$( serializer, statusList ) - expect( serialized ).is.not.not.undefined - } ) - } ) - - - describe( "RecruitmentServiceRequest", () => { - it( "can serialize DeployParticipantGroup", () => { - const deployGroup = new RecruitmentServiceRequest.InviteNewParticipantGroup( - UUID.Companion.randomUUID(), - toSet( [ - new AssignedParticipantRoles( UUID.Companion.randomUUID(), AssignedTo.All ) - ] ) - ) - - const json: Json = createDefaultJSON() - const serializer = RecruitmentServiceRequest.Serializer - const serialized = json.encodeToString_tf03ej$( serializer, deployGroup ) - expect( serialized ).is.not.undefined - } ) - - it( "can serialize Participant", () => { - const participant = new Participant( new UsernameAccountIdentity( new Username( "Test" ) ), UUID.Companion.randomUUID() ) - - const json: Json = createDefaultJSON() - const serializer = Participant.Companion.serializer() - const serialized = json.encodeToString_tf03ej$( serializer, participant ) - expect( serialized ).is.not.undefined - } ) - - it( "can serialize ParticipantGroupStatus", () => { - const deploymentId = UUID.Companion.randomUUID() - const now = Clock.System.now() - const deploymentStatus = new StudyDeploymentStatus.Running( now, deploymentId, new ArrayList( [] ), new ArrayList( [] ), now ) - const participants = toSet( [ new Participant( new UsernameAccountIdentity( new Username( "Test" ) ) ) ] ) - const group = new ParticipantGroupStatus.Invited( deploymentId, participants, now, deploymentStatus ) - - const json: Json = createDefaultJSON() - const serializer = ParticipantGroupStatus.Companion.serializer() - const serialized = json.encodeToString_tf03ej$( serializer, group ) - expect( serialized ).is.not.undefined - } ) - } ) -} ) diff --git a/typescript-declarations/tests/kotlin-test.ts b/typescript-declarations/tests/kotlin-test.ts new file mode 100644 index 000000000..a5e0c7a98 --- /dev/null +++ b/typescript-declarations/tests/kotlin-test.ts @@ -0,0 +1,102 @@ +import VerifyModule from './VerifyModule' + +import { expect } from 'chai' +import { kotlin } from '../src/kotlin' +import toLong = kotlin.toLong +import listOf = kotlin.collections.listOf +import setOf = kotlin.collections.setOf + + +describe( "kotlin", () => { + it( "verify module declarations", async () => { + const list = listOf( [ 42 ] ) + const set = setOf( [ 42 ] ) + const instances: any[] = [ + toLong( 42 ), + [ "Collection", list ], + [ "List", list ], + [ "EmptyList", listOf( [] ) ], + [ "AbstractMutableList", list ], + [ "Set", set ], + [ "EmptySet", setOf( [] ) ], + [ "HashSet", set ] + ] + + const moduleVerifier = new VerifyModule( + 'kotlin-kotlin-stdlib-js-ir', + instances + ) + await moduleVerifier.verify() + } ) + + describe( "Long", () => { + it( "toLong and back toNumber equals", () => { + const answer = toLong( 42 ) + const answerAsNumber: Number = answer.toNumber() + + expect( answerAsNumber ).equals( 42 ) + } ) + } ) + + describe( "List", () => { + it( "listOf and back toArray succeeds", () => { + const numbers = [ 1, 2, 3 ] + const numbersList = listOf( numbers ) + const numbersArray = numbersList.toArray() + + expect( numbersArray ).deep.equals( numbers ) + } ) + + it( "contains succeeds", () => { + const includesAnswer = listOf( [ 0, 42, 50 ] ) + + expect( includesAnswer.contains( 42 ) ).is.true + expect( includesAnswer.contains( 100 ) ).is.false + } ) + + it( "size succeeds", () => { + const three = listOf( [ 1, 2, 3 ] ) + + expect( three.size() ).equals( 3 ) + } ) + + it( "empty list succeeds", () => { + const emptyList = listOf( [] ) + + expect( emptyList.toArray() ).deep.equals( [] ) + expect( emptyList.contains( 42 ) ).is.false + expect( emptyList.size() ).equals( 0 ) + } ) + } ) + + describe( "Set", () => { + it( "setOf and conversion back to array succeeds", () => { + const answers = [ 42 ] + const answersSet = setOf( answers ) + const answersArray = answersSet.toArray() + + expect( answersArray ).deep.equals( answers ) + } ) + + it( "contains succeeds", () => { + const includesAnswer = setOf( [ 0, 42, 50 ] ) + + expect( includesAnswer.contains( 42 ) ).is.true + expect( includesAnswer.contains( 100 ) ).is.false + } ) + + it( "size succeeds", () => { + const three = setOf( [ 1, 2, 3 ] ) + + expect( three.size() ).equals( 3 ) + } ) + + it( "empty set succeeds", () => { + const emptySet = setOf( [] ) + + expect( emptySet.toArray() ).deep.equals( [] ) + expect( emptySet.contains( 42 ) ).is.false + expect( emptySet.size() ).equals( 0 ) + } ) + } ) +} ) diff --git a/typescript-declarations/tests/kotlin.ts b/typescript-declarations/tests/kotlin.ts deleted file mode 100644 index 80553481e..000000000 --- a/typescript-declarations/tests/kotlin.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { expect } from 'chai' -import VerifyModule from './VerifyModule' - -import { Long } from 'kotlin' -import { kotlin } from 'kotlin' -import Pair = kotlin.Pair -import ArrayList = kotlin.collections.ArrayList -import HashSet = kotlin.collections.HashSet -import toSet = kotlin.collections.toSet_us0mfu$ -import Duration = kotlin.time.Duration - - -describe( "kotlin", () => { - it( "verify module declarations", async () => { - const instances = [ - new Pair( "key", "value" ), - new HashSet(), - new ArrayList( [ "One", "Two", "Three" ] ), - Duration.Companion - ] - - const moduleVerifier = new VerifyModule( 'kotlin', instances ) - await moduleVerifier.verify() - } ) - - - describe( "Long", () => { - it( "fromNumber and toNumber equals", () => { - const answer = Long.fromNumber( 42 ) - const answerAsNumber = answer.toNumber() - - expect( answerAsNumber ).equals( 42 ) - } ) - } ) - - - describe( "ArrayList", () => { - it( "toArray succeeds", () => { - const list = new ArrayList( [ 1, 2, 3 ] ) - const array = list.toArray() - - expect( array.length ).equals( 3 ) - } ) - - it( "size returns length of array", () => { - const list = new ArrayList( [ 1, 2, 3 ] ) - - expect( list.size ).equals( 3 ) - } ) - } ) - - - describe( "HashSet", () => { - it( "toArray succeeds", () => { - const answers = toSet( [ "42" ] ) - const answersArray = answers.toArray() - - expect( answersArray.length ).equals( 1 ) - expect( answersArray[ 0 ] ).equals( "42" ) - } ) - - it( "contains succeeds", () => { - const answers = toSet( [ "42" ] ) - - expect( answers.contains_11rb$( "42" ) ).is.true - expect( answers.contains_11rb$( "nope" ) ).is.false - } ) - - it( "can convert array to set", () => { - const elements = [ "One", "Two", "Three" ] - const set = toSet( elements ) - expect( set ).is.not.undefined - } ) - } ) -} ) diff --git a/typescript-declarations/tests/kotlinx-datetime.ts b/typescript-declarations/tests/kotlinx-datetime.ts deleted file mode 100644 index 0425b7e36..000000000 --- a/typescript-declarations/tests/kotlinx-datetime.ts +++ /dev/null @@ -1,39 +0,0 @@ -import VerifyModule from './VerifyModule' - -import { kotlinx } from 'kotlinx-serialization-kotlinx-serialization-json-js-legacy' -import Json = kotlinx.serialization.json.Json - -import { kotlinx as kxd } from 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy' -import Clock = kxd.datetime.Clock -import Instant = kxd.datetime.Instant - -import { dk as cdk } from 'carp.core-kotlin-carp.common' -import createDefaultJSON = cdk.cachet.carp.common.infrastructure.serialization.createDefaultJSON_18xi4u$ -import { expect } from 'chai' - - -describe( "kotlinx-datetime", () => { - it( "verify module declarations", async () => { - const instances = [ - Clock.System, - [ "Instant$Companion", Instant.Companion ] - ] - - const moduleVerifier = new VerifyModule( - 'Kotlin-DateTime-library-kotlinx-datetime-js-legacy', - instances - ) - await moduleVerifier.verify() - } ) - - describe( "Instant", () => { - it( "can serialize", () => { - const now: Instant = Clock.System.now() - const json: Json = createDefaultJSON() - const serializer = Instant.Companion.serializer() - const serialized = json.encodeToString_tf03ej$( serializer, now ) - - expect(serialized).is.not.undefined - } ) - } ) -} ) diff --git a/typescript-declarations/tests/kotlinx-serialization.ts b/typescript-declarations/tests/kotlinx-serialization.ts deleted file mode 100644 index f9e802aad..000000000 --- a/typescript-declarations/tests/kotlinx-serialization.ts +++ /dev/null @@ -1,24 +0,0 @@ -import VerifyModule from './VerifyModule' - - -describe( "kotlinx-serialization", () => { - it( "verify core module declarations", async () => { - const instances = new Array() - - const moduleVerifier = new VerifyModule( - 'kotlinx-serialization-kotlinx-serialization-core-js-legacy', - instances - ) - await moduleVerifier.verify() - } ) - - it( "verify json module declarations", async () => { - const instances = new Array() - - const moduleVerifier = new VerifyModule( - 'kotlinx-serialization-kotlinx-serialization-json-js-legacy', - instances - ) - await moduleVerifier.verify() - } ) -} ) diff --git a/typescript-declarations/tsconfig.json b/typescript-declarations/tsconfig.json index 9afb2d0d8..a4819229f 100644 --- a/typescript-declarations/tsconfig.json +++ b/typescript-declarations/tsconfig.json @@ -8,6 +8,7 @@ "typeRoots": ["./node_modules/@types", "./@types"] }, "include": [ + "src/**/*.ts", "tests/**/*.ts" ] } \ No newline at end of file From d24416d28a0e6aaeb7dcf8760fc3035b33f6db20 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Tue, 10 Jan 2023 00:26:42 +0100 Subject: [PATCH 17/50] Add kotlinx datetime TypeScript facade --- .../kotlin/KotlinxDateTimeExport.kt | 29 ++++++++++++ ...in-DateTime-library-kotlinx-datetime-js-ir | 2 + .../index.d.ts | 18 ++++++++ .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 2 +- typescript-declarations/src/kotlin.ts | 2 +- .../src/kotlinx-datetime.ts | 46 +++++++++++++++++++ .../tests/kotlinx-datetime-test.ts | 36 +++++++++++++++ 7 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 publish-npm-packages/src/commonMain/kotlin/KotlinxDateTimeExport.kt create mode 100644 publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir create mode 100644 typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts create mode 100644 typescript-declarations/src/kotlinx-datetime.ts create mode 100644 typescript-declarations/tests/kotlinx-datetime-test.ts diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinxDateTimeExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinxDateTimeExport.kt new file mode 100644 index 000000000..ddc6f2606 --- /dev/null +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinxDateTimeExport.kt @@ -0,0 +1,29 @@ +@file:Suppress( + "NON_EXPORTABLE_TYPE", + "UNUSED_VARIABLE" // The variable names show up in generated JS sources which is useful to look up mangled names. +) + +import kotlinx.datetime.Clock +import kotlinx.datetime.Instant +import kotlin.js.JsExport + + +/** + * Refers to types/methods in the kotlinx datetime library to ensure they aren't removed from compiled sources + * as part of the JS IR backend's compiler optimizations. + * The exported JS sources for this class can also be used to look up mangled method names. + */ +@JsExport +class KotlinxDateTimeExport +{ + fun clock( clock: Clock ) + { + val system: Clock = Clock.System + val now = clock.now() + } + + fun instant( instant: Instant ) + { + val toEpochMilliseconds = instant.toEpochMilliseconds() + } +} diff --git a/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir b/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir new file mode 100644 index 000000000..17f272004 --- /dev/null +++ b/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir @@ -0,0 +1,2 @@ +System +Instant_0 \ No newline at end of file diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts new file mode 100644 index 000000000..1f8c3637f --- /dev/null +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -0,0 +1,18 @@ +declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +{ + namespace $_$ + { + interface System + { + // now + c5(): Instant_0 + } + function System_getInstance(): System + + interface Instant_0 + { + // toEpochMilliseconds + k5(): number + } + } +} diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index 1e34ae79b..c4547ed4b 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -5,7 +5,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Long { // toNumber - x4(): number + y4(): number } function toLong( number: number ): Long diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 32107d2c4..abef1c8ce 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -57,7 +57,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" } // Implement base interfaces in internal types. -kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.x4(); }; +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.y4(); }; kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts new file mode 100644 index 000000000..ac50f337a --- /dev/null +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -0,0 +1,46 @@ +import * as kotlinxDateTime from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" + + +declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +{ + // Base interfaces with better method names for internal types. + namespace kotlinx.datetime + { + interface Clock + { + now(): Instant + } + interface Instant + { + toEpochMilliseconds(): number + } + } + + // Augment internal types to implement desired base interfaces. + namespace $_$ + { + abstract class System implements kotlinx.datetime.Clock + { + now(): kotlinx.datetime.Instant + } + abstract class Instant_0 implements kotlinx.datetime.Instant + { + toEpochMilliseconds(): number + } + } +} + +// Implement base interfaces in internal types. +kotlinxDateTime.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.c5(); }; +kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.k5(); }; + +// Export facade. +export namespace kotlinx.datetime +{ + export type Clock = kotlinxDateTime.kotlinx.datetime.Clock + export type Instant = kotlinxDateTime.kotlinx.datetime.Instant + export namespace Clock + { + export const System: kotlinx.datetime.Clock = kotlinxDateTime.$_$.System_getInstance() + } +} diff --git a/typescript-declarations/tests/kotlinx-datetime-test.ts b/typescript-declarations/tests/kotlinx-datetime-test.ts new file mode 100644 index 000000000..35f62e180 --- /dev/null +++ b/typescript-declarations/tests/kotlinx-datetime-test.ts @@ -0,0 +1,36 @@ +import VerifyModule from './VerifyModule' + +import { expect } from 'chai' +import { kotlinx } from '../src/kotlinx-datetime' +import Clock = kotlinx.datetime.Clock + + +describe( "kotlinx-datetime", () => { + it( "verify module declarations", async () => { + const instances: any[] = [ + Clock.System, + Clock.System.now() + ] + + const moduleVerifier = new VerifyModule( + 'Kotlin-DateTime-library-kotlinx-datetime-js-ir', + instances + ) + await moduleVerifier.verify() + } ) + + describe( "Clock", () => { + it( "now succeeds", () => { + const now = Clock.System.now() + expect( now ).not.undefined + } ) + } ) + + describe( "Instant", () => { + it( "toEpochMilliseconds succeeds", () => { + const now = Clock.System.now() + + expect( now.toEpochMilliseconds() ).not.undefined + } ) + } ) +} ) \ No newline at end of file From 6337ae24d14353f1d81cb2dd488cddaba1f721d4 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Tue, 10 Jan 2023 01:06:11 +0100 Subject: [PATCH 18/50] Fix: import/export didn't use consistent names on overloads When methods were overloaded, one module may use a different internal name than another, causing the current renaming of import/export to fail. Instead, keep the original compiled import/export names, but add the custom desired ones. --- build.gradle | 15 ++------------- ...Kotlin-DateTime-library-kotlinx-datetime-js-ir | 1 + .../src/forced-exports/kotlin-kotlin-stdlib-js-ir | 5 ++++- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 2f911e535..632bc175f 100644 --- a/build.gradle +++ b/build.gradle @@ -265,25 +265,14 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { // Change these to the named modules created in the previous step. def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'\$1'") - // Unscramble generated import/export names. - def fixedExport = namedModules.replaceAll( - ~/(\_\.\$\_\$\.).+? = (.+?);/, - "\$1\$2 = \$2" - ) - def fixedImport = fixedExport.replaceAll( - ~/var (.+?) = (kotlin\_kotlin\.\$\_\$\.)(.+);/, - "var \$1 = \$2\$1;" - ) - - // By default, only types used across modules are exported for internal use. - // Therefore, add additional configured exports to ensure they are present. + // Add additional internal types to be exported, as configured in `forced-exports`. def toExport = [] def forcedExportsFile = new File("$rootDir/publish-npm-packages/src/forced-exports/$moduleName") if (forcedExportsFile.exists()) { forcedExportsFile.eachLine { type -> toExport << type } } def toExportList = toExport.collect { "_.\\\$_\\\$.$it = $it\n " } - def additionalExports = fixedImport.replaceAll( + def additionalExports = namedModules.replaceAll( ~/return \_;/, toExportList.join() + "return _;" ) diff --git a/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir b/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir index 17f272004..52f66e340 100644 --- a/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir +++ b/publish-npm-packages/src/forced-exports/Kotlin-DateTime-library-kotlinx-datetime-js-ir @@ -1,2 +1,3 @@ System +System_getInstance Instant_0 \ No newline at end of file diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index e2764f32f..b658e3b08 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -1,5 +1,8 @@ Long +toLong EmptyList AbstractMutableList HashSet -EmptySet \ No newline at end of file +EmptySet +listOf +setOf \ No newline at end of file From 67920fdd0c2a073a0034c3748f3d6ad4a0b79e5a Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Thu, 12 Jan 2023 14:01:25 +0100 Subject: [PATCH 19/50] Add common module TS exports to make previous tests pass This doesn't export all types in common yet. Only those used in the TS unit tests which were present before. Because additional code was exported, the mangled names in the kotlin standard library and datetime library had to be updated. --- .../carp/common/application/EmailAddress.kt | 2 + .../carp/common/application/MACAddress.kt | 2 + .../carp/common/application/NamespacedId.kt | 2 + .../carp/common/application/RecurrenceRule.kt | 3 + .../carp/common/application/TimeOfDay.kt | 2 + .../cachet/carp/common/application/Trilean.kt | 4 + .../dk/cachet/carp/common/application/UUID.kt | 2 + .../common/application/data/Acceleration.kt | 2 + .../application/data/AngularVelocity.kt | 2 + .../common/application/data/CarpDataTypes.kt | 3 + .../common/application/data/CompletedTask.kt | 2 + .../carp/common/application/data/Data.kt | 3 + .../carp/common/application/data/DataType.kt | 3 + .../carp/common/application/data/ECG.kt | 2 + .../carp/common/application/data/EDA.kt | 2 + .../common/application/data/Geolocation.kt | 2 + .../carp/common/application/data/HeartRate.kt | 2 + .../application/data/InterbeatInterval.kt | 2 + .../data/NonGravitationalAcceleration.kt | 2 + .../carp/common/application/data/PPG.kt | 3 + .../application/data/SensorSkinContact.kt | 2 + .../common/application/data/SignalStrength.kt | 2 + .../carp/common/application/data/StepCount.kt | 2 + .../common/application/data/TriggeredTask.kt | 2 + .../data/input/CarpInputDataTypes.kt | 2 + .../application/data/input/CustomInput.kt | 2 + .../carp/common/application/data/input/Sex.kt | 2 + .../data/input/elements/InputElement.kt | 3 + .../data/input/elements/SelectOne.kt | 4 + .../application/data/input/elements/Text.kt | 4 + .../application/triggers/TaskControl.kt | 2 + .../application/users/AccountIdentity.kt | 6 ++ .../common/application/users/AssignedTo.kt | 7 +- .../users/ExpectedParticipantData.kt | 2 + .../application/users/ParticipantAttribute.kt | 4 + .../application/users/ParticipantRole.kt | 2 + .../carp/common/application/users/Username.kt | 2 + .../forced-exports/kotlin-kotlin-stdlib-js-ir | 2 +- .../index.d.ts | 4 +- .../carp.core-kotlin-carp.common/index.d.ts | 6 ++ .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 6 +- typescript-declarations/src/carp-common.ts | 21 +++++ typescript-declarations/src/kotlin.ts | 20 ++--- .../src/kotlinx-datetime.ts | 18 ++-- .../tests/carp.common-test.ts | 82 +++++++++++++++++++ 45 files changed, 230 insertions(+), 26 deletions(-) create mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts create mode 100644 typescript-declarations/src/carp-common.ts create mode 100644 typescript-declarations/tests/carp.common-test.ts diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/EmailAddress.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/EmailAddress.kt index 33c0d976f..c888cca62 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/EmailAddress.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/EmailAddress.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,6 +10,7 @@ import kotlinx.serialization.* * TODO: Validate so only valid email addresses can be passed. */ @Serializable( EmailAddressSerializer::class ) +@JsExport data class EmailAddress( val address: String ) { override fun toString(): String = address diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/MACAddress.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/MACAddress.kt index 2bf8dec98..e46088957 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/MACAddress.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/MACAddress.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -13,6 +14,7 @@ import kotlinx.serialization.* * @param address Six groups of two upper case hexadecimal digits, separated by hyphens (-). */ @Serializable( with = MACAddressSerializer::class ) +@JsExport data class MACAddress( /** * The MAC address, represented according to the recommended IEEE 802 standard notation. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/NamespacedId.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/NamespacedId.kt index 50872a6ea..ad0ad0e21 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/NamespacedId.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/NamespacedId.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** * A uniquely named identifier within a [namespace]. */ @Serializable( with = NamespacedIdSerializer::class ) +@JsExport data class NamespacedId( /** * Uniquely identifies the organization/person who determines how to interpret [name]. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/RecurrenceRule.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/RecurrenceRule.kt index f9b7e806c..6c31f4eb5 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/RecurrenceRule.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/RecurrenceRule.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.DurationSerializer import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.time.Duration import kotlin.time.Duration.Companion.microseconds @@ -16,6 +17,7 @@ import kotlin.time.Duration.Companion.microseconds * they are replaced with time spans representing elapsed time since the start of the study. */ @Serializable( with = RecurrenceRuleSerializer::class ) +@JsExport data class RecurrenceRule( /** * Specifies the type of interval at which to repeat events, or multiples thereof. @@ -120,6 +122,7 @@ data class RecurrenceRule( @Serializable data class Until( @Serializable( DurationSerializer::class ) + @Suppress( "NON_EXPORTABLE_TYPE" ) val elapsedTime: Duration ) : End() { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/TimeOfDay.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/TimeOfDay.kt index 6e697d4f5..a507d9ff8 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/TimeOfDay.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/TimeOfDay.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** * Represents a specific time of the day according to a 24-hour clock. */ @Serializable( TimeOfDaySerializer::class ) +@JsExport @Suppress( "MagicNumber" ) data class TimeOfDay( val hour: Int, val minutes: Int = 0, val seconds: Int = 0 ) { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt index f1d855a5e..1b5ee8ec6 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt @@ -1,5 +1,9 @@ +@file:JsExport + package dk.cachet.carp.common.application +import kotlin.js.JsExport + /** * A boolean value that can also be 'unknown' in case insufficient information is available. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/UUID.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/UUID.kt index cc6c0ba25..c5a50882d 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/UUID.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/UUID.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -11,6 +12,7 @@ import kotlinx.serialization.* * @param stringRepresentation The recommended RFC 4122 notation of UUID. Hexadecimal digits should be lowercase. */ @Serializable( UUIDSerializer::class ) +@JsExport class UUID( val stringRepresentation: String ) { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Acceleration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Acceleration.kt index 29c0d2e4b..c91d863ac 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Acceleration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Acceleration.kt @@ -1,12 +1,14 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** * Holds rate of change in velocity, including gravity, along perpendicular [x], [y], and [z] axes in meters per second squared (m/s^2). */ @Serializable @SerialName( CarpDataTypes.ACCELERATION_TYPE_NAME ) +@JsExport data class Acceleration( val x: Double, val y: Double, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/AngularVelocity.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/AngularVelocity.kt index 1a898af19..d17864bae 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/AngularVelocity.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/AngularVelocity.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,6 +11,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.ANGULAR_VELOCITY_TYPE_NAME ) +@JsExport data class AngularVelocity( val x: Double, val y: Double, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CarpDataTypes.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CarpDataTypes.kt index 595158194..9e5cf05ae 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CarpDataTypes.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CarpDataTypes.kt @@ -3,10 +3,13 @@ */ package dk.cachet.carp.common.application.data +import kotlin.js.JsExport + /** * All CARP data types. */ +@JsExport object CarpDataTypes : DataTypeMetaDataMap() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CompletedTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CompletedTask.kt index e5ff421cd..14710c5e8 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CompletedTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/CompletedTask.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,4 +10,5 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.COMPLETED_TASK_TYPE_NAME ) +@JsExport data class CompletedTask( val taskName: String, val taskData: Data? = null ) : Data diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Data.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Data.kt index a5e11f074..187ce6544 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Data.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Data.kt @@ -3,12 +3,14 @@ package dk.cachet.carp.common.application.data import dk.cachet.carp.common.application.Immutable import dk.cachet.carp.common.application.ImplementAsDataClass import kotlinx.serialization.* +import kotlin.js.JsExport /** * Holds data for a [DataType]. */ @Polymorphic +@JsExport @Immutable @ImplementAsDataClass interface Data @@ -17,6 +19,7 @@ interface Data /** * Holds data for a [DataType] collected by a sensor which may include additional [sensorSpecificData]. */ +@JsExport interface SensorData : Data { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataType.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataType.kt index 091a2052b..b117b566b 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataType.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataType.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import dk.cachet.carp.common.application.NamespacedId +import kotlin.js.JsExport /** @@ -14,6 +15,7 @@ typealias DataType = NamespacedId /** * Contains meta data about [type]. */ +@JsExport data class DataTypeMetaData( /** * Unique fully qualified name for the data type this meta data relates to. @@ -33,6 +35,7 @@ data class DataTypeMetaData( /** * Describes how [Data] for a [DataType] should be stored temporally. */ +@JsExport enum class DataTimeType { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/ECG.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/ECG.kt index 80e60a67c..9aa5eaf94 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/ECG.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/ECG.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,4 +9,5 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.ECG_TYPE_NAME ) +@JsExport data class ECG( val milliVolt: Double, override val sensorSpecificData: Data? = null ) : SensorData diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/EDA.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/EDA.kt index af955691e..1a086353f 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/EDA.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/EDA.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,6 +10,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.EDA_TYPE_NAME ) +@JsExport data class EDA( val microSiemens: Double, override val sensorSpecificData: Data? = null ) : SensorData { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Geolocation.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Geolocation.kt index 973997343..06e066a48 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Geolocation.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/Geolocation.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,6 +9,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.GEOLOCATION_TYPE_NAME ) +@JsExport data class Geolocation( val latitude: Double, val longitude: Double, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/HeartRate.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/HeartRate.kt index 6bf7e7743..f7091b894 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/HeartRate.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/HeartRate.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,6 +9,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.HEART_RATE_TYPE_NAME ) +@JsExport data class HeartRate( val bpm: Int, override val sensorSpecificData: Data? = null ) : SensorData { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/InterbeatInterval.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/InterbeatInterval.kt index 40db9e0b3..ed3e6c111 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/InterbeatInterval.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/InterbeatInterval.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,4 +10,5 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.INTERBEAT_INTERVAL_TYPE_NAME ) +@JsExport data class InterbeatInterval( override val sensorSpecificData: Data? = null ) : SensorData diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/NonGravitationalAcceleration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/NonGravitationalAcceleration.kt index 9b51925a8..1b166f2fb 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/NonGravitationalAcceleration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/NonGravitationalAcceleration.kt @@ -1,12 +1,14 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** * Holds rate of change in velocity, excluding gravity, along perpendicular [x], [y], and [z] axes in meters per second squared (m/s^2). */ @Serializable @SerialName( CarpDataTypes.NON_GRAVITATIONAL_ACCELERATION_TYPE_NAME ) +@JsExport data class NonGravitationalAcceleration( val x: Double, val y: Double, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/PPG.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/PPG.kt index 03ba7063b..e00e4dc9f 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/PPG.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/PPG.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,12 +10,14 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.PPG_TYPE_NAME ) +@JsExport data class PPG( /** * A collection of light sources for which a photodetector collected data, identified by name (key), * and the amount of measured reflected light (value). * The unit of the received data by the photodetector is determined by the sensor manufacturer. */ + @Suppress( "NON_EXPORTABLE_TYPE" ) val lightSources: Map, override val sensorSpecificData: Data? = null ) : SensorData diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SensorSkinContact.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SensorSkinContact.kt index 0ee164a04..1ec26e500 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SensorSkinContact.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SensorSkinContact.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,4 +9,5 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.SENSOR_SKIN_CONTACT_TYPE_NAME ) +@JsExport data class SensorSkinContact( val contact: Boolean, override val sensorSpecificData: Data? = null ) : SensorData diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SignalStrength.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SignalStrength.kt index 2e11be700..de7afb005 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SignalStrength.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/SignalStrength.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,4 +11,5 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.SIGNAL_STRENGTH_TYPE_NAME ) +@JsExport data class SignalStrength( val rssi: Short, override val sensorSpecificData: Data? = null ) : SensorData diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/StepCount.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/StepCount.kt index 397d8fbdb..e06d2292f 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/StepCount.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/StepCount.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,6 +9,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.STEP_COUNT_TYPE_NAME ) +@JsExport data class StepCount( val steps: Int, override val sensorSpecificData: Data? = null ) : SensorData { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/TriggeredTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/TriggeredTask.kt index 427b9931b..38b9f766a 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/TriggeredTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/TriggeredTask.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application.data import dk.cachet.carp.common.application.triggers.TaskControl import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -11,6 +12,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpDataTypes.TRIGGERED_TASK_TYPE_NAME ) +@JsExport data class TriggeredTask( val triggerId: Int, val taskName: String, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CarpInputDataTypes.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CarpInputDataTypes.kt index c38fd4c8d..beb9e39e4 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CarpInputDataTypes.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CarpInputDataTypes.kt @@ -1,11 +1,13 @@ package dk.cachet.carp.common.application.data.input import dk.cachet.carp.common.application.data.input.elements.SelectOne +import kotlin.js.JsExport /** * All default CARP [InputDataType]s. */ +@JsExport object CarpInputDataTypes : InputDataTypeList() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CustomInput.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CustomInput.kt index 73344cc06..e603ec064 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CustomInput.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/CustomInput.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.common.application.data.Data import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -13,6 +14,7 @@ import kotlin.reflect.KClass @Serializable( CustomInputSerializer::class ) @SerialName( CUSTOM_INPUT_TYPE_NAME ) @Suppress( "Immutable" ) // TODO: `assumeImmutable` configuration in detekt.yml is not working. +@JsExport data class CustomInput( val input: Any ) : Data diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/Sex.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/Sex.kt index 884388e6c..d1ae68701 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/Sex.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/Sex.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application.data.input import dk.cachet.carp.common.application.data.Data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,6 +10,7 @@ import kotlinx.serialization.* */ @Serializable @SerialName( CarpInputDataTypes.SEX_TYPE_NAME ) +@JsExport enum class Sex : Data { Male, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/InputElement.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/InputElement.kt index 7f1449301..fd5e4dd94 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/InputElement.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/InputElement.kt @@ -1,11 +1,13 @@ package dk.cachet.carp.common.application.data.input.elements +import kotlin.js.JsExport import kotlin.reflect.KClass /** * Describes data and its constraints which may be input by a user. */ +@JsExport interface InputElement { /** @@ -21,6 +23,7 @@ interface InputElement /** * Return the class information of the expected input data ([TData]). */ + @Suppress( "NON_EXPORTABLE_TYPE" ) fun getDataClass(): KClass } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/SelectOne.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/SelectOne.kt index a8a20e7ab..a64966917 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/SelectOne.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/SelectOne.kt @@ -1,6 +1,9 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.data.input.elements import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -8,6 +11,7 @@ import kotlin.reflect.KClass * User needs to select one out of multiple [options]. */ @Serializable +@JsExport data class SelectOne( override val prompt: String, val options: Set ) : InputElement { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/Text.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/Text.kt index 1cbc8223e..be8c51a8f 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/Text.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/elements/Text.kt @@ -1,6 +1,9 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.data.input.elements import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -8,6 +11,7 @@ import kotlin.reflect.KClass * Text entry by the user. */ @Serializable +@JsExport data class Text( override val prompt: String ) : InputElement { override fun isValid( input: String ): Boolean = true diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TaskControl.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TaskControl.kt index 4818af002..2c71a8452 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TaskControl.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TaskControl.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.triggers import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -8,6 +9,7 @@ import kotlinx.serialization.* * the task with [taskName] on [destinationDeviceRoleName] should be started or stopped. */ @Serializable +@JsExport data class TaskControl( val triggerId: Int, val taskName: String, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt index 69500cd97..5d74148de 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt @@ -2,6 +2,8 @@ package dk.cachet.carp.common.application.users import dk.cachet.carp.common.application.EmailAddress import kotlinx.serialization.* +import kotlin.js.JsExport +import kotlin.js.JsName /** @@ -28,8 +30,10 @@ interface AccountIdentity * Identifies an account by an [emailAddress] somebody has access to. */ @Serializable +@JsExport data class EmailAccountIdentity( val emailAddress: EmailAddress ) : AccountIdentity { + @JsName( "create" ) constructor( emailAddress: String ) : this( EmailAddress( emailAddress ) ) } @@ -37,7 +41,9 @@ data class EmailAccountIdentity( val emailAddress: EmailAddress ) : AccountIdent * Identifies an account by a unique [username]. */ @Serializable +@JsExport data class UsernameAccountIdentity( val username: Username ) : AccountIdentity { + @JsName( "create" ) constructor( username: String ) : this( Username( username ) ) } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AssignedTo.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AssignedTo.kt index a59e5ebed..b3cbc5c49 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AssignedTo.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AssignedTo.kt @@ -1,12 +1,14 @@ package dk.cachet.carp.common.application.users import kotlinx.serialization.* +import kotlin.js.JsExport /** * Determines which participant roles to assign to something. */ @Serializable +@JsExport sealed class AssignedTo { /** @@ -19,5 +21,8 @@ sealed class AssignedTo * Assign this to the specified [roleNames] in the study protocol. */ @Serializable - data class Roles( val roleNames: Set ) : AssignedTo() + data class Roles( + @Suppress( "NON_EXPORTABLE_TYPE" ) + val roleNames: Set + ) : AssignedTo() } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt index f438e61db..d3f6521cf 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application.users import dk.cachet.carp.common.application.data.input.InputDataType import kotlinx.serialization.* +import kotlin.js.JsExport /** * Describes a participant [attribute] that pertains to all or specified participants in a study. */ @Serializable +@JsExport data class ExpectedParticipantData( val attribute: ParticipantAttribute, /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantAttribute.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantAttribute.kt index 210f472b1..a375dc59d 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantAttribute.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantAttribute.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.users import dk.cachet.carp.common.application.UUID @@ -9,12 +11,14 @@ import dk.cachet.carp.common.application.data.input.InputDataTypeList import dk.cachet.carp.common.application.data.input.elements.AnyInputElement import dk.cachet.carp.common.application.data.input.elements.InputElement import kotlinx.serialization.* +import kotlin.js.JsExport /** * Describes expected data to be input by users related to one or multiple participants in a study. */ @Serializable +@JsExport sealed class ParticipantAttribute { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantRole.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantRole.kt index 58a8078af..1e0d31ebf 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantRole.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ParticipantRole.kt @@ -1,10 +1,12 @@ package dk.cachet.carp.common.application.users import kotlinx.serialization.* +import kotlin.js.JsExport /** * Describes a participant playing a [role] in a study, and whether this role [isOptional]. */ @Serializable +@JsExport data class ParticipantRole( val role: String, val isOptional: Boolean ) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/Username.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/Username.kt index 135ac1ccc..63d42e03b 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/Username.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/Username.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application.users import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** * A unique name which identifies an account. */ @Serializable( UsernameSerializer::class ) +@JsExport data class Username( val name: String ) { override fun toString(): String = name diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index b658e3b08..ee3bb0689 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -1,5 +1,5 @@ Long -toLong +toLong_0 EmptyList AbstractMutableList HashSet diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index 1f8c3637f..fa11835ee 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - c5(): Instant_0 + hm(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - k5(): number + qm(): number } } } diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts new file mode 100644 index 000000000..a46d8970d --- /dev/null +++ b/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts @@ -0,0 +1,6 @@ +import * as common from "carp.core-kotlin-carp.common" + + +declare module "carp.core-kotlin-carp.common" +{ +} diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index c4547ed4b..abfcda3ad 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Long { // toNumber - y4(): number + z3(): number } - function toLong( number: number ): Long + function toLong_0( number: number ): Long interface Collection { // contains - g( value: T ): boolean + s( value: T ): boolean // size f(): number diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts new file mode 100644 index 000000000..fa9d0de99 --- /dev/null +++ b/typescript-declarations/src/carp-common.ts @@ -0,0 +1,21 @@ +import * as common from "carp.core-kotlin-carp.common" + + +declare module "carp.core-kotlin-carp.common" +{ + // Base interfaces with better method names for internal types. + namespace dk.cachet.carp.common.application.users + { + interface AccountIdentity {} + } + + // Augment internal types to implement desired base interfaces. + namespace dk.cachet.carp.common.application.users + { + interface EmailAccountIdentity extends AccountIdentity {} + interface UsernameAccountIdentity extends AccountIdentity {} + } +} + +// Export facade. +export * from "carp.core-kotlin-carp.common" diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index abef1c8ce..2a2a91d60 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -10,6 +10,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" { toNumber(): number } + function toLong( number: number ): Long } namespace kotlin.collections { @@ -21,6 +22,8 @@ declare module "kotlin-kotlin-stdlib-js-ir" } interface List extends Collection {} interface Set extends Collection {} + function listOf( array: T[] ): List + function setOf( array: T[] ): Set } // Augment internal types to implement desired base interfaces. @@ -57,29 +60,26 @@ declare module "kotlin-kotlin-stdlib-js-ir" } // Implement base interfaces in internal types. -kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.y4(); }; +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.z3(); }; kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.g( value ); } +kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.s( value ); } kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.f(); } kotlinStdLib.$_$.EmptySet.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.g( value ); } +kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.s( value ); } kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } // Export facade. +export * from "kotlin-kotlin-stdlib-js-ir" export namespace kotlin { - export type Long = kotlinStdLib.kotlin.Long - export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong + export const toLong = kotlinStdLib.$_$.toLong_0 } export namespace kotlin.collections { - export type Collection = kotlinStdLib.kotlin.collections.Collection - export type List = kotlinStdLib.kotlin.collections.List - export const listOf: (array: T[]) => List = kotlinStdLib.$_$.listOf - export type Set = kotlinStdLib.kotlin.collections.Set - export const setOf: (array: T[]) => Set = kotlinStdLib.$_$.setOf + export const listOf = kotlinStdLib.$_$.listOf + export const setOf = kotlinStdLib.$_$.setOf } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index ac50f337a..d29f67a3a 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -10,6 +10,10 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" { now(): Instant } + namespace Clock + { + const System: Instant + } interface Instant { toEpochMilliseconds(): number @@ -31,16 +35,12 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" } // Implement base interfaces in internal types. -kotlinxDateTime.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.c5(); }; -kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.k5(); }; +kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.hm(); }; +kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.qm(); }; // Export facade. -export namespace kotlinx.datetime +export * from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +export namespace kotlinx.datetime.Clock { - export type Clock = kotlinxDateTime.kotlinx.datetime.Clock - export type Instant = kotlinxDateTime.kotlinx.datetime.Instant - export namespace Clock - { - export const System: kotlinx.datetime.Clock = kotlinxDateTime.$_$.System_getInstance() - } + export const System = kotlinxDateTime.$_$.System_getInstance() } diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp.common-test.ts new file mode 100644 index 000000000..e06b690f9 --- /dev/null +++ b/typescript-declarations/tests/carp.common-test.ts @@ -0,0 +1,82 @@ +import VerifyModule from './VerifyModule' + +import { expect } from 'chai' +import { kotlin } from '../src/kotlin' +import setOf = kotlin.collections.setOf +import { dk } from "../src/carp-common" +import Trilean = dk.cachet.carp.common.application.Trilean +import toTrilean = dk.cachet.carp.common.application.toTrilean +import EmailAddress = dk.cachet.carp.common.application.EmailAddress +import NamespacedId = dk.cachet.carp.common.application.NamespacedId +import AccountIdentity = dk.cachet.carp.common.application.users.AccountIdentity +import AssignedTo = dk.cachet.carp.common.application.users.AssignedTo +import EmailAccountIdentity = dk.cachet.carp.common.application.users.EmailAccountIdentity +import ExpectedParticipantData = dk.cachet.carp.common.application.users.ExpectedParticipantData +import ParticipantAttribute = dk.cachet.carp.common.application.users.ParticipantAttribute +import CarpInputDataTypes = dk.cachet.carp.common.application.data.input.CarpInputDataTypes +import Text = dk.cachet.carp.common.application.data.input.elements.Text +import CustomInput = dk.cachet.carp.common.application.data.input.CustomInput + + +describe( "carp.common", () => { + it( "verify module declarations", async () => { + const instances: any[] = [] + + const moduleVerifier = new VerifyModule( + 'carp.core-kotlin-carp.common', + instances + ) + await moduleVerifier.verify() + } ) + + describe( "Trilean", () => { + it( "has values TRUE, FALSE, UNKNOWN", () => { + const trileanValues = Trilean.values() + expect( trileanValues ).to.have.members( [ Trilean.TRUE, Trilean.FALSE, Trilean.UNKNOWN ] ) + } ) + + it( "toTrilean works", () => { + expect( toTrilean( true ) ).equals( Trilean.TRUE ) + expect( toTrilean( false ) ).equals( Trilean.FALSE ) + } ) + } ) + + describe( "EmailAccountIdentity", () => { + it( "can initialize from email address", () => { + const identity = new EmailAccountIdentity( new EmailAddress( "test@test.com" ) ) + expect( identity.emailAddress ).instanceOf( EmailAddress ) + } ) + + it( "can initialize from string", () => { + const identity = EmailAccountIdentity.create( "test@test.com" ) + expect( identity.emailAddress ).instanceOf( EmailAddress ) + } ) + + it( "can cast to AccountIdentity base type", () => { + const identity: AccountIdentity = EmailAccountIdentity.create( "test@test.com" ) + } ) + } ) + + describe( "ParticipantAttribute", () => { + const attribute = new ParticipantAttribute.CustomParticipantAttribute( new Text( "Prompt" ) ) + + it( "getInputElement works", () => { + const inputElement = attribute.getInputElement( CarpInputDataTypes ) + expect( inputElement ).instanceOf( Text ) + } ) + + it( "isValidInput works", () => { + const isNumberValid = attribute.isValidInput( CarpInputDataTypes, 42 ) + expect( isNumberValid ).is.false + + const isStringValid = attribute.isValidInput( CarpInputDataTypes, "Steven" ) + expect( isStringValid ).is.true + } ) + + it( "inputToData works", () => { + const data = attribute.inputToData( CarpInputDataTypes, "Steven" ) + const customInput = data as CustomInput + expect( customInput.input ).equals( "Steven" ) + } ) + } ) +} ) From d0de04453698db6c930bf8c451b3538bcd5c569b Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Thu, 12 Jan 2023 17:33:07 +0100 Subject: [PATCH 20/50] Add kotlinx serialization facade and test with CARP common type Again, because additional code was exported, the mangled names in the kotlin standard library and datetime library had to be updated. --- .../serialization/Serialization.kt | 3 ++ .../kotlin/KotlinxSerializationExport.kt | 25 +++++++++ ...alization-kotlinx-serialization-json-js-ir | 2 + .../index.d.ts | 4 +- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 4 +- .../index.d.ts | 15 ++++++ typescript-declarations/src/kotlin.ts | 6 +-- .../src/kotlinx-datetime.ts | 12 +++-- .../src/kotlinx-serialization.ts | 52 +++++++++++++++++++ .../tests/carp.common-test.ts | 20 ++++++- .../tests/kotlinx-serialization-test.ts | 20 +++++++ 11 files changed, 151 insertions(+), 12 deletions(-) create mode 100644 publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt create mode 100644 publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-json-js-ir create mode 100644 typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts create mode 100644 typescript-declarations/src/kotlinx-serialization.ts create mode 100644 typescript-declarations/tests/kotlinx-serialization-test.ts diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt index 5f8dab8c1..4a7d7b3e5 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt @@ -11,6 +11,7 @@ import dk.cachet.carp.common.application.users.* import kotlinx.serialization.* import kotlinx.serialization.json.Json import kotlinx.serialization.modules.* +import kotlin.js.JsExport /** @@ -152,6 +153,8 @@ const val CLASS_DISCRIMINATOR: String = "__type" * In case custom extending types are defined, this variable should be reassigned for serialization extension functions to work as expected. * [createDefaultJSON] can be used to this end, by including all extending types in the [SerializersModule] as parameter. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) var JSON: Json = createDefaultJSON() diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt new file mode 100644 index 000000000..4e0a009da --- /dev/null +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt @@ -0,0 +1,25 @@ +@file:Suppress( + "NON_EXPORTABLE_TYPE", + "UNUSED_VARIABLE" // The variable names show up in generated JS sources which is useful to look up mangled names. +) + +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.json.Json +import kotlin.js.JsExport + + +/** + * Refers to types/methods in the kotlinx serialization library to ensure they aren't removed from compiled sources + * as part of the JS IR backend's compiler optimizations. + * The exported JS sources for this class can also be used to look up mangled method names. + */ +@JsExport +class KotlinxSerializationExport +{ + fun json( json: Json ) + { + val default = Json.Default + val encodeToString = json.encodeToString( String.serializer(), "Test" ) + val decodeFromString = json.decodeFromString( String.serializer(), "Test" ) + } +} diff --git a/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-json-js-ir b/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-json-js-ir new file mode 100644 index 000000000..df523b487 --- /dev/null +++ b/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-json-js-ir @@ -0,0 +1,2 @@ +JsonImpl +Default_getInstance \ No newline at end of file diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index fa11835ee..e2eab008e 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - hm(): Instant_0 + g10(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - qm(): number + r10(): number } } } diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index abfcda3ad..b60d20639 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Long { // toNumber - z3(): number + l4(): number } function toLong_0( number: number ): Long interface Collection { // contains - s( value: T ): boolean + y( value: T ): boolean // size f(): number diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts new file mode 100644 index 000000000..3cf387f2c --- /dev/null +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts @@ -0,0 +1,15 @@ +declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +{ + namespace $_$ + { + interface JsonImpl + { + // encodeToString + w10( serializer: any, instance: any ): string + + // decodeFromString + x10( serializer: any, string: string ): string + } + function Default_getInstance(): JsonImpl + } +} diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 2a2a91d60..a94c5d550 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -60,16 +60,16 @@ declare module "kotlin-kotlin-stdlib-js-ir" } // Implement base interfaces in internal types. -kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.z3(); }; +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.l4(); }; kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.s( value ); } +kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.y( value ); } kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.f(); } kotlinStdLib.$_$.EmptySet.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.s( value ); } +kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.y( value ); } kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } // Export facade. diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index d29f67a3a..3e938a0bd 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -35,12 +35,16 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" } // Implement base interfaces in internal types. -kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.hm(); }; -kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.qm(); }; +kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.g10(); }; +kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.r10(); }; // Export facade. export * from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" -export namespace kotlinx.datetime.Clock +export namespace kotlinx.datetime { - export const System = kotlinxDateTime.$_$.System_getInstance() + export type Clock = kotlinxDateTime.kotlinx.datetime.Clock + export namespace Clock + { + export const System = kotlinxDateTime.$_$.System_getInstance() + } } diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts new file mode 100644 index 000000000..06a47223f --- /dev/null +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -0,0 +1,52 @@ +import * as extend from "kotlinx-serialization-kotlinx-serialization-json-js-ir" + + +declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +{ + // Base interfaces with better method names for internal types. + namespace kotlinx.serialization + { + interface Json + { + encodeToString( serializer: any, value: any ): string + decodeFromString( serializer: any, string: string ): any + } + namespace Json + { + const Default: Json + } + } + + // Augment internal types to implement desired base interfaces. + namespace $_$ + { + abstract class JsonImpl implements kotlinx.serialization.Json + { + encodeToString( serializer: any, value: any ): string + decodeFromString( serializer: any, string: string ): any + } + } +} + +// Implement base interfaces in internal types. +extend.$_$.JsonImpl.prototype.encodeToString = + function( serializer: any, value: any ): string + { + return this.w10( serializer, value ); + }; +extend.$_$.JsonImpl.prototype.decodeFromString = + function( serializer: any, string: string ): any + { + return this.x10( serializer, string ); + }; + +// Export facade. +export * from "kotlinx-serialization-kotlinx-serialization-json-js-ir" +export namespace kotlinx.serialization +{ + export type Json = extend.kotlinx.serialization.Json + export namespace Json + { + export const Default = extend.$_$.Default_getInstance() + } +} diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp.common-test.ts index e06b690f9..a85842632 100644 --- a/typescript-declarations/tests/carp.common-test.ts +++ b/typescript-declarations/tests/carp.common-test.ts @@ -3,7 +3,9 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' import setOf = kotlin.collections.setOf -import { dk } from "../src/carp-common" +import { kotlinx } from '../src/kotlinx-serialization' +import Json = kotlinx.serialization.Json +import { dk } from '../src/carp-common' import Trilean = dk.cachet.carp.common.application.Trilean import toTrilean = dk.cachet.carp.common.application.toTrilean import EmailAddress = dk.cachet.carp.common.application.EmailAddress @@ -16,6 +18,7 @@ import ParticipantAttribute = dk.cachet.carp.common.application.users.Participan import CarpInputDataTypes = dk.cachet.carp.common.application.data.input.CarpInputDataTypes import Text = dk.cachet.carp.common.application.data.input.elements.Text import CustomInput = dk.cachet.carp.common.application.data.input.CustomInput +import JSON = dk.cachet.carp.common.infrastructure.serialization.JSON describe( "carp.common", () => { @@ -79,4 +82,19 @@ describe( "carp.common", () => { expect( customInput.input ).equals( "Steven" ) } ) } ) + + describe( "ExpectedParticipantData", () => { + it( "can serialize and deserialize", () => { + const expectedData = new ExpectedParticipantData( + new ParticipantAttribute.DefaultParticipantAttribute( new NamespacedId( "namespace", "type" ) ), + new AssignedTo.Roles( setOf( [ "Roles are added" ] ) ) + ) + + const json = JSON as Json + const serializer = ExpectedParticipantData.Companion.serializer() + const serialized = json.encodeToString( serializer, expectedData ) + const deserialized = json.decodeFromString( serializer, serialized ) as ExpectedParticipantData + expect( deserialized.equals( expectedData ) ).is.true + } ) + } ) } ) diff --git a/typescript-declarations/tests/kotlinx-serialization-test.ts b/typescript-declarations/tests/kotlinx-serialization-test.ts new file mode 100644 index 000000000..679553c40 --- /dev/null +++ b/typescript-declarations/tests/kotlinx-serialization-test.ts @@ -0,0 +1,20 @@ +import VerifyModule from './VerifyModule' + +import { expect } from 'chai' +import { kotlinx } from '../src/kotlinx-serialization' +import Json = kotlinx.serialization.Json + + +describe( "kotlinx-datetime", () => { + it( "verify module declarations", async () => { + const instances: any[] = [ + [ "JsonImpl", Json.Default ] + ] + + const moduleVerifier = new VerifyModule( + 'kotlinx-serialization-kotlinx-serialization-json-js-ir', + instances + ) + await moduleVerifier.verify() + } ) +} ) From 5add474533f1b914a2c9444e241cbbb9a71f6993 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Thu, 12 Jan 2023 17:49:53 +0100 Subject: [PATCH 21/50] Fix: export interface rather than implementation to hide internals --- typescript-declarations/src/kotlin.ts | 6 +++--- typescript-declarations/src/kotlinx-datetime.ts | 4 ++-- typescript-declarations/src/kotlinx-serialization.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index a94c5d550..52c15c2d7 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -76,10 +76,10 @@ kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f( export * from "kotlin-kotlin-stdlib-js-ir" export namespace kotlin { - export const toLong = kotlinStdLib.$_$.toLong_0 + export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong_0 } export namespace kotlin.collections { - export const listOf = kotlinStdLib.$_$.listOf - export const setOf = kotlinStdLib.$_$.setOf + export const listOf: (array: T[]) => kotlinStdLib.kotlin.collections.List = kotlinStdLib.$_$.listOf + export const setOf: (array: T[]) => kotlinStdLib.kotlin.collections.Set = kotlinStdLib.$_$.setOf } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index 3e938a0bd..af3aa8db7 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -12,7 +12,7 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" } namespace Clock { - const System: Instant + const System: Clock } interface Instant { @@ -45,6 +45,6 @@ export namespace kotlinx.datetime export type Clock = kotlinxDateTime.kotlinx.datetime.Clock export namespace Clock { - export const System = kotlinxDateTime.$_$.System_getInstance() + export const System: Clock = kotlinxDateTime.$_$.System_getInstance() } } diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 06a47223f..1d79ead81 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -47,6 +47,6 @@ export namespace kotlinx.serialization export type Json = extend.kotlinx.serialization.Json export namespace Json { - export const Default = extend.$_$.Default_getInstance() + export const Default: Json = extend.$_$.Default_getInstance() } } From a13907225b91a108397ab83d4d90627aeb3edbb7 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Thu, 12 Jan 2023 23:15:26 +0100 Subject: [PATCH 22/50] Add kotlin Map TypeScript facade --- .../src/commonMain/kotlin/KotlinExport.kt | 20 ++++++++- .../forced-exports/kotlin-kotlin-stdlib-js-ir | 6 ++- .../index.d.ts | 4 +- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 26 ++++++++++- .../index.d.ts | 4 +- typescript-declarations/src/kotlin.ts | 45 ++++++++++++++++++- .../src/kotlinx-datetime.ts | 4 +- .../src/kotlinx-serialization.ts | 4 +- typescript-declarations/tests/kotlin-test.ts | 31 ++++++++++++- 9 files changed, 130 insertions(+), 14 deletions(-) diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt index 034d4ab8d..017801d0a 100644 --- a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt @@ -29,6 +29,22 @@ class KotlinExport } // Two values needed to ensure export which takes an array and unpacks it. - val list = listOf( 42, 42 ) - val set = setOf( 42, 42 ) + val listOf = listOf( 42, 42 ) + val setOf = setOf( 42, 42 ) + + fun map( map: Map ) + { + val get = map[ 42 ] + val keys = map.keys + val values = map.values + } + + fun pair( pair: Pair ) + { + val to = 42 to "answer" + val first = pair.first + val second = pair.second + } + + val mapOf = mapOf( 42 to "answer" ) } diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index ee3bb0689..af9d2c8d7 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -4,5 +4,9 @@ EmptyList AbstractMutableList HashSet EmptySet +HashMap +Pair +to listOf -setOf \ No newline at end of file +setOf +mapOf \ No newline at end of file diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index e2eab008e..5a3ea724a 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - g10(): Instant_0 + i10(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - r10(): number + t10(): number } } } diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index b60d20639..d6d5a02a3 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -5,10 +5,20 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Long { // toNumber - l4(): number + p4(): number } function toLong_0( number: number ): Long + function to( first: K, second: V ): Pair + interface Pair + { + // first + s2_1: K + + // second + t2_1: V + } + interface Collection { // contains @@ -29,5 +39,19 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface EmptySet extends Set {} interface HashSet extends Set {} function setOf( elements: T[] ): Set + + interface Map + { + // get + x1( key: K ): V + + // keys + y1(): Set + + // values + z1(): Collection + } + interface HashMap extends Map {} + function mapOf( pairs: Pair[] ): Map } } diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts index 3cf387f2c..78f0f04eb 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts @@ -5,10 +5,10 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" interface JsonImpl { // encodeToString - w10( serializer: any, instance: any ): string + y10( serializer: any, instance: any ): string // decodeFromString - x10( serializer: any, string: string ): string + z10( serializer: any, string: string ): string } function Default_getInstance(): JsonImpl } diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 52c15c2d7..c9ca0a797 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -11,6 +11,12 @@ declare module "kotlin-kotlin-stdlib-js-ir" toNumber(): number } function toLong( number: number ): Long + interface Pair + { + first: K + second: V + } + function pair( first: K, second: V ): Pair } namespace kotlin.collections { @@ -22,8 +28,15 @@ declare module "kotlin-kotlin-stdlib-js-ir" } interface List extends Collection {} interface Set extends Collection {} + interface Map + { + get( key: K ): V + keys: Set + values: Collection + } function listOf( array: T[] ): List function setOf( array: T[] ): Set + function mapOf( pairs: kotlin.Pair[] ): Map } // Augment internal types to implement desired base interfaces. @@ -33,6 +46,11 @@ declare module "kotlin-kotlin-stdlib-js-ir" { toNumber(): number } + abstract class Pair implements kotlin.Pair + { + first: K + second: V + } interface Collection extends kotlin.collections.Collection {} interface List extends kotlin.collections.List {} abstract class EmptyList implements kotlin.collections.List @@ -56,11 +74,24 @@ declare module "kotlin-kotlin-stdlib-js-ir" contains( value: T ): boolean size(): number } + interface Map extends kotlin.collections.Map {} + abstract class HashMap implements kotlin.collections.Map + { + get( key: K ): V + keys: Set + values: Collection + } } } // Implement base interfaces in internal types. -kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.l4(); }; +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.p4(); }; +Object.defineProperty( kotlinStdLib.$_$.Pair.prototype, "first", { + get: function first() { return this.s2_1; } +} ); +Object.defineProperty( kotlinStdLib.$_$.Pair.prototype, "second", { + get: function second() { return this.t2_1; } +} ); kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } @@ -71,15 +102,27 @@ kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.y( value ); } kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } +kotlinStdLib.$_$.HashMap.prototype.get = function( key: K ): V { return this.x1( key ); } +Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "keys", { + get: function keys() { return this.y1(); } +} ); +Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", { + get: function values() { return this.z1(); } +} ); // Export facade. export * from "kotlin-kotlin-stdlib-js-ir" export namespace kotlin { export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong_0 + export const pair: (first: K, second: V) => kotlinStdLib.kotlin.Pair = kotlinStdLib.$_$.to } export namespace kotlin.collections { export const listOf: (array: T[]) => kotlinStdLib.kotlin.collections.List = kotlinStdLib.$_$.listOf export const setOf: (array: T[]) => kotlinStdLib.kotlin.collections.Set = kotlinStdLib.$_$.setOf + export const mapOf = + function( pairs: kotlinStdLib.kotlin.Pair[] ): kotlinStdLib.kotlin.collections.Map { + return kotlinStdLib.$_$.mapOf( pairs as any ) + } } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index af3aa8db7..9938f490c 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -35,8 +35,8 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" } // Implement base interfaces in internal types. -kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.g10(); }; -kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.r10(); }; +kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.i10(); }; +kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.t10(); }; // Export facade. export * from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 1d79ead81..680a2eeed 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -32,12 +32,12 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" extend.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { - return this.w10( serializer, value ); + return this.y10( serializer, value ); }; extend.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { - return this.x10( serializer, string ); + return this.z10( serializer, string ); }; // Export facade. diff --git a/typescript-declarations/tests/kotlin-test.ts b/typescript-declarations/tests/kotlin-test.ts index a5e0c7a98..e0e638374 100644 --- a/typescript-declarations/tests/kotlin-test.ts +++ b/typescript-declarations/tests/kotlin-test.ts @@ -3,23 +3,29 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' import toLong = kotlin.toLong +import pair = kotlin.pair import listOf = kotlin.collections.listOf import setOf = kotlin.collections.setOf +import mapOf = kotlin.collections.mapOf describe( "kotlin", () => { it( "verify module declarations", async () => { const list = listOf( [ 42 ] ) const set = setOf( [ 42 ] ) + const map = mapOf( [ pair( 42, "answer" ) ] ) const instances: any[] = [ toLong( 42 ), + pair( 42, "answer" ), [ "Collection", list ], [ "List", list ], [ "EmptyList", listOf( [] ) ], [ "AbstractMutableList", list ], [ "Set", set ], [ "EmptySet", setOf( [] ) ], - [ "HashSet", set ] + [ "HashSet", set ], + [ "Map", map ], + [ "HashMap", map ] ] const moduleVerifier = new VerifyModule( @@ -38,6 +44,14 @@ describe( "kotlin", () => { } ) } ) + describe( "Pair", () => { + it( "can access first and second", () => { + const answer = pair( 42, "answer" ) + expect( answer.first ).equals( 42 ) + expect( answer.second ).equals( "answer" ) + } ) + } ) + describe( "List", () => { it( "listOf and back toArray succeeds", () => { const numbers = [ 1, 2, 3 ] @@ -99,4 +113,19 @@ describe( "kotlin", () => { expect( emptySet.size() ).equals( 0 ) } ) } ) + + describe( "Map", () => { + it( "get succeeds", () => { + const answers = mapOf( [ pair( "answer", 42 ) ] ) + expect( answers.get( "answer" ) ).equals( 42 ) + } ) + + it( "mapOf keys and entries accessible", () => { + const answers = [ pair( "answer", 42 ) ] + const answersMap = mapOf( answers ) + + expect( answersMap.keys.toArray() ).deep.equals( [ "answer" ] ) + expect( answersMap.values.toArray() ).deep.equals( [ 42 ] ) + } ) + } ) } ) From fdfae3a1e2966a46a89c9555c38476f718e20888 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Fri, 13 Jan 2023 00:40:37 +0100 Subject: [PATCH 23/50] Refactor: less redundant interface definitions + hide internals --- typescript-declarations/src/kotlin.ts | 29 ++++--------------- .../src/kotlinx-datetime.ts | 12 +++----- .../src/kotlinx-serialization.ts | 7 ++--- .../tests/kotlinx-serialization-test.ts | 2 +- 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index c9ca0a797..0c41c5a4d 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -52,34 +52,17 @@ declare module "kotlin-kotlin-stdlib-js-ir" second: V } interface Collection extends kotlin.collections.Collection {} - interface List extends kotlin.collections.List {} - abstract class EmptyList implements kotlin.collections.List - { - contains( value: T ): boolean - size(): number - } - abstract class AbstractMutableList implements kotlin.collections.List - { - contains( value: T ): boolean - size(): number - } + abstract class EmptyList implements kotlin.collections.List {} + abstract class AbstractMutableList implements kotlin.collections.List {} interface Set extends kotlin.collections.Set {} - abstract class EmptySet implements kotlin.collections.Set - { - contains( value: T ): boolean - size(): number - } - abstract class HashSet implements kotlin.collections.Set - { - contains( value: T ): boolean - size(): number - } + abstract class EmptySet implements kotlin.collections.Set {} + abstract class HashSet implements kotlin.collections.Set {} interface Map extends kotlin.collections.Map {} abstract class HashMap implements kotlin.collections.Map { get( key: K ): V - keys: Set - values: Collection + keys: kotlin.collections.Set + values: kotlin.collections.Collection } } } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index 9938f490c..7a2f1567b 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -23,14 +23,10 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Augment internal types to implement desired base interfaces. namespace $_$ { - abstract class System implements kotlinx.datetime.Clock - { - now(): kotlinx.datetime.Instant - } - abstract class Instant_0 implements kotlinx.datetime.Instant - { - toEpochMilliseconds(): number - } + interface System extends kotlinx.datetime.Clock {} + abstract class System implements kotlinx.datetime.Clock {} + interface Instant_0 extends kotlinx.datetime.Instant {} + abstract class Instant_0 implements kotlinx.datetime.Instant {} } } diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 680a2eeed..6d6699c78 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -20,11 +20,8 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" // Augment internal types to implement desired base interfaces. namespace $_$ { - abstract class JsonImpl implements kotlinx.serialization.Json - { - encodeToString( serializer: any, value: any ): string - decodeFromString( serializer: any, string: string ): any - } + interface JsonImpl extends kotlinx.serialization.Json {} + abstract class JsonImpl implements kotlinx.serialization.Json {} } } diff --git a/typescript-declarations/tests/kotlinx-serialization-test.ts b/typescript-declarations/tests/kotlinx-serialization-test.ts index 679553c40..c83acb274 100644 --- a/typescript-declarations/tests/kotlinx-serialization-test.ts +++ b/typescript-declarations/tests/kotlinx-serialization-test.ts @@ -5,7 +5,7 @@ import { kotlinx } from '../src/kotlinx-serialization' import Json = kotlinx.serialization.Json -describe( "kotlinx-datetime", () => { +describe( "kotlinx-serialization", () => { it( "verify module declarations", async () => { const instances: any[] = [ [ "JsonImpl", Json.Default ] From 9b79de3ab8c16bdbded0c6f3db451f40e1f4c159 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Fri, 13 Jan 2023 11:45:37 +0100 Subject: [PATCH 24/50] Refactor: replace pair function with constructor --- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 5 +++-- typescript-declarations/src/kotlin.ts | 20 ++++++++++--------- typescript-declarations/tests/kotlin-test.ts | 13 ++++++------ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index d6d5a02a3..6ce48f60d 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -9,9 +9,10 @@ declare module "kotlin-kotlin-stdlib-js-ir" } function toLong_0( number: number ): Long - function to( first: K, second: V ): Pair - interface Pair + class Pair { + constructor( first: K, second: V ) + // first s2_1: K diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 0c41c5a4d..a13fba443 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -16,7 +16,6 @@ declare module "kotlin-kotlin-stdlib-js-ir" first: K second: V } - function pair( first: K, second: V ): Pair } namespace kotlin.collections { @@ -46,7 +45,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" { toNumber(): number } - abstract class Pair implements kotlin.Pair + interface Pair extends kotlin.Pair { first: K second: V @@ -69,12 +68,6 @@ declare module "kotlin-kotlin-stdlib-js-ir" // Implement base interfaces in internal types. kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.p4(); }; -Object.defineProperty( kotlinStdLib.$_$.Pair.prototype, "first", { - get: function first() { return this.s2_1; } -} ); -Object.defineProperty( kotlinStdLib.$_$.Pair.prototype, "second", { - get: function second() { return this.t2_1; } -} ); kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } @@ -97,8 +90,17 @@ Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", { export * from "kotlin-kotlin-stdlib-js-ir" export namespace kotlin { + export const Pair = class implements kotlinStdLib.kotlin.Pair { + constructor( first: K, second: V ) { + let kotlinPair = new kotlinStdLib.$_$.Pair( first, second ); + kotlinPair.first = kotlinPair.s2_1; + kotlinPair.second = kotlinPair.t2_1; + return kotlinPair; + } + get first(): K { return this.first; } + get second(): V { return this.second; } + } export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong_0 - export const pair: (first: K, second: V) => kotlinStdLib.kotlin.Pair = kotlinStdLib.$_$.to } export namespace kotlin.collections { diff --git a/typescript-declarations/tests/kotlin-test.ts b/typescript-declarations/tests/kotlin-test.ts index e0e638374..47bfc00bb 100644 --- a/typescript-declarations/tests/kotlin-test.ts +++ b/typescript-declarations/tests/kotlin-test.ts @@ -3,7 +3,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' import toLong = kotlin.toLong -import pair = kotlin.pair +import Pair = kotlin.Pair import listOf = kotlin.collections.listOf import setOf = kotlin.collections.setOf import mapOf = kotlin.collections.mapOf @@ -13,10 +13,10 @@ describe( "kotlin", () => { it( "verify module declarations", async () => { const list = listOf( [ 42 ] ) const set = setOf( [ 42 ] ) - const map = mapOf( [ pair( 42, "answer" ) ] ) + const map = mapOf( [ new Pair( 42, "answer" ) ] ) const instances: any[] = [ toLong( 42 ), - pair( 42, "answer" ), + new Pair( 42, "answer" ), [ "Collection", list ], [ "List", list ], [ "EmptyList", listOf( [] ) ], @@ -46,7 +46,8 @@ describe( "kotlin", () => { describe( "Pair", () => { it( "can access first and second", () => { - const answer = pair( 42, "answer" ) + const answer = new Pair( 42, "answer" ) + console.log(answer) expect( answer.first ).equals( 42 ) expect( answer.second ).equals( "answer" ) } ) @@ -116,12 +117,12 @@ describe( "kotlin", () => { describe( "Map", () => { it( "get succeeds", () => { - const answers = mapOf( [ pair( "answer", 42 ) ] ) + const answers = mapOf( [ new Pair( "answer", 42 ) ] ) expect( answers.get( "answer" ) ).equals( 42 ) } ) it( "mapOf keys and entries accessible", () => { - const answers = [ pair( "answer", 42 ) ] + const answers = [ new Pair( "answer", 42 ) ] const answersMap = mapOf( answers ) expect( answersMap.keys.toArray() ).deep.equals( [ "answer" ] ) From 2ec194904235d9e8766bb85eaaf56b75f75bbc09 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Fri, 13 Jan 2023 13:20:12 +0100 Subject: [PATCH 25/50] Fix: ensure all types are exported Before, while the code worked, trying to do typecasts etc. would fail since the types weren't exported. By exporting the namespaces within the facade as opposed to in the declaration, this seems to be solved. --- typescript-declarations/src/carp-common.ts | 10 +- typescript-declarations/src/kotlin.ts | 100 ++++++++---------- .../src/kotlinx-datetime.ts | 51 ++++----- .../src/kotlinx-serialization.ts | 39 +++---- 4 files changed, 88 insertions(+), 112 deletions(-) diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index fa9d0de99..ac31e82d3 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -1,21 +1,17 @@ -import * as common from "carp.core-kotlin-carp.common" +import * as extend from "carp.core-kotlin-carp.common" +// Augment internal types to implement desired base interfaces. declare module "carp.core-kotlin-carp.common" { - // Base interfaces with better method names for internal types. namespace dk.cachet.carp.common.application.users { interface AccountIdentity {} - } - - // Augment internal types to implement desired base interfaces. - namespace dk.cachet.carp.common.application.users - { interface EmailAccountIdentity extends AccountIdentity {} interface UsernameAccountIdentity extends AccountIdentity {} } } + // Export facade. export * from "carp.core-kotlin-carp.common" diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index a13fba443..a71add3ff 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -1,44 +1,55 @@ import * as kotlinStdLib from "kotlin-kotlin-stdlib-js-ir" -declare module "kotlin-kotlin-stdlib-js-ir" +// Facade with better method names and type conversions for internal types. +export namespace kotlin { - // Base interfaces with better method names for internal types. - namespace kotlin + export interface Long { - interface Long - { - toNumber(): number - } - function toLong( number: number ): Long - interface Pair - { - first: K - second: V - } + toNumber(): number } - namespace kotlin.collections + export const toLong: (number: number) => Long = kotlinStdLib.$_$.toLong_0 + export class Pair { - interface Collection - { - contains( value: T ): boolean - size(): number - toArray(): Array + constructor( first: K, second: V ) { + let kotlinPair = new kotlinStdLib.$_$.Pair( first, second ); + kotlinPair.first = kotlinPair.s2_1; + kotlinPair.second = kotlinPair.t2_1; + return kotlinPair; } - interface List extends Collection {} - interface Set extends Collection {} - interface Map + get first(): K { return this.first; } + get second(): V { return this.second; } + } +} +export namespace kotlin.collections +{ + export interface Collection + { + contains( value: T ): boolean + size(): number + toArray(): Array + } + export interface List extends Collection {} + export interface Set extends Collection {} + export interface Map + { + get( key: K ): V + keys: Set + values: Collection + } + export const listOf: (array: T[]) => List = kotlinStdLib.$_$.listOf + export const setOf: (array: T[]) => Set = kotlinStdLib.$_$.setOf + export const mapOf = + function( pairs: kotlin.Pair[] ): Map { - get( key: K ): V - keys: Set - values: Collection + return kotlinStdLib.$_$.mapOf( pairs as any ) } - function listOf( array: T[] ): List - function setOf( array: T[] ): Set - function mapOf( pairs: kotlin.Pair[] ): Map - } +} + - // Augment internal types to implement desired base interfaces. +// Augment internal types to implement facade. +declare module "kotlin-kotlin-stdlib-js-ir" +{ namespace $_$ { abstract class Long implements kotlin.Long @@ -66,6 +77,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" } } + // Implement base interfaces in internal types. kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.p4(); }; kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } @@ -86,28 +98,6 @@ Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", { get: function values() { return this.z1(); } } ); -// Export facade. -export * from "kotlin-kotlin-stdlib-js-ir" -export namespace kotlin -{ - export const Pair = class implements kotlinStdLib.kotlin.Pair { - constructor( first: K, second: V ) { - let kotlinPair = new kotlinStdLib.$_$.Pair( first, second ); - kotlinPair.first = kotlinPair.s2_1; - kotlinPair.second = kotlinPair.t2_1; - return kotlinPair; - } - get first(): K { return this.first; } - get second(): V { return this.second; } - } - export const toLong: (number: number) => kotlinStdLib.kotlin.Long = kotlinStdLib.$_$.toLong_0 -} -export namespace kotlin.collections -{ - export const listOf: (array: T[]) => kotlinStdLib.kotlin.collections.List = kotlinStdLib.$_$.listOf - export const setOf: (array: T[]) => kotlinStdLib.kotlin.collections.Set = kotlinStdLib.$_$.setOf - export const mapOf = - function( pairs: kotlinStdLib.kotlin.Pair[] ): kotlinStdLib.kotlin.collections.Map { - return kotlinStdLib.$_$.mapOf( pairs as any ) - } -} + +// Re-export augmented types. +export * from "kotlin-kotlin-stdlib-js-ir"; diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index 7a2f1567b..6d142e4dc 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -1,26 +1,27 @@ -import * as kotlinxDateTime from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +import * as extend from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" -declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +// Facade with better method names and type conversions for internal types. +export namespace kotlinx.datetime { - // Base interfaces with better method names for internal types. - namespace kotlinx.datetime + export interface Clock + { + now(): Instant + } + export namespace Clock { - interface Clock - { - now(): Instant - } - namespace Clock - { - const System: Clock - } - interface Instant - { - toEpochMilliseconds(): number - } + export const System: Clock = extend.$_$.System_getInstance() } + export interface Instant + { + toEpochMilliseconds(): number + } +} - // Augment internal types to implement desired base interfaces. + +// Augment internal types to implement facade. +declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +{ namespace $_$ { interface System extends kotlinx.datetime.Clock {} @@ -30,17 +31,11 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" } } + // Implement base interfaces in internal types. -kotlinxDateTime.$_$.System.prototype.now = function(): kotlinxDateTime.kotlinx.datetime.Instant { return this.i10(); }; -kotlinxDateTime.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.t10(); }; +extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.i10(); }; +extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.t10(); }; + -// Export facade. +// Re-export augmented types. export * from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" -export namespace kotlinx.datetime -{ - export type Clock = kotlinxDateTime.kotlinx.datetime.Clock - export namespace Clock - { - export const System: Clock = kotlinxDateTime.$_$.System_getInstance() - } -} diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 6d6699c78..5ffed98cb 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -1,23 +1,24 @@ import * as extend from "kotlinx-serialization-kotlinx-serialization-json-js-ir" -declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +// Facade with better method names and type conversions for internal types. +export namespace kotlinx.serialization { - // Base interfaces with better method names for internal types. - namespace kotlinx.serialization + export interface Json + { + encodeToString( serializer: any, value: any ): string + decodeFromString( serializer: any, string: string ): any + } + export namespace Json { - interface Json - { - encodeToString( serializer: any, value: any ): string - decodeFromString( serializer: any, string: string ): any - } - namespace Json - { - const Default: Json - } + export const Default: Json = extend.$_$.Default_getInstance() } +} + - // Augment internal types to implement desired base interfaces. +// Augment internal types to implement facade. +declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +{ namespace $_$ { interface JsonImpl extends kotlinx.serialization.Json {} @@ -25,6 +26,7 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" } } + // Implement base interfaces in internal types. extend.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string @@ -37,13 +39,6 @@ extend.$_$.JsonImpl.prototype.decodeFromString = return this.z10( serializer, string ); }; -// Export facade. + +// Re-export augmented types. export * from "kotlinx-serialization-kotlinx-serialization-json-js-ir" -export namespace kotlinx.serialization -{ - export type Json = extend.kotlinx.serialization.Json - export namespace Json - { - export const Default: Json = extend.$_$.Default_getInstance() - } -} From 3a8bfe463857ff484d86b48ef28f394ee0376088 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Fri, 13 Jan 2023 15:34:46 +0100 Subject: [PATCH 26/50] Add Duration TypeScript facade --- .../src/commonMain/kotlin/KotlinExport.kt | 13 +++++++++ .../forced-exports/kotlin-kotlin-stdlib-js-ir | 5 +++- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 16 ++++++++++ typescript-declarations/src/kotlin.ts | 29 +++++++++++++++++++ typescript-declarations/tests/kotlin-test.ts | 23 +++++++++++++-- 5 files changed, 83 insertions(+), 3 deletions(-) diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt index 017801d0a..9e3bade2f 100644 --- a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt @@ -5,6 +5,9 @@ ) import kotlin.js.JsExport +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds +import kotlin.time.DurationUnit /** * Refers to types/methods in the kotlin standard library to ensure they aren't removed from compiled sources @@ -47,4 +50,14 @@ class KotlinExport } val mapOf = mapOf( 42 to "answer" ) + + fun duration( duration: Duration ) + { + val parseIsoString = Duration.parseIsoString("PT1M") + val companion = Duration.Companion + val zero = Duration.ZERO + val infinite = Duration.INFINITE + val inWholeMilliseconds = duration.inWholeMilliseconds + val inWholeMicroseconds = duration.inWholeMicroseconds + } } diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index af9d2c8d7..e33869ec9 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -9,4 +9,7 @@ Pair to listOf setOf -mapOf \ No newline at end of file +mapOf +Companion_getInstance_4 +_Duration___get_inWholeMilliseconds__impl__msfiry +_Duration___get_inWholeMicroseconds__impl__8oe8vv \ No newline at end of file diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index 6ce48f60d..d15568200 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -54,5 +54,21 @@ declare module "kotlin-kotlin-stdlib-js-ir" } interface HashMap extends Map {} function mapOf( pairs: Pair[] ): Map + + interface Duration extends Long {} + interface DurationCompanion + { + // parseIsoString + t4(): Duration + + // ZERO + q4_1: Duration + + // INFINITE + r4_1: Duration + } + function Companion_getInstance_4(): DurationCompanion + function _Duration___get_inWholeMilliseconds__impl__msfiry(duration: Duration): Long + function _Duration___get_inWholeMicroseconds__impl__8oe8vv(duration: Duration): Long } } diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index a71add3ff..26213292b 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -45,6 +45,21 @@ export namespace kotlin.collections return kotlinStdLib.$_$.mapOf( pairs as any ) } } +export namespace kotlin.time +{ + export interface Duration + { + get inWholeMilliseconds(): number + get inWholeMicroseconds(): number + } + export namespace Duration + { + export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_4() + export const parseIsoString: (isoDuration: string) => Duration = Companion.t4 + export const ZERO: Duration = Companion.q4_1 + export const INFINITE: Duration = Companion.r4_1 + } +} // Augment internal types to implement facade. @@ -55,6 +70,8 @@ declare module "kotlin-kotlin-stdlib-js-ir" abstract class Long implements kotlin.Long { toNumber(): number + inWholeMilliseconds(): number + inWholeMicroseconds(): number } interface Pair extends kotlin.Pair { @@ -80,6 +97,18 @@ declare module "kotlin-kotlin-stdlib-js-ir" // Implement base interfaces in internal types. kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.p4(); }; +Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMilliseconds", { + get: function inWholeMilliseconds() + { + return kotlinStdLib.$_$._Duration___get_inWholeMilliseconds__impl__msfiry(this).toNumber(); + } +} ); +Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMicroseconds", { + get: function inWholeMicroseconds() + { + return kotlinStdLib.$_$._Duration___get_inWholeMicroseconds__impl__8oe8vv(this).toNumber(); + } +} ); kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } diff --git a/typescript-declarations/tests/kotlin-test.ts b/typescript-declarations/tests/kotlin-test.ts index 47bfc00bb..2a5d29939 100644 --- a/typescript-declarations/tests/kotlin-test.ts +++ b/typescript-declarations/tests/kotlin-test.ts @@ -4,6 +4,7 @@ import { expect } from 'chai' import { kotlin } from '../src/kotlin' import toLong = kotlin.toLong import Pair = kotlin.Pair +import Duration = kotlin.time.Duration import listOf = kotlin.collections.listOf import setOf = kotlin.collections.setOf import mapOf = kotlin.collections.mapOf @@ -25,7 +26,9 @@ describe( "kotlin", () => { [ "EmptySet", setOf( [] ) ], [ "HashSet", set ], [ "Map", map ], - [ "HashMap", map ] + [ "HashMap", map ], + [ "DurationCompanion", Duration.Companion ], + [ "Duration", Duration.ZERO ] ] const moduleVerifier = new VerifyModule( @@ -47,7 +50,6 @@ describe( "kotlin", () => { describe( "Pair", () => { it( "can access first and second", () => { const answer = new Pair( 42, "answer" ) - console.log(answer) expect( answer.first ).equals( 42 ) expect( answer.second ).equals( "answer" ) } ) @@ -129,4 +131,21 @@ describe( "kotlin", () => { expect( answersMap.values.toArray() ).deep.equals( [ 42 ] ) } ) } ) + + describe( "Duration", () => { + it( "parseIsoString succeeds", () => { + const oneSeconds = Duration.parseIsoString( "PT1S" ) + expect( oneSeconds.inWholeMilliseconds ).equals( 1000 ) + } ) + + it( "ZERO and INFINITE succeeds", () => { + const zero = Duration.ZERO + expect( zero.inWholeMilliseconds ).equals( 0 ) + expect( zero.inWholeMicroseconds ).equals( 0 ) + + const infinite = Duration.INFINITE + expect( infinite.inWholeMilliseconds ).equals( -1 ) + expect( infinite.inWholeMicroseconds ).equals( -1 ) + } ) + } ) } ) From 6822ed39b7d6368b0306b819aa9deb0ac742d209 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Sat, 14 Jan 2023 00:08:18 +0100 Subject: [PATCH 27/50] Add `JsExport` where possible in common submodule --- .../dk/cachet/carp/common/application/InstantExtensions.kt | 3 +++ .../kotlin/dk/cachet/carp/common/application/Trilean.kt | 4 ++-- .../carp/common/application/data/DataTypeMetaDataMap.kt | 2 ++ .../dk/cachet/carp/common/application/devices/AltBeacon.kt | 6 ++++++ .../carp/common/application/devices/BLEHeartRateDevice.kt | 3 +++ .../devices/BLESerialNumberDeviceRegistration.kt | 3 +++ .../common/application/devices/CustomProtocolDevice.kt | 3 +++ .../application/devices/DefaultDeviceRegistration.kt | 3 +++ .../carp/common/application/devices/DeviceConfiguration.kt | 5 +++++ .../carp/common/application/devices/DeviceRegistration.kt | 5 +++++ .../application/devices/MACAddressDeviceRegistration.kt | 3 +++ .../application/devices/PrimaryDeviceConfiguration.kt | 5 +++++ .../cachet/carp/common/application/devices/Smartphone.kt | 7 +++++++ .../application/sampling/AdaptiveGranularitySampling.kt | 2 ++ .../common/application/sampling/BatteryAwareSampling.kt | 6 ++++++ .../common/application/sampling/GranularitySampling.kt | 5 +++++ .../carp/common/application/sampling/IntervalSampling.kt | 6 ++++++ .../carp/common/application/sampling/NoOptionsSampling.kt | 4 ++++ .../common/application/sampling/SamplingConfiguration.kt | 2 ++ .../cachet/carp/common/application/services/ApiVersion.kt | 2 ++ .../carp/common/application/services/ApplicationService.kt | 3 +++ .../carp/common/application/services/IntegrationEvent.kt | 2 ++ .../cachet/carp/common/application/tasks/BackgroundTask.kt | 5 +++++ .../carp/common/application/tasks/CustomProtocolTask.kt | 3 +++ .../dk/cachet/carp/common/application/tasks/Measure.kt | 2 ++ .../carp/common/application/tasks/TaskConfiguration.kt | 6 ++++++ .../carp/common/application/tasks/TaskConfigurationList.kt | 5 +++++ .../dk/cachet/carp/common/application/tasks/WebTask.kt | 3 +++ .../carp/common/application/triggers/ElapsedTimeTrigger.kt | 5 +++++ .../carp/common/application/triggers/ManualTrigger.kt | 2 ++ .../carp/common/application/triggers/ScheduledTrigger.kt | 6 +++++- .../common/application/triggers/TriggerConfiguration.kt | 2 ++ .../common/application/users/ExpectedParticipantData.kt | 1 + publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt | 2 -- 34 files changed, 121 insertions(+), 5 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/InstantExtensions.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/InstantExtensions.kt index 2def3506a..6b68354a7 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/InstantExtensions.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/InstantExtensions.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application import kotlinx.datetime.Instant +import kotlin.js.JsExport private const val MICROS_PER_SECOND = 1_000_000 @@ -10,4 +11,6 @@ private const val NANOS_PER_MICRO = 1_000 /** * Get the elapsed microseconds since the start of the UTC day 1970-01-01 at this [Instant]'s moment in time. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) fun Instant.toEpochMicroseconds(): Long = epochSeconds * MICROS_PER_SECOND + nanosecondsOfSecond / NANOS_PER_MICRO diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt index 1b5ee8ec6..746f35e06 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/Trilean.kt @@ -1,5 +1,3 @@ -@file:JsExport - package dk.cachet.carp.common.application import kotlin.js.JsExport @@ -8,6 +6,7 @@ import kotlin.js.JsExport /** * A boolean value that can also be 'unknown' in case insufficient information is available. */ +@JsExport enum class Trilean { TRUE, @@ -18,6 +17,7 @@ enum class Trilean /** * Convert a [Boolean] value into a corresponding [Trilean]. */ +@JsExport fun Boolean.toTrilean(): Trilean { return if ( this ) Trilean.TRUE else Trilean.FALSE diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataTypeMetaDataMap.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataTypeMetaDataMap.kt index 1bd981b82..34bd7e709 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataTypeMetaDataMap.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/DataTypeMetaDataMap.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.common.application.data import dk.cachet.carp.common.application.EnumObjectMap +import kotlin.js.JsExport /** @@ -10,6 +11,7 @@ import dk.cachet.carp.common.application.EnumObjectMap * Extend from this class as an object and assign members as follows: * `val SOME_TYPE = add( "dk.cachet.carp.sometype", "Some type", DataTimeType.POINT )`. */ +@JsExport open class DataTypeMetaDataMap : EnumObjectMap( { metaData -> metaData.type } ) { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt index ad0966471..74e60a14a 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/AltBeacon.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.Trilean @@ -10,6 +12,7 @@ import dk.cachet.carp.common.application.sampling.SamplingConfiguration import dk.cachet.carp.common.application.tasks.TaskConfigurationList import dk.cachet.carp.common.infrastructure.serialization.NotSerializable import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -17,6 +20,7 @@ import kotlin.reflect.KClass * A beacon meeting the open AltBeacon standard. */ @Serializable +@JsExport data class AltBeacon( override val roleName: String, override val isOptional: Boolean = false, @@ -50,6 +54,7 @@ data class AltBeacon( * The beacon ID is 20 bytes, made up out of the recommended subdivision [organizationId], [majorId], and [minorId]. */ @Serializable +@JsExport data class AltBeaconDeviceRegistration( /** * The beacon device manufacturer's company identifier code as maintained by the Bluetooth SIG assigned numbers database. @@ -92,6 +97,7 @@ data class AltBeaconDeviceRegistration( @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( NotSerializable::class ) +@JsExport class AltBeaconDeviceRegistrationBuilder : DeviceRegistrationBuilder() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLEHeartRateDevice.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLEHeartRateDevice.kt index 341d0a9f3..85eddf7ba 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLEHeartRateDevice.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLEHeartRateDevice.kt @@ -8,6 +8,7 @@ import dk.cachet.carp.common.application.sampling.NoOptionsSamplingScheme import dk.cachet.carp.common.application.sampling.SamplingConfiguration import dk.cachet.carp.common.application.tasks.TaskConfigurationList import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -15,6 +16,8 @@ import kotlin.reflect.KClass * A Bluetooth Low Energy (BLE) device which implements a GATT Heart Rate service (https://www.bluetooth.com/specifications/gatt/services/). */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) data class BLEHeartRateDevice( override val roleName: String, override val isOptional: Boolean = false diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt index bbba2d5f1..0dcda4c86 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/BLESerialNumberDeviceRegistration.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.infrastructure.serialization.NotSerializable import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,6 +11,7 @@ import kotlinx.serialization.* * to uniquely identify the device. */ @Serializable +@JsExport data class BLESerialNumberDeviceRegistration( val serialNumber: String, @Required @@ -28,6 +30,7 @@ data class BLESerialNumberDeviceRegistration( @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( with = NotSerializable::class ) +@JsExport class BLESerialNumberDeviceRegistrationBuilder : DeviceRegistrationBuilder() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/CustomProtocolDevice.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/CustomProtocolDevice.kt index ea0f8ae84..d0b6d54e9 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/CustomProtocolDevice.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/CustomProtocolDevice.kt @@ -7,6 +7,7 @@ import dk.cachet.carp.common.application.sampling.SamplingConfiguration import dk.cachet.carp.common.application.tasks.CustomProtocolTask import dk.cachet.carp.common.application.tasks.TaskConfigurationList import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -14,6 +15,8 @@ import kotlin.reflect.KClass * A primary device which uses a single [CustomProtocolTask] to determine how to run a study on the device. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) data class CustomProtocolDevice( override val roleName: String, override val isOptional: Boolean = false ) : PrimaryDeviceConfiguration() { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt index c3225aaa0..3bd05b368 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DefaultDeviceRegistration.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.infrastructure.serialization.NotSerializable import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -11,6 +12,7 @@ import kotlinx.serialization.* * The base class can't be made concrete since this would prevent being able to serialize extending types (constructors may not contain parameters which are not properties). */ @Serializable +@JsExport data class DefaultDeviceRegistration( @Required override val deviceDisplayName: String? = null, @@ -25,6 +27,7 @@ data class DefaultDeviceRegistration( */ @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( with = NotSerializable::class ) +@JsExport class DefaultDeviceRegistrationBuilder : DeviceRegistrationBuilder() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceConfiguration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceConfiguration.kt index f83a23bf1..67a5db7b7 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceConfiguration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceConfiguration.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.Immutable @@ -8,6 +10,7 @@ import dk.cachet.carp.common.application.sampling.DataTypeSamplingSchemeMap import dk.cachet.carp.common.application.sampling.SamplingConfiguration import dk.cachet.carp.common.application.sampling.SamplingConfigurationMapBuilder import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass @@ -22,6 +25,7 @@ import kotlin.reflect.KClass @Polymorphic @Immutable @ImplementAsDataClass +@JsExport abstract class DeviceConfiguration< TRegistration : DeviceRegistration, out TRegistrationBuilder : DeviceRegistrationBuilder @@ -120,6 +124,7 @@ typealias DeviceType = KClass * A helper class to configure and construct immutable [DeviceConfiguration] classes. */ @DeviceConfigurationBuilderDsl +@JsExport abstract class DeviceConfigurationBuilder { private var samplingConfigurationBuilder: TSamplingConfigurationMapBuilder.() -> Unit = { } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt index 1da49efd7..a6d86a081 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/DeviceRegistration.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.Immutable @@ -6,6 +8,7 @@ import dk.cachet.carp.common.infrastructure.serialization.NotSerializable import kotlinx.datetime.Clock import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -18,6 +21,7 @@ import kotlinx.serialization.* @Polymorphic @Immutable @ImplementAsDataClass +@JsExport abstract class DeviceRegistration { /** @@ -50,6 +54,7 @@ abstract class DeviceRegistration @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( NotSerializable::class ) @DeviceRegistrationBuilderDsl +@JsExport abstract class DeviceRegistrationBuilder { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt index 1769368ed..6825872f3 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/MACAddressDeviceRegistration.kt @@ -3,12 +3,14 @@ package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.MACAddress import dk.cachet.carp.common.infrastructure.serialization.NotSerializable import kotlinx.serialization.* +import kotlin.js.JsExport /** * A [DeviceRegistration] for devices which have a MAC address. */ @Serializable +@JsExport data class MACAddressDeviceRegistration( val macAddress: MACAddress, @Required @@ -22,6 +24,7 @@ data class MACAddressDeviceRegistration( @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( with = NotSerializable::class ) +@JsExport class MACAddressDeviceRegistrationBuilder : DeviceRegistrationBuilder() { var macAddress: String = "" diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/PrimaryDeviceConfiguration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/PrimaryDeviceConfiguration.kt index 2b35c89a1..c668df43e 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/PrimaryDeviceConfiguration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/PrimaryDeviceConfiguration.kt @@ -1,9 +1,12 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.triggers.ElapsedTimeTrigger import kotlinx.serialization.* import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract +import kotlin.js.JsExport import kotlin.time.Duration @@ -13,6 +16,7 @@ import kotlin.time.Duration */ @Serializable @Polymorphic +@JsExport abstract class PrimaryDeviceConfiguration< TRegistration : DeviceRegistration, out TBuilder : DeviceRegistrationBuilder @@ -36,6 +40,7 @@ typealias AnyPrimaryDeviceConfiguration = PrimaryDeviceConfiguration<*, *> * Determines whether this device configuration is a primary device configuration ([AnyPrimaryDeviceConfiguration]). */ @OptIn( ExperimentalContracts::class ) +@JsExport fun AnyDeviceConfiguration.isPrimary(): Boolean { contract { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt index 96c1cd800..86659b941 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.devices import dk.cachet.carp.common.application.Trilean @@ -6,6 +8,8 @@ import dk.cachet.carp.common.application.data.DataType import dk.cachet.carp.common.application.sampling.* import dk.cachet.carp.common.application.tasks.* import kotlinx.serialization.* +import kotlin.js.JsExport +import kotlin.js.JsName import kotlin.reflect.KClass import kotlin.time.Duration.Companion.milliseconds @@ -24,6 +28,7 @@ data class Smartphone( override val defaultSamplingConfiguration: Map = emptyMap() ) : PrimaryDeviceConfiguration() { + @JsName( "create" ) constructor( roleName: String, isOptional: Boolean = false, builder: SmartphoneBuilder.() -> Unit ) : this( roleName, isOptional, SmartphoneBuilder().apply( builder ).buildSamplingConfiguration() ) @@ -122,6 +127,7 @@ data class Smartphone( /** * A helper class to configure and construct immutable [Smartphone] classes. */ +@JsExport class SmartphoneBuilder : DeviceConfigurationBuilder() { override fun createSamplingConfigurationMapBuilder(): SmartphoneSamplingConfigurationMapBuilder = @@ -132,6 +138,7 @@ class SmartphoneBuilder : DeviceConfigurationBuilder( dataType, diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/BatteryAwareSampling.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/BatteryAwareSampling.kt index c158425c1..dc7b8a7af 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/BatteryAwareSampling.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/BatteryAwareSampling.kt @@ -1,14 +1,18 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.sampling import dk.cachet.carp.common.application.data.DataTypeMetaData import dk.cachet.carp.common.application.devices.DeviceConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.reflect.KClass /** * A sampling scheme which changes based on how much battery the device has left. */ +@JsExport abstract class BatteryAwareSamplingScheme< TConfig : SamplingConfiguration, TBuilder : SamplingConfigurationBuilder @@ -72,6 +76,7 @@ abstract class BatteryAwareSamplingScheme< * A sampling configuration which changes based on how much battery the device has left. */ @Serializable +@JsExport data class BatteryAwareSamplingConfiguration( /** * The sampling configuration to use when there is plenty of battery left. @@ -92,6 +97,7 @@ data class BatteryAwareSamplingConfiguration( * A helper class to configure and construct immutable [BatteryAwareSamplingConfiguration] classes * as part of setting up a [DeviceConfiguration]. */ +@JsExport class BatteryAwareSamplingConfigurationBuilder< TConfig : SamplingConfiguration, TBuilder : SamplingConfigurationBuilder diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/GranularitySampling.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/GranularitySampling.kt index fe47b0a1e..d1ba93720 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/GranularitySampling.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/GranularitySampling.kt @@ -3,12 +3,14 @@ package dk.cachet.carp.common.application.sampling import dk.cachet.carp.common.application.data.DataTypeMetaData import dk.cachet.carp.common.application.devices.DeviceConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport /** * Sampling scheme which provides only indirect control over how data is sampled by specifying a desired level of [Granularity]. * The levels of granularity correspond to expected degrees of power consumption. */ +@JsExport class GranularitySamplingScheme( dataType: DataTypeMetaData, val defaultGranularity: Granularity ) : DataTypeSamplingScheme( dataType, @@ -26,6 +28,7 @@ class GranularitySamplingScheme( dataType: DataTypeMetaData, val defaultGranular * The level of detail a data stream should be sampled at, corresponding to expected degrees of power consumption. */ @Serializable +@JsExport enum class Granularity { /** @@ -50,6 +53,7 @@ enum class Granularity * corresponding to expected degrees of power consumption. */ @Serializable +@JsExport data class GranularitySamplingConfiguration( val granularity: Granularity ) : SamplingConfiguration @@ -57,6 +61,7 @@ data class GranularitySamplingConfiguration( val granularity: Granularity ) : Sa * A helper class to configure and construct immutable [GranularitySamplingConfiguration] objects * as part of setting up a [DeviceConfiguration]. */ +@JsExport class GranularitySamplingConfigurationBuilder( var granularity: Granularity ) : SamplingConfigurationBuilder { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/IntervalSampling.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/IntervalSampling.kt index 8eba706e9..f92d73ac3 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/IntervalSampling.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/IntervalSampling.kt @@ -1,15 +1,19 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.sampling import dk.cachet.carp.common.application.data.DataTypeMetaData import dk.cachet.carp.common.application.devices.DeviceConfiguration import dk.cachet.carp.common.infrastructure.serialization.DurationSerializer import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.time.Duration /** * Sampling scheme which allows configuring a time interval in between subsequent measurements. */ +@JsExport class IntervalSamplingScheme( dataType: DataTypeMetaData, val defaultMeasureInterval: Duration, @@ -46,6 +50,7 @@ class IntervalSamplingScheme( * A sampling configuration which allows configuring the time [interval] in between subsequent measurements. */ @Serializable +@JsExport data class IntervalSamplingConfiguration( @Serializable( DurationSerializer::class ) val interval: Duration @@ -56,6 +61,7 @@ data class IntervalSamplingConfiguration( * A helper class to configure and construct immutable [IntervalSamplingConfiguration] objects * as part of setting up a [DeviceConfiguration]. */ +@JsExport class IntervalSamplingConfigurationBuilder internal constructor( var interval: Duration, val validOptions: Set? diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/NoOptionsSampling.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/NoOptionsSampling.kt index a59af0c8d..f0f58fc04 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/NoOptionsSampling.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/NoOptionsSampling.kt @@ -2,11 +2,13 @@ package dk.cachet.carp.common.application.sampling import dk.cachet.carp.common.application.data.DataTypeMetaData import kotlinx.serialization.* +import kotlin.js.JsExport /** * Sampling scheme which does not allow any sampling configuration. */ +@JsExport class NoOptionsSamplingScheme( dataType: DataTypeMetaData ) : DataTypeSamplingScheme( dataType, NoOptionsSamplingConfiguration ) { @@ -21,12 +23,14 @@ class NoOptionsSamplingScheme( dataType: DataTypeMetaData ) : * A sampling configuration which does not provide any configuration options. */ @Serializable +@JsExport object NoOptionsSamplingConfiguration : SamplingConfiguration /** * A [SamplingConfiguration] builder for [DataTypeSamplingScheme]s which cannot be configured. */ +@JsExport object NoOptionsSamplingConfigurationBuilder : SamplingConfigurationBuilder { override fun build(): NoOptionsSamplingConfiguration = NoOptionsSamplingConfiguration diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/SamplingConfiguration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/SamplingConfiguration.kt index c4ffe96e6..dfb00ac57 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/SamplingConfiguration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/SamplingConfiguration.kt @@ -7,6 +7,7 @@ import dk.cachet.carp.common.application.devices.DeviceConfiguration import dk.cachet.carp.common.application.devices.DeviceConfigurationBuilder import dk.cachet.carp.common.application.devices.DeviceConfigurationBuilderDsl import kotlinx.serialization.Polymorphic +import kotlin.js.JsExport /** @@ -15,6 +16,7 @@ import kotlinx.serialization.Polymorphic @Polymorphic @Immutable @ImplementAsDataClass +@JsExport interface SamplingConfiguration diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApiVersion.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApiVersion.kt index 2efbb81d1..28e294a93 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApiVersion.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApiVersion.kt @@ -2,6 +2,7 @@ package dk.cachet.carp.common.application.services import dk.cachet.carp.common.infrastructure.serialization.createCarpStringPrimitiveSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -11,6 +12,7 @@ import kotlinx.serialization.* * E.g. a 2.0 request will work on a 2.1 hosted service, but not on 1.0 or 3.0. */ @Serializable( ApiVersionSerializer::class ) +@JsExport data class ApiVersion( val major: Int, val minor: Int ) { init diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt index 5aedbd5d9..be48c617c 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt @@ -1,9 +1,12 @@ package dk.cachet.carp.common.application.services +import kotlin.js.JsExport + /** * Exposes interactions with internal domain objects which may raise [TIntegrationEvent]s. */ +@JsExport interface ApplicationService< Self : ApplicationService, in TIntegrationEvent : IntegrationEvent diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt index 264c87795..16a68beee 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.common.application.Immutable import dk.cachet.carp.common.application.ImplementAsDataClass import kotlinx.serialization.Polymorphic import kotlinx.serialization.Required +import kotlin.js.JsExport /** @@ -14,6 +15,7 @@ import kotlinx.serialization.Required @Polymorphic @Immutable @ImplementAsDataClass +@JsExport interface IntegrationEvent> { @Required diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/BackgroundTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/BackgroundTask.kt index 802f7cc29..ba5c3f163 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/BackgroundTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/BackgroundTask.kt @@ -1,8 +1,11 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.tasks import dk.cachet.carp.common.application.data.NoData import dk.cachet.carp.common.infrastructure.serialization.DurationSerializer import kotlinx.serialization.* +import kotlin.js.JsExport import kotlin.time.Duration @@ -14,6 +17,7 @@ import kotlin.time.Duration * TODO: Outputs are not yet specified. */ @Serializable +@JsExport data class BackgroundTask( override val name: String, override val measures: List = emptyList(), @@ -30,6 +34,7 @@ data class BackgroundTask( /** * A helper class to configure and construct immutable [BackgroundTask] instances. */ +@JsExport class BackgroundTaskBuilder( /** * The optional duration over the course of which the [measures] need to be sampled. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/CustomProtocolTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/CustomProtocolTask.kt index 0fbb08030..e63d509c3 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/CustomProtocolTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/CustomProtocolTask.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application.tasks import dk.cachet.carp.common.application.data.NoData import kotlinx.serialization.* +import kotlin.js.JsExport /** * A [TaskConfiguration] which contains a definition on how to run tasks, measures, and triggers which differs from the CARP domain model. */ @Serializable +@JsExport data class CustomProtocolTask( override val name: String, /** @@ -24,5 +26,6 @@ data class CustomProtocolTask( /** * This list is empty, since measures are defined in [studyProtocol] in a different format. */ + @Suppress( "NON_EXPORTABLE_TYPE" ) override val measures: List = emptyList() } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/Measure.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/Measure.kt index 3b2957a47..b4c8de647 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/Measure.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/Measure.kt @@ -4,12 +4,14 @@ import dk.cachet.carp.common.application.data.DataType import dk.cachet.carp.common.application.devices.DeviceConfiguration import dk.cachet.carp.common.application.sampling.SamplingConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport /** * Defines data that needs to be measured/collected passively as part of a task defined by [TaskConfiguration]. */ @Serializable +@JsExport sealed class Measure { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfiguration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfiguration.kt index a6866bd6c..69ad23553 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfiguration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfiguration.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.tasks import dk.cachet.carp.common.application.Immutable @@ -6,6 +8,7 @@ import dk.cachet.carp.common.application.data.CarpDataTypes import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.DataType import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -15,6 +18,7 @@ import kotlinx.serialization.* @Polymorphic @Immutable @ImplementAsDataClass +@JsExport interface TaskConfiguration { /** @@ -38,6 +42,7 @@ interface TaskConfiguration * Get data types of all data which may be collected, either passively as part of task measures, * or as the result of user interactions, for this task. */ +@JsExport fun TaskConfiguration<*>.getAllExpectedDataTypes(): Set = measures.map { measure -> when ( measure ) @@ -54,6 +59,7 @@ fun TaskConfiguration<*>.getAllExpectedDataTypes(): Set = * A helper class to configure and construct immutable [TaskConfiguration] classes. */ @TaskConfigurationBuilderDsl +@JsExport abstract class TaskConfigurationBuilder> { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfigurationList.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfigurationList.kt index c32eadd58..06bd520e6 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfigurationList.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/TaskConfigurationList.kt @@ -1,6 +1,8 @@ package dk.cachet.carp.common.application.tasks import dk.cachet.carp.common.application.devices.DeviceConfiguration +import kotlin.js.JsExport +import kotlin.js.JsName /** @@ -9,10 +11,12 @@ import dk.cachet.carp.common.application.devices.DeviceConfiguration * * Extend from this class as an object and assign members as follows: `val SOME_TASK = add { SomeTaskBuilder() }`. */ +@JsExport open class TaskConfigurationList private constructor( private val list: MutableList> ) : List> by list { + @JsName( "create" ) constructor() : this( mutableListOf() ) /** @@ -34,6 +38,7 @@ open class TaskConfigurationList private constructor( /** * A [TaskConfiguration] which is listed as a supported task on a [DeviceConfiguration]. */ +@JsExport class SupportedTaskConfiguration< TConfiguration : TaskConfiguration<*>, TBuilder : TaskConfigurationBuilder diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt index 9c4918450..fc2651441 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.NoData import dk.cachet.carp.common.application.tasks.WebTask.UrlVariable import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -60,6 +61,8 @@ data class WebTask( /** * A helper class to configure and construct immutable [WebTask] instances. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) class WebTaskBuilder : TaskConfigurationBuilder() { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ElapsedTimeTrigger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ElapsedTimeTrigger.kt index f6d8b0057..71b2c0480 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ElapsedTimeTrigger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ElapsedTimeTrigger.kt @@ -4,6 +4,8 @@ import dk.cachet.carp.common.application.data.NoData import dk.cachet.carp.common.application.devices.AnyPrimaryDeviceConfiguration import dk.cachet.carp.common.infrastructure.serialization.DurationSerializer import kotlinx.serialization.* +import kotlin.js.JsExport +import kotlin.js.JsName import kotlin.time.Duration @@ -14,6 +16,7 @@ import kotlin.time.Duration */ @Suppress( "DataClassPrivateConstructor" ) @Serializable +@JsExport data class ElapsedTimeTrigger private constructor( override val sourceDeviceRoleName: String, @Serializable( DurationSerializer::class ) @@ -23,6 +26,8 @@ data class ElapsedTimeTrigger private constructor( @Transient override val requiresPrimaryDevice: Boolean = true + @JsName( "create" ) + @Suppress( "NON_EXPORTABLE_TYPE" ) constructor( sourceDevice: AnyPrimaryDeviceConfiguration, elapsedTime: Duration ) : this( sourceDevice.roleName, elapsedTime ) } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ManualTrigger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ManualTrigger.kt index ca430ff7f..ffd270ba4 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ManualTrigger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ManualTrigger.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.common.application.triggers import dk.cachet.carp.common.application.data.NoData import kotlinx.serialization.* +import kotlin.js.JsExport /** * A trigger initiated by a user, i.e., the user decides when to start a task. */ @Serializable +@JsExport data class ManualTrigger( override val sourceDeviceRoleName: String, /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ScheduledTrigger.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ScheduledTrigger.kt index fb106b312..51f088c69 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ScheduledTrigger.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/ScheduledTrigger.kt @@ -5,6 +5,8 @@ import dk.cachet.carp.common.application.TimeOfDay import dk.cachet.carp.common.application.data.NoData import dk.cachet.carp.common.application.devices.AnyPrimaryDeviceConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport +import kotlin.js.JsName /** @@ -14,6 +16,7 @@ import kotlinx.serialization.* */ @Suppress( "DataClassPrivateConstructor" ) @Serializable +@JsExport data class ScheduledTrigger private constructor( override val sourceDeviceRoleName: String, val time: TimeOfDay, @@ -23,9 +26,10 @@ data class ScheduledTrigger private constructor( @Transient override val requiresPrimaryDevice: Boolean = true + @JsName( "create" ) constructor( /** - * The priary device on which this trigger is evaluated. + * The primary device on which this trigger is evaluated. */ sourceDevice: AnyPrimaryDeviceConfiguration, /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TriggerConfiguration.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TriggerConfiguration.kt index 5250124b7..35daa757c 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TriggerConfiguration.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/triggers/TriggerConfiguration.kt @@ -6,6 +6,7 @@ import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.devices.DeviceConfiguration import dk.cachet.carp.common.application.devices.PrimaryDeviceConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -16,6 +17,7 @@ import kotlinx.serialization.* @Polymorphic @Immutable @ImplementAsDataClass +@JsExport abstract class TriggerConfiguration { /** diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt index d3f6521cf..f498cb58c 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/ExpectedParticipantData.kt @@ -31,6 +31,7 @@ data class ExpectedParticipantData( * * @throws IllegalArgumentException if [exceptionOnConflict] is set to true and the set contains a conflict. */ +@JsExport fun Set.hasNoConflicts( exceptionOnConflict: Boolean = false ): Boolean { val expectedDataByInputType = this.groupBy { it.inputDataType } diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt index 9e3bade2f..2e2d17668 100644 --- a/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinExport.kt @@ -6,8 +6,6 @@ import kotlin.js.JsExport import kotlin.time.Duration -import kotlin.time.Duration.Companion.seconds -import kotlin.time.DurationUnit /** * Refers to types/methods in the kotlin standard library to ensure they aren't removed from compiled sources From ea655d86e24c5cc9642e55b748b242e5acc1ed2a Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Mon, 30 Jan 2023 15:30:21 +0100 Subject: [PATCH 28/50] Replace `any` with actual types for non-exported types with facades in generated TS Types for which no `@JsExport` is applied, when exposed in an API, are exported as `any`. For those types for which manual facades are written, replace these in the generated TypeScript sources with their facade type. --- build.gradle | 15 ++++++++++- publish-npm-packages/src/known-facade-types | 10 ++++++++ typescript-declarations/src/carp-common.ts | 25 ++++++++++++++++++- .../tests/carp.common-test.ts | 9 +++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 publish-npm-packages/src/known-facade-types diff --git a/build.gradle b/build.gradle index 632bc175f..78b2387e0 100644 --- a/build.gradle +++ b/build.gradle @@ -259,12 +259,25 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { def extension = fileMatch[0][2] file.relativePath = new RelativePath(true, moduleName, "index.$extension") + // Non-exported types show up as `any/* some.unknown.Type */` in generated TypeScript sources. + // Types for which a facade has been manually added can be replaced with the actual type (instead of `any`). + def knownFacadeTypes = [] + def knownFacadeTypesFile = new File("$rootDir/publish-npm-packages/src/known-facade-types") + knownFacadeTypesFile.eachLine { type -> knownFacadeTypes << type } + // Modify sources to act like modules with exported named members. file.filter { line -> // Compiled sources refer to other modules as adjacent .js source files. // Change these to the named modules created in the previous step. def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'\$1'") + def replacedTypes = knownFacadeTypes.inject(namedModules) { curLine, type -> + curLine.replaceAll( + ~/any\/\* $type(<.+?>)? \*\//, + "$type\$1" + ) + } + // Add additional internal types to be exported, as configured in `forced-exports`. def toExport = [] def forcedExportsFile = new File("$rootDir/publish-npm-packages/src/forced-exports/$moduleName") @@ -272,7 +285,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { forcedExportsFile.eachLine { type -> toExport << type } } def toExportList = toExport.collect { "_.\\\$_\\\$.$it = $it\n " } - def additionalExports = namedModules.replaceAll( + def additionalExports = replacedTypes.replaceAll( ~/return \_;/, toExportList.join() + "return _;" ) diff --git a/publish-npm-packages/src/known-facade-types b/publish-npm-packages/src/known-facade-types new file mode 100644 index 000000000..69affd4e7 --- /dev/null +++ b/publish-npm-packages/src/known-facade-types @@ -0,0 +1,10 @@ +kotlin.Long +kotlin.Pair +kotlin.collections.Collection +kotlin.collections.List +kotlin.collections.Set +kotlin.collections.Map +kotlin.time.Duration +kotlinx.datetime.Clock +kotlinx.datetime.Instant +kotlinx.serialization.Json \ No newline at end of file diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index ac31e82d3..ccfd64d37 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -1,9 +1,32 @@ import * as extend from "carp.core-kotlin-carp.common" +import * as kotlinStdLib from "./kotlin" +import * as kotlinDateTime from "./kotlinx-datetime" -// Augment internal types to implement desired base interfaces. declare module "carp.core-kotlin-carp.common" { + // Declare missing types for which no imports were generated. + namespace kotlin + { + type Long = kotlinStdLib.kotlin.Long + } + namespace kotlin.time + { + type Duration = kotlinStdLib.kotlin.time.Duration + } + namespace kotlin.collections + { + type List = kotlinStdLib.kotlin.collections.List + type Set = kotlinStdLib.kotlin.collections.Set + type Map = kotlinStdLib.kotlin.collections.Map + } + namespace kotlinx.datetime + { + type Instant = kotlinDateTime.kotlinx.datetime.Instant + } + + + // Augment internal types to implement desired base interfaces. namespace dk.cachet.carp.common.application.users { interface AccountIdentity {} diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp.common-test.ts index a85842632..fdb20ec04 100644 --- a/typescript-declarations/tests/carp.common-test.ts +++ b/typescript-declarations/tests/carp.common-test.ts @@ -3,6 +3,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' import setOf = kotlin.collections.setOf +import Duration = kotlin.time.Duration import { kotlinx } from '../src/kotlinx-serialization' import Json = kotlinx.serialization.Json import { dk } from '../src/carp-common' @@ -18,6 +19,7 @@ import ParticipantAttribute = dk.cachet.carp.common.application.users.Participan import CarpInputDataTypes = dk.cachet.carp.common.application.data.input.CarpInputDataTypes import Text = dk.cachet.carp.common.application.data.input.elements.Text import CustomInput = dk.cachet.carp.common.application.data.input.CustomInput +import IntervalSamplingConfiguration = dk.cachet.carp.common.application.sampling.IntervalSamplingConfiguration import JSON = dk.cachet.carp.common.infrastructure.serialization.JSON @@ -97,4 +99,11 @@ describe( "carp.common", () => { expect( deserialized.equals( expectedData ) ).is.true } ) } ) + + describe( "IntervalSamplingConfiguration", () => { + it( "can construct", () => { + const config = new IntervalSamplingConfiguration( Duration.parseIsoString( "PT1S" ) ) + expect( config.interval.inWholeMilliseconds ).equals( 1000 ) + } ) + } ) } ) From e8acc78eebba34e08a1f6fd1357dddbbb7fcfde0 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Mon, 30 Jan 2023 19:25:35 +0100 Subject: [PATCH 29/50] Add `JsExport` where possible in studies/protocols/deployments/data submodules This does not re-introduce TypeScript unit tests yet. --- build.gradle | 4 +- .../carp/data/application/DataStreamBatch.kt | 5 +++ .../carp/data/application/DataStreamId.kt | 2 + .../carp/data/application/DataStreamPoint.kt | 4 ++ .../data/application/DataStreamSequence.kt | 7 ++++ .../application/DataStreamsConfiguration.kt | 4 ++ .../carp/data/application/Measurement.kt | 6 ++- .../cachet/carp/data/application/SyncPoint.kt | 5 ++- .../application/DeviceDeploymentStatus.kt | 4 ++ .../application/PrimaryDeviceDeployment.kt | 4 ++ .../application/StudyDeploymentStatus.kt | 6 +++ .../deployments/application/Validation.kt | 5 +++ .../users/ActiveParticipationInvitation.kt | 3 ++ .../users/AssignedPrimaryDevice.kt | 2 + .../application/users/ParticipantData.kt | 4 ++ .../users/ParticipantInvitation.kt | 3 ++ .../application/users/ParticipantStatus.kt | 3 ++ .../application/users/Participation.kt | 2 + .../application/users/StudyInvitation.kt | 2 + .../protocols/application/ProtocolVersion.kt | 3 ++ .../application/StudyProtocolSnapshot.kt | 4 ++ .../carp/studies/application/StudyDetails.kt | 4 ++ .../carp/studies/application/StudyStatus.kt | 4 ++ .../users/AssignedParticipantRoles.kt | 6 +++ .../studies/application/users/Participant.kt | 3 ++ .../users/ParticipantGroupStatus.kt | 4 ++ .../infrastructure/StudyServiceRequest.kt | 1 + .../forced-exports/kotlin-kotlin-stdlib-js-ir | 2 +- publish-npm-packages/src/known-facade-types | 3 +- .../index.d.ts | 4 +- .../index.d.ts | 6 +++ .../index.d.ts | 6 +++ .../index.d.ts | 6 +++ .../index.d.ts | 6 +++ .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 22 +++++------ .../index.d.ts | 4 +- typescript-declarations/src/carp-data-core.ts | 31 ++++++++++++++++ .../src/carp-deployments-core.ts | 36 ++++++++++++++++++ .../src/carp-protocols-core.ts | 31 ++++++++++++++++ .../src/carp-studies-core.ts | 37 +++++++++++++++++++ typescript-declarations/src/kotlin.ts | 24 ++++++------ .../src/kotlinx-datetime.ts | 4 +- .../src/kotlinx-serialization.ts | 4 +- 43 files changed, 294 insertions(+), 36 deletions(-) create mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts create mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts create mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts create mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts create mode 100644 typescript-declarations/src/carp-data-core.ts create mode 100644 typescript-declarations/src/carp-deployments-core.ts create mode 100644 typescript-declarations/src/carp-protocols-core.ts create mode 100644 typescript-declarations/src/carp-studies-core.ts diff --git a/build.gradle b/build.gradle index 78b2387e0..aba327243 100644 --- a/build.gradle +++ b/build.gradle @@ -271,11 +271,13 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { // Change these to the named modules created in the previous step. def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'\$1'") + // Replace `any` types with actual types for which facades are specified. def replacedTypes = knownFacadeTypes.inject(namedModules) { curLine, type -> - curLine.replaceAll( + def knownType = curLine.replaceAll( ~/any\/\* $type(<.+?>)? \*\//, "$type\$1" ) + knownType.replaceAll(~/UnknownType \*/, "any") } // Add additional internal types to be exported, as configured in `forced-exports`. diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamBatch.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamBatch.kt index dc2c7cff0..906540509 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamBatch.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamBatch.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import dk.cachet.carp.common.application.data.Data @@ -5,12 +7,14 @@ import kotlinx.serialization.* import kotlinx.serialization.builtins.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* +import kotlin.js.JsExport /** * A collection of non-overlapping, ordered, data stream [sequences]. */ @Serializable( DataStreamBatchSerializer::class ) +@JsExport interface DataStreamBatch : Sequence> { val sequences: Sequence> @@ -37,6 +41,7 @@ interface DataStreamBatch : Sequence> /** * A mutable collection of non-overlapping data stream [sequences]. */ +@JsExport class MutableDataStreamBatch : DataStreamBatch { private val sequenceMap: MutableMap>> = mutableMapOf() diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamId.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamId.kt index 815efdacc..153b72f06 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamId.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamId.kt @@ -3,6 +3,7 @@ package dk.cachet.carp.data.application import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,4 +11,5 @@ import kotlinx.serialization.* * in a deployed study protocol with [studyDeploymentId]. */ @Serializable +@JsExport data class DataStreamId( val studyDeploymentId: UUID, val deviceRoleName: String, val dataType: DataType ) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamPoint.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamPoint.kt index ece5f8ebb..631a06bb8 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamPoint.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamPoint.kt @@ -1,8 +1,11 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.Data import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,6 +13,7 @@ import kotlinx.serialization.* * which was collected because the triggers identified by [triggerIds] requested data collection. */ @Serializable +@JsExport data class DataStreamPoint( /** * The sequence number of this [measurement] in the data stream, acting as a unique key. diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamSequence.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamSequence.kt index 6ad823a28..69dde70cf 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamSequence.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamSequence.kt @@ -1,15 +1,20 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import dk.cachet.carp.common.application.data.Data import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* +import kotlin.js.JsExport +import kotlin.js.JsName /** * A sequence of consecutive [measurements] for a [dataStream] starting from [firstSequenceId] * which all share the same [triggerIds] and [syncPoint]. */ +@JsExport sealed interface DataStreamSequence : Sequence> { val dataStream: DataStreamId @@ -87,6 +92,7 @@ sealed interface DataStreamSequence : Sequence( override val dataStream: DataStreamId, override val firstSequenceId: Long, @@ -108,6 +114,7 @@ class MutableDataStreamSequence( * * @throws IllegalArgumentException when any of the [measurements] is of a different data type than [dataStream]. */ + @JsName( "appendMeasurementsList" ) fun appendMeasurements( measurements: List> ) { require( measurements.all { it.dataType == dataStream.dataType } ) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamsConfiguration.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamsConfiguration.kt index 9643780a0..e8e4f68f7 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamsConfiguration.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/DataStreamsConfiguration.kt @@ -1,14 +1,18 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.DataType import kotlinx.serialization.* +import kotlin.js.JsExport /** * Configures [expectedDataStreams] for a study deployment. */ @Serializable +@JsExport data class DataStreamsConfiguration( val studyDeploymentId: UUID, val expectedDataStreams: Set diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt index 1eacbc349..68921ba1c 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import dk.cachet.carp.common.application.data.Data @@ -7,6 +9,7 @@ import dk.cachet.carp.data.infrastructure.getDataType import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.* +import kotlin.js.JsExport /** @@ -17,9 +20,10 @@ import kotlinx.serialization.encoding.* * For example, it could be a simple clock increment since the device powered up. */ @Serializable( MeasurementSerializer::class ) +@JsExport data class Measurement( val sensorStartTime: Long, - val sensorEndTime: Long? = null, + val sensorEndTime: Long?, val dataType: DataType, val data: TData ) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/SyncPoint.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/SyncPoint.kt index 79159d7ad..eecc9307a 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/SyncPoint.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/SyncPoint.kt @@ -1,8 +1,10 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.data.application import kotlinx.datetime.Instant import kotlinx.serialization.* - +import kotlin.js.JsExport /** @@ -13,6 +15,7 @@ import kotlinx.serialization.* * syncedTime = [relativeClockSpeed] * (sensorTime - [sensorTimestampAtSyncPoint]) + [synchronizedOn] */ @Serializable +@JsExport data class SyncPoint( /** * The UTC time as measured on the primary device when it determined the synchronization point. diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeviceDeploymentStatus.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeviceDeploymentStatus.kt index f219c0e6a..57582af71 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeviceDeploymentStatus.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/DeviceDeploymentStatus.kt @@ -1,13 +1,17 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.deployments.application import dk.cachet.carp.common.application.devices.AnyDeviceConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport /** * Describes the status of a device, part of a study deployment. */ @Serializable +@JsExport sealed class DeviceDeploymentStatus { /** diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/PrimaryDeviceDeployment.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/PrimaryDeviceDeployment.kt index e2c29aecf..68c9ea0f0 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/PrimaryDeviceDeployment.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/PrimaryDeviceDeployment.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.deployments.application import dk.cachet.carp.common.application.data.DataType @@ -15,12 +17,14 @@ import dk.cachet.carp.common.infrastructure.serialization.ApplicationDataSeriali import kotlinx.datetime.Clock import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** * Contains the entire description and configuration for how a single primary device participates in running a study. */ @Serializable +@JsExport data class PrimaryDeviceDeployment( /** * The configuration for the primary device this deployment is intended for. diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/StudyDeploymentStatus.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/StudyDeploymentStatus.kt index 93cfb4470..e5047c796 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/StudyDeploymentStatus.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/StudyDeploymentStatus.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.deployments.application import dk.cachet.carp.common.application.UUID @@ -6,12 +8,15 @@ import dk.cachet.carp.common.application.devices.AnyPrimaryDeviceConfiguration import dk.cachet.carp.deployments.application.users.ParticipantStatus import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport +import kotlin.js.JsName /** * Describes the status of a study deployment: registered devices, last received data, whether consent has been given, etc. */ @Serializable +@JsExport sealed class StudyDeploymentStatus { /** @@ -114,6 +119,7 @@ sealed class StudyDeploymentStatus /** * Get the status of a device with the given [deviceRoleName] in this study deployment. */ + @JsName( "getDeviceStatusByRoleName" ) fun getDeviceStatus( deviceRoleName: String ): DeviceDeploymentStatus = deviceStatusList.firstOrNull { it.device.roleName == deviceRoleName } ?: throw IllegalArgumentException( diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/Validation.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/Validation.kt index 1895be923..79199856a 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/Validation.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/Validation.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.deployments.application import dk.cachet.carp.common.application.devices.DeviceRegistration @@ -5,6 +7,7 @@ import dk.cachet.carp.common.application.users.AssignedTo import dk.cachet.carp.deployments.application.users.ParticipantInvitation import dk.cachet.carp.deployments.domain.users.getAssignedDeviceRoleNames import dk.cachet.carp.protocols.application.StudyProtocolSnapshot +import kotlin.js.JsExport /** @@ -16,6 +19,7 @@ import dk.cachet.carp.protocols.application.StudyProtocolSnapshot * - not all necessary primary devices part of the study protocol have been assigned a participant * - not all necessary participant roles part of the study have been assigned a participant */ +@JsExport fun StudyProtocolSnapshot.throwIfInvalidInvitations( invitations: List ) { require( invitations.isNotEmpty() ) { "No participants invited." } @@ -54,6 +58,7 @@ fun StudyProtocolSnapshot.throwIfInvalidInvitations( invitations: List ) diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ActiveParticipationInvitation.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ActiveParticipationInvitation.kt index c01974b15..01d3d61f3 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ActiveParticipationInvitation.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ActiveParticipationInvitation.kt @@ -1,6 +1,7 @@ package dk.cachet.carp.deployments.application.users import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -9,8 +10,10 @@ import kotlinx.serialization.* * If the participant wants to use a different device, they will need to unregister the existing device first. */ @Serializable +@JsExport data class ActiveParticipationInvitation( val participation: Participation, val invitation: StudyInvitation, + @Suppress( "NON_EXPORTABLE_TYPE" ) val assignedDevices: Set ) diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/AssignedPrimaryDevice.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/AssignedPrimaryDevice.kt index 4c36a2c2f..ab8d96985 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/AssignedPrimaryDevice.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/AssignedPrimaryDevice.kt @@ -3,12 +3,14 @@ package dk.cachet.carp.deployments.application.users import dk.cachet.carp.common.application.devices.AnyPrimaryDeviceConfiguration import dk.cachet.carp.common.application.devices.DeviceRegistration import kotlinx.serialization.* +import kotlin.js.JsExport /** * Primary [device] and its current [registration] assigned to participants as part of a participant group. */ @Serializable +@JsExport data class AssignedPrimaryDevice( val device: AnyPrimaryDeviceConfiguration, val registration: DeviceRegistration? = null diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantData.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantData.kt index 74c1a38fc..8e29402cd 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantData.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantData.kt @@ -1,9 +1,12 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.deployments.application.users import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.input.InputDataType import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -11,6 +14,7 @@ import kotlinx.serialization.* * Data which is not set equals null. */ @Serializable +@JsExport data class ParticipantData( val studyDeploymentId: UUID, /** diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantInvitation.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantInvitation.kt index 403078e9a..5803eaaa4 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantInvitation.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantInvitation.kt @@ -4,12 +4,14 @@ import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.AccountIdentity import dk.cachet.carp.common.application.users.AssignedTo import kotlinx.serialization.* +import kotlin.js.JsExport /** * The information which needs to be provided when inviting a participant to a deployment. */ @Serializable +@JsExport data class ParticipantInvitation( /** * An ID for the participant, uniquely assigned by the calling service. @@ -22,6 +24,7 @@ data class ParticipantInvitation( /** * The identity used to authenticate and invite the participant. */ + @Suppress( "NON_EXPORTABLE_TYPE" ) val identity: AccountIdentity, /** * A description of the study which is shared with the participant. diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantStatus.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantStatus.kt index 5ee217912..632a52d52 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantStatus.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/ParticipantStatus.kt @@ -3,14 +3,17 @@ package dk.cachet.carp.deployments.application.users import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.AssignedTo import kotlinx.serialization.* +import kotlin.js.JsExport /** * Provides information on the status of a participant in a study deployment. */ @Serializable +@JsExport data class ParticipantStatus( val participantId: UUID, val assignedParticipantRoles: AssignedTo, + @Suppress( "NON_EXPORTABLE_TYPE" ) val assignedPrimaryDeviceRoleNames: Set ) diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/Participation.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/Participation.kt index fc87f9d83..4a7ff81f6 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/Participation.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/Participation.kt @@ -3,12 +3,14 @@ package dk.cachet.carp.deployments.application.users import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.AssignedTo import kotlinx.serialization.* +import kotlin.js.JsExport /** * Uniquely identifies a participation of an account in a study deployment. */ @Serializable +@JsExport data class Participation( val studyDeploymentId: UUID, @Required diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/StudyInvitation.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/StudyInvitation.kt index 32105a119..c42c59370 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/StudyInvitation.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/application/users/StudyInvitation.kt @@ -2,12 +2,14 @@ package dk.cachet.carp.deployments.application.users import dk.cachet.carp.common.infrastructure.serialization.ApplicationDataSerializer import kotlinx.serialization.* +import kotlin.js.JsExport /** * A description of a study, shared with participants once they are invited to a study. */ @Serializable +@JsExport data class StudyInvitation( /** * A descriptive name for the study to be shown to participants. diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/ProtocolVersion.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/ProtocolVersion.kt index a958c6639..f3f903010 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/ProtocolVersion.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/ProtocolVersion.kt @@ -4,6 +4,7 @@ import dk.cachet.carp.protocols.domain.StudyProtocol import kotlinx.datetime.Clock import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -12,8 +13,10 @@ import kotlinx.serialization.* * @param date The date when this version of the protocol was created. */ @Serializable +@JsExport data class ProtocolVersion( val tag: String, @Required + @Suppress( "NON_EXPORTABLE_TYPE" ) val date: Instant = Clock.System.now() ) diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/StudyProtocolSnapshot.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/StudyProtocolSnapshot.kt index 257afa54f..8f2ed0d5d 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/StudyProtocolSnapshot.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/StudyProtocolSnapshot.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.protocols.application import dk.cachet.carp.common.application.UUID @@ -15,12 +17,14 @@ import dk.cachet.carp.common.infrastructure.serialization.ApplicationDataSeriali import dk.cachet.carp.protocols.domain.StudyProtocol import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** * A serializable snapshot of a [StudyProtocol] at the moment in time when it was created. */ @Serializable +@JsExport data class StudyProtocolSnapshot( override val id: UUID, override val createdOn: Instant, diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyDetails.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyDetails.kt index 3ff444ed2..693adc91c 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyDetails.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyDetails.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.studies.application import dk.cachet.carp.common.application.UUID @@ -5,12 +7,14 @@ import dk.cachet.carp.deployments.application.users.StudyInvitation import dk.cachet.carp.protocols.application.StudyProtocolSnapshot import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** * Contains detailed information about a study, such as the configured study protocol. */ @Serializable +@JsExport data class StudyDetails( val studyId: UUID, /** diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyStatus.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyStatus.kt index 8e1ddd19a..6340542cc 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyStatus.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/StudyStatus.kt @@ -1,14 +1,18 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.studies.application import dk.cachet.carp.common.application.UUID import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** * Describes the status of a study: the number of participants, progress towards study goal, etc. */ @Serializable +@JsExport sealed class StudyStatus { abstract val studyId: UUID diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/AssignedParticipantRoles.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/AssignedParticipantRoles.kt index bf9ec7a1e..c939322aa 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/AssignedParticipantRoles.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/AssignedParticipantRoles.kt @@ -1,8 +1,11 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.studies.application.users import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.AssignedTo import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -10,16 +13,19 @@ import kotlinx.serialization.* * to the participant identified by [participantId]. */ @Serializable +@JsExport data class AssignedParticipantRoles( val participantId: UUID, val assignedRoles: AssignedTo ) /** * Get the unique set of participant IDs defined in a collection of [AssignedParticipantRoles]. */ +@JsExport fun Collection.participantIds(): Set = this.map { it.participantId }.toSet() /** * Get the unique set of participant roles defined in a collection of [AssignedParticipantRoles]. */ +@JsExport fun Collection.participantRoles(): Set = this .flatMap { when ( it.assignedRoles ) diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/Participant.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/Participant.kt index 631ffbae7..71dbf6dbe 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/Participant.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/Participant.kt @@ -4,12 +4,15 @@ import dk.cachet.carp.common.application.UUID import dk.cachet.carp.common.application.users.AccountIdentity import dk.cachet.carp.studies.domain.Study import kotlinx.serialization.* +import kotlin.js.JsExport /** * A person to be invited or participating in a [Study]. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) data class Participant( val accountIdentity: AccountIdentity, @Required diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/ParticipantGroupStatus.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/ParticipantGroupStatus.kt index 525f02ec0..ad6b6ac47 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/ParticipantGroupStatus.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/application/users/ParticipantGroupStatus.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.studies.application.users import dk.cachet.carp.common.application.UUID @@ -6,6 +8,7 @@ import dk.cachet.carp.deployments.domain.StudyDeployment import dk.cachet.carp.deployments.domain.users.ParticipantGroup import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** @@ -14,6 +17,7 @@ import kotlinx.serialization.* * until the deployment is [Stopped]. */ @Serializable +@JsExport sealed class ParticipantGroupStatus { /** diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt index ba6fbc4c8..85fd36d5a 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt @@ -10,6 +10,7 @@ import dk.cachet.carp.studies.application.StudyDetails import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyStatus import kotlinx.serialization.* +import kotlin.js.JsExport /** diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index e33869ec9..fbc4fe0c6 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -10,6 +10,6 @@ to listOf setOf mapOf -Companion_getInstance_4 +Companion_getInstance_6 _Duration___get_inWholeMilliseconds__impl__msfiry _Duration___get_inWholeMicroseconds__impl__8oe8vv \ No newline at end of file diff --git a/publish-npm-packages/src/known-facade-types b/publish-npm-packages/src/known-facade-types index 69affd4e7..0f1ead3a3 100644 --- a/publish-npm-packages/src/known-facade-types +++ b/publish-npm-packages/src/known-facade-types @@ -7,4 +7,5 @@ kotlin.collections.Map kotlin.time.Duration kotlinx.datetime.Clock kotlinx.datetime.Instant -kotlinx.serialization.Json \ No newline at end of file +kotlinx.serialization.Json +dk.cachet.carp.common.application.users.AccountIdentity \ No newline at end of file diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index 5a3ea724a..da1ebb75e 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - i10(): Instant_0 + x11(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - t10(): number + k12(): number } } } diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts new file mode 100644 index 000000000..7e2f38254 --- /dev/null +++ b/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts @@ -0,0 +1,6 @@ +import * as data from "carp.core-kotlin-carp.data.core" + + +declare module "carp.core-kotlin-carp.data.core" +{ +} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts new file mode 100644 index 000000000..6ddb078f4 --- /dev/null +++ b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts @@ -0,0 +1,6 @@ +import * as studies from "carp.core-kotlin-carp.deployments.core" + + +declare module "carp.core-kotlin-carp.deployments.core" +{ +} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts new file mode 100644 index 000000000..a46ff8304 --- /dev/null +++ b/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts @@ -0,0 +1,6 @@ +import * as protocols from "carp.core-kotlin-carp.protocols.core" + + +declare module "carp.core-kotlin-carp.protocols.core" +{ +} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts new file mode 100644 index 000000000..1e73a72d8 --- /dev/null +++ b/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts @@ -0,0 +1,6 @@ +import * as studies from "carp.core-kotlin-carp.studies.core" + + +declare module "carp.core-kotlin-carp.studies.core" +{ +} diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index d15568200..bdd043dff 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -5,7 +5,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Long { // toNumber - p4(): number + i5(): number } function toLong_0( number: number ): Long @@ -14,16 +14,16 @@ declare module "kotlin-kotlin-stdlib-js-ir" constructor( first: K, second: V ) // first - s2_1: K + a3_1: K // second - t2_1: V + b3_1: V } interface Collection { // contains - y( value: T ): boolean + d1( value: T ): boolean // size f(): number @@ -44,13 +44,13 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface Map { // get - x1( key: K ): V + e2( key: K ): V // keys - y1(): Set + f2(): Set // values - z1(): Collection + g2(): Collection } interface HashMap extends Map {} function mapOf( pairs: Pair[] ): Map @@ -59,15 +59,15 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface DurationCompanion { // parseIsoString - t4(): Duration + j6(): Duration // ZERO - q4_1: Duration + g6_1: Duration // INFINITE - r4_1: Duration + h6_1: Duration } - function Companion_getInstance_4(): DurationCompanion + function Companion_getInstance_6(): DurationCompanion function _Duration___get_inWholeMilliseconds__impl__msfiry(duration: Duration): Long function _Duration___get_inWholeMicroseconds__impl__8oe8vv(duration: Duration): Long } diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts index 78f0f04eb..7b68cd58f 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts @@ -5,10 +5,10 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" interface JsonImpl { // encodeToString - y10( serializer: any, instance: any ): string + p12( serializer: any, instance: any ): string // decodeFromString - z10( serializer: any, string: string ): string + q12( serializer: any, string: string ): string } function Default_getInstance(): JsonImpl } diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/src/carp-data-core.ts new file mode 100644 index 000000000..70406c0f2 --- /dev/null +++ b/typescript-declarations/src/carp-data-core.ts @@ -0,0 +1,31 @@ +import * as extend from "carp.core-kotlin-carp.data.core" +import * as kotlinStdLib from "./kotlin" +import * as kotlinDateTime from "./kotlinx-datetime" + + +declare module "carp.core-kotlin-carp.data.core" +{ + // Declare missing types for which no imports were generated. + namespace kotlin + { + type Long = kotlinStdLib.kotlin.Long + } + namespace kotlin.time + { + type Duration = kotlinStdLib.kotlin.time.Duration + } + namespace kotlin.collections + { + type List = kotlinStdLib.kotlin.collections.List + type Set = kotlinStdLib.kotlin.collections.Set + type Map = kotlinStdLib.kotlin.collections.Map + } + namespace kotlinx.datetime + { + type Instant = kotlinDateTime.kotlinx.datetime.Instant + } +} + + +// Export facade. +export * from "carp.core-kotlin-carp.data.core" diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts new file mode 100644 index 000000000..9fe595d50 --- /dev/null +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -0,0 +1,36 @@ +import * as extend from "carp.core-kotlin-carp.deployments.core" +import * as kotlinStdLib from "./kotlin" +import * as kotlinDateTime from "./kotlinx-datetime" +import * as carpCommon from "./carp-common" + + +declare module "carp.core-kotlin-carp.deployments.core" +{ + // Declare missing types for which no imports were generated. + namespace kotlin + { + type Long = kotlinStdLib.kotlin.Long + } + namespace kotlin.time + { + type Duration = kotlinStdLib.kotlin.time.Duration + } + namespace kotlin.collections + { + type List = kotlinStdLib.kotlin.collections.List + type Set = kotlinStdLib.kotlin.collections.Set + type Map = kotlinStdLib.kotlin.collections.Map + } + namespace kotlinx.datetime + { + type Instant = kotlinDateTime.kotlinx.datetime.Instant + } + namespace dk.cachet.carp.common.application.users + { + type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity + } +} + + +// Export facade. +export * from "carp.core-kotlin-carp.deployments.core" diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/src/carp-protocols-core.ts new file mode 100644 index 000000000..ede4e894d --- /dev/null +++ b/typescript-declarations/src/carp-protocols-core.ts @@ -0,0 +1,31 @@ +import * as extend from "carp.core-kotlin-carp.protocols.core" +import * as kotlinStdLib from "./kotlin" +import * as kotlinDateTime from "./kotlinx-datetime" + + +declare module "carp.core-kotlin-carp.protocols.core" +{ + // Declare missing types for which no imports were generated. + namespace kotlin + { + type Long = kotlinStdLib.kotlin.Long + } + namespace kotlin.time + { + type Duration = kotlinStdLib.kotlin.time.Duration + } + namespace kotlin.collections + { + type List = kotlinStdLib.kotlin.collections.List + type Set = kotlinStdLib.kotlin.collections.Set + type Map = kotlinStdLib.kotlin.collections.Map + } + namespace kotlinx.datetime + { + type Instant = kotlinDateTime.kotlinx.datetime.Instant + } +} + + +// Export facade. +export * from "carp.core-kotlin-carp.protocols.core" diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts new file mode 100644 index 000000000..9992f924d --- /dev/null +++ b/typescript-declarations/src/carp-studies-core.ts @@ -0,0 +1,37 @@ +import * as extend from "carp.core-kotlin-carp.studies.core" +import * as kotlinStdLib from "./kotlin" +import * as kotlinDateTime from "./kotlinx-datetime" +import * as carpCommon from "./carp-common" + + +declare module "carp.core-kotlin-carp.studies.core" +{ + // Declare missing types for which no imports were generated. + namespace kotlin + { + type Long = kotlinStdLib.kotlin.Long + } + namespace kotlin.time + { + type Duration = kotlinStdLib.kotlin.time.Duration + } + namespace kotlin.collections + { + type Collection = kotlinStdLib.kotlin.collections.Collection + type List = kotlinStdLib.kotlin.collections.List + type Set = kotlinStdLib.kotlin.collections.Set + type Map = kotlinStdLib.kotlin.collections.Map + } + namespace kotlinx.datetime + { + type Instant = kotlinDateTime.kotlinx.datetime.Instant + } + namespace dk.cachet.carp.common.application.users + { + type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity + } +} + + +// Export facade. +export * from "carp.core-kotlin-carp.studies.core" diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 26213292b..6474d5e6f 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -13,8 +13,8 @@ export namespace kotlin { constructor( first: K, second: V ) { let kotlinPair = new kotlinStdLib.$_$.Pair( first, second ); - kotlinPair.first = kotlinPair.s2_1; - kotlinPair.second = kotlinPair.t2_1; + kotlinPair.first = kotlinPair.a3_1; + kotlinPair.second = kotlinPair.b3_1; return kotlinPair; } get first(): K { return this.first; } @@ -54,10 +54,10 @@ export namespace kotlin.time } export namespace Duration { - export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_4() - export const parseIsoString: (isoDuration: string) => Duration = Companion.t4 - export const ZERO: Duration = Companion.q4_1 - export const INFINITE: Duration = Companion.r4_1 + export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_6() + export const parseIsoString: (isoDuration: string) => Duration = Companion.j6 + export const ZERO: Duration = Companion.g6_1 + export const INFINITE: Duration = Companion.h6_1 } } @@ -96,7 +96,7 @@ declare module "kotlin-kotlin-stdlib-js-ir" // Implement base interfaces in internal types. -kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.p4(); }; +kotlinStdLib.$_$.Long.prototype.toNumber = function(): number { return this.i5(); }; Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMilliseconds", { get: function inWholeMilliseconds() { @@ -112,19 +112,19 @@ Object.defineProperty( kotlinStdLib.$_$.Long.prototype, "inWholeMicroseconds", { kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.y( value ); } +kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.d1( value ); } kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.f(); } kotlinStdLib.$_$.EmptySet.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } -kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.y( value ); } +kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.d1( value ); } kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } -kotlinStdLib.$_$.HashMap.prototype.get = function( key: K ): V { return this.x1( key ); } +kotlinStdLib.$_$.HashMap.prototype.get = function( key: K ): V { return this.e2( key ); } Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "keys", { - get: function keys() { return this.y1(); } + get: function keys() { return this.f2(); } } ); Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", { - get: function values() { return this.z1(); } + get: function values() { return this.g2(); } } ); diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index 6d142e4dc..c8b646ec6 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -33,8 +33,8 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Implement base interfaces in internal types. -extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.i10(); }; -extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.t10(); }; +extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.x11(); }; +extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.k12(); }; // Re-export augmented types. diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 5ffed98cb..d1858c854 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -31,12 +31,12 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" extend.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { - return this.y10( serializer, value ); + return this.p12( serializer, value ); }; extend.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { - return this.z10( serializer, string ); + return this.q12( serializer, string ); }; From 91f761357cb9ccdc848c99b9ee29d7c827c0a688 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Tue, 31 Jan 2023 08:26:50 +0100 Subject: [PATCH 30/50] Add TypeScript tests for deployments/protocols/studies available before This doesn't include request object tests which were there before because so far these fail to be exported. --- .../tests/carp.common-test.ts | 4 +- .../tests/carp.deployments-test.ts | 14 +++++ .../tests/carp.protocols-test.ts | 35 +++++++++++ .../tests/carp.studies-test.ts | 59 +++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 typescript-declarations/tests/carp.deployments-test.ts create mode 100644 typescript-declarations/tests/carp.protocols-test.ts create mode 100644 typescript-declarations/tests/carp.studies-test.ts diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp.common-test.ts index fdb20ec04..8a81f9b99 100644 --- a/typescript-declarations/tests/carp.common-test.ts +++ b/typescript-declarations/tests/carp.common-test.ts @@ -1,11 +1,13 @@ import VerifyModule from './VerifyModule' - import { expect } from 'chai' + import { kotlin } from '../src/kotlin' import setOf = kotlin.collections.setOf import Duration = kotlin.time.Duration + import { kotlinx } from '../src/kotlinx-serialization' import Json = kotlinx.serialization.Json + import { dk } from '../src/carp-common' import Trilean = dk.cachet.carp.common.application.Trilean import toTrilean = dk.cachet.carp.common.application.toTrilean diff --git a/typescript-declarations/tests/carp.deployments-test.ts b/typescript-declarations/tests/carp.deployments-test.ts new file mode 100644 index 000000000..0dfbe1263 --- /dev/null +++ b/typescript-declarations/tests/carp.deployments-test.ts @@ -0,0 +1,14 @@ +import VerifyModule from './VerifyModule' + + +describe( "carp.deployments.core", () => { + it( "verify module declarations", async () => { + const instances: any[] = [] + + const moduleVerifier = new VerifyModule( + 'carp.core-kotlin-carp.deployments.core', + instances + ) + await moduleVerifier.verify() + } ) +} ) diff --git a/typescript-declarations/tests/carp.protocols-test.ts b/typescript-declarations/tests/carp.protocols-test.ts new file mode 100644 index 000000000..592100314 --- /dev/null +++ b/typescript-declarations/tests/carp.protocols-test.ts @@ -0,0 +1,35 @@ +import VerifyModule from './VerifyModule' +import { expect } from 'chai' + +import { kotlinx } from '../src/kotlinx-serialization' +import Json = kotlinx.serialization.Json + +import { dk as cdk } from '../src/carp-common' +import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON + +import { dk } from '../src/carp-protocols-core' +import StudyProtocolSnapshot = dk.cachet.carp.protocols.application.StudyProtocolSnapshot + +const serializedSnapshot = `{"id":"ad4ca03a-6f69-4a95-8701-488dc511925b","createdOn":"2023-01-30T21:02:56.068710100Z","version":0,"ownerId":"27879e75-ccc1-4866-9ab3-4ece1b735052","name":"Test protocol","description":"Test description","primaryDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Stub primary device"}],"connectedDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Stub device"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Chained primary"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Chained connected"}],"connections":[{"roleName":"Stub device","connectedToRoleName":"Stub primary device"},{"roleName":"Chained primary","connectedToRoleName":"Stub primary device"},{"roleName":"Chained connected","connectedToRoleName":"Chained primary"}],"tasks":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubTaskConfiguration","name":"Task","measures":[{"__type":"dk.cachet.carp.common.application.tasks.Measure.DataStream","type":"dk.cachet.carp.stubpoint"}]}],"triggers":{"0":{"__type":"dk.cachet.carp.common.infrastructure.test.StubTriggerConfiguration","sourceDeviceRoleName":"Stub device"}},"taskControls":[{"triggerId":0,"taskName":"Task","destinationDeviceRoleName":"Stub primary device","control":"Start"}],"participantRoles":[{"role":"Role","isOptional":false},{"role":"Optional role","isOptional":true}],"assignedDevices":{"Stub primary device":["Role"]},"expectedParticipantData":[{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"some.type"}},{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"dk.cachet.carp.input.sex"},"assignedTo":{"__type":"dk.cachet.carp.common.application.users.AssignedTo.Roles","roleNames":["Role"]}}]}` + + +describe( "carp.protocols.core", () => { + it( "verify module declarations", async () => { + const instances: any[] = [] + + const moduleVerifier = new VerifyModule( + 'carp.core-kotlin-carp.protocols.core', + instances + ) + await moduleVerifier.verify() + } ) + + describe( "StudyProtocolSnapshot", () => { + it( "can deserialize", () => { + const json = JSON as Json + const serializer = StudyProtocolSnapshot.Companion.serializer() + const parsed = json.decodeFromString( serializer, serializedSnapshot ) + expect( parsed ).is.instanceOf( StudyProtocolSnapshot ) + } ) + } ) +} ) diff --git a/typescript-declarations/tests/carp.studies-test.ts b/typescript-declarations/tests/carp.studies-test.ts new file mode 100644 index 000000000..a27749efc --- /dev/null +++ b/typescript-declarations/tests/carp.studies-test.ts @@ -0,0 +1,59 @@ +import VerifyModule from './VerifyModule' +import { expect } from 'chai' + +import { kotlin } from '../src/kotlin' +import setOf = kotlin.collections.setOf +import listOf = kotlin.collections.listOf + +import { kotlinx as kcd } from '../src/kotlinx-datetime' +import Clock = kcd.datetime.Clock + +import { dk as cdk } from 'carp.core-kotlin-carp.common' +import UUID = cdk.cachet.carp.common.application.UUID +import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo + +import { dk } from 'carp.core-kotlin-carp.studies.core' +import StudyStatus = dk.cachet.carp.studies.application.StudyStatus +import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles +import participantIds = dk.cachet.carp.studies.application.users.participantIds +import participantRoles = dk.cachet.carp.studies.application.users.participantRoles + + +describe( "carp.studies.core", () => { + it( "verify module declarations", async () => { + const instances: any[] = [] + + const moduleVerifier = new VerifyModule( + 'carp.core-kotlin-carp.studies.core', + instances + ) + await moduleVerifier.verify() + } ) + + describe( "AssignedParticipantRoles", () => { + it( "getAssigned participantIds and participantRoles works", () => { + const participant1 = UUID.Companion.randomUUID() + const participant2 = UUID.Companion.randomUUID() + const assigned1 = new AssignedParticipantRoles( participant1, new AssignedTo.Roles( setOf( [ "Test" ] ) ) ) + const assigned2 = new AssignedParticipantRoles( participant2, AssignedTo.All ) + const assignedGroup = listOf( [ assigned1, assigned2 ] ) + expect( participantIds( assignedGroup ).contains( participant1 ) ).is.true + expect( participantRoles( assignedGroup ).contains( "Test" ) ).is.true + } ) + } ) + + + describe( "StudyStatus", () => { + it ( "can typecheck StudyStatus", () => { + const configuring = new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ) + const configuringStatus: StudyStatus = configuring + expect( configuringStatus instanceof StudyStatus.Configuring ).is.true + expect( configuringStatus instanceof StudyStatus.Live ).is.false + + const live = new StudyStatus.Live( UUID.Companion.randomUUID(), "Test", Clock.System.now(), UUID.Companion.randomUUID(), false, false, true ) + const liveStatus: StudyStatus = live + expect( liveStatus instanceof StudyStatus.Live ).is.true + expect( liveStatus instanceof StudyStatus.Configuring ).is.false + } ) + } ) +} ) From eda83ac3b36c686d84a9362d4abbe837f6ded2c8 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Tue, 31 Jan 2023 14:05:47 +0100 Subject: [PATCH 31/50] Fix: `Json` facade was exported in wrong TypeScript namespace --- publish-npm-packages/src/known-facade-types | 2 +- typescript-declarations/src/carp-common.ts | 5 +++++ typescript-declarations/src/carp-data-core.ts | 5 +++++ typescript-declarations/src/carp-deployments-core.ts | 5 +++++ typescript-declarations/src/carp-protocols-core.ts | 5 +++++ typescript-declarations/src/carp-studies-core.ts | 5 +++++ typescript-declarations/src/kotlinx-serialization.ts | 6 +++--- typescript-declarations/tests/carp.common-test.ts | 7 +++---- typescript-declarations/tests/carp.protocols-test.ts | 5 ++--- .../tests/kotlinx-serialization-test.ts | 2 +- 10 files changed, 35 insertions(+), 12 deletions(-) diff --git a/publish-npm-packages/src/known-facade-types b/publish-npm-packages/src/known-facade-types index 0f1ead3a3..52939054f 100644 --- a/publish-npm-packages/src/known-facade-types +++ b/publish-npm-packages/src/known-facade-types @@ -7,5 +7,5 @@ kotlin.collections.Map kotlin.time.Duration kotlinx.datetime.Clock kotlinx.datetime.Instant -kotlinx.serialization.Json +kotlinx.serialization.json.Json dk.cachet.carp.common.application.users.AccountIdentity \ No newline at end of file diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index ccfd64d37..20d7eeb04 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -1,6 +1,7 @@ import * as extend from "carp.core-kotlin-carp.common" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" +import * as kotlinSerialization from "./kotlinx-serialization" declare module "carp.core-kotlin-carp.common" @@ -24,6 +25,10 @@ declare module "carp.core-kotlin-carp.common" { type Instant = kotlinDateTime.kotlinx.datetime.Instant } + namespace kotlinx.serialization.json + { + type Json = kotlinSerialization.kotlinx.serialization.json.Json + } // Augment internal types to implement desired base interfaces. diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/src/carp-data-core.ts index 70406c0f2..db347878d 100644 --- a/typescript-declarations/src/carp-data-core.ts +++ b/typescript-declarations/src/carp-data-core.ts @@ -1,6 +1,7 @@ import * as extend from "carp.core-kotlin-carp.data.core" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" +import * as kotlinSerialization from "./kotlinx-serialization" declare module "carp.core-kotlin-carp.data.core" @@ -24,6 +25,10 @@ declare module "carp.core-kotlin-carp.data.core" { type Instant = kotlinDateTime.kotlinx.datetime.Instant } + namespace kotlinx.serialization.json + { + type Json = kotlinSerialization.kotlinx.serialization.json.Json + } } diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts index 9fe595d50..49c0e4ab6 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -1,6 +1,7 @@ import * as extend from "carp.core-kotlin-carp.deployments.core" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" +import * as kotlinSerialization from "./kotlinx-serialization" import * as carpCommon from "./carp-common" @@ -25,6 +26,10 @@ declare module "carp.core-kotlin-carp.deployments.core" { type Instant = kotlinDateTime.kotlinx.datetime.Instant } + namespace kotlinx.serialization.json + { + type Json = kotlinSerialization.kotlinx.serialization.json.Json + } namespace dk.cachet.carp.common.application.users { type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/src/carp-protocols-core.ts index ede4e894d..5933af459 100644 --- a/typescript-declarations/src/carp-protocols-core.ts +++ b/typescript-declarations/src/carp-protocols-core.ts @@ -1,6 +1,7 @@ import * as extend from "carp.core-kotlin-carp.protocols.core" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" +import * as kotlinSerialization from "./kotlinx-serialization" declare module "carp.core-kotlin-carp.protocols.core" @@ -24,6 +25,10 @@ declare module "carp.core-kotlin-carp.protocols.core" { type Instant = kotlinDateTime.kotlinx.datetime.Instant } + namespace kotlinx.serialization.json + { + type Json = kotlinSerialization.kotlinx.serialization.json.Json + } } diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts index 9992f924d..5719d8ca5 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/src/carp-studies-core.ts @@ -1,6 +1,7 @@ import * as extend from "carp.core-kotlin-carp.studies.core" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" +import * as kotlinSerialization from "./kotlinx-serialization" import * as carpCommon from "./carp-common" @@ -26,6 +27,10 @@ declare module "carp.core-kotlin-carp.studies.core" { type Instant = kotlinDateTime.kotlinx.datetime.Instant } + namespace kotlinx.serialization.json + { + type Json = kotlinSerialization.kotlinx.serialization.json.Json + } namespace dk.cachet.carp.common.application.users { type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index d1858c854..3193a4b5b 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -2,7 +2,7 @@ import * as extend from "kotlinx-serialization-kotlinx-serialization-json-js-ir" // Facade with better method names and type conversions for internal types. -export namespace kotlinx.serialization +export namespace kotlinx.serialization.json { export interface Json { @@ -21,8 +21,8 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" { namespace $_$ { - interface JsonImpl extends kotlinx.serialization.Json {} - abstract class JsonImpl implements kotlinx.serialization.Json {} + interface JsonImpl extends kotlinx.serialization.json.Json {} + abstract class JsonImpl implements kotlinx.serialization.json.Json {} } } diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp.common-test.ts index 8a81f9b99..d098691b0 100644 --- a/typescript-declarations/tests/carp.common-test.ts +++ b/typescript-declarations/tests/carp.common-test.ts @@ -6,7 +6,7 @@ import setOf = kotlin.collections.setOf import Duration = kotlin.time.Duration import { kotlinx } from '../src/kotlinx-serialization' -import Json = kotlinx.serialization.Json +import Json = kotlinx.serialization.json.Json import { dk } from '../src/carp-common' import Trilean = dk.cachet.carp.common.application.Trilean @@ -94,10 +94,9 @@ describe( "carp.common", () => { new AssignedTo.Roles( setOf( [ "Roles are added" ] ) ) ) - const json = JSON as Json const serializer = ExpectedParticipantData.Companion.serializer() - const serialized = json.encodeToString( serializer, expectedData ) - const deserialized = json.decodeFromString( serializer, serialized ) as ExpectedParticipantData + const serialized = JSON.encodeToString( serializer, expectedData ) + const deserialized = JSON.decodeFromString( serializer, serialized ) as ExpectedParticipantData expect( deserialized.equals( expectedData ) ).is.true } ) } ) diff --git a/typescript-declarations/tests/carp.protocols-test.ts b/typescript-declarations/tests/carp.protocols-test.ts index 592100314..8531639d6 100644 --- a/typescript-declarations/tests/carp.protocols-test.ts +++ b/typescript-declarations/tests/carp.protocols-test.ts @@ -2,7 +2,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlinx } from '../src/kotlinx-serialization' -import Json = kotlinx.serialization.Json +import Json = kotlinx.serialization.json.Json import { dk as cdk } from '../src/carp-common' import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON @@ -26,9 +26,8 @@ describe( "carp.protocols.core", () => { describe( "StudyProtocolSnapshot", () => { it( "can deserialize", () => { - const json = JSON as Json const serializer = StudyProtocolSnapshot.Companion.serializer() - const parsed = json.decodeFromString( serializer, serializedSnapshot ) + const parsed = JSON.decodeFromString( serializer, serializedSnapshot ) expect( parsed ).is.instanceOf( StudyProtocolSnapshot ) } ) } ) diff --git a/typescript-declarations/tests/kotlinx-serialization-test.ts b/typescript-declarations/tests/kotlinx-serialization-test.ts index c83acb274..a92f3c48f 100644 --- a/typescript-declarations/tests/kotlinx-serialization-test.ts +++ b/typescript-declarations/tests/kotlinx-serialization-test.ts @@ -2,7 +2,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlinx } from '../src/kotlinx-serialization' -import Json = kotlinx.serialization.Json +import Json = kotlinx.serialization.json.Json describe( "kotlinx-serialization", () => { From b1511751d2261af049866f6c9e220e676db102bf Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 12 Mar 2023 16:44:00 +0100 Subject: [PATCH 32/50] Remove `ApplicationServiceRequest.invokeOn` This is no longer used and is superseded by `ApplicationServiceInvoker`. --- .../ApplicationServiceRequestsTest.kt | 21 +----------- .../services/ApplicationServiceRequest.kt | 3 +- .../services/ApplicationServiceRequestTest.kt | 34 ------------------- .../ApplicationServiceApiMigratorTest.kt | 1 - .../DataStreamServiceRequest.kt | 7 ---- .../DeploymentServiceRequest.kt | 17 ---------- .../ParticipationServiceRequest.kt | 8 ----- .../ProtocolFactoryServiceRequest.kt | 2 -- .../infrastructure/ProtocolServiceRequest.kt | 7 ---- .../RecruitmentServiceRequest.kt | 7 ---- .../infrastructure/StudyServiceRequest.kt | 13 ------- 11 files changed, 2 insertions(+), 118 deletions(-) diff --git a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt index c180557c6..d87bd33fa 100644 --- a/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt +++ b/carp.common.test/src/commonMain/kotlin/dk/cachet/carp/common/test/infrastructure/ApplicationServiceRequestsTest.kt @@ -4,7 +4,6 @@ import dk.cachet.carp.common.application.services.ApplicationService import dk.cachet.carp.common.infrastructure.services.* import dk.cachet.carp.common.infrastructure.test.createTestJSON import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.runTest import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.json.* @@ -12,8 +11,7 @@ import kotlin.test.* /** - * Base class to test whether application service request objects can be serialized, - * and whether they correctly call the application service on invoke. + * Base class to test whether application service request objects can be serialized. */ @ExperimentalCoroutinesApi @Suppress( "FunctionName" ) @@ -42,23 +40,6 @@ abstract class ApplicationServiceRequestsTest< assertEquals( allRequestObjects, testedRequestObjects ) } - @Test - fun invokeOn_requests_call_service() = runTest { - // Create logged service. Events can safely be ignored since they go unused. - val eventBusLog = EventBusLog( SingleThreadedEventBus() ) - val logger = ApplicationServiceLogger() - val loggedService = decoratedServiceConstructor( createService() ) - { ApplicationServiceRequestLogger( eventBusLog, logger::addLog, it ) } - - requests.forEach { request -> - try { request.invokeOn( loggedService ) } - catch ( ignore: Exception ) { } // Requests do not have to succeed to verify request arrived. - assertTrue( logger.wasCalled( request ) ) - - logger.clear() - } - } - @Test fun can_serialize_and_deserialize_requests() { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt index 042007df3..6ba5cd9bd 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.Required /** - * A request for [TService] stored in memory, which can be invoked using [invokeOn]. + * A request for [TService] stored in memory. */ interface ApplicationServiceRequest, out TReturn> { @@ -15,5 +15,4 @@ interface ApplicationServiceRequest, val apiVersion: ApiVersion fun getResponseSerializer(): KSerializer - suspend fun invokeOn( service: TService ): TReturn } diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestTest.kt index de6cf51fd..182950924 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequestTest.kt @@ -4,7 +4,6 @@ import dk.cachet.carp.common.application.services.ApiVersion import dk.cachet.carp.common.application.services.ApplicationService import dk.cachet.carp.common.application.services.IntegrationEvent import dk.cachet.carp.common.infrastructure.serialization.ignoreTypeParameters -import kotlinx.coroutines.test.runTest import kotlinx.serialization.* import kotlinx.serialization.json.Json import kotlin.test.* @@ -43,7 +42,6 @@ class ApplicationServiceRequestTest data class Operation( val parameter: Int ) : TestServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: TestService ): Int = service.operation( parameter ) } } @@ -67,36 +65,4 @@ class ApplicationServiceRequestTest assertEquals( request, parsed ) } - - @Test - fun invokeOn_requests_calls_service() = runTest { - var requestResponse: Int? = null - val service = - object : TestService - { - override suspend fun operation( parameter: Int ): Int = parameter.also { requestResponse = it } - } - - val request = TestServiceRequest.Operation( 42 ) - request.invokeOn( service ) - - assertEquals( 42, requestResponse ) - } - - @Test - fun invokeOn_deserialized_request_succeeds() = runTest { - var requestResponse: Int? = null - val service = - object : TestService - { - override suspend fun operation( parameter: Int ): Int = parameter.also { requestResponse = it } - } - - val serializedRequest = - Json.encodeToString( TestServiceRequest.Serializer, TestServiceRequest.Operation( 42 ) ) - val request = Json.decodeFromString( TestServiceRequest.Serializer, serializedRequest ) - request.invokeOn( service ) - - assertEquals( 42, requestResponse ) - } } diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt index 2d68c8087..895cd51b7 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/versioning/ApplicationServiceApiMigratorTest.kt @@ -50,7 +50,6 @@ class ApplicationServiceApiMigratorTest data class GetAnswer( val question: String ) : TestServiceRequest() { override fun getResponseSerializer() = Int.serializer() - override suspend fun invokeOn( service: TestService ) = service.getAnswer( question ) } } diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt index d15e70812..dfa1705d6 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt @@ -28,7 +28,6 @@ sealed class DataStreamServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DataStreamService ) = service.openDataStreams( configuration ) } @Serializable @@ -39,8 +38,6 @@ sealed class DataStreamServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DataStreamService ) = - service.appendToDataStreams( studyDeploymentId, batch ) } @Serializable @@ -51,8 +48,6 @@ sealed class DataStreamServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = DataStreamBatchSerializer - override suspend fun invokeOn( service: DataStreamService ) = - service.getDataStream( dataStream, fromSequenceId, toSequenceIdInclusive ) } @Serializable @@ -60,7 +55,6 @@ sealed class DataStreamServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DataStreamService ) = service.closeDataStreams( studyDeploymentIds ) } @Serializable @@ -68,6 +62,5 @@ sealed class DataStreamServiceRequest : ApplicationServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: DataStreamService ) = service.removeDataStreams( studyDeploymentIds ) } } diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt index c5f19530e..9cdf894ac 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt @@ -35,16 +35,12 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.createStudyDeployment( id, protocol, invitations, connectedDevicePreregistrations ) } @Serializable data class RemoveStudyDeployments( val studyDeploymentIds: Set ) : DeploymentServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: DeploymentService ) = - service.removeStudyDeployments( studyDeploymentIds ) } @Serializable @@ -52,8 +48,6 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.getStudyDeploymentStatus( studyDeploymentId ) } @Serializable @@ -61,8 +55,6 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: DeploymentService ) = - service.getStudyDeploymentStatusList( studyDeploymentIds ) } @Serializable @@ -73,8 +65,6 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.registerDevice( studyDeploymentId, deviceRoleName, registration ) } @Serializable @@ -82,8 +72,6 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.unregisterDevice( studyDeploymentId, deviceRoleName ) } @Serializable @@ -91,8 +79,6 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.getDeviceDeploymentFor( studyDeploymentId, primaryDeviceRoleName ) } @Serializable @@ -103,14 +89,11 @@ sealed class DeploymentServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = - service.deviceDeployed( studyDeploymentId, primaryDeviceRoleName, deviceDeploymentLastUpdatedOn ) } @Serializable data class Stop( val studyDeploymentId: UUID ) : DeploymentServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: DeploymentService ) = service.stop( studyDeploymentId ) } } diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt index e7e441fd8..93efa3666 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt @@ -29,16 +29,12 @@ sealed class ParticipationServiceRequest : ApplicationServiceReques ParticipationServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: ParticipationService ) = - service.getActiveParticipationInvitations( accountId ) } @Serializable data class GetParticipantData( val studyDeploymentId: UUID ) : ParticipationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ParticipationService ) = - service.getParticipantData( studyDeploymentId ) } @Serializable @@ -46,8 +42,6 @@ sealed class ParticipationServiceRequest : ApplicationServiceReques ParticipationServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: ParticipationService ) = - service.getParticipantDataList( studyDeploymentIds ) } @Serializable @@ -59,7 +53,5 @@ sealed class ParticipationServiceRequest : ApplicationServiceReques ParticipationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ParticipationService ) = - service.setParticipantData( studyDeploymentId, data, inputByParticipantRole ) } } diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt index 4f980e63a..458d3a68c 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt @@ -30,7 +30,5 @@ sealed class ProtocolFactoryServiceRequest : ApplicationServiceRequ ) : ProtocolFactoryServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ProtocolFactoryService ) = - service.createCustomProtocol( ownerId, name, customProtocol, description ) } } diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt index 25d84420e..51abc4a07 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt @@ -29,7 +29,6 @@ sealed class ProtocolServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ProtocolService ) = service.add( protocol, versionTag ) } @Serializable @@ -39,7 +38,6 @@ sealed class ProtocolServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ProtocolService ) = service.addVersion( protocol, versionTag ) } @Serializable @@ -50,8 +48,6 @@ sealed class ProtocolServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ProtocolService ) = - service.updateParticipantDataConfiguration( protocolId, versionTag, expectedParticipantData ) } @Serializable @@ -59,20 +55,17 @@ sealed class ProtocolServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: ProtocolService ) = service.getBy( protocolId, versionTag ) } @Serializable data class GetAllForOwner( val ownerId: UUID ) : ProtocolServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: ProtocolService ) = service.getAllForOwner( ownerId ) } @Serializable data class GetVersionHistoryFor( val protocolId: UUID ) : ProtocolServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: ProtocolService ) = service.getVersionHistoryFor( protocolId ) } } diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt index 612c2622f..39dda8448 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt @@ -28,21 +28,18 @@ sealed class RecruitmentServiceRequest : ApplicationServiceRequest< data class AddParticipant( val studyId: UUID, val email: EmailAddress ) : RecruitmentServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: RecruitmentService ) = service.addParticipant( studyId, email ) } @Serializable data class GetParticipant( val studyId: UUID, val participantId: UUID ) : RecruitmentServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: RecruitmentService ) = service.getParticipant( studyId, participantId ) } @Serializable data class GetParticipants( val studyId: UUID ) : RecruitmentServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: RecruitmentService ) = service.getParticipants( studyId ) } @Serializable @@ -50,8 +47,6 @@ sealed class RecruitmentServiceRequest : ApplicationServiceRequest< RecruitmentServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: RecruitmentService ) = - service.inviteNewParticipantGroup( studyId, group ) } @Serializable @@ -59,7 +54,6 @@ sealed class RecruitmentServiceRequest : ApplicationServiceRequest< RecruitmentServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: RecruitmentService ) = service.getParticipantGroupStatusList( studyId ) } @Serializable @@ -67,6 +61,5 @@ sealed class RecruitmentServiceRequest : ApplicationServiceRequest< RecruitmentServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: RecruitmentService ) = service.stopParticipantGroup( studyId, groupId ) } } diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt index 85fd36d5a..180db73bd 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt @@ -10,7 +10,6 @@ import dk.cachet.carp.studies.application.StudyDetails import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyStatus import kotlinx.serialization.* -import kotlin.js.JsExport /** @@ -34,8 +33,6 @@ sealed class StudyServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = - service.createStudy( ownerId, name, description, invitation ) } @Serializable @@ -43,36 +40,30 @@ sealed class StudyServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = - service.setInternalDescription( studyId, name, description ) } @Serializable data class GetStudyDetails( val studyId: UUID ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.getStudyDetails( studyId ) } @Serializable data class GetStudyStatus( val studyId: UUID ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.getStudyStatus( studyId ) } @Serializable data class GetStudiesOverview( val ownerId: UUID ) : StudyServiceRequest>() { override fun getResponseSerializer() = serializer>() - override suspend fun invokeOn( service: StudyService ) = service.getStudiesOverview( ownerId ) } @Serializable data class SetInvitation( val studyId: UUID, val invitation: StudyInvitation ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.setInvitation( studyId, invitation ) } @Serializable @@ -80,27 +71,23 @@ sealed class StudyServiceRequest : ApplicationServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.setProtocol( studyId, protocol ) } @Serializable data class RemoveProtocol( val studyId: UUID ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.removeProtocol( studyId ) } @Serializable data class GoLive( val studyId: UUID ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.goLive( studyId ) } @Serializable data class Remove( val studyId: UUID ) : StudyServiceRequest() { override fun getResponseSerializer() = serializer() - override suspend fun invokeOn( service: StudyService ) = service.remove( studyId ) } } From bf24840e3383a0132176818065a9ab468690696a Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 12 Mar 2023 18:53:11 +0100 Subject: [PATCH 33/50] Build: upgrade to Kotlin 1.8.10 and serialization 1.5.0 --- build.gradle | 6 +++--- .../infrastructure/serialization/Serialization.kt | 14 +++++++------- .../UnknownPolymorphicSerializerTest.kt | 2 +- .../ConcreteTypesSerializationTest.kt | 9 +-------- .../index.d.ts | 4 ++-- .../index.d.ts | 4 ++-- typescript-declarations/src/kotlinx-datetime.ts | 4 ++-- .../src/kotlinx-serialization.ts | 4 ++-- 8 files changed, 20 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index aba327243..9a3eff209 100644 --- a/build.gradle +++ b/build.gradle @@ -8,9 +8,9 @@ buildscript { versions = [ // Kotlin multiplatform versions. - kotlin:'1.8.0', - serialization:'1.4.1', - coroutines:'1.6.4', + kotlin:'1.8.10', + serialization:'1.5.0', + coroutines:'1.7.0-Beta', datetime:'0.4.0', // JVM versions. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt index 4a7d7b3e5..d1e70a131 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/Serialization.kt @@ -49,7 +49,7 @@ val COMMON_SERIAL_MODULE = SerializersModule { subclass( Sex::class, PolymorphicEnumSerializer( Sex.serializer() ) ) subclass( CustomData::class ) - default { DataSerializer } + defaultDeserializer { DataSerializer } } polymorphic( InputElement::class ) { @@ -73,13 +73,13 @@ val COMMON_SERIAL_MODULE = SerializersModule { registerPrimaryDeviceConfigurationSubclasses() subclass( CustomDeviceConfiguration::class ) - default { DeviceConfigurationSerializer } + defaultDeserializer { DeviceConfigurationSerializer } } polymorphic( PrimaryDeviceConfiguration::class ) { registerPrimaryDeviceConfigurationSubclasses() - default { PrimaryDeviceConfigurationSerializer } + defaultDeserializer { PrimaryDeviceConfigurationSerializer } } polymorphic( DeviceRegistration::class ) { @@ -89,7 +89,7 @@ val COMMON_SERIAL_MODULE = SerializersModule { subclass( MACAddressDeviceRegistration::class ) subclass( CustomDeviceRegistration::class ) - default { DeviceRegistrationSerializer } + defaultDeserializer { DeviceRegistrationSerializer } } @@ -107,7 +107,7 @@ val COMMON_SERIAL_MODULE = SerializersModule { subclass( NoOptionsSamplingConfiguration::class, NoOptionsSamplingConfiguration.serializer() ) subclass( CustomSamplingConfiguration::class ) - default { SamplingConfigurationSerializer } + defaultDeserializer { SamplingConfigurationSerializer } } @@ -119,7 +119,7 @@ val COMMON_SERIAL_MODULE = SerializersModule { subclass( WebTask::class ) subclass( CustomTaskConfiguration::class ) - default { TaskConfigurationSerializer } + defaultDeserializer { TaskConfigurationSerializer } } @@ -131,7 +131,7 @@ val COMMON_SERIAL_MODULE = SerializersModule { subclass( ScheduledTrigger::class ) subclass( CustomTriggerConfiguration::class ) - default { TriggerConfigurationSerializer } + defaultDeserializer { TriggerConfigurationSerializer } } diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownPolymorphicSerializerTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownPolymorphicSerializerTest.kt index 1f080a7ee..4e78d45ad 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownPolymorphicSerializerTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownPolymorphicSerializerTest.kt @@ -20,7 +20,7 @@ class UnknownPolymorphicSerializerTest subclass( DerivingType::class ) subclass( CustomBaseType::class ) - default { UnknownBaseTypeSerializer } + defaultDeserializer { UnknownBaseTypeSerializer } } } diff --git a/carp.test/src/commonMain/kotlin/dk/cachet/carp/test/serialization/ConcreteTypesSerializationTest.kt b/carp.test/src/commonMain/kotlin/dk/cachet/carp/test/serialization/ConcreteTypesSerializationTest.kt index 2dfa6af33..0006072c4 100644 --- a/carp.test/src/commonMain/kotlin/dk/cachet/carp/test/serialization/ConcreteTypesSerializationTest.kt +++ b/carp.test/src/commonMain/kotlin/dk/cachet/carp/test/serialization/ConcreteTypesSerializationTest.kt @@ -88,6 +88,7 @@ fun getPolymorphicSerializers( serialModule: SerializersModule ): Map, serializers[ actualClass ] = actualSerializer } + @Suppress( "REDUNDANT_PROJECTION", "KotlinRedundantDiagnosticSuppress" ) // Exact override needed. override fun polymorphicDefaultDeserializer( baseClass: KClass, defaultDeserializerProvider: (className: String?) -> DeserializationStrategy? @@ -103,14 +104,6 @@ fun getPolymorphicSerializers( serialModule: SerializersModule ): Map, { // The default serializer is not returned by this method. } - - override fun polymorphicDefault( - baseClass: KClass, - defaultDeserializerProvider: (className: String?) -> DeserializationStrategy? - ) - { - // The default serializer is not returned by this method. - } } serialModule.dumpTo( collector ) diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index da1ebb75e..cac974078 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - x11(): Instant_0 + b12(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - k12(): number + o12(): number } } } diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts index 7b68cd58f..ca6edae2f 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts @@ -5,10 +5,10 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" interface JsonImpl { // encodeToString - p12( serializer: any, instance: any ): string + t12( serializer: any, instance: any ): string // decodeFromString - q12( serializer: any, string: string ): string + u12( serializer: any, string: string ): string } function Default_getInstance(): JsonImpl } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index c8b646ec6..cbff65218 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -33,8 +33,8 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Implement base interfaces in internal types. -extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.x11(); }; -extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.k12(); }; +extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.b12(); }; +extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.o12(); }; // Re-export augmented types. diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 3193a4b5b..7d9977388 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -31,12 +31,12 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" extend.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { - return this.p12( serializer, value ); + return this.t12( serializer, value ); }; extend.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { - return this.q12( serializer, string ); + return this.u12( serializer, string ); }; From 420b061a751a5e8324f79dc95c636b30dc7bb5a7 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 18 Mar 2023 14:19:50 +0100 Subject: [PATCH 34/50] Add collection serializers TypeScript facade --- .../kotlin/KotlinxSerializationExport.kt | 10 ++++++++++ ...serialization-kotlinx-serialization-core-js-ir | 3 +++ .../index.d.ts | 9 +++++++++ .../src/kotlinx-serialization.ts | 15 +++++++++++---- 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-core-js-ir create mode 100644 typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts diff --git a/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt b/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt index 4e0a009da..8dc312929 100644 --- a/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt +++ b/publish-npm-packages/src/commonMain/kotlin/KotlinxSerializationExport.kt @@ -3,6 +3,9 @@ "UNUSED_VARIABLE" // The variable names show up in generated JS sources which is useful to look up mangled names. ) +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.MapSerializer +import kotlinx.serialization.builtins.SetSerializer import kotlinx.serialization.builtins.serializer import kotlinx.serialization.json.Json import kotlin.js.JsExport @@ -16,6 +19,13 @@ import kotlin.js.JsExport @JsExport class KotlinxSerializationExport { + fun builtins() + { + val listSerializer = ListSerializer( Int.serializer() ) + val mapSerializer = MapSerializer( Int.serializer(), Int.serializer() ) + val setSerializer = SetSerializer( Int.serializer() ) + } + fun json( json: Json ) { val default = Json.Default diff --git a/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-core-js-ir b/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-core-js-ir new file mode 100644 index 000000000..cab638649 --- /dev/null +++ b/publish-npm-packages/src/forced-exports/kotlinx-serialization-kotlinx-serialization-core-js-ir @@ -0,0 +1,3 @@ +ListSerializer +MapSerializer +SetSerializer \ No newline at end of file diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts new file mode 100644 index 000000000..9a8c7c4d6 --- /dev/null +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts @@ -0,0 +1,9 @@ +declare module "kotlinx-serialization-kotlinx-serialization-core-js-ir" +{ + namespace $_$ + { + function ListSerializer( serializer: any ): any + function MapSerializer( keySerializer: any, valueSerializer: any ): any + function SetSerializer( serializer: any ): any + } +} diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index 7d9977388..b239502ee 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -1,4 +1,5 @@ -import * as extend from "kotlinx-serialization-kotlinx-serialization-json-js-ir" +import * as extendCore from "kotlinx-serialization-kotlinx-serialization-core-js-ir" +import * as extendJson from "kotlinx-serialization-kotlinx-serialization-json-js-ir" // Facade with better method names and type conversions for internal types. @@ -11,9 +12,15 @@ export namespace kotlinx.serialization.json } export namespace Json { - export const Default: Json = extend.$_$.Default_getInstance() + export const Default: Json = extendJson.$_$.Default_getInstance() } } +export namespace kotlinx.serialization.builtins +{ + export const ListSerializer: (serializer: any) => any = extendCore.$_$.ListSerializer + export const MapSerializer: (keySerializer: any, valueSerializer: any) => any = extendCore.$_$.MapSerializer + export const SetSerializer: (serializer: any) => any = extendCore.$_$.SetSerializer +} // Augment internal types to implement facade. @@ -28,12 +35,12 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" // Implement base interfaces in internal types. -extend.$_$.JsonImpl.prototype.encodeToString = +extendJson.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { return this.t12( serializer, value ); }; -extend.$_$.JsonImpl.prototype.decodeFromString = +extendJson.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { return this.u12( serializer, string ); From 3e95c29410c0a04d6e4f2437500892dbc2156a94 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Wed, 15 Mar 2023 23:10:59 +0100 Subject: [PATCH 35/50] Add `JsExport` to application service requests This didn't work before due to a compilation error: https://youtrack.jetbrains.com/issue/KT-57356 But, by removing `@JsExport` from `ApplicationService`, where it isn't really needed, compilation succeeds. As part of this, old TypeScript unit tests operating on request objects were reintroduced. This again changed the JS export drastically enough so that the custom typescript declarations hacking into non-exported JS exports had to be updated. --- .../services/ApplicationService.kt | 4 +- .../application/services/IntegrationEvent.kt | 2 - .../services/ApplicationServiceRequest.kt | 3 + .../DataStreamServiceRequest.kt | 3 + .../DeploymentServiceRequest.kt | 3 + .../ParticipationServiceRequest.kt | 3 + .../ProtocolFactoryServiceRequest.kt | 3 + .../infrastructure/ProtocolServiceRequest.kt | 3 + .../RecruitmentServiceRequest.kt | 3 + .../infrastructure/StudyServiceRequest.kt | 3 + .../forced-exports/kotlin-kotlin-stdlib-js-ir | 2 +- .../index.d.ts | 4 +- .../kotlin-kotlin-stdlib-js-ir/index.d.ts | 8 +- .../index.d.ts | 4 +- typescript-declarations/src/kotlin.ts | 8 +- .../src/kotlinx-datetime.ts | 4 +- .../src/kotlinx-serialization.ts | 4 +- .../tests/carp.protocols-test.ts | 15 +++- .../tests/carp.studies-test.ts | 77 +++++++++++++++++++ 19 files changed, 131 insertions(+), 25 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt index be48c617c..32e7efcda 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/ApplicationService.kt @@ -1,12 +1,10 @@ package dk.cachet.carp.common.application.services -import kotlin.js.JsExport - /** * Exposes interactions with internal domain objects which may raise [TIntegrationEvent]s. */ -@JsExport +// @JsExport can't be applied due to a bug: https://youtrack.jetbrains.com/issue/KT-57356/ interface ApplicationService< Self : ApplicationService, in TIntegrationEvent : IntegrationEvent diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt index 16a68beee..264c87795 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/services/IntegrationEvent.kt @@ -4,7 +4,6 @@ import dk.cachet.carp.common.application.Immutable import dk.cachet.carp.common.application.ImplementAsDataClass import kotlinx.serialization.Polymorphic import kotlinx.serialization.Required -import kotlin.js.JsExport /** @@ -15,7 +14,6 @@ import kotlin.js.JsExport @Polymorphic @Immutable @ImplementAsDataClass -@JsExport interface IntegrationEvent> { @Required diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt index 6ba5cd9bd..229e9e5e8 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/services/ApplicationServiceRequest.kt @@ -4,11 +4,14 @@ import dk.cachet.carp.common.application.services.ApiVersion import dk.cachet.carp.common.application.services.ApplicationService import kotlinx.serialization.KSerializer import kotlinx.serialization.Required +import kotlin.js.JsExport /** * A request for [TService] stored in memory. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) interface ApplicationServiceRequest, out TReturn> { @Required diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt index dfa1705d6..db4334ac4 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/DataStreamServiceRequest.kt @@ -10,12 +10,15 @@ import dk.cachet.carp.data.application.DataStreamId import dk.cachet.carp.data.application.DataStreamService import dk.cachet.carp.data.application.DataStreamsConfiguration import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [DataStreamServiceRequest] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class DataStreamServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt index 9cdf894ac..a5f50c6f0 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/DeploymentServiceRequest.kt @@ -12,12 +12,15 @@ import dk.cachet.carp.deployments.application.users.ParticipantInvitation import dk.cachet.carp.protocols.application.StudyProtocolSnapshot import kotlinx.datetime.Instant import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [DeploymentService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class DeploymentServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt index 93efa3666..d27d771ae 100644 --- a/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt +++ b/carp.deployments.core/src/commonMain/kotlin/dk/cachet/carp/deployments/infrastructure/ParticipationServiceRequest.kt @@ -10,12 +10,15 @@ import dk.cachet.carp.deployments.application.ParticipationService import dk.cachet.carp.deployments.application.users.ActiveParticipationInvitation import dk.cachet.carp.deployments.application.users.ParticipantData import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [ParticipationService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class ParticipationServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt index 458d3a68c..90cda9316 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolFactoryServiceRequest.kt @@ -7,12 +7,15 @@ import dk.cachet.carp.common.infrastructure.services.ApplicationServiceRequest import dk.cachet.carp.protocols.application.ProtocolFactoryService import dk.cachet.carp.protocols.application.StudyProtocolSnapshot import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [ProtocolFactoryService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class ProtocolFactoryServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt index 51abc4a07..066add5b2 100644 --- a/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt +++ b/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/infrastructure/ProtocolServiceRequest.kt @@ -10,12 +10,15 @@ import dk.cachet.carp.protocols.application.ProtocolVersion import dk.cachet.carp.protocols.application.StudyProtocolSnapshot import kotlinx.datetime.Clock import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [ProtocolService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class ProtocolServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt index 39dda8448..ac447f7b7 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/RecruitmentServiceRequest.kt @@ -10,12 +10,15 @@ import dk.cachet.carp.studies.application.users.AssignedParticipantRoles import dk.cachet.carp.studies.application.users.Participant import dk.cachet.carp.studies.application.users.ParticipantGroupStatus import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [RecruitmentService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class RecruitmentServiceRequest : ApplicationServiceRequest { @Required diff --git a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt index 180db73bd..e9c3b7f64 100644 --- a/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt +++ b/carp.studies.core/src/commonMain/kotlin/dk/cachet/carp/studies/infrastructure/StudyServiceRequest.kt @@ -10,12 +10,15 @@ import dk.cachet.carp.studies.application.StudyDetails import dk.cachet.carp.studies.application.StudyService import dk.cachet.carp.studies.application.StudyStatus import kotlinx.serialization.* +import kotlin.js.JsExport /** * Serializable application service requests to [StudyService] which can be executed on demand. */ @Serializable +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) sealed class StudyServiceRequest : ApplicationServiceRequest { @Required diff --git a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir index fbc4fe0c6..ab5a0e234 100644 --- a/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir +++ b/publish-npm-packages/src/forced-exports/kotlin-kotlin-stdlib-js-ir @@ -10,6 +10,6 @@ to listOf setOf mapOf -Companion_getInstance_6 +Companion_getInstance_7 _Duration___get_inWholeMilliseconds__impl__msfiry _Duration___get_inWholeMicroseconds__impl__8oe8vv \ No newline at end of file diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts index cac974078..e035a55f9 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts @@ -5,14 +5,14 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - b12(): Instant_0 + d12(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - o12(): number + q12(): number } } } diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts index bdd043dff..643b16661 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts @@ -59,15 +59,15 @@ declare module "kotlin-kotlin-stdlib-js-ir" interface DurationCompanion { // parseIsoString - j6(): Duration + n6(): Duration // ZERO - g6_1: Duration + k6_1: Duration // INFINITE - h6_1: Duration + l6_1: Duration } - function Companion_getInstance_6(): DurationCompanion + function Companion_getInstance_7(): DurationCompanion function _Duration___get_inWholeMilliseconds__impl__msfiry(duration: Duration): Long function _Duration___get_inWholeMicroseconds__impl__8oe8vv(duration: Duration): Long } diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts index ca6edae2f..33f9b0802 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts +++ b/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts @@ -5,10 +5,10 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" interface JsonImpl { // encodeToString - t12( serializer: any, instance: any ): string + v12( serializer: any, instance: any ): string // decodeFromString - u12( serializer: any, string: string ): string + w12( serializer: any, string: string ): string } function Default_getInstance(): JsonImpl } diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/src/kotlin.ts index 6474d5e6f..cb8600672 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/src/kotlin.ts @@ -54,10 +54,10 @@ export namespace kotlin.time } export namespace Duration { - export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_6() - export const parseIsoString: (isoDuration: string) => Duration = Companion.j6 - export const ZERO: Duration = Companion.g6_1 - export const INFINITE: Duration = Companion.h6_1 + export const Companion: any = kotlinStdLib.$_$.Companion_getInstance_7() + export const parseIsoString: (isoDuration: string) => Duration = Companion.n6 + export const ZERO: Duration = Companion.k6_1 + export const INFINITE: Duration = Companion.l6_1 } } diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/src/kotlinx-datetime.ts index cbff65218..1d6b73165 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/src/kotlinx-datetime.ts @@ -33,8 +33,8 @@ declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Implement base interfaces in internal types. -extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.b12(); }; -extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.o12(); }; +extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.d12(); }; +extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.q12(); }; // Re-export augmented types. diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/src/kotlinx-serialization.ts index b239502ee..9ce8de0d1 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/src/kotlinx-serialization.ts @@ -38,12 +38,12 @@ declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" extendJson.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { - return this.t12( serializer, value ); + return this.v12( serializer, value ); }; extendJson.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { - return this.u12( serializer, string ); + return this.w12( serializer, string ); }; diff --git a/typescript-declarations/tests/carp.protocols-test.ts b/typescript-declarations/tests/carp.protocols-test.ts index 8531639d6..1f77c3a94 100644 --- a/typescript-declarations/tests/carp.protocols-test.ts +++ b/typescript-declarations/tests/carp.protocols-test.ts @@ -1,14 +1,12 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' -import { kotlinx } from '../src/kotlinx-serialization' -import Json = kotlinx.serialization.json.Json - import { dk as cdk } from '../src/carp-common' import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON import { dk } from '../src/carp-protocols-core' import StudyProtocolSnapshot = dk.cachet.carp.protocols.application.StudyProtocolSnapshot +import ProtocolServiceRequest = dk.cachet.carp.protocols.infrastructure.ProtocolServiceRequest const serializedSnapshot = `{"id":"ad4ca03a-6f69-4a95-8701-488dc511925b","createdOn":"2023-01-30T21:02:56.068710100Z","version":0,"ownerId":"27879e75-ccc1-4866-9ab3-4ece1b735052","name":"Test protocol","description":"Test description","primaryDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Stub primary device"}],"connectedDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Stub device"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Chained primary"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Chained connected"}],"connections":[{"roleName":"Stub device","connectedToRoleName":"Stub primary device"},{"roleName":"Chained primary","connectedToRoleName":"Stub primary device"},{"roleName":"Chained connected","connectedToRoleName":"Chained primary"}],"tasks":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubTaskConfiguration","name":"Task","measures":[{"__type":"dk.cachet.carp.common.application.tasks.Measure.DataStream","type":"dk.cachet.carp.stubpoint"}]}],"triggers":{"0":{"__type":"dk.cachet.carp.common.infrastructure.test.StubTriggerConfiguration","sourceDeviceRoleName":"Stub device"}},"taskControls":[{"triggerId":0,"taskName":"Task","destinationDeviceRoleName":"Stub primary device","control":"Start"}],"participantRoles":[{"role":"Role","isOptional":false},{"role":"Optional role","isOptional":true}],"assignedDevices":{"Stub primary device":["Role"]},"expectedParticipantData":[{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"some.type"}},{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"dk.cachet.carp.input.sex"},"assignedTo":{"__type":"dk.cachet.carp.common.application.users.AssignedTo.Roles","roleNames":["Role"]}}]}` @@ -31,4 +29,15 @@ describe( "carp.protocols.core", () => { expect( parsed ).is.instanceOf( StudyProtocolSnapshot ) } ) } ) + + describe( "ProtocolServiceRequest", () => { + it( "add request has default version tag", () => { + const serializer = StudyProtocolSnapshot.Companion.serializer() + const snapshot = JSON.decodeFromString( serializer, serializedSnapshot ) + + const addProtocol = new ProtocolServiceRequest.Add( snapshot ) + const versionTag = (addProtocol as any).versionTag + expect( versionTag ).equals( "Initial" ) + } ) + } ) } ) diff --git a/typescript-declarations/tests/carp.studies-test.ts b/typescript-declarations/tests/carp.studies-test.ts index a27749efc..2026d9813 100644 --- a/typescript-declarations/tests/carp.studies-test.ts +++ b/typescript-declarations/tests/carp.studies-test.ts @@ -8,15 +8,31 @@ import listOf = kotlin.collections.listOf import { kotlinx as kcd } from '../src/kotlinx-datetime' import Clock = kcd.datetime.Clock +import { kotlinx as scd } from '../src/kotlinx-serialization' +import ListSerializer = scd.serialization.builtins.ListSerializer + import { dk as cdk } from 'carp.core-kotlin-carp.common' import UUID = cdk.cachet.carp.common.application.UUID +import Username = cdk.cachet.carp.common.application.users.Username import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo +import UsernameAccountIdentity = cdk.cachet.carp.common.application.users.UsernameAccountIdentity +import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON + +import { dk as ddk } from 'carp.core-kotlin-carp.deployments.core' +import DeviceDeploymentStatus = ddk.cachet.carp.deployments.application.DeviceDeploymentStatus +import StudyDeploymentStatus = ddk.cachet.carp.deployments.application.StudyDeploymentStatus +import ParticipantStatus = ddk.cachet.carp.deployments.application.users.ParticipantStatus +import StudyInvitation = ddk.cachet.carp.deployments.application.users.StudyInvitation import { dk } from 'carp.core-kotlin-carp.studies.core' import StudyStatus = dk.cachet.carp.studies.application.StudyStatus import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles +import Participant = dk.cachet.carp.studies.application.users.Participant +import ParticipantGroupStatus = dk.cachet.carp.studies.application.users.ParticipantGroupStatus import participantIds = dk.cachet.carp.studies.application.users.participantIds import participantRoles = dk.cachet.carp.studies.application.users.participantRoles +import StudyServiceRequest = dk.cachet.carp.studies.infrastructure.StudyServiceRequest +import RecruitmentServiceRequest = dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest describe( "carp.studies.core", () => { @@ -56,4 +72,65 @@ describe( "carp.studies.core", () => { expect( liveStatus instanceof StudyStatus.Configuring ).is.false } ) } ) + + describe( "StudyServiceRequest", () => { + it( "can serialize requests with polymorphic serializer", () => { + const createStudy = new StudyServiceRequest.CreateStudy( + UUID.Companion.randomUUID(), + "Test study", + "This is a study description", + new StudyInvitation( "Some study" ) + ) + + const serialized = JSON.encodeToString( StudyServiceRequest.Serializer, createStudy ) + expect( serialized ).has.string( "dk.cachet.carp.studies.infrastructure.StudyServiceRequest.CreateStudy" ) + } ) + + it( "can serialize getStudiesOverview response", () => { + const status = new StudyStatus.Configuring( UUID.Companion.randomUUID(), "Test", Clock.System.now(), null, true, true, false, true ) + const statusList = listOf( [ status ] ) + + const serializer = ListSerializer( StudyStatus.Companion.serializer() ) + expect( serializer ).is.not.undefined + const serialized = JSON.encodeToString( serializer, statusList ) + expect( serialized ).is.not.not.undefined + } ) + } ) + + + describe( "RecruitmentServiceRequest", () => { + it( "can serialize DeployParticipantGroup", () => { + const deployGroup = new RecruitmentServiceRequest.InviteNewParticipantGroup( + UUID.Companion.randomUUID(), + setOf( [ + new AssignedParticipantRoles( UUID.Companion.randomUUID(), AssignedTo.All ) + ] ) + ) + + const serializer = RecruitmentServiceRequest.Serializer + const serialized = JSON.encodeToString( serializer, deployGroup ) + expect( serialized ).is.not.undefined + } ) + + it( "can serialize Participant", () => { + const participant = new Participant( new UsernameAccountIdentity( new Username( "Test" ) ), UUID.Companion.randomUUID() ) + + const serializer = Participant.Companion.serializer() + const serialized = JSON.encodeToString( serializer, participant ) + expect( serialized ).is.not.undefined + } ) + + it( "can serialize ParticipantGroupStatus", () => { + const deploymentId = UUID.Companion.randomUUID() + const now = Clock.System.now() + const deploymentStatus = new StudyDeploymentStatus.Running( now, deploymentId, listOf( [] ), listOf( [] ), now ) + const participants = setOf( [ new Participant( new UsernameAccountIdentity( new Username( "Test" ) ) ) ] ) + const castDeploymentStatus = deploymentStatus as any // HACK: Type safety needs to be turned off due to loading from different packages. + const group = new ParticipantGroupStatus.Invited( deploymentId, participants, now, castDeploymentStatus ) + + const serializer = ParticipantGroupStatus.Companion.serializer() + const serialized = JSON.encodeToString( serializer, group ) + expect( serialized ).is.not.undefined + } ) + } ) } ) From 6cafc464e3e258cdc3e64cfcf8270ae6245333dd Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 18 Mar 2023 16:20:09 +0100 Subject: [PATCH 36/50] Workaround to JS export `WebTask` `WebTask` export didn't work on JS due to a bug in generated TypeScript sources: required parameters can't follow optional parameters: https://youtrack.jetbrains.com/issue/KT-53180/Kotlin-JS-generated-TypeScript-constructor-can-have-TS1016-A-required-parameter-cannot-follow-an-optional-parameter-error-with --- .../cachet/carp/common/application/tasks/WebTask.kt | 12 +++++++----- .../carp/common/application/users/AccountIdentity.kt | 2 +- .../cachet/carp/common/application/TestInstances.kt | 2 +- .../carp/common/application/tasks/WebTaskTest.kt | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt index fc2651441..38466326b 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/tasks/WebTask.kt @@ -1,3 +1,5 @@ +@file:Suppress( "NON_EXPORTABLE_TYPE" ) + package dk.cachet.carp.common.application.tasks import dk.cachet.carp.common.application.UUID @@ -12,15 +14,16 @@ import kotlin.js.JsExport * The passive [measures] are started when the website is opened and stopped when it is closed. */ @Serializable +@JsExport data class WebTask( override val name: String, - override val measures: List = emptyList(), - override val description: String? = null, /** * The URL of the web page which contains the task to be performed. * The URL may contain [UrlVariable] patterns which will be replaced with the corresponding values by the client runtime. */ - val url: String + val url: String, + override val description: String? = null, + override val measures: List = emptyList(), ) : TaskConfiguration // The execution of the task is delegated to a web page, so this task uploads no data. { companion object @@ -62,7 +65,6 @@ data class WebTask( * A helper class to configure and construct immutable [WebTask] instances. */ @JsExport -@Suppress( "NON_EXPORTABLE_TYPE" ) class WebTaskBuilder : TaskConfigurationBuilder() { /** @@ -71,5 +73,5 @@ class WebTaskBuilder : TaskConfigurationBuilder() */ var url: String = "" - override fun build( name: String ): WebTask = WebTask( name, measures, description, url ) + override fun build( name: String ): WebTask = WebTask( name, url, description, measures ) } diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt index 5d74148de..c88cb14b4 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt @@ -12,7 +12,7 @@ import kotlin.js.JsName @Polymorphic interface AccountIdentity { - companion object Factory + companion object { /** * Create an [AccountIdentity] identified by an [emailAddress] somebody has access to. diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/TestInstances.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/TestInstances.kt index c29f81c9f..a699a0a5d 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/TestInstances.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/TestInstances.kt @@ -68,7 +68,7 @@ val commonInstances = listOf( "Custom study runtime", "{ \"\$type\": \"Study\", \"custom\": \"protocol\" }" ), - WebTask( "Survey", emptyList(), "Some survey", "http://survey.com" ), + WebTask( "Survey", "http://survey.com", "Some survey" ), // `triggers` namespace. ElapsedTimeTrigger( Smartphone( "User's phone" ), Duration.ZERO ), diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/tasks/WebTaskTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/tasks/WebTaskTest.kt index 24cc37915..60ff4babe 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/tasks/WebTaskTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/tasks/WebTaskTest.kt @@ -27,7 +27,7 @@ class WebTaskTest "participantId=${WebTask.UrlVariable.PARTICIPANT_ID.pattern}" + "&deploymentId=${WebTask.UrlVariable.DEPLOYMENT_ID.pattern}" + "&triggerId=${WebTask.UrlVariable.TRIGGER_ID.pattern}" - val task = WebTask( "Survey", emptyList(), "Demographics survey", url ) + val task = WebTask( "Survey", url, "Demographics survey" ) val participantId = UUID.randomUUID() val deploymentId = UUID.randomUUID() From 63285769f4dad22250ed0d8fc001b63226346b6b Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 19 Mar 2023 20:45:06 +0100 Subject: [PATCH 37/50] Workaround to JS export `AccountIdentity` `AccountIdentity` couldn't be exported due to the companion object on the interface: https://youtrack.jetbrains.com/issue/KT-51292/Proposed-behavior-of-JsExport-on-interfaces-and-classes-with-companion-objects Using an abstract class is a good enough solution for now. --- .../carp/common/application/users/AccountIdentity.kt | 10 +++++++--- .../carp.core-kotlin-carp.deployments.core/index.d.ts | 2 +- typescript-declarations/src/carp-common.ts | 9 --------- typescript-declarations/src/carp-deployments-core.ts | 4 ---- typescript-declarations/src/carp-studies-core.ts | 4 ---- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt index c88cb14b4..28caf6cde 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/users/AccountIdentity.kt @@ -10,7 +10,11 @@ import kotlin.js.JsName * Identifies an account. */ @Polymorphic -interface AccountIdentity +@Serializable +@JsExport +// HACK: defined as abstract class so that `JsExport` works: https://youtrack.jetbrains.com/issue/KT-51292 +@Suppress( "UnnecessaryAbstractClass", "UtilityClassWithPublicConstructor" ) +abstract class AccountIdentity { companion object { @@ -31,7 +35,7 @@ interface AccountIdentity */ @Serializable @JsExport -data class EmailAccountIdentity( val emailAddress: EmailAddress ) : AccountIdentity +data class EmailAccountIdentity( val emailAddress: EmailAddress ) : AccountIdentity() { @JsName( "create" ) constructor( emailAddress: String ) : this( EmailAddress( emailAddress ) ) @@ -42,7 +46,7 @@ data class EmailAccountIdentity( val emailAddress: EmailAddress ) : AccountIdent */ @Serializable @JsExport -data class UsernameAccountIdentity( val username: Username ) : AccountIdentity +data class UsernameAccountIdentity( val username: Username ) : AccountIdentity() { @JsName( "create" ) constructor( username: String ) : this( Username( username ) ) diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts index 6ddb078f4..5d421d0a3 100644 --- a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts +++ b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts @@ -1,4 +1,4 @@ -import * as studies from "carp.core-kotlin-carp.deployments.core" +import * as deployments from "carp.core-kotlin-carp.deployments.core" declare module "carp.core-kotlin-carp.deployments.core" diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index 20d7eeb04..dbaadba70 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -29,15 +29,6 @@ declare module "carp.core-kotlin-carp.common" { type Json = kotlinSerialization.kotlinx.serialization.json.Json } - - - // Augment internal types to implement desired base interfaces. - namespace dk.cachet.carp.common.application.users - { - interface AccountIdentity {} - interface EmailAccountIdentity extends AccountIdentity {} - interface UsernameAccountIdentity extends AccountIdentity {} - } } diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts index 49c0e4ab6..1a3db14aa 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -30,10 +30,6 @@ declare module "carp.core-kotlin-carp.deployments.core" { type Json = kotlinSerialization.kotlinx.serialization.json.Json } - namespace dk.cachet.carp.common.application.users - { - type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity - } } diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts index 5719d8ca5..e34558153 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/src/carp-studies-core.ts @@ -31,10 +31,6 @@ declare module "carp.core-kotlin-carp.studies.core" { type Json = kotlinSerialization.kotlinx.serialization.json.Json } - namespace dk.cachet.carp.common.application.users - { - type AccountIdentity = carpCommon.dk.cachet.carp.common.application.users.AccountIdentity - } } From c3ef4d36da8de00104b675d0ce654a792149f91d Mon Sep 17 00:00:00 2001 From: Whathecode Date: Mon, 20 Mar 2023 18:50:08 +0100 Subject: [PATCH 38/50] Workaround to JS export `Smartphone` JS export of `Smartphone` didn't work due to a bug: required parameters can't follow optional parameters: https://youtrack.jetbrains.com/issue/KT-53180/ But, using the constructor for the builder pattern wasn't ideal either way. With the previous builder in the constructor, to access `isOptional`, or later subbuilders once we add them (like `buildSamplingConfiguration()`), the builder would need to be applied multiple times. --- README.md | 2 +- .../common/application/devices/Smartphone.kt | 16 ++++++++++++---- .../common/application/devices/SmartphoneTest.kt | 6 ++++-- .../carp/protocols/ProtocolsCodeSamples.kt | 2 +- .../cachet/carp/rpc/GenerateExampleRequests.kt | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index aef743523..ad374b969 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ val ownerId = UUID.randomUUID() val protocol = StudyProtocol( ownerId, "Track patient movement" ) // Define which devices are used for data collection. -val phone = Smartphone( "Patient's phone" ) +val phone = Smartphone.create( "Patient's phone" ) { // Configure device-specific options, e.g., frequency to collect data at. defaultSamplingConfiguration { diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt index 86659b941..a18ce58e3 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/devices/Smartphone.kt @@ -9,7 +9,6 @@ import dk.cachet.carp.common.application.sampling.* import dk.cachet.carp.common.application.tasks.* import kotlinx.serialization.* import kotlin.js.JsExport -import kotlin.js.JsName import kotlin.reflect.KClass import kotlin.time.Duration.Companion.milliseconds @@ -22,15 +21,22 @@ typealias SmartphoneDeviceRegistrationBuilder = DefaultDeviceRegistrationBuilder * An internet-connected phone with built-in sensors. */ @Serializable +@JsExport data class Smartphone( override val roleName: String, override val isOptional: Boolean = false, override val defaultSamplingConfiguration: Map = emptyMap() ) : PrimaryDeviceConfiguration() { - @JsName( "create" ) - constructor( roleName: String, isOptional: Boolean = false, builder: SmartphoneBuilder.() -> Unit ) : - this( roleName, isOptional, SmartphoneBuilder().apply( builder ).buildSamplingConfiguration() ) + companion object + { + fun create( roleName: String, builder: SmartphoneBuilder.() -> Unit ): Smartphone + { + val smartphoneBuilder = SmartphoneBuilder().apply( builder ) + val configuration = smartphoneBuilder.buildSamplingConfiguration() + return Smartphone( roleName, smartphoneBuilder.isOptional, configuration ) + } + } /** * All the sensors commonly available on smartphones. @@ -130,6 +136,8 @@ data class Smartphone( @JsExport class SmartphoneBuilder : DeviceConfigurationBuilder() { + var isOptional: Boolean = false + override fun createSamplingConfigurationMapBuilder(): SmartphoneSamplingConfigurationMapBuilder = SmartphoneSamplingConfigurationMapBuilder() } diff --git a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/devices/SmartphoneTest.kt b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/devices/SmartphoneTest.kt index 558fa05e2..ce7309028 100644 --- a/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/devices/SmartphoneTest.kt +++ b/carp.common/src/commonTest/kotlin/dk/cachet/carp/common/application/devices/SmartphoneTest.kt @@ -12,17 +12,19 @@ import kotlin.test.* class SmartphoneTest { @Test - fun builder_sets_sampling_configuration() + fun builder_sets_fields() { val expectedGranularity = Granularity.Balanced - val phone = Smartphone( "Test" ) + val phone = Smartphone.create( "Test" ) { + isOptional = true defaultSamplingConfiguration { geolocation { allBatteryLevels { granularity = expectedGranularity } } } } + assertTrue( phone.isOptional ) val type = Smartphone.Sensors.GEOLOCATION.dataType.type val configuration = phone.defaultSamplingConfiguration[ type ] as? BatteryAwareSamplingConfiguration<*> assertNotNull( configuration ) diff --git a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/ProtocolsCodeSamples.kt b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/ProtocolsCodeSamples.kt index 87fb84cb5..5a509e55e 100644 --- a/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/ProtocolsCodeSamples.kt +++ b/carp.protocols.core/src/commonTest/kotlin/dk/cachet/carp/protocols/ProtocolsCodeSamples.kt @@ -28,7 +28,7 @@ class ProtocolsCodeSamples val protocol = StudyProtocol( ownerId, "Track patient movement" ) // Define which devices are used for data collection. - val phone = Smartphone( "Patient's phone" ) + val phone = Smartphone.create( "Patient's phone" ) { // Configure device-specific options, e.g., frequency to collect data at. defaultSamplingConfiguration { diff --git a/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt b/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt index 0ffa854bd..c000c48ba 100644 --- a/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt +++ b/rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt @@ -99,7 +99,7 @@ private fun T.setRegistrationCreatedOn( createdOn: Inst private val ownerId = UUID( "491f03fc-964b-4783-86a6-a528bbfe4e94" ) private val protocolId = UUID( "25fe92a5-0d52-4e37-8d05-31f347d72d3d" ) private val protocolCreatedOn = Instant.fromEpochSeconds( 1642503419 ) -private val phone = Smartphone( "Participant's phone", false ) { +private val phone = Smartphone.create( "Participant's phone" ) { defaultSamplingConfiguration { geolocation { batteryNormal { granularity = Granularity.Detailed } } } From e422bb56744c017c2c954dad08dd57d388cc0154 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Mon, 20 Mar 2023 19:27:12 +0100 Subject: [PATCH 39/50] JS export `DataTypeSamplingScheme` and map Unclear why this failed before. Maybe a clean was needed, or something got fixed in Kotlin 1.8.10 which was broken on 1.8.0 when I last tried this. --- .../common/application/sampling/DataTypeSamplingScheme.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/DataTypeSamplingScheme.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/DataTypeSamplingScheme.kt index ed516aabe..7680ef885 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/DataTypeSamplingScheme.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/sampling/DataTypeSamplingScheme.kt @@ -4,11 +4,14 @@ import dk.cachet.carp.common.application.EnumObjectMap import dk.cachet.carp.common.application.data.DataType import dk.cachet.carp.common.application.data.DataTypeMetaData import dk.cachet.carp.common.application.tasks.Measure +import kotlin.js.JsExport /** * Specifies the sampling scheme for a [DataType], including possible options, defaults, and constraints. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) abstract class DataTypeSamplingScheme>( /** * Information about the data type this sampling scheme relates to. @@ -55,5 +58,6 @@ abstract class DataTypeSamplingScheme>( { scheme -> scheme.dataType.type } ) From 7feb795f0b33616441de30724e808d4069620154 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Tue, 21 Mar 2023 19:42:51 +0100 Subject: [PATCH 40/50] Workaround to JS export `InputDataTypeList` --- .../carp/common/application/data/input/InputDataTypeList.kt | 5 +++++ typescript-declarations/src/carp-common.ts | 6 ++++++ typescript-declarations/src/carp-data-core.ts | 6 ++++++ typescript-declarations/src/carp-deployments-core.ts | 6 ++++++ typescript-declarations/src/carp-protocols-core.ts | 6 ++++++ typescript-declarations/src/carp-studies-core.ts | 6 ++++++ 6 files changed, 35 insertions(+) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/InputDataTypeList.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/InputDataTypeList.kt index b31e87c47..cb5641a10 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/InputDataTypeList.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/application/data/input/InputDataTypeList.kt @@ -3,6 +3,8 @@ package dk.cachet.carp.common.application.data.input import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.input.elements.AnyInputElement import dk.cachet.carp.common.application.data.input.elements.InputElement +import kotlin.js.JsExport +import kotlin.js.JsName import kotlin.reflect.KClass @@ -12,8 +14,11 @@ import kotlin.reflect.KClass * * Extend from this class as an object and assign members as follows: `val MEMBER = add( type, dataConverter, inputElement )`. */ +@JsExport +@Suppress( "NON_EXPORTABLE_TYPE" ) open class InputDataTypeList private constructor( val list: MutableList ) : List by list { + @JsName( "create" ) constructor() : this( mutableListOf() ) private val _inputElements: MutableMap = mutableMapOf() diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index dbaadba70..7bb77f53b 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -11,6 +11,12 @@ declare module "carp.core-kotlin-carp.common" { type Long = kotlinStdLib.kotlin.Long } + namespace kotlin.reflect + { + // When used as a type parameter for a type exported through `forced-exports`, normally compiled as `any`, + // `KClass` can't be resolved. But, no facade is implemented for `KClass` as it isn't needed yet by TS clients. + type KClass = any + } namespace kotlin.time { type Duration = kotlinStdLib.kotlin.time.Duration diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/src/carp-data-core.ts index db347878d..9f8f4e689 100644 --- a/typescript-declarations/src/carp-data-core.ts +++ b/typescript-declarations/src/carp-data-core.ts @@ -11,6 +11,12 @@ declare module "carp.core-kotlin-carp.data.core" { type Long = kotlinStdLib.kotlin.Long } + namespace kotlin.reflect + { + // When used as a type parameter for a type exported through `forced-exports`, normally compiled as `any`, + // `KClass` can't be resolved. But, no facade is implemented for `KClass` as it isn't needed yet by TS clients. + type KClass = any + } namespace kotlin.time { type Duration = kotlinStdLib.kotlin.time.Duration diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts index 1a3db14aa..d593a8f3f 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -12,6 +12,12 @@ declare module "carp.core-kotlin-carp.deployments.core" { type Long = kotlinStdLib.kotlin.Long } + namespace kotlin.reflect + { + // When used as a type parameter for a type exported through `forced-exports`, normally compiled as `any`, + // `KClass` can't be resolved. But, no facade is implemented for `KClass` as it isn't needed yet by TS clients. + type KClass = any + } namespace kotlin.time { type Duration = kotlinStdLib.kotlin.time.Duration diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/src/carp-protocols-core.ts index 5933af459..9c6442d83 100644 --- a/typescript-declarations/src/carp-protocols-core.ts +++ b/typescript-declarations/src/carp-protocols-core.ts @@ -11,6 +11,12 @@ declare module "carp.core-kotlin-carp.protocols.core" { type Long = kotlinStdLib.kotlin.Long } + namespace kotlin.reflect + { + // When used as a type parameter for a type exported through `forced-exports`, normally compiled as `any`, + // `KClass` can't be resolved. But, no facade is implemented for `KClass` as it isn't needed yet by TS clients. + type KClass = any + } namespace kotlin.time { type Duration = kotlinStdLib.kotlin.time.Duration diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts index e34558153..c9af2ac66 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/src/carp-studies-core.ts @@ -12,6 +12,12 @@ declare module "carp.core-kotlin-carp.studies.core" { type Long = kotlinStdLib.kotlin.Long } + namespace kotlin.reflect + { + // When used as a type parameter for a type exported through `forced-exports`, normally compiled as `any`, + // `KClass` can't be resolved. But, no facade is implemented for `KClass` as it isn't needed yet by TS clients. + type KClass = any + } namespace kotlin.time { type Duration = kotlinStdLib.kotlin.time.Duration From fd8fd22ca667b4963cfd9feb81e1d6c4ba7e48a6 Mon Sep 17 00:00:00 2001 From: Alex Olah Date: Wed, 19 Apr 2023 14:24:18 +0200 Subject: [PATCH 41/50] Fix #438: MeasurementSerializer didn't support unknown data types --- .../cachet/carp/data/application/Measurement.kt | 12 ++++++++++-- .../infrastructure/SerializerDerivedMethods.kt | 1 - .../carp/data/infrastructure/MeasurementTest.kt | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt index 68921ba1c..49dd8ce79 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/application/Measurement.kt @@ -5,6 +5,7 @@ package dk.cachet.carp.data.application import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.DataTimeType import dk.cachet.carp.common.application.data.DataType +import dk.cachet.carp.common.infrastructure.serialization.CustomData import dk.cachet.carp.data.infrastructure.getDataType import kotlinx.serialization.* import kotlinx.serialization.descriptors.* @@ -78,7 +79,14 @@ object MeasurementSerializer : KSerializer> override fun deserialize( decoder: Decoder ): Measurement { val surrogate = decoder.decodeSerializableValue( Surrogate.serializer() ) - val dataType = getDataType( surrogate.data::class ) - return Measurement( surrogate.sensorStartTime, surrogate.sensorEndTime, dataType, surrogate.data ) + val data = surrogate.data + + // Data type can only be derived from serializers of types known at runtime, + // but for unknown types, it can be extracted from the wrapper class (`CustomData`). + val dataType = + if ( data is CustomData ) DataType.fromString( data.className ) + else getDataType( data::class ) + + return Measurement( surrogate.sensorStartTime, surrogate.sensorEndTime, dataType, data ) } } diff --git a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/SerializerDerivedMethods.kt b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/SerializerDerivedMethods.kt index a21f48535..ef303b2f3 100644 --- a/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/SerializerDerivedMethods.kt +++ b/carp.data.core/src/commonMain/kotlin/dk/cachet/carp/data/infrastructure/SerializerDerivedMethods.kt @@ -6,7 +6,6 @@ import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.application.data.DataTimeType import dk.cachet.carp.common.application.data.DataType import dk.cachet.carp.common.application.data.DataTypeMetaData -import dk.cachet.carp.common.application.data.DataTypeMetaDataMap import dk.cachet.carp.common.application.toTrilean import dk.cachet.carp.data.application.DataStreamId import dk.cachet.carp.data.application.DataStreamSequence diff --git a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/MeasurementTest.kt b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/MeasurementTest.kt index d34ca4711..3a170bb63 100644 --- a/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/MeasurementTest.kt +++ b/carp.data.core/src/commonTest/kotlin/dk/cachet/carp/data/infrastructure/MeasurementTest.kt @@ -4,8 +4,10 @@ import dk.cachet.carp.common.application.data.Data import dk.cachet.carp.common.infrastructure.serialization.createDefaultJSON import dk.cachet.carp.common.infrastructure.test.STUBS_SERIAL_MODULE import dk.cachet.carp.common.infrastructure.test.StubDataPoint +import dk.cachet.carp.common.infrastructure.test.makeUnknown import dk.cachet.carp.data.application.Measurement import dk.cachet.carp.data.application.MeasurementSerializer +import kotlinx.serialization.encodeToString import kotlin.test.* @@ -38,4 +40,19 @@ class MeasurementTest assertEquals( measurement, parsed ) } + + @Test + fun can_serialize_and_deserialize_Measurement_with_unknown_data() + { + // Construct JSON of measurement with an unknown data type. + val stubData = StubDataPoint( "Some data" ) + val measurement: Measurement = measurement( stubData, 0 ) + val encoded = json.encodeToString( measurement ) + val measurementWithUnknownData = encoded.makeUnknown( stubData ) + + // Deserializing the measurement with unknown data type and serializing it should result in the original JSON. + val parsed: Measurement = json.decodeFromString( MeasurementSerializer, measurementWithUnknownData ) + val serialized = json.encodeToString( MeasurementSerializer, parsed ) + assertEquals( measurementWithUnknownData, serialized ) + } } From dd6b840d32e55544a6493fb39d7037d6fd17e35d Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sat, 29 Apr 2023 18:05:00 +0200 Subject: [PATCH 42/50] Make constructors of unknown polymorphic wrappers internal These types should never be initialized by clients, but only by the unknown polymorphic serializers. --- .../serialization/UnknownDataSerializers.kt | 7 ++- .../serialization/UnknownDeviceSerializers.kt | 6 +-- ...UnknownSamplingConfigurationSerializers.kt | 2 +- .../serialization/UnknownTaskSerializers.kt | 2 +- .../UnknownTriggerSerializers.kt | 2 +- .../infrastructure/test/CreateTestObjects.kt | 29 +++++++++++ .../UnknownPolymorphicSerializerTest.kt | 7 ++- .../deployments/domain/StudyDeploymentTest.kt | 50 +++++++------------ .../ActiveParticipationInvitationTest.kt | 6 +-- 9 files changed, 64 insertions(+), 47 deletions(-) diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDataSerializers.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDataSerializers.kt index d814531c1..1cc92c7ae 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDataSerializers.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDataSerializers.kt @@ -10,8 +10,11 @@ import kotlinx.serialization.json.Json */ @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( DataSerializer::class ) -data class CustomData( override val className: String, override val jsonSource: String, val serializer: Json ) : - Data, UnknownPolymorphicWrapper +data class CustomData internal constructor( + override val className: String, + override val jsonSource: String, + val serializer: Json +) : Data, UnknownPolymorphicWrapper /** * Custom serializer for [Data] which enables deserializing types that are unknown at runtime, yet extend from [Data]. diff --git a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt index bafb4be37..21e48b9fe 100644 --- a/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt +++ b/carp.common/src/commonMain/kotlin/dk/cachet/carp/common/infrastructure/serialization/UnknownDeviceSerializers.kt @@ -20,7 +20,7 @@ import kotlin.reflect.KClass */ @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( DeviceConfigurationSerializer::class ) -data class CustomDeviceConfiguration( +data class CustomDeviceConfiguration internal constructor( override val className: String, override val jsonSource: String, val serializer: Json @@ -67,7 +67,7 @@ data class CustomDeviceConfiguration( */ @Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" ) @Serializable( PrimaryDeviceConfigurationSerializer::class ) -data class CustomPrimaryDeviceConfiguration( +data class CustomPrimaryDeviceConfiguration internal constructor( override val className: String, override val jsonSource: String, val serializer: Json @@ -169,7 +169,7 @@ object PrimaryDeviceConfigurationSerializer : KSerializer Date: Sun, 2 Apr 2023 18:15:00 +0200 Subject: [PATCH 43/50] Rename generated JS packages with "-generated" suffix This distinguishes them from the facades, and hyphens are used to be consistent with facade names (common npm naming). --- build.gradle | 3 ++- .../@types/carp-common-generated/index.d.ts | 6 ++++++ .../@types/carp-data-core-generated/index.d.ts | 6 ++++++ .../@types/carp-deployments-core-generated/index.d.ts | 6 ++++++ .../@types/carp-protocols-core-generated/index.d.ts | 6 ++++++ .../@types/carp-studies-core-generated/index.d.ts | 6 ++++++ .../@types/carp.core-kotlin-carp.common/index.d.ts | 6 ------ .../@types/carp.core-kotlin-carp.data.core/index.d.ts | 6 ------ .../carp.core-kotlin-carp.deployments.core/index.d.ts | 6 ------ .../carp.core-kotlin-carp.protocols.core/index.d.ts | 6 ------ .../carp.core-kotlin-carp.studies.core/index.d.ts | 6 ------ typescript-declarations/src/carp-common.ts | 6 +++--- typescript-declarations/src/carp-data-core.ts | 6 +++--- typescript-declarations/src/carp-deployments-core.ts | 6 +++--- typescript-declarations/src/carp-protocols-core.ts | 6 +++--- typescript-declarations/src/carp-studies-core.ts | 6 +++--- .../tests/{carp.common-test.ts => carp-common-test.ts} | 4 ++-- ...rp.deployments-test.ts => carp-deployments-test.ts} | 4 ++-- .../{carp.protocols-test.ts => carp-protocols-test.ts} | 4 ++-- .../{carp.studies-test.ts => carp-studies-test.ts} | 10 +++++----- 20 files changed, 58 insertions(+), 57 deletions(-) create mode 100644 typescript-declarations/@types/carp-common-generated/index.d.ts create mode 100644 typescript-declarations/@types/carp-data-core-generated/index.d.ts create mode 100644 typescript-declarations/@types/carp-deployments-core-generated/index.d.ts create mode 100644 typescript-declarations/@types/carp-protocols-core-generated/index.d.ts create mode 100644 typescript-declarations/@types/carp-studies-core-generated/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts delete mode 100644 typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts rename typescript-declarations/tests/{carp.common-test.ts => carp-common-test.ts} (98%) rename typescript-declarations/tests/{carp.deployments-test.ts => carp-deployments-test.ts} (73%) rename typescript-declarations/tests/{carp.protocols-test.ts => carp-protocols-test.ts} (97%) rename typescript-declarations/tests/{carp.studies-test.ts => carp-studies-test.ts} (96%) diff --git a/build.gradle b/build.gradle index 9a3eff209..f05919474 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,7 @@ configure( subprojects - devOpsModules ) { } } js(IR) { + moduleName = project.name.replaceAll("\\.", "-") + "-generated" binaries.executable() // Export JS/TypeScript files. browser() } @@ -243,7 +244,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { } // Copy compiled JS and TypeScript sources to test project's node_modules. - from("$rootDir/build/js/packages/carp.core-kotlin-publish-npm-packages") { + from("$rootDir/build/js/packages/publish-npm-packages-generated") { include "**/*.js" } from("$rootDir/build/js/packages") { diff --git a/typescript-declarations/@types/carp-common-generated/index.d.ts b/typescript-declarations/@types/carp-common-generated/index.d.ts new file mode 100644 index 000000000..728927ccb --- /dev/null +++ b/typescript-declarations/@types/carp-common-generated/index.d.ts @@ -0,0 +1,6 @@ +import * as common from "carp-common-generated" + + +declare module "carp-common-generated" +{ +} diff --git a/typescript-declarations/@types/carp-data-core-generated/index.d.ts b/typescript-declarations/@types/carp-data-core-generated/index.d.ts new file mode 100644 index 000000000..1f1677115 --- /dev/null +++ b/typescript-declarations/@types/carp-data-core-generated/index.d.ts @@ -0,0 +1,6 @@ +import * as data from "carp-data-core-generated" + + +declare module "carp-data-core-generated" +{ +} diff --git a/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts b/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts new file mode 100644 index 000000000..6dad9c55b --- /dev/null +++ b/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts @@ -0,0 +1,6 @@ +import * as deployments from "carp-deployments-core-generated" + + +declare module "carp-deployments-core-generated" +{ +} diff --git a/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts b/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts new file mode 100644 index 000000000..b9c0c98d2 --- /dev/null +++ b/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts @@ -0,0 +1,6 @@ +import * as protocols from "carp-protocols-core-generated" + + +declare module "carp-protocols-core-generated" +{ +} diff --git a/typescript-declarations/@types/carp-studies-core-generated/index.d.ts b/typescript-declarations/@types/carp-studies-core-generated/index.d.ts new file mode 100644 index 000000000..46bd5d50c --- /dev/null +++ b/typescript-declarations/@types/carp-studies-core-generated/index.d.ts @@ -0,0 +1,6 @@ +import * as studies from "carp-studies-core-generated" + + +declare module "carp-studies-core-generated" +{ +} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts deleted file mode 100644 index a46d8970d..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.common/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as common from "carp.core-kotlin-carp.common" - - -declare module "carp.core-kotlin-carp.common" -{ -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts deleted file mode 100644 index 7e2f38254..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.data.core/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as data from "carp.core-kotlin-carp.data.core" - - -declare module "carp.core-kotlin-carp.data.core" -{ -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts deleted file mode 100644 index 5d421d0a3..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.deployments.core/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as deployments from "carp.core-kotlin-carp.deployments.core" - - -declare module "carp.core-kotlin-carp.deployments.core" -{ -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts deleted file mode 100644 index a46ff8304..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.protocols.core/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as protocols from "carp.core-kotlin-carp.protocols.core" - - -declare module "carp.core-kotlin-carp.protocols.core" -{ -} diff --git a/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts b/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts deleted file mode 100644 index 1e73a72d8..000000000 --- a/typescript-declarations/@types/carp.core-kotlin-carp.studies.core/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as studies from "carp.core-kotlin-carp.studies.core" - - -declare module "carp.core-kotlin-carp.studies.core" -{ -} diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/src/carp-common.ts index 7bb77f53b..11154a2bb 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/src/carp-common.ts @@ -1,10 +1,10 @@ -import * as extend from "carp.core-kotlin-carp.common" +import * as extend from "carp-common-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" -declare module "carp.core-kotlin-carp.common" +declare module "carp-common-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -39,4 +39,4 @@ declare module "carp.core-kotlin-carp.common" // Export facade. -export * from "carp.core-kotlin-carp.common" +export * from "carp-common-generated" diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/src/carp-data-core.ts index 9f8f4e689..3e96ccc10 100644 --- a/typescript-declarations/src/carp-data-core.ts +++ b/typescript-declarations/src/carp-data-core.ts @@ -1,10 +1,10 @@ -import * as extend from "carp.core-kotlin-carp.data.core" +import * as extend from "carp-data-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" -declare module "carp.core-kotlin-carp.data.core" +declare module "carp-data-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -39,4 +39,4 @@ declare module "carp.core-kotlin-carp.data.core" // Export facade. -export * from "carp.core-kotlin-carp.data.core" +export * from "carp-data-core-generated" diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts index d593a8f3f..536490dd0 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -1,11 +1,11 @@ -import * as extend from "carp.core-kotlin-carp.deployments.core" +import * as extend from "carp-deployments-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" import * as carpCommon from "./carp-common" -declare module "carp.core-kotlin-carp.deployments.core" +declare module "carp-deployments-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -40,4 +40,4 @@ declare module "carp.core-kotlin-carp.deployments.core" // Export facade. -export * from "carp.core-kotlin-carp.deployments.core" +export * from "carp-deployments-core-generated" diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/src/carp-protocols-core.ts index 9c6442d83..e9d9ed432 100644 --- a/typescript-declarations/src/carp-protocols-core.ts +++ b/typescript-declarations/src/carp-protocols-core.ts @@ -1,10 +1,10 @@ -import * as extend from "carp.core-kotlin-carp.protocols.core" +import * as extend from "carp-protocols-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" -declare module "carp.core-kotlin-carp.protocols.core" +declare module "carp-protocols-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -39,4 +39,4 @@ declare module "carp.core-kotlin-carp.protocols.core" // Export facade. -export * from "carp.core-kotlin-carp.protocols.core" +export * from "carp-protocols-core-generated" diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts index c9af2ac66..13e8a6038 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/src/carp-studies-core.ts @@ -1,11 +1,11 @@ -import * as extend from "carp.core-kotlin-carp.studies.core" +import * as extend from "carp-studies-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" import * as carpCommon from "./carp-common" -declare module "carp.core-kotlin-carp.studies.core" +declare module "carp-studies-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -41,4 +41,4 @@ declare module "carp.core-kotlin-carp.studies.core" // Export facade. -export * from "carp.core-kotlin-carp.studies.core" +export * from "carp-studies-core-generated" diff --git a/typescript-declarations/tests/carp.common-test.ts b/typescript-declarations/tests/carp-common-test.ts similarity index 98% rename from typescript-declarations/tests/carp.common-test.ts rename to typescript-declarations/tests/carp-common-test.ts index d098691b0..7f5130451 100644 --- a/typescript-declarations/tests/carp.common-test.ts +++ b/typescript-declarations/tests/carp-common-test.ts @@ -25,12 +25,12 @@ import IntervalSamplingConfiguration = dk.cachet.carp.common.application.samplin import JSON = dk.cachet.carp.common.infrastructure.serialization.JSON -describe( "carp.common", () => { +describe( "carp-common", () => { it( "verify module declarations", async () => { const instances: any[] = [] const moduleVerifier = new VerifyModule( - 'carp.core-kotlin-carp.common', + 'carp-common-generated', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/carp.deployments-test.ts b/typescript-declarations/tests/carp-deployments-test.ts similarity index 73% rename from typescript-declarations/tests/carp.deployments-test.ts rename to typescript-declarations/tests/carp-deployments-test.ts index 0dfbe1263..6a61a272a 100644 --- a/typescript-declarations/tests/carp.deployments-test.ts +++ b/typescript-declarations/tests/carp-deployments-test.ts @@ -1,12 +1,12 @@ import VerifyModule from './VerifyModule' -describe( "carp.deployments.core", () => { +describe( "carp-deployments-core", () => { it( "verify module declarations", async () => { const instances: any[] = [] const moduleVerifier = new VerifyModule( - 'carp.core-kotlin-carp.deployments.core', + 'carp-deployments-core-generated', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/carp.protocols-test.ts b/typescript-declarations/tests/carp-protocols-test.ts similarity index 97% rename from typescript-declarations/tests/carp.protocols-test.ts rename to typescript-declarations/tests/carp-protocols-test.ts index 1f77c3a94..c6d0ef4eb 100644 --- a/typescript-declarations/tests/carp.protocols-test.ts +++ b/typescript-declarations/tests/carp-protocols-test.ts @@ -11,12 +11,12 @@ import ProtocolServiceRequest = dk.cachet.carp.protocols.infrastructure.Protocol const serializedSnapshot = `{"id":"ad4ca03a-6f69-4a95-8701-488dc511925b","createdOn":"2023-01-30T21:02:56.068710100Z","version":0,"ownerId":"27879e75-ccc1-4866-9ab3-4ece1b735052","name":"Test protocol","description":"Test description","primaryDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Stub primary device"}],"connectedDevices":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Stub device"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration","isPrimaryDevice":true,"roleName":"Chained primary"},{"__type":"dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration","roleName":"Chained connected"}],"connections":[{"roleName":"Stub device","connectedToRoleName":"Stub primary device"},{"roleName":"Chained primary","connectedToRoleName":"Stub primary device"},{"roleName":"Chained connected","connectedToRoleName":"Chained primary"}],"tasks":[{"__type":"dk.cachet.carp.common.infrastructure.test.StubTaskConfiguration","name":"Task","measures":[{"__type":"dk.cachet.carp.common.application.tasks.Measure.DataStream","type":"dk.cachet.carp.stubpoint"}]}],"triggers":{"0":{"__type":"dk.cachet.carp.common.infrastructure.test.StubTriggerConfiguration","sourceDeviceRoleName":"Stub device"}},"taskControls":[{"triggerId":0,"taskName":"Task","destinationDeviceRoleName":"Stub primary device","control":"Start"}],"participantRoles":[{"role":"Role","isOptional":false},{"role":"Optional role","isOptional":true}],"assignedDevices":{"Stub primary device":["Role"]},"expectedParticipantData":[{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"some.type"}},{"attribute":{"__type":"dk.cachet.carp.common.application.users.ParticipantAttribute.DefaultParticipantAttribute","inputDataType":"dk.cachet.carp.input.sex"},"assignedTo":{"__type":"dk.cachet.carp.common.application.users.AssignedTo.Roles","roleNames":["Role"]}}]}` -describe( "carp.protocols.core", () => { +describe( "carp-protocols-core", () => { it( "verify module declarations", async () => { const instances: any[] = [] const moduleVerifier = new VerifyModule( - 'carp.core-kotlin-carp.protocols.core', + 'carp-protocols-core-generated', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/carp.studies-test.ts b/typescript-declarations/tests/carp-studies-test.ts similarity index 96% rename from typescript-declarations/tests/carp.studies-test.ts rename to typescript-declarations/tests/carp-studies-test.ts index 2026d9813..a8cb041af 100644 --- a/typescript-declarations/tests/carp.studies-test.ts +++ b/typescript-declarations/tests/carp-studies-test.ts @@ -11,20 +11,20 @@ import Clock = kcd.datetime.Clock import { kotlinx as scd } from '../src/kotlinx-serialization' import ListSerializer = scd.serialization.builtins.ListSerializer -import { dk as cdk } from 'carp.core-kotlin-carp.common' +import { dk as cdk } from 'carp-common-generated' import UUID = cdk.cachet.carp.common.application.UUID import Username = cdk.cachet.carp.common.application.users.Username import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo import UsernameAccountIdentity = cdk.cachet.carp.common.application.users.UsernameAccountIdentity import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON -import { dk as ddk } from 'carp.core-kotlin-carp.deployments.core' +import { dk as ddk } from 'carp-deployments-core-generated' import DeviceDeploymentStatus = ddk.cachet.carp.deployments.application.DeviceDeploymentStatus import StudyDeploymentStatus = ddk.cachet.carp.deployments.application.StudyDeploymentStatus import ParticipantStatus = ddk.cachet.carp.deployments.application.users.ParticipantStatus import StudyInvitation = ddk.cachet.carp.deployments.application.users.StudyInvitation -import { dk } from 'carp.core-kotlin-carp.studies.core' +import { dk } from 'carp-studies-core-generated' import StudyStatus = dk.cachet.carp.studies.application.StudyStatus import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles import Participant = dk.cachet.carp.studies.application.users.Participant @@ -35,12 +35,12 @@ import StudyServiceRequest = dk.cachet.carp.studies.infrastructure.StudyServiceR import RecruitmentServiceRequest = dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest -describe( "carp.studies.core", () => { +describe( "carp-studies-core", () => { it( "verify module declarations", async () => { const instances: any[] = [] const moduleVerifier = new VerifyModule( - 'carp.core-kotlin-carp.studies.core', + 'carp-studies-core-generated', instances ) await moduleVerifier.verify() From 9206843dcae780defee6d873bc9724b2dc865e40 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Mon, 3 Apr 2023 18:22:17 +0200 Subject: [PATCH 44/50] Fix: don't publish `publish-npm-packages` project --- publish-npm-packages/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/publish-npm-packages/build.gradle b/publish-npm-packages/build.gradle index ab9e9d351..40d2a0d29 100644 --- a/publish-npm-packages/build.gradle +++ b/publish-npm-packages/build.gradle @@ -11,3 +11,11 @@ kotlin { } } } + + +// This project is not intended to be published, but the root project is. +// This skips this project when publishing the root: https://stackoverflow.com/a/59096967/590790 +apply { + plugin("maven-publish") +} +project.tasks.publish.enabled = false From 226bea2fb349f3d978f69ef06411e36c7b1c9031 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Tue, 25 Apr 2023 20:22:19 +0200 Subject: [PATCH 45/50] Fix #437: incompatible TS types of duplicated types across modules When using TS declarations, a cast to 'any' was needed for some types when a type from one module was passed to another module; this was observed with `StudyDeploymentStatus` (deployment subsystem) which was passed to `ParticipantGroupStatus` (studies subsystem). This change fixes that by only loading generated TS declarations of a single generated module, which automatically includes dependent declarations. But, this required importing the dependent modules in the corresponding namespaces in the facade module; otherwise this is "undefined" at runtime. --- typescript-declarations/src/carp-data-core.ts | 5 ++ .../src/carp-deployments-core.ts | 4 ++ .../src/carp-protocols-core.ts | 5 ++ .../src/carp-studies-core.ts | 6 +++ .../tests/carp-studies-test.ts | 49 ++++++++++--------- 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/src/carp-data-core.ts index 3e96ccc10..b7342e44e 100644 --- a/typescript-declarations/src/carp-data-core.ts +++ b/typescript-declarations/src/carp-data-core.ts @@ -2,6 +2,7 @@ import * as extend from "carp-data-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" +import * as carpCommon from "./carp-common" declare module "carp-data-core-generated" @@ -38,5 +39,9 @@ declare module "carp-data-core-generated" } +// Set namespace objects of dependent imported modules, so that they aren't "undefined" at runtime. +extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; + + // Export facade. export * from "carp-data-core-generated" diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/src/carp-deployments-core.ts index 536490dd0..41848da66 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/src/carp-deployments-core.ts @@ -39,5 +39,9 @@ declare module "carp-deployments-core-generated" } +// Set namespace objects of dependent imported modules, so that they aren't "undefined" at runtime. +extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; + + // Export facade. export * from "carp-deployments-core-generated" diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/src/carp-protocols-core.ts index e9d9ed432..dc26d449a 100644 --- a/typescript-declarations/src/carp-protocols-core.ts +++ b/typescript-declarations/src/carp-protocols-core.ts @@ -2,6 +2,7 @@ import * as extend from "carp-protocols-core-generated" import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" +import * as carpCommon from "./carp-common" declare module "carp-protocols-core-generated" @@ -38,5 +39,9 @@ declare module "carp-protocols-core-generated" } +// Set namespace objects of dependent imported modules, so that they aren't "undefined" at runtime. +extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; + + // Export facade. export * from "carp-protocols-core-generated" diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/src/carp-studies-core.ts index 13e8a6038..f8532712f 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/src/carp-studies-core.ts @@ -3,6 +3,7 @@ import * as kotlinStdLib from "./kotlin" import * as kotlinDateTime from "./kotlinx-datetime" import * as kotlinSerialization from "./kotlinx-serialization" import * as carpCommon from "./carp-common" +import * as carpDeployments from "./carp-deployments-core" declare module "carp-studies-core-generated" @@ -40,5 +41,10 @@ declare module "carp-studies-core-generated" } +// Set namespace objects of dependent imported modules, so that they aren't "undefined" at runtime. +extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; +extend.dk.cachet.carp.deployments = carpDeployments.dk.cachet.carp.deployments as any; + + // Export facade. export * from "carp-studies-core-generated" diff --git a/typescript-declarations/tests/carp-studies-test.ts b/typescript-declarations/tests/carp-studies-test.ts index a8cb041af..c97678d36 100644 --- a/typescript-declarations/tests/carp-studies-test.ts +++ b/typescript-declarations/tests/carp-studies-test.ts @@ -11,28 +11,30 @@ import Clock = kcd.datetime.Clock import { kotlinx as scd } from '../src/kotlinx-serialization' import ListSerializer = scd.serialization.builtins.ListSerializer -import { dk as cdk } from 'carp-common-generated' -import UUID = cdk.cachet.carp.common.application.UUID -import Username = cdk.cachet.carp.common.application.users.Username -import AssignedTo = cdk.cachet.carp.common.application.users.AssignedTo -import UsernameAccountIdentity = cdk.cachet.carp.common.application.users.UsernameAccountIdentity -import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON - -import { dk as ddk } from 'carp-deployments-core-generated' -import DeviceDeploymentStatus = ddk.cachet.carp.deployments.application.DeviceDeploymentStatus -import StudyDeploymentStatus = ddk.cachet.carp.deployments.application.StudyDeploymentStatus -import ParticipantStatus = ddk.cachet.carp.deployments.application.users.ParticipantStatus -import StudyInvitation = ddk.cachet.carp.deployments.application.users.StudyInvitation - -import { dk } from 'carp-studies-core-generated' -import StudyStatus = dk.cachet.carp.studies.application.StudyStatus -import AssignedParticipantRoles = dk.cachet.carp.studies.application.users.AssignedParticipantRoles -import Participant = dk.cachet.carp.studies.application.users.Participant -import ParticipantGroupStatus = dk.cachet.carp.studies.application.users.ParticipantGroupStatus -import participantIds = dk.cachet.carp.studies.application.users.participantIds -import participantRoles = dk.cachet.carp.studies.application.users.participantRoles -import StudyServiceRequest = dk.cachet.carp.studies.infrastructure.StudyServiceRequest -import RecruitmentServiceRequest = dk.cachet.carp.studies.infrastructure.RecruitmentServiceRequest +import { dk } from '../src/carp-studies-core' + +import common = dk.cachet.carp.common +import UUID = common.application.UUID +import Username = common.application.users.Username +import AssignedTo = common.application.users.AssignedTo +import UsernameAccountIdentity = common.application.users.UsernameAccountIdentity +import JSON = common.infrastructure.serialization.JSON + +import deployments = dk.cachet.carp.deployments +import DeviceDeploymentStatus = deployments.application.DeviceDeploymentStatus +import StudyDeploymentStatus = deployments.application.StudyDeploymentStatus +import ParticipantStatus = deployments.application.users.ParticipantStatus +import StudyInvitation = deployments.application.users.StudyInvitation + +import studies = dk.cachet.carp.studies +import StudyStatus = studies.application.StudyStatus +import AssignedParticipantRoles = studies.application.users.AssignedParticipantRoles +import Participant = studies.application.users.Participant +import ParticipantGroupStatus = studies.application.users.ParticipantGroupStatus +import participantIds = studies.application.users.participantIds +import participantRoles = studies.application.users.participantRoles +import StudyServiceRequest = studies.infrastructure.StudyServiceRequest +import RecruitmentServiceRequest = studies.infrastructure.RecruitmentServiceRequest describe( "carp-studies-core", () => { @@ -125,8 +127,7 @@ describe( "carp-studies-core", () => { const now = Clock.System.now() const deploymentStatus = new StudyDeploymentStatus.Running( now, deploymentId, listOf( [] ), listOf( [] ), now ) const participants = setOf( [ new Participant( new UsernameAccountIdentity( new Username( "Test" ) ) ) ] ) - const castDeploymentStatus = deploymentStatus as any // HACK: Type safety needs to be turned off due to loading from different packages. - const group = new ParticipantGroupStatus.Invited( deploymentId, participants, now, castDeploymentStatus ) + const group = new ParticipantGroupStatus.Invited( deploymentId, participants, now, deploymentStatus ) const serializer = ParticipantGroupStatus.Companion.serializer() const serialized = JSON.encodeToString( serializer, group ) From 1d79e3a73f580767896bcd374d740eb7a01a97b5 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Fri, 28 Apr 2023 20:51:19 +0200 Subject: [PATCH 46/50] Refactor: remove unnecesary TS module augmentations These files were added as placeholders in the expectation that the generated TS files would need to be augmented, but this is no longer the case for the CARP modules, only for third-party libraries (e.g., kotlinx-serialization). --- .../@types/carp-common-generated/index.d.ts | 6 ------ .../@types/carp-data-core-generated/index.d.ts | 6 ------ .../carp-deployments-core-generated/index.d.ts | 6 ------ .../carp-protocols-core-generated/index.d.ts | 6 ------ .../@types/carp-studies-core-generated/index.d.ts | 6 ------ typescript-declarations/tests/carp-common-test.ts | 11 ----------- .../tests/carp-deployments-test.ts | 14 -------------- .../tests/carp-protocols-test.ts | 11 ----------- typescript-declarations/tests/carp-studies-test.ts | 11 ----------- 9 files changed, 77 deletions(-) delete mode 100644 typescript-declarations/@types/carp-common-generated/index.d.ts delete mode 100644 typescript-declarations/@types/carp-data-core-generated/index.d.ts delete mode 100644 typescript-declarations/@types/carp-deployments-core-generated/index.d.ts delete mode 100644 typescript-declarations/@types/carp-protocols-core-generated/index.d.ts delete mode 100644 typescript-declarations/@types/carp-studies-core-generated/index.d.ts delete mode 100644 typescript-declarations/tests/carp-deployments-test.ts diff --git a/typescript-declarations/@types/carp-common-generated/index.d.ts b/typescript-declarations/@types/carp-common-generated/index.d.ts deleted file mode 100644 index 728927ccb..000000000 --- a/typescript-declarations/@types/carp-common-generated/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as common from "carp-common-generated" - - -declare module "carp-common-generated" -{ -} diff --git a/typescript-declarations/@types/carp-data-core-generated/index.d.ts b/typescript-declarations/@types/carp-data-core-generated/index.d.ts deleted file mode 100644 index 1f1677115..000000000 --- a/typescript-declarations/@types/carp-data-core-generated/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as data from "carp-data-core-generated" - - -declare module "carp-data-core-generated" -{ -} diff --git a/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts b/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts deleted file mode 100644 index 6dad9c55b..000000000 --- a/typescript-declarations/@types/carp-deployments-core-generated/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as deployments from "carp-deployments-core-generated" - - -declare module "carp-deployments-core-generated" -{ -} diff --git a/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts b/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts deleted file mode 100644 index b9c0c98d2..000000000 --- a/typescript-declarations/@types/carp-protocols-core-generated/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as protocols from "carp-protocols-core-generated" - - -declare module "carp-protocols-core-generated" -{ -} diff --git a/typescript-declarations/@types/carp-studies-core-generated/index.d.ts b/typescript-declarations/@types/carp-studies-core-generated/index.d.ts deleted file mode 100644 index 46bd5d50c..000000000 --- a/typescript-declarations/@types/carp-studies-core-generated/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as studies from "carp-studies-core-generated" - - -declare module "carp-studies-core-generated" -{ -} diff --git a/typescript-declarations/tests/carp-common-test.ts b/typescript-declarations/tests/carp-common-test.ts index 7f5130451..c9e2934f7 100644 --- a/typescript-declarations/tests/carp-common-test.ts +++ b/typescript-declarations/tests/carp-common-test.ts @@ -1,4 +1,3 @@ -import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' @@ -26,16 +25,6 @@ import JSON = dk.cachet.carp.common.infrastructure.serialization.JSON describe( "carp-common", () => { - it( "verify module declarations", async () => { - const instances: any[] = [] - - const moduleVerifier = new VerifyModule( - 'carp-common-generated', - instances - ) - await moduleVerifier.verify() - } ) - describe( "Trilean", () => { it( "has values TRUE, FALSE, UNKNOWN", () => { const trileanValues = Trilean.values() diff --git a/typescript-declarations/tests/carp-deployments-test.ts b/typescript-declarations/tests/carp-deployments-test.ts deleted file mode 100644 index 6a61a272a..000000000 --- a/typescript-declarations/tests/carp-deployments-test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import VerifyModule from './VerifyModule' - - -describe( "carp-deployments-core", () => { - it( "verify module declarations", async () => { - const instances: any[] = [] - - const moduleVerifier = new VerifyModule( - 'carp-deployments-core-generated', - instances - ) - await moduleVerifier.verify() - } ) -} ) diff --git a/typescript-declarations/tests/carp-protocols-test.ts b/typescript-declarations/tests/carp-protocols-test.ts index c6d0ef4eb..092f4b48a 100644 --- a/typescript-declarations/tests/carp-protocols-test.ts +++ b/typescript-declarations/tests/carp-protocols-test.ts @@ -1,4 +1,3 @@ -import VerifyModule from './VerifyModule' import { expect } from 'chai' import { dk as cdk } from '../src/carp-common' @@ -12,16 +11,6 @@ const serializedSnapshot = `{"id":"ad4ca03a-6f69-4a95-8701-488dc511925b","create describe( "carp-protocols-core", () => { - it( "verify module declarations", async () => { - const instances: any[] = [] - - const moduleVerifier = new VerifyModule( - 'carp-protocols-core-generated', - instances - ) - await moduleVerifier.verify() - } ) - describe( "StudyProtocolSnapshot", () => { it( "can deserialize", () => { const serializer = StudyProtocolSnapshot.Companion.serializer() diff --git a/typescript-declarations/tests/carp-studies-test.ts b/typescript-declarations/tests/carp-studies-test.ts index c97678d36..116ccd15c 100644 --- a/typescript-declarations/tests/carp-studies-test.ts +++ b/typescript-declarations/tests/carp-studies-test.ts @@ -1,4 +1,3 @@ -import VerifyModule from './VerifyModule' import { expect } from 'chai' import { kotlin } from '../src/kotlin' @@ -38,16 +37,6 @@ import RecruitmentServiceRequest = studies.infrastructure.RecruitmentServiceRequ describe( "carp-studies-core", () => { - it( "verify module declarations", async () => { - const instances: any[] = [] - - const moduleVerifier = new VerifyModule( - 'carp-studies-core-generated', - instances - ) - await moduleVerifier.verify() - } ) - describe( "AssignedParticipantRoles", () => { it( "getAssigned participantIds and participantRoles works", () => { const participant1 = UUID.Companion.randomUUID() From b0635c4a66a60459a77f6f67b26c272b86632951 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 30 Apr 2023 19:36:06 +0200 Subject: [PATCH 47/50] Create scoped node packages for JS/TS sources --- build.gradle | 6 +- .../carp-common.ts => carp-common/index.ts} | 12 +-- .../carp-common/package.json | 4 + .../index.ts} | 14 +-- .../carp-data-core/package.json | 4 + .../index.ts} | 14 +-- .../carp-deployments-core/package.json | 4 + .../{src/kotlin.ts => carp-kotlin/index.ts} | 6 +- .../kotlin-kotlin-stdlib-js-ir.d.ts} | 2 +- .../carp-kotlin/package.json | 4 + ...eTime-library-kotlinx-datetime-js-ir.d.ts} | 2 +- .../index.ts} | 6 +- .../carp-kotlinx-datetime/package.json | 4 + .../index.ts} | 8 +- ...ion-kotlinx-serialization-core-js-ir.d.ts} | 2 +- ...ion-kotlinx-serialization-json-js-ir.d.ts} | 2 +- .../carp-kotlinx-serialization/package.json | 4 + .../index.ts} | 14 +-- .../carp-protocols-core/package.json | 4 + .../index.ts} | 16 +-- .../carp-studies-core/package.json | 4 + typescript-declarations/package-lock.json | 98 +++++++++++++++++++ typescript-declarations/package.json | 10 ++ typescript-declarations/tests/VerifyModule.ts | 7 +- .../tests/carp-common-test.ts | 6 +- .../{kotlin-test.ts => carp-kotlin-test.ts} | 5 +- ...-test.ts => carp-kotlinx-datetime-test.ts} | 5 +- ....ts => carp-kotlinx-serialization-test.ts} | 5 +- .../tests/carp-protocols-test.ts | 4 +- .../tests/carp-studies-test.ts | 8 +- typescript-declarations/tsconfig.json | 9 +- 31 files changed, 216 insertions(+), 77 deletions(-) rename typescript-declarations/{src/carp-common.ts => carp-common/index.ts} (75%) create mode 100644 typescript-declarations/carp-common/package.json rename typescript-declarations/{src/carp-protocols-core.ts => carp-data-core/index.ts} (75%) create mode 100644 typescript-declarations/carp-data-core/package.json rename typescript-declarations/{src/carp-deployments-core.ts => carp-deployments-core/index.ts} (74%) create mode 100644 typescript-declarations/carp-deployments-core/package.json rename typescript-declarations/{src/kotlin.ts => carp-kotlin/index.ts} (96%) rename typescript-declarations/{@types/kotlin-kotlin-stdlib-js-ir/index.d.ts => carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts} (97%) create mode 100644 typescript-declarations/carp-kotlin/package.json rename typescript-declarations/{@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts => carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts} (79%) rename typescript-declarations/{src/kotlinx-datetime.ts => carp-kotlinx-datetime/index.ts} (81%) create mode 100644 typescript-declarations/carp-kotlinx-datetime/package.json rename typescript-declarations/{src/kotlinx-serialization.ts => carp-kotlinx-serialization/index.ts} (80%) rename typescript-declarations/{@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts => carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-core-js-ir.d.ts} (73%) rename typescript-declarations/{@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts => carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts} (79%) create mode 100644 typescript-declarations/carp-kotlinx-serialization/package.json rename typescript-declarations/{src/carp-data-core.ts => carp-protocols-core/index.ts} (74%) create mode 100644 typescript-declarations/carp-protocols-core/package.json rename typescript-declarations/{src/carp-studies-core.ts => carp-studies-core/index.ts} (74%) create mode 100644 typescript-declarations/carp-studies-core/package.json rename typescript-declarations/tests/{kotlin-test.ts => carp-kotlin-test.ts} (96%) rename typescript-declarations/tests/{kotlinx-datetime-test.ts => carp-kotlinx-datetime-test.ts} (79%) rename typescript-declarations/tests/{kotlinx-serialization-test.ts => carp-kotlinx-serialization-test.ts} (64%) diff --git a/build.gradle b/build.gradle index f05919474..96662a08b 100644 --- a/build.gradle +++ b/build.gradle @@ -254,7 +254,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { } eachFile { file -> // Compiled sources have the name of the module they represent, followed by ".js" and ".d.ts". - // To be recognized by node, place them as "index.js" and "index.d.ts" in "node_modules/". + // To be recognized by node, place them as "index.js" and "index.d.ts" in "node_modules/@cachet/". def fileMatch = file.name =~ /(.+)\.(js|d\.ts)/ def moduleName = fileMatch[0][1] def extension = fileMatch[0][2] @@ -270,7 +270,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { file.filter { line -> // Compiled sources refer to other modules as adjacent .js source files. // Change these to the named modules created in the previous step. - def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'\$1'") + def namedModules = line.replaceAll(~/'\.\/(.+?)\.js'/, "'@cachet/\$1'") // Replace `any` types with actual types for which facades are specified. def replacedTypes = knownFacadeTypes.inject(namedModules) { curLine, type -> @@ -295,7 +295,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { additionalExports } } - into "./$typescriptFolder/node_modules" + into "./$typescriptFolder/node_modules/@cachet/" } task compileTs(type: NpmTask, dependsOn: copyTestJsSources) { workingDir = file(typescriptFolder) diff --git a/typescript-declarations/src/carp-common.ts b/typescript-declarations/carp-common/index.ts similarity index 75% rename from typescript-declarations/src/carp-common.ts rename to typescript-declarations/carp-common/index.ts index 11154a2bb..9c1a7b107 100644 --- a/typescript-declarations/src/carp-common.ts +++ b/typescript-declarations/carp-common/index.ts @@ -1,10 +1,10 @@ -import * as extend from "carp-common-generated" -import * as kotlinStdLib from "./kotlin" -import * as kotlinDateTime from "./kotlinx-datetime" -import * as kotlinSerialization from "./kotlinx-serialization" +import * as extend from "@cachet/carp-common-generated" +import * as kotlinStdLib from "@cachet/carp-kotlin" +import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime" +import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization" -declare module "carp-common-generated" +declare module "@cachet/carp-common-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -39,4 +39,4 @@ declare module "carp-common-generated" // Export facade. -export * from "carp-common-generated" +export * from "@cachet/carp-common-generated" diff --git a/typescript-declarations/carp-common/package.json b/typescript-declarations/carp-common/package.json new file mode 100644 index 000000000..d7b03783e --- /dev/null +++ b/typescript-declarations/carp-common/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-common", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/carp-protocols-core.ts b/typescript-declarations/carp-data-core/index.ts similarity index 75% rename from typescript-declarations/src/carp-protocols-core.ts rename to typescript-declarations/carp-data-core/index.ts index dc26d449a..2ce2186f6 100644 --- a/typescript-declarations/src/carp-protocols-core.ts +++ b/typescript-declarations/carp-data-core/index.ts @@ -1,11 +1,11 @@ -import * as extend from "carp-protocols-core-generated" -import * as kotlinStdLib from "./kotlin" -import * as kotlinDateTime from "./kotlinx-datetime" -import * as kotlinSerialization from "./kotlinx-serialization" -import * as carpCommon from "./carp-common" +import * as extend from "@cachet/carp-data-core-generated" +import * as kotlinStdLib from "@cachet/carp-kotlin" +import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime" +import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization" +import * as carpCommon from "@cachet/carp-common" -declare module "carp-protocols-core-generated" +declare module "@cachet/carp-data-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -44,4 +44,4 @@ extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; // Export facade. -export * from "carp-protocols-core-generated" +export * from "@cachet/carp-data-core-generated" diff --git a/typescript-declarations/carp-data-core/package.json b/typescript-declarations/carp-data-core/package.json new file mode 100644 index 000000000..e58be6f19 --- /dev/null +++ b/typescript-declarations/carp-data-core/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-data-core", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/carp-deployments-core.ts b/typescript-declarations/carp-deployments-core/index.ts similarity index 74% rename from typescript-declarations/src/carp-deployments-core.ts rename to typescript-declarations/carp-deployments-core/index.ts index 41848da66..5a0aff641 100644 --- a/typescript-declarations/src/carp-deployments-core.ts +++ b/typescript-declarations/carp-deployments-core/index.ts @@ -1,11 +1,11 @@ -import * as extend from "carp-deployments-core-generated" -import * as kotlinStdLib from "./kotlin" -import * as kotlinDateTime from "./kotlinx-datetime" -import * as kotlinSerialization from "./kotlinx-serialization" -import * as carpCommon from "./carp-common" +import * as extend from "@cachet/carp-deployments-core-generated" +import * as kotlinStdLib from "@cachet/carp-kotlin" +import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime" +import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization" +import * as carpCommon from "@cachet/carp-common" -declare module "carp-deployments-core-generated" +declare module "@cachet/carp-deployments-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -44,4 +44,4 @@ extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; // Export facade. -export * from "carp-deployments-core-generated" +export * from "@cachet/carp-deployments-core-generated" diff --git a/typescript-declarations/carp-deployments-core/package.json b/typescript-declarations/carp-deployments-core/package.json new file mode 100644 index 000000000..78ce43d76 --- /dev/null +++ b/typescript-declarations/carp-deployments-core/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-deployments-core", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/kotlin.ts b/typescript-declarations/carp-kotlin/index.ts similarity index 96% rename from typescript-declarations/src/kotlin.ts rename to typescript-declarations/carp-kotlin/index.ts index cb8600672..3bceb6369 100644 --- a/typescript-declarations/src/kotlin.ts +++ b/typescript-declarations/carp-kotlin/index.ts @@ -1,4 +1,4 @@ -import * as kotlinStdLib from "kotlin-kotlin-stdlib-js-ir" +import * as kotlinStdLib from "@cachet/kotlin-kotlin-stdlib-js-ir" // Facade with better method names and type conversions for internal types. @@ -63,7 +63,7 @@ export namespace kotlin.time // Augment internal types to implement facade. -declare module "kotlin-kotlin-stdlib-js-ir" +declare module "@cachet/kotlin-kotlin-stdlib-js-ir" { namespace $_$ { @@ -129,4 +129,4 @@ Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "values", { // Re-export augmented types. -export * from "kotlin-kotlin-stdlib-js-ir"; +export * from "@cachet/kotlin-kotlin-stdlib-js-ir"; diff --git a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts b/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts similarity index 97% rename from typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts rename to typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts index 643b16661..058805e23 100644 --- a/typescript-declarations/@types/kotlin-kotlin-stdlib-js-ir/index.d.ts +++ b/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts @@ -1,4 +1,4 @@ -declare module "kotlin-kotlin-stdlib-js-ir" +declare module "@cachet/kotlin-kotlin-stdlib-js-ir" { namespace $_$ { diff --git a/typescript-declarations/carp-kotlin/package.json b/typescript-declarations/carp-kotlin/package.json new file mode 100644 index 000000000..bd0b4af7c --- /dev/null +++ b/typescript-declarations/carp-kotlin/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-kotlin", + "version": "1.1.2" +} diff --git a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts b/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts similarity index 79% rename from typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts rename to typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts index e035a55f9..a0c6ba001 100644 --- a/typescript-declarations/@types/Kotlin-DateTime-library-kotlinx-datetime-js-ir/index.d.ts +++ b/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts @@ -1,4 +1,4 @@ -declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +declare module "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" { namespace $_$ { diff --git a/typescript-declarations/src/kotlinx-datetime.ts b/typescript-declarations/carp-kotlinx-datetime/index.ts similarity index 81% rename from typescript-declarations/src/kotlinx-datetime.ts rename to typescript-declarations/carp-kotlinx-datetime/index.ts index 1d6b73165..1d3393d98 100644 --- a/typescript-declarations/src/kotlinx-datetime.ts +++ b/typescript-declarations/carp-kotlinx-datetime/index.ts @@ -1,4 +1,4 @@ -import * as extend from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +import * as extend from "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Facade with better method names and type conversions for internal types. @@ -20,7 +20,7 @@ export namespace kotlinx.datetime // Augment internal types to implement facade. -declare module "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +declare module "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" { namespace $_$ { @@ -38,4 +38,4 @@ extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return // Re-export augmented types. -export * from "Kotlin-DateTime-library-kotlinx-datetime-js-ir" +export * from "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" diff --git a/typescript-declarations/carp-kotlinx-datetime/package.json b/typescript-declarations/carp-kotlinx-datetime/package.json new file mode 100644 index 000000000..687b8db7e --- /dev/null +++ b/typescript-declarations/carp-kotlinx-datetime/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-kotlinx-datetime", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/kotlinx-serialization.ts b/typescript-declarations/carp-kotlinx-serialization/index.ts similarity index 80% rename from typescript-declarations/src/kotlinx-serialization.ts rename to typescript-declarations/carp-kotlinx-serialization/index.ts index 9ce8de0d1..8df7a51cd 100644 --- a/typescript-declarations/src/kotlinx-serialization.ts +++ b/typescript-declarations/carp-kotlinx-serialization/index.ts @@ -1,5 +1,5 @@ -import * as extendCore from "kotlinx-serialization-kotlinx-serialization-core-js-ir" -import * as extendJson from "kotlinx-serialization-kotlinx-serialization-json-js-ir" +import * as extendCore from "@cachet/kotlinx-serialization-kotlinx-serialization-core-js-ir" +import * as extendJson from "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" // Facade with better method names and type conversions for internal types. @@ -24,7 +24,7 @@ export namespace kotlinx.serialization.builtins // Augment internal types to implement facade. -declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +declare module "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" { namespace $_$ { @@ -48,4 +48,4 @@ extendJson.$_$.JsonImpl.prototype.decodeFromString = // Re-export augmented types. -export * from "kotlinx-serialization-kotlinx-serialization-json-js-ir" +export * from "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-core-js-ir.d.ts similarity index 73% rename from typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts rename to typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-core-js-ir.d.ts index 9a8c7c4d6..4dc2f3599 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-core-js-ir/index.d.ts +++ b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-core-js-ir.d.ts @@ -1,4 +1,4 @@ -declare module "kotlinx-serialization-kotlinx-serialization-core-js-ir" +declare module "@cachet/kotlinx-serialization-kotlinx-serialization-core-js-ir" { namespace $_$ { diff --git a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts similarity index 79% rename from typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts rename to typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts index 33f9b0802..d1c856328 100644 --- a/typescript-declarations/@types/kotlinx-serialization-kotlinx-serialization-json-js-ir/index.d.ts +++ b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts @@ -1,4 +1,4 @@ -declare module "kotlinx-serialization-kotlinx-serialization-json-js-ir" +declare module "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" { namespace $_$ { diff --git a/typescript-declarations/carp-kotlinx-serialization/package.json b/typescript-declarations/carp-kotlinx-serialization/package.json new file mode 100644 index 000000000..5c648899a --- /dev/null +++ b/typescript-declarations/carp-kotlinx-serialization/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-kotlinx-serialization", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/carp-data-core.ts b/typescript-declarations/carp-protocols-core/index.ts similarity index 74% rename from typescript-declarations/src/carp-data-core.ts rename to typescript-declarations/carp-protocols-core/index.ts index b7342e44e..0a1ae2bbb 100644 --- a/typescript-declarations/src/carp-data-core.ts +++ b/typescript-declarations/carp-protocols-core/index.ts @@ -1,11 +1,11 @@ -import * as extend from "carp-data-core-generated" -import * as kotlinStdLib from "./kotlin" -import * as kotlinDateTime from "./kotlinx-datetime" -import * as kotlinSerialization from "./kotlinx-serialization" -import * as carpCommon from "./carp-common" +import * as extend from "@cachet/carp-protocols-core-generated" +import * as kotlinStdLib from "@cachet/carp-kotlin" +import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime" +import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization" +import * as carpCommon from "@cachet/carp-common" -declare module "carp-data-core-generated" +declare module "@cachet/carp-protocols-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -44,4 +44,4 @@ extend.dk.cachet.carp.common = carpCommon.dk.cachet.carp.common as any; // Export facade. -export * from "carp-data-core-generated" +export * from "@cachet/carp-protocols-core-generated" diff --git a/typescript-declarations/carp-protocols-core/package.json b/typescript-declarations/carp-protocols-core/package.json new file mode 100644 index 000000000..a10f088d5 --- /dev/null +++ b/typescript-declarations/carp-protocols-core/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-protocols-core", + "version": "1.1.2" +} diff --git a/typescript-declarations/src/carp-studies-core.ts b/typescript-declarations/carp-studies-core/index.ts similarity index 74% rename from typescript-declarations/src/carp-studies-core.ts rename to typescript-declarations/carp-studies-core/index.ts index f8532712f..0e5dd1e8e 100644 --- a/typescript-declarations/src/carp-studies-core.ts +++ b/typescript-declarations/carp-studies-core/index.ts @@ -1,12 +1,12 @@ -import * as extend from "carp-studies-core-generated" -import * as kotlinStdLib from "./kotlin" -import * as kotlinDateTime from "./kotlinx-datetime" -import * as kotlinSerialization from "./kotlinx-serialization" -import * as carpCommon from "./carp-common" -import * as carpDeployments from "./carp-deployments-core" +import * as extend from "@cachet/carp-studies-core-generated" +import * as kotlinStdLib from "@cachet/carp-kotlin" +import * as kotlinDateTime from "@cachet/carp-kotlinx-datetime" +import * as kotlinSerialization from "@cachet/carp-kotlinx-serialization" +import * as carpCommon from "@cachet/carp-common" +import * as carpDeployments from "@cachet/carp-deployments-core" -declare module "carp-studies-core-generated" +declare module "@cachet/carp-studies-core-generated" { // Declare missing types for which no imports were generated. namespace kotlin @@ -47,4 +47,4 @@ extend.dk.cachet.carp.deployments = carpDeployments.dk.cachet.carp.deployments a // Export facade. -export * from "carp-studies-core-generated" +export * from "@cachet/carp-studies-core-generated" diff --git a/typescript-declarations/carp-studies-core/package.json b/typescript-declarations/carp-studies-core/package.json new file mode 100644 index 000000000..ab9026b8d --- /dev/null +++ b/typescript-declarations/carp-studies-core/package.json @@ -0,0 +1,4 @@ +{ + "name": "@cachet/carp-studies-core", + "version": "1.1.2" +} diff --git a/typescript-declarations/package-lock.json b/typescript-declarations/package-lock.json index 4bf951cac..b8556c3e7 100644 --- a/typescript-declarations/package-lock.json +++ b/typescript-declarations/package-lock.json @@ -4,6 +4,16 @@ "requires": true, "packages": { "": { + "workspaces": [ + "carp-kotlin", + "carp-kotlinx-datetime", + "carp-kotlinx-serialization", + "carp-common", + "carp-data-core", + "carp-deployments-core", + "carp-protocols-core", + "carp-studies-core" + ], "dependencies": { "@js-joda/core": "5.2.0", "big.js": "6.1.1" @@ -21,6 +31,70 @@ "typescript": "4.6.3" } }, + "carp-common": { + "name": "@cachet/carp-common", + "version": "1.1.2" + }, + "carp-data-core": { + "name": "@cachet/carp-data-core", + "version": "1.1.2" + }, + "carp-deployments-core": { + "name": "@cachet/carp-deployments-core", + "version": "1.1.2" + }, + "carp-kotlin": { + "name": "@cachet/carp-kotlin", + "version": "1.1.2" + }, + "carp-kotlinx-datetime": { + "name": "@cachet/carp-kotlinx-datetime", + "version": "1.1.2" + }, + "carp-kotlinx-serialization": { + "name": "@cachet/carp-kotlinx-serialization", + "version": "1.1.2" + }, + "carp-protocols-core": { + "name": "@cachet/carp-protocols-core", + "version": "1.1.2" + }, + "carp-studies-core": { + "name": "@cachet/carp-studies-core", + "version": "1.1.2" + }, + "node_modules/@cachet/carp-common": { + "resolved": "carp-common", + "link": true + }, + "node_modules/@cachet/carp-data-core": { + "resolved": "carp-data-core", + "link": true + }, + "node_modules/@cachet/carp-deployments-core": { + "resolved": "carp-deployments-core", + "link": true + }, + "node_modules/@cachet/carp-kotlin": { + "resolved": "carp-kotlin", + "link": true + }, + "node_modules/@cachet/carp-kotlinx-datetime": { + "resolved": "carp-kotlinx-datetime", + "link": true + }, + "node_modules/@cachet/carp-kotlinx-serialization": { + "resolved": "carp-kotlinx-serialization", + "link": true + }, + "node_modules/@cachet/carp-protocols-core": { + "resolved": "carp-protocols-core", + "link": true + }, + "node_modules/@cachet/carp-studies-core": { + "resolved": "carp-studies-core", + "link": true + }, "node_modules/@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", @@ -2243,6 +2317,30 @@ } }, "dependencies": { + "@cachet/carp-common": { + "version": "file:carp-common" + }, + "@cachet/carp-data-core": { + "version": "file:carp-data-core" + }, + "@cachet/carp-deployments-core": { + "version": "file:carp-deployments-core" + }, + "@cachet/carp-kotlin": { + "version": "file:carp-kotlin" + }, + "@cachet/carp-kotlinx-datetime": { + "version": "file:carp-kotlinx-datetime" + }, + "@cachet/carp-kotlinx-serialization": { + "version": "file:carp-kotlinx-serialization" + }, + "@cachet/carp-protocols-core": { + "version": "file:carp-protocols-core" + }, + "@cachet/carp-studies-core": { + "version": "file:carp-studies-core" + }, "@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", diff --git a/typescript-declarations/package.json b/typescript-declarations/package.json index dbc201a9b..a6dec4cd8 100644 --- a/typescript-declarations/package.json +++ b/typescript-declarations/package.json @@ -2,6 +2,16 @@ "scripts": { "tsc": "tsc" }, + "workspaces": [ + "carp-kotlin", + "carp-kotlinx-datetime", + "carp-kotlinx-serialization", + "carp-common", + "carp-data-core", + "carp-deployments-core", + "carp-protocols-core", + "carp-studies-core" + ], "dependencies": { "@js-joda/core": "5.2.0", "big.js": "6.1.1" diff --git a/typescript-declarations/tests/VerifyModule.ts b/typescript-declarations/tests/VerifyModule.ts index f3a73d405..bf5bb4e1f 100644 --- a/typescript-declarations/tests/VerifyModule.ts +++ b/typescript-declarations/tests/VerifyModule.ts @@ -19,11 +19,13 @@ import * as fs from 'fs' export default class VerifyModule { private moduleName: string + private declarationFile: string private instances: Map - constructor( moduleName: string, instances: Array ) + constructor( moduleName: string, declarationFile: string, instances: Array ) { this.moduleName = moduleName + this.declarationFile = declarationFile this.instances = new Map( instances.map( i => { if ( i instanceof Array ) return [ i[0], i[1] ] // Type name specified manually. else return [ i.constructor.name, i ] // Type name inferred from constructor. @@ -32,8 +34,7 @@ export default class VerifyModule async verify(): Promise { - const declarationFile = `./@types/${this.moduleName}/index.d.ts` - const source = fs.readFileSync( declarationFile ).toString() + const source = fs.readFileSync( this.declarationFile ).toString() const ast = parse( source ) const scope = await Promise.resolve( import( this.moduleName ) ) diff --git a/typescript-declarations/tests/carp-common-test.ts b/typescript-declarations/tests/carp-common-test.ts index c9e2934f7..5b3e2d22f 100644 --- a/typescript-declarations/tests/carp-common-test.ts +++ b/typescript-declarations/tests/carp-common-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai' -import { kotlin } from '../src/kotlin' +import { kotlin } from '@cachet/carp-kotlin' import setOf = kotlin.collections.setOf import Duration = kotlin.time.Duration -import { kotlinx } from '../src/kotlinx-serialization' +import { kotlinx } from '@cachet/carp-kotlinx-serialization' import Json = kotlinx.serialization.json.Json -import { dk } from '../src/carp-common' +import { dk } from '@cachet/carp-common' import Trilean = dk.cachet.carp.common.application.Trilean import toTrilean = dk.cachet.carp.common.application.toTrilean import EmailAddress = dk.cachet.carp.common.application.EmailAddress diff --git a/typescript-declarations/tests/kotlin-test.ts b/typescript-declarations/tests/carp-kotlin-test.ts similarity index 96% rename from typescript-declarations/tests/kotlin-test.ts rename to typescript-declarations/tests/carp-kotlin-test.ts index 2a5d29939..8deea4cd4 100644 --- a/typescript-declarations/tests/kotlin-test.ts +++ b/typescript-declarations/tests/carp-kotlin-test.ts @@ -1,7 +1,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' -import { kotlin } from '../src/kotlin' +import { kotlin } from '@cachet/carp-kotlin' import toLong = kotlin.toLong import Pair = kotlin.Pair import Duration = kotlin.time.Duration @@ -32,7 +32,8 @@ describe( "kotlin", () => { ] const moduleVerifier = new VerifyModule( - 'kotlin-kotlin-stdlib-js-ir', + '@cachet/kotlin-kotlin-stdlib-js-ir', + './carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/kotlinx-datetime-test.ts b/typescript-declarations/tests/carp-kotlinx-datetime-test.ts similarity index 79% rename from typescript-declarations/tests/kotlinx-datetime-test.ts rename to typescript-declarations/tests/carp-kotlinx-datetime-test.ts index 35f62e180..a33d805ef 100644 --- a/typescript-declarations/tests/kotlinx-datetime-test.ts +++ b/typescript-declarations/tests/carp-kotlinx-datetime-test.ts @@ -1,7 +1,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' -import { kotlinx } from '../src/kotlinx-datetime' +import { kotlinx } from '@cachet/carp-kotlinx-datetime' import Clock = kotlinx.datetime.Clock @@ -13,7 +13,8 @@ describe( "kotlinx-datetime", () => { ] const moduleVerifier = new VerifyModule( - 'Kotlin-DateTime-library-kotlinx-datetime-js-ir', + '@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir', + './carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/kotlinx-serialization-test.ts b/typescript-declarations/tests/carp-kotlinx-serialization-test.ts similarity index 64% rename from typescript-declarations/tests/kotlinx-serialization-test.ts rename to typescript-declarations/tests/carp-kotlinx-serialization-test.ts index a92f3c48f..496f67578 100644 --- a/typescript-declarations/tests/kotlinx-serialization-test.ts +++ b/typescript-declarations/tests/carp-kotlinx-serialization-test.ts @@ -1,7 +1,7 @@ import VerifyModule from './VerifyModule' import { expect } from 'chai' -import { kotlinx } from '../src/kotlinx-serialization' +import { kotlinx } from '@cachet/carp-kotlinx-serialization' import Json = kotlinx.serialization.json.Json @@ -12,7 +12,8 @@ describe( "kotlinx-serialization", () => { ] const moduleVerifier = new VerifyModule( - 'kotlinx-serialization-kotlinx-serialization-json-js-ir', + '@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir', + './carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts', instances ) await moduleVerifier.verify() diff --git a/typescript-declarations/tests/carp-protocols-test.ts b/typescript-declarations/tests/carp-protocols-test.ts index 092f4b48a..a71537b30 100644 --- a/typescript-declarations/tests/carp-protocols-test.ts +++ b/typescript-declarations/tests/carp-protocols-test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai' -import { dk as cdk } from '../src/carp-common' +import { dk as cdk } from '@cachet/carp-common' import JSON = cdk.cachet.carp.common.infrastructure.serialization.JSON -import { dk } from '../src/carp-protocols-core' +import { dk } from '@cachet/carp-protocols-core' import StudyProtocolSnapshot = dk.cachet.carp.protocols.application.StudyProtocolSnapshot import ProtocolServiceRequest = dk.cachet.carp.protocols.infrastructure.ProtocolServiceRequest diff --git a/typescript-declarations/tests/carp-studies-test.ts b/typescript-declarations/tests/carp-studies-test.ts index 116ccd15c..815e415d6 100644 --- a/typescript-declarations/tests/carp-studies-test.ts +++ b/typescript-declarations/tests/carp-studies-test.ts @@ -1,16 +1,16 @@ import { expect } from 'chai' -import { kotlin } from '../src/kotlin' +import { kotlin } from '@cachet/carp-kotlin' import setOf = kotlin.collections.setOf import listOf = kotlin.collections.listOf -import { kotlinx as kcd } from '../src/kotlinx-datetime' +import { kotlinx as kcd } from '@cachet/carp-kotlinx-datetime' import Clock = kcd.datetime.Clock -import { kotlinx as scd } from '../src/kotlinx-serialization' +import { kotlinx as scd } from '@cachet/carp-kotlinx-serialization' import ListSerializer = scd.serialization.builtins.ListSerializer -import { dk } from '../src/carp-studies-core' +import { dk } from '@cachet/carp-studies-core' import common = dk.cachet.carp.common import UUID = common.application.UUID diff --git a/typescript-declarations/tsconfig.json b/typescript-declarations/tsconfig.json index a4819229f..441d734b2 100644 --- a/typescript-declarations/tsconfig.json +++ b/typescript-declarations/tsconfig.json @@ -4,11 +4,6 @@ "module": "UMD", "moduleResolution": "node", "sourceMap": true, - "strict": true, - "typeRoots": ["./node_modules/@types", "./@types"] - }, - "include": [ - "src/**/*.ts", - "tests/**/*.ts" - ] + "strict": true + } } \ No newline at end of file From ac0781c7bbfe4c16a8147924af6e385bf5c6c007 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Fri, 5 May 2023 17:01:15 +0200 Subject: [PATCH 48/50] Fix: don't publish `publish-npm-packages` project (2) Previous applied fix (9206843dcae780defee6d873bc9724b2dc865e40) was still configured in main build file to be published. Apparently `publish.enabled = false` is no longer needed. Maybe since the upgrade to the new publish plugin happened. Publication is simply not set up for "dev ops projects", so `publish` isn't called on those since the tasks don't exist. --- build.gradle | 8 +++++--- carp.detekt/build.gradle | 8 -------- publish-npm-packages/build.gradle | 25 +++++++++++++++++-------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 96662a08b..b3edbbed3 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,9 @@ buildscript { commonModule = subprojects.find { it.name == 'carp.common' } coreModules = subprojects.findAll { it.name.endsWith( '.core' ) } - devOpsModules = subprojects.findAll { it.name == 'carp.detekt' || it.name == 'rpc' } + publishNpmModule = subprojects.find { it.name == 'publish-npm-packages' } + devOpsModules = + subprojects.findAll {it.name == 'carp.detekt' || it.name == 'rpc' } + publishNpmModule } dependencies { @@ -236,8 +238,8 @@ task setupTsProject(type: NpmTask) { args = ['install'] } task copyTestJsSources(type: Copy, dependsOn: setupTsProject) { - // Compile production sources for all subprojects that compile to JS. - def projects = subprojects - devOpsModules + // Compile production sources for CARP, and the JS publication project (`publishNpmModule`). + def projects = coreModules + commonModule + publishNpmModule projects.each { def project = it.name dependsOn("$project:jsProductionExecutableCompileSync") diff --git a/carp.detekt/build.gradle b/carp.detekt/build.gradle index 6b7e1a287..4cb913e3d 100644 --- a/carp.detekt/build.gradle +++ b/carp.detekt/build.gradle @@ -16,11 +16,3 @@ dependencies { test { useJUnitPlatform() } - - -// This project is not intended to be published, but the root project is. -// This skips this project when publishing the root: https://stackoverflow.com/a/59096967/590790 -apply { - plugin("maven-publish") -} -project.tasks.publish.enabled = false \ No newline at end of file diff --git a/publish-npm-packages/build.gradle b/publish-npm-packages/build.gradle index 40d2a0d29..2a05a27f2 100644 --- a/publish-npm-packages/build.gradle +++ b/publish-npm-packages/build.gradle @@ -1,4 +1,14 @@ +apply { + plugin("kotlin-multiplatform") +} + kotlin { + js(IR) { + moduleName = project.name.replaceAll("\\.", "-") + "-generated" + binaries.executable() // Export JS/TypeScript files. + browser() + } + sourceSets { commonMain { dependencies { @@ -9,13 +19,12 @@ kotlin { api project(':carp.studies.core') } } - } -} - -// This project is not intended to be published, but the root project is. -// This skips this project when publishing the root: https://stackoverflow.com/a/59096967/590790 -apply { - plugin("maven-publish") + all { + languageSettings { + // We do not mind being early adopters of Jetbrains APIs likely to change in the future. + optIn('kotlin.js.ExperimentalJsExport') + } + } + } } -project.tasks.publish.enabled = false From 4284a05d24a758e0e1c9fe3ac0c4d87b70215421 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Fri, 5 May 2023 23:49:48 +0200 Subject: [PATCH 49/50] Build: upgrade to Kotlin 1.8.21 and other dependencies --- build.gradle | 11 +- kotlin-js-store/yarn.lock | 366 +++++++++++++++++- typescript-declarations/carp-kotlin/index.ts | 4 +- .../kotlin-kotlin-stdlib-js-ir.d.ts | 2 +- ...teTime-library-kotlinx-datetime-js-ir.d.ts | 4 +- .../carp-kotlinx-datetime/index.ts | 4 +- .../carp-kotlinx-serialization/index.ts | 4 +- ...tion-kotlinx-serialization-json-js-ir.d.ts | 4 +- 8 files changed, 380 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index b3edbbed3..f51eb522c 100644 --- a/build.gradle +++ b/build.gradle @@ -8,24 +8,24 @@ buildscript { versions = [ // Kotlin multiplatform versions. - kotlin:'1.8.10', + kotlin:'1.8.21', serialization:'1.5.0', - coroutines:'1.7.0-Beta', + coroutines:'1.7.0', datetime:'0.4.0', // JVM versions. jvmTarget:'1.8', - dokkaPlugin:'1.7.20', + dokkaPlugin:'1.8.10', reflections:'0.10.2', // JS versions. - nodePlugin:'3.5.0', + nodePlugin:'4.0.0', bigJs:'6.2.1', // DevOps versions. detektPlugin:'1.22.0', detektVerifyImplementation:'1.2.5', - nexusPublishPlugin:'1.1.0', + nexusPublishPlugin:'1.3.0', apacheCommons:'2.11.0' ] @@ -88,6 +88,7 @@ configure( subprojects - devOpsModules ) { moduleName = project.name.replaceAll("\\.", "-") + "-generated" binaries.executable() // Export JS/TypeScript files. browser() + generateTypeScriptDefinitions() } sourceSets { diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 3cd7f20fe..c5c050e1e 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -2,6 +2,27 @@ # yarn lockfile v1 +"@babel/code-frame@^7.10.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/helper-validator-identifier@^7.18.6": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -12,6 +33,51 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f" integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA== +"@jridgewell/gen-mapping@^0.3.0": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/source-map@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.3.tgz#8108265659d4c33e72ffe14e33d6cc5eb59f2fda" + integrity sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@1.4.14": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" + integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + "@js-joda/core@3.2.0": version "3.2.0" resolved "https://registry.yarnpkg.com/@js-joda/core/-/core-3.2.0.tgz#3e61e21b7b2b8a6be746df1335cf91d70db2a273" @@ -22,6 +88,48 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== +"@rollup/plugin-commonjs@^21.0.1": + version "21.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-21.1.0.tgz#45576d7b47609af2db87f55a6d4b46e44fc3a553" + integrity sha512-6ZtHx3VHIp2ReNNDxHjuUml6ur+WcQ28N1yHgCQwsbNkQg2suhxGMDQGJOn/KuDxKtd1xuZP5xSTwBA4GQ8hbA== + dependencies: + "@rollup/pluginutils" "^3.1.0" + commondir "^1.0.1" + estree-walker "^2.0.1" + glob "^7.1.6" + is-reference "^1.2.1" + magic-string "^0.25.7" + resolve "^1.17.0" + +"@rollup/plugin-node-resolve@^13.1.3": + version "13.3.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz#da1c5c5ce8316cef96a2f823d111c1e4e498801c" + integrity sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw== + dependencies: + "@rollup/pluginutils" "^3.1.0" + "@types/resolve" "1.17.1" + deepmerge "^4.2.2" + is-builtin-module "^3.1.0" + is-module "^1.0.0" + resolve "^1.19.0" + +"@rollup/plugin-typescript@^8.3.0": + version "8.5.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.5.0.tgz#7ea11599a15b0a30fa7ea69ce3b791d41b862515" + integrity sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ== + dependencies: + "@rollup/pluginutils" "^3.1.0" + resolve "^1.17.0" + +"@rollup/pluginutils@^3.0.9", "@rollup/pluginutils@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" + integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== + dependencies: + "@types/estree" "0.0.39" + estree-walker "^1.0.1" + picomatch "^2.2.2" + "@socket.io/component-emitter@~3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553" @@ -90,6 +198,11 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + "@types/estree@^0.0.51": version "0.0.51" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" @@ -136,6 +249,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.0.tgz#62797cee3b8b497f6547503b2312254d4fe3c2bb" integrity sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw== +"@types/node@^12.12.14": + version "12.20.55" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" + integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== + "@types/qs@*": version "6.9.7" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb" @@ -146,6 +264,13 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== +"@types/resolve@1.17.1": + version "1.17.1" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" + integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== + dependencies: + "@types/node" "*" + "@types/retry@^0.12.0": version "0.12.1" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065" @@ -359,6 +484,11 @@ acorn-import-assertions@^1.7.6: resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9" integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw== +acorn@^8.5.0: + version "8.8.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" + integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== + acorn@^8.7.1: version "8.8.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" @@ -418,6 +548,13 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" @@ -448,6 +585,11 @@ array-flatten@^2.1.2: resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -560,6 +702,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +builtin-modules@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" + integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== + bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -593,6 +740,15 @@ caniuse-lite@^1.0.30001286: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001289.tgz#d62a20175c4d9e740feda12a78b7c8df7866329e" integrity sha512-hV6x4IfrYViN8cJbGFVbjD7KCrhS/O7wfDgvevYRanJ/IN+hhxpTcXXqaxy3CzPNFe5rlqdimdEB/k7H0YzxHg== +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -654,6 +810,13 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -661,6 +824,11 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" @@ -681,6 +849,11 @@ commander@^7.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== + compressible@~2.0.16: version "2.0.18" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -806,6 +979,16 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== +decode-uri-component@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== + +deepmerge@^4.2.2: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + default-gateway@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71" @@ -957,6 +1140,11 @@ escape-string-regexp@4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + eslint-scope@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -982,6 +1170,16 @@ estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== +estree-walker@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" + integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== + +estree-walker@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -1140,7 +1338,7 @@ follow-redirects@^1.0.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd" integrity sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A== -format-util@1.0.5: +format-util@1.0.5, format-util@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271" integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg== @@ -1227,6 +1425,18 @@ glob@7.2.0, glob@^7.1.3, glob@^7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + google-protobuf@3.12.2: version "3.12.2" resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.2.tgz#50ce9f9b6281235724eb243d6a83e969a2176e53" @@ -1247,6 +1457,11 @@ handle-thing@^2.0.0: resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -1413,6 +1628,20 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-builtin-module@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== + dependencies: + builtin-modules "^3.3.0" + +is-core-module@^2.11.0: + version "2.12.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.0.tgz#36ad62f6f73c8253fd6472517a12483cf03e7ec4" + integrity sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ== + dependencies: + has "^1.0.3" + is-core-module@^2.2.0: version "2.8.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" @@ -1442,6 +1671,11 @@ is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" @@ -1464,6 +1698,13 @@ is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-reference@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== + dependencies: + "@types/estree" "*" + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -1501,6 +1742,15 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= +jest-worker@^26.2.1: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + jest-worker@^27.4.1: version "27.4.5" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.4.5.tgz#d696e3e46ae0f24cff3fa7195ffba22889262242" @@ -1510,6 +1760,11 @@ jest-worker@^27.4.1: merge-stream "^2.0.0" supports-color "^8.0.0" +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -1647,6 +1902,13 @@ log4js@^6.4.1: rfdc "^1.3.0" streamroller "^3.1.3" +magic-string@^0.25.7: + version "0.25.9" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" + integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== + dependencies: + sourcemap-codec "^1.4.8" + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -1740,6 +2002,13 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimist@^1.2.3, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" @@ -1963,7 +2232,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -1983,6 +2252,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== +picomatch@^2.2.2: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -2120,6 +2394,15 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== +resolve@^1.17.0, resolve@^1.19.0: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== + dependencies: + is-core-module "^2.11.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^1.9.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" @@ -2145,6 +2428,31 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" +rollup-plugin-sourcemaps@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz#bf93913ffe056e414419607f1d02780d7ece84ed" + integrity sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw== + dependencies: + "@rollup/pluginutils" "^3.0.9" + source-map-resolve "^0.6.0" + +rollup-plugin-terser@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" + integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== + dependencies: + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" + +rollup@^2.68.0: + version "2.79.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7" + integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw== + optionalDependencies: + fsevents "~2.3.2" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -2217,6 +2525,13 @@ serialize-javascript@6.0.0, serialize-javascript@^6.0.0: dependencies: randombytes "^2.1.0" +serialize-javascript@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" + integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== + dependencies: + randombytes "^2.1.0" + serve-index@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" @@ -2331,6 +2646,14 @@ source-map-loader@4.0.0: iconv-lite "^0.6.3" source-map-js "^1.0.2" +source-map-resolve@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.6.0.tgz#3d9df87e236b53f16d01e58150fc7711138e5ed2" + integrity sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -2349,6 +2672,11 @@ source-map@~0.7.2: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +sourcemap-codec@^1.4.8: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + spdy-transport@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" @@ -2438,13 +2766,25 @@ supports-color@8.1.1, supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-color@^7.1.0: +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + tapable@^2.1.1, tapable@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" @@ -2461,6 +2801,16 @@ terser-webpack-plugin@^5.1.3: source-map "^0.6.1" terser "^5.7.2" +terser@^5.0.0: + version "5.17.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.17.1.tgz#948f10830454761e2eeedc6debe45c532c83fd69" + integrity sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw== + dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" + commander "^2.20.0" + source-map-support "~0.5.20" + terser@^5.7.2: version "5.10.0" resolved "https://registry.yarnpkg.com/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc" @@ -2494,6 +2844,11 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== +tslib@^2.3.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -2512,6 +2867,11 @@ typescript@4.7.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@^3.7.2: + version "3.9.10" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8" + integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== + ua-parser-js@^0.7.30: version "0.7.32" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211" diff --git a/typescript-declarations/carp-kotlin/index.ts b/typescript-declarations/carp-kotlin/index.ts index 3bceb6369..ad0e8f6ce 100644 --- a/typescript-declarations/carp-kotlin/index.ts +++ b/typescript-declarations/carp-kotlin/index.ts @@ -113,12 +113,12 @@ kotlinStdLib.$_$.EmptyList.prototype.contains = function( value: T ): boolean kotlinStdLib.$_$.EmptyList.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptyList.prototype.toArray = function(): T[] { return []; } kotlinStdLib.$_$.AbstractMutableList.prototype.contains = function( value: T ): boolean { return this.d1( value ); } -kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.f(); } +kotlinStdLib.$_$.AbstractMutableList.prototype.size = function(): number { return this.i(); } kotlinStdLib.$_$.EmptySet.prototype.contains = function( value: T ): boolean { return false; } kotlinStdLib.$_$.EmptySet.prototype.size = function(): number { return 0; } kotlinStdLib.$_$.EmptySet.prototype.toArray = function(): T[] { return []; } kotlinStdLib.$_$.HashSet.prototype.contains = function( value: T ): boolean { return this.d1( value ); } -kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.f(); } +kotlinStdLib.$_$.HashSet.prototype.size = function(): number { return this.i(); } kotlinStdLib.$_$.HashMap.prototype.get = function( key: K ): V { return this.e2( key ); } Object.defineProperty( kotlinStdLib.$_$.HashMap.prototype, "keys", { get: function keys() { return this.f2(); } diff --git a/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts b/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts index 058805e23..caab865d1 100644 --- a/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts +++ b/typescript-declarations/carp-kotlin/kotlin-kotlin-stdlib-js-ir.d.ts @@ -26,7 +26,7 @@ declare module "@cachet/kotlin-kotlin-stdlib-js-ir" d1( value: T ): boolean // size - f(): number + i(): number toArray(): Array } diff --git a/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts b/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts index a0c6ba001..1f1208d75 100644 --- a/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts +++ b/typescript-declarations/carp-kotlinx-datetime/Kotlin-DateTime-library-kotlinx-datetime-js-ir.d.ts @@ -5,14 +5,14 @@ declare module "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" interface System { // now - d12(): Instant_0 + b12(): Instant_0 } function System_getInstance(): System interface Instant_0 { // toEpochMilliseconds - q12(): number + o12(): number } } } diff --git a/typescript-declarations/carp-kotlinx-datetime/index.ts b/typescript-declarations/carp-kotlinx-datetime/index.ts index 1d3393d98..59da9f0b6 100644 --- a/typescript-declarations/carp-kotlinx-datetime/index.ts +++ b/typescript-declarations/carp-kotlinx-datetime/index.ts @@ -33,8 +33,8 @@ declare module "@cachet/Kotlin-DateTime-library-kotlinx-datetime-js-ir" // Implement base interfaces in internal types. -extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.d12(); }; -extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.q12(); }; +extend.$_$.System.prototype.now = function(): kotlinx.datetime.Instant { return this.b12(); }; +extend.$_$.Instant_0.prototype.toEpochMilliseconds = function(): number { return this.o12(); }; // Re-export augmented types. diff --git a/typescript-declarations/carp-kotlinx-serialization/index.ts b/typescript-declarations/carp-kotlinx-serialization/index.ts index 8df7a51cd..e390745e2 100644 --- a/typescript-declarations/carp-kotlinx-serialization/index.ts +++ b/typescript-declarations/carp-kotlinx-serialization/index.ts @@ -38,12 +38,12 @@ declare module "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" extendJson.$_$.JsonImpl.prototype.encodeToString = function( serializer: any, value: any ): string { - return this.v12( serializer, value ); + return this.t12( serializer, value ); }; extendJson.$_$.JsonImpl.prototype.decodeFromString = function( serializer: any, string: string ): any { - return this.w12( serializer, string ); + return this.u12( serializer, string ); }; diff --git a/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts index d1c856328..bded3d9b1 100644 --- a/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts +++ b/typescript-declarations/carp-kotlinx-serialization/kotlinx-serialization-kotlinx-serialization-json-js-ir.d.ts @@ -5,10 +5,10 @@ declare module "@cachet/kotlinx-serialization-kotlinx-serialization-json-js-ir" interface JsonImpl { // encodeToString - v12( serializer: any, instance: any ): string + t12( serializer: any, instance: any ): string // decodeFromString - w12( serializer: any, string: string ): string + u12( serializer: any, string: string ): string } function Default_getInstance(): JsonImpl } From aea801b010faf1f0fce71539b1d6247379cb2ad7 Mon Sep 17 00:00:00 2001 From: Whathecode Date: Sun, 7 May 2023 20:09:01 +0200 Subject: [PATCH 50/50] Build: upgrade JS dependencies/resolve dependabot alerts --- build.gradle | 2 +- kotlin-js-store/yarn.lock | 755 +++--- typescript-declarations/package-lock.json | 2695 ++++----------------- typescript-declarations/package.json | 21 +- 4 files changed, 760 insertions(+), 2713 deletions(-) diff --git a/build.gradle b/build.gradle index f51eb522c..57fb4191c 100644 --- a/build.gradle +++ b/build.gradle @@ -305,7 +305,7 @@ task compileTs(type: NpmTask, dependsOn: copyTestJsSources) { args = ['run', 'tsc'] } task verifyTsDeclarations(type: NodeTask, dependsOn: compileTs) { - script = file("${typescriptFolder}/node_modules/mocha/bin/mocha") + script = file("${typescriptFolder}/node_modules/mocha/bin/mocha.js") execOverrides { it.workingDir = typescriptFolder } diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index c5c050e1e..8c580cdf3 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -29,9 +29,9 @@ integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== "@discoveryjs/json-ext@^0.5.0": - version "0.5.6" - resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f" - integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA== + version "0.5.7" + resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" + integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== "@jridgewell/gen-mapping@^0.3.0": version "0.3.3" @@ -70,7 +70,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.18" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== @@ -151,9 +151,9 @@ "@types/node" "*" "@types/connect-history-api-fallback@^1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.3.5.tgz#d1f7a8a09d0ed5a57aee5ae9c18ab9b803205dae" - integrity sha512-h8QJa8xSb1WD4fpKBDcATDNGXghFj6/3GRWG6dhmRcu0RX1Ubasur2Uvx5aeEwlf0MwblEC2bMzzMQntxnw/Cw== + version "1.5.0" + resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#9fd20b3974bdc2bcd4ac6567e2e0f6885cb2cf41" + integrity sha512-4x5FkPpLipqwthjPsF7ZRbOv3uoLUFkTA9G9v583qi4pACvq0uTELrB8OLUzPWUI4IJIyvM85vzkV1nyiI2Lig== dependencies: "@types/express-serve-static-core" "*" "@types/node" "*" @@ -186,17 +186,17 @@ "@types/estree" "*" "@types/eslint@*": - version "8.2.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.2.1.tgz#13f3d69bac93c2ae008019c28783868d0a1d6605" - integrity sha512-UP9rzNn/XyGwb5RQ2fok+DzcIRIYwc16qTXse5+Smsy8MOIccCChT15KAwnsgQx4PzJkaMq4myFyZ4CL5TjhIQ== + version "8.37.0" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.37.0.tgz#29cebc6c2a3ac7fea7113207bf5a828fdf4d7ef1" + integrity sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ== dependencies: "@types/estree" "*" "@types/json-schema" "*" "@types/estree@*": - version "0.0.50" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" - integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" + integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== "@types/estree@0.0.39": version "0.0.39" @@ -208,46 +208,52 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== -"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.31": - version "4.17.31" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz#a1139efeab4e7323834bb0226e62ac019f474b2f" - integrity sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q== +"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": + version "4.17.34" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.34.tgz#c119e85b75215178bc127de588e93100698ab4cc" + integrity sha512-fvr49XlCGoUj2Pp730AItckfjat4WNb0lb3kfrLWffd+RLeoGAMsq7UOy04PAPtoL01uKwcp6u8nhzpgpDYr3w== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" + "@types/send" "*" "@types/express@*", "@types/express@^4.17.13": - version "4.17.15" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.15.tgz#9290e983ec8b054b65a5abccb610411953d417ff" - integrity sha512-Yv0k4bXGOH+8a+7bELd2PqHQsuiANB+A8a4gnQrkRWzrkKlb6KHaVvyXhqs04sVW/OWlbPyYxRgYlIXLfrufMQ== + version "4.17.17" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.17.tgz#01d5437f6ef9cfa8668e616e13c2f2ac9a491ae4" + integrity sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q== dependencies: "@types/body-parser" "*" - "@types/express-serve-static-core" "^4.17.31" + "@types/express-serve-static-core" "^4.17.33" "@types/qs" "*" "@types/serve-static" "*" "@types/http-proxy@^1.17.8": - version "1.17.9" - resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.9.tgz#7f0e7931343761efde1e2bf48c40f02f3f75705a" - integrity sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw== + version "1.17.11" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.11.tgz#0ca21949a5588d55ac2b659b69035c84bd5da293" + integrity sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA== dependencies: "@types/node" "*" "@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": - version "7.0.9" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" - integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== "@types/mime@*": version "3.0.1" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== +"@types/mime@^1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" + integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== + "@types/node@*", "@types/node@>=10.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.0.tgz#62797cee3b8b497f6547503b2312254d4fe3c2bb" - integrity sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw== + version "20.1.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.1.0.tgz#258805edc37c327cf706e64c6957f241ca4c4c20" + integrity sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A== "@types/node@^12.12.14": version "12.20.55" @@ -271,10 +277,18 @@ dependencies: "@types/node" "*" -"@types/retry@^0.12.0": - version "0.12.1" - resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065" - integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g== +"@types/retry@0.12.0": + version "0.12.0" + resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" + integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== + +"@types/send@*": + version "0.17.1" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301" + integrity sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q== + dependencies: + "@types/mime" "^1" + "@types/node" "*" "@types/serve-index@^1.9.1": version "1.9.1" @@ -284,9 +298,9 @@ "@types/express" "*" "@types/serve-static@*", "@types/serve-static@^1.13.10": - version "1.15.0" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.0.tgz#c7930ff61afb334e121a9da780aac0d9b8f34155" - integrity sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg== + version "1.15.1" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.1.tgz#86b1753f0be4f9a1bee68d459fcda5be4ea52b5d" + integrity sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ== dependencies: "@types/mime" "*" "@types/node" "*" @@ -299,9 +313,9 @@ "@types/node" "*" "@types/ws@^8.5.1": - version "8.5.3" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" - integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== + version "8.5.4" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.4.tgz#bb10e36116d6e570dd943735f86c933c1587b8a5" + integrity sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg== dependencies: "@types/node" "*" @@ -463,15 +477,7 @@ abab@^2.0.6: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -accepts@~1.3.4, accepts@~1.3.5: - version "1.3.7" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== - dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" - -accepts@~1.3.8: +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== @@ -484,16 +490,11 @@ acorn-import-assertions@^1.7.6: resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9" integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw== -acorn@^8.5.0: +acorn@^8.5.0, acorn@^8.7.1: version "8.8.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== -acorn@^8.7.1: - version "8.8.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" - integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== - ajv-formats@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" @@ -506,7 +507,7 @@ ajv-keywords@^3.5.2: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv-keywords@^5.0.0: +ajv-keywords@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== @@ -523,10 +524,10 @@ ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.8.0: - version "8.8.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.8.2.tgz#01b4fef2007a28bf75f0b7fc009f62679de4abbb" - integrity sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw== +ajv@^8.0.0, ajv@^8.9.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -563,9 +564,9 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: color-convert "^2.0.1" anymatch@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" @@ -578,7 +579,7 @@ argparse@^2.0.1: array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== array-flatten@^2.1.2: version "2.1.2" @@ -603,7 +604,7 @@ base64id@2.0.0, base64id@~2.0.0: batch@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" - integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= + integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== big.js@6.2.1: version "6.2.1" @@ -634,25 +635,27 @@ body-parser@1.20.1: unpipe "1.0.0" body-parser@^1.19.0: - version "1.19.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.1.tgz#1499abbaa9274af3ecc9f6f10396c995943e31d4" - integrity sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA== + version "1.20.2" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" + integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== dependencies: - bytes "3.1.1" - content-type "~1.0.4" + bytes "3.1.2" + content-type "~1.0.5" debug "2.6.9" - depd "~1.1.2" - http-errors "1.8.1" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.9.6" - raw-body "2.4.2" + on-finished "2.4.1" + qs "6.11.0" + raw-body "2.5.2" type-is "~1.6.18" + unpipe "1.0.0" bonjour-service@^1.0.11: - version "1.0.14" - resolved "https://registry.yarnpkg.com/bonjour-service/-/bonjour-service-1.0.14.tgz#c346f5bc84e87802d08f8d5a60b93f758e514ee7" - integrity sha512-HIMbgLnk1Vqvs6B4Wq5ep7mxvj9sGz5d1JJyDNSGNIdA/w2MCz6GTjWTdjqOJV1bEPj+6IkxDvWNFKEBxNt4kQ== + version "1.1.1" + resolved "https://registry.yarnpkg.com/bonjour-service/-/bonjour-service-1.1.1.tgz#960948fa0e0153f5d26743ab15baf8e33752c135" + integrity sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg== dependencies: array-flatten "^2.1.2" dns-equal "^1.0.0" @@ -674,7 +677,7 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.1, braces@^3.0.2, braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -687,15 +690,14 @@ browser-stdout@1.3.1: integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== browserslist@^4.14.5: - version "4.19.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" - integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== + version "4.21.5" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7" + integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w== dependencies: - caniuse-lite "^1.0.30001286" - electron-to-chromium "^1.4.17" - escalade "^3.1.1" - node-releases "^2.0.1" - picocolors "^1.0.0" + caniuse-lite "^1.0.30001449" + electron-to-chromium "^1.4.284" + node-releases "^2.0.8" + update-browserslist-db "^1.0.10" buffer-from@^1.0.0: version "1.1.2" @@ -710,12 +712,7 @@ builtin-modules@^3.3.0: bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" - integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= - -bytes@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.1.tgz#3f018291cb4cbad9accb6e6970bca9c8889e879a" - integrity sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg== + integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== bytes@3.1.2: version "3.1.2" @@ -731,14 +728,14 @@ call-bind@^1.0.0: get-intrinsic "^1.0.2" camelcase@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.1.tgz#250fd350cfd555d0d2160b1d51510eaf8326e86e" - integrity sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA== + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001286: - version "1.0.30001289" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001289.tgz#d62a20175c4d9e740feda12a78b7c8df7866329e" - integrity sha512-hV6x4IfrYViN8cJbGFVbjD7KCrhS/O7wfDgvevYRanJ/IN+hhxpTcXXqaxy3CzPNFe5rlqdimdEB/k7H0YzxHg== +caniuse-lite@^1.0.30001449: + version "1.0.30001486" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz#56a08885228edf62cbe1ac8980f2b5dae159997e" + integrity sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg== chalk@^2.0.0: version "2.4.2" @@ -757,7 +754,7 @@ chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chokidar@3.5.3, chokidar@^3.5.3: +chokidar@3.5.3, chokidar@^3.5.1, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -772,21 +769,6 @@ chokidar@3.5.3, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" -chokidar@^3.5.1: - version "3.5.2" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" - integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - chrome-trace-event@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" @@ -835,9 +817,9 @@ color-name@~1.1.4: integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== colorette@^2.0.10, colorette@^2.0.14: - version "2.0.16" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.16.tgz#713b9af84fdb000139f04546bd4a93f62a5085da" - integrity sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g== + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== commander@^2.20.0: version "2.20.3" @@ -877,7 +859,7 @@ compression@^1.7.4: concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== connect-history-api-fallback@^2.0.0: version "2.0.0" @@ -901,15 +883,15 @@ content-disposition@0.5.4: dependencies: safe-buffer "5.2.1" -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== +content-type@~1.0.4, content-type@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== cookie@0.5.0: version "0.5.0" @@ -917,9 +899,9 @@ cookie@0.5.0: integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== cookie@~0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" - integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== + version "0.4.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" + integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== core-util-is@~1.0.0: version "1.0.3" @@ -946,7 +928,7 @@ cross-spawn@^7.0.3: custom-event@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425" - integrity sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU= + integrity sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg== date-format@^4.0.14: version "4.0.14" @@ -960,20 +942,13 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4.3.4, debug@^4.3.4, debug@~4.3.2: +debug@4.3.4, debug@^4.1.0, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" -debug@^4.1.0, debug@~4.3.1: - version "4.3.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" - integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== - dependencies: - ms "2.1.2" - decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" @@ -1009,7 +984,7 @@ depd@2.0.0: depd@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== destroy@1.2.0: version "1.2.0" @@ -1024,7 +999,7 @@ detect-node@^2.0.4: di@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" - integrity sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw= + integrity sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA== diff@5.0.0: version "5.0.0" @@ -1034,19 +1009,19 @@ diff@5.0.0: dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" - integrity sha1-s55/HabrCnW6nBcySzR1PEfgZU0= + integrity sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg== dns-packet@^5.2.2: - version "5.4.0" - resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.4.0.tgz#1f88477cf9f27e78a213fb6d118ae38e759a879b" - integrity sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g== + version "5.6.0" + resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.6.0.tgz#2202c947845c7a63c23ece58f2f70ff6ab4c2f7d" + integrity sha512-rza3UH1LwdHh9qyPXp8lkwpjSNk/AMD3dPytUoRoqnypDUhY0xvbdmVhWOfxO68frEfV9BU8V12Ez7ZsHGZpCQ== dependencies: "@leichtgewicht/ip-codec" "^2.0.1" dom-serialize@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b" - integrity sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs= + integrity sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ== dependencies: custom-event "~1.0.0" ent "~2.2.0" @@ -1064,12 +1039,12 @@ dukat@0.5.8-rc.4: ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== -electron-to-chromium@^1.4.17: - version "1.4.24" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.24.tgz#9cf8a92d5729c480ee47ff0aa5555f57467ae2fa" - integrity sha512-erwx5r69B/WFfFuF2jcNN0817BfDBdC4765kQ6WltOMuwsimlQo3JTEq0Cle+wpHralwdeX3OfAtw/mHxPK0Wg== +electron-to-chromium@^1.4.284: + version "1.4.385" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.385.tgz#1afd8d6280d510145148777b899ff481c65531ff" + integrity sha512-L9zlje9bIw0h+CwPQumiuVlfMcV4boxRjFIWDcLfFqTZNbkwOExBzfmswytHawObQX4OUhtNv8gIiB21kOurIg== emoji-regex@^8.0.0: version "8.0.0" @@ -1079,17 +1054,17 @@ emoji-regex@^8.0.0: encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== engine.io-parser@~5.0.3: - version "5.0.4" - resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.0.4.tgz#0b13f704fa9271b3ec4f33112410d8f3f41d0fc0" - integrity sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg== + version "5.0.6" + resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.0.6.tgz#7811244af173e157295dec9b2718dfe42a64ef45" + integrity sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw== -engine.io@~6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.2.1.tgz#e3f7826ebc4140db9bbaa9021ad6b1efb175878f" - integrity sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA== +engine.io@~6.4.1: + version "6.4.2" + resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.4.2.tgz#ffeaf68f69b1364b0286badddf15ff633476473f" + integrity sha512-FKn/3oMiJjrOEOeUub2WCox6JhxBXq/Zn3fZOMCBxKnNYtsdKjxhl7yR3fZhM9PV+rdE75SU5SYMc+2PGzo+Tg== dependencies: "@types/cookie" "^0.4.1" "@types/cors" "^2.8.12" @@ -1100,12 +1075,12 @@ engine.io@~6.2.1: cors "~2.8.5" debug "~4.3.1" engine.io-parser "~5.0.3" - ws "~8.2.3" + ws "~8.11.0" enhanced-resolve@^5.10.0: - version "5.12.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz#300e1c90228f5b570c4d35babf263f6da7155634" - integrity sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ== + version "5.13.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz#26d1ecc448c02de997133217b5c1053f34a0a275" + integrity sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -1113,7 +1088,7 @@ enhanced-resolve@^5.10.0: ent@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" - integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0= + integrity sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA== envinfo@^7.7.3: version "7.8.1" @@ -1133,7 +1108,7 @@ escalade@^3.1.1: escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== escape-string-regexp@4.0.0: version "4.0.0" @@ -1183,7 +1158,7 @@ estree-walker@^2.0.1: etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== eventemitter3@^4.0.0: version "4.0.7" @@ -1263,9 +1238,9 @@ fast-json-stable-stringify@^2.0.0: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fastest-levenshtein@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2" - integrity sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow== + version "1.0.16" + resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" + integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== faye-websocket@^0.11.3: version "0.11.4" @@ -1334,9 +1309,9 @@ flatted@^3.2.7: integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== follow-redirects@^1.0.0: - version "1.14.6" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd" - integrity sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A== + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== format-util@1.0.5, format-util@^1.0.5: version "1.0.5" @@ -1351,7 +1326,7 @@ forwarded@0.2.0: fresh@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== fs-extra@^8.1.0: version "8.1.0" @@ -1370,7 +1345,7 @@ fs-monkey@^1.0.3: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@~2.3.2: version "2.3.2" @@ -1388,13 +1363,13 @@ get-caller-file@^2.0.5: integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-intrinsic@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" - integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f" + integrity sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q== dependencies: function-bind "^1.1.1" has "^1.0.3" - has-symbols "^1.0.1" + has-symbols "^1.0.3" get-stream@^6.0.0: version "6.0.1" @@ -1413,7 +1388,7 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@7.2.0, glob@^7.1.3, glob@^7.1.7: +glob@7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== @@ -1425,7 +1400,7 @@ glob@7.2.0, glob@^7.1.3, glob@^7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.6: +glob@^7.1.3, glob@^7.1.6, glob@^7.1.7: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -1442,15 +1417,10 @@ google-protobuf@3.12.2: resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.2.tgz#50ce9f9b6281235724eb243d6a83e969a2176e53" integrity sha512-4CZhpuRr1d6HjlyrxoXoocoGFnRYgKULgMtikMddA9ztRyYR59Aondv2FioyxWVamRo0rF2XpYawkTCBEQOSkA== -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6: - version "4.2.8" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" - integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== - -graceful-fs@^4.2.9: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== handle-thing@^2.0.0: version "2.0.1" @@ -1467,10 +1437,10 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" - integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== has@^1.0.3: version "1.0.3" @@ -1487,7 +1457,7 @@ he@1.2.0: hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" - integrity sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI= + integrity sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ== dependencies: inherits "^2.0.1" obuf "^1.0.0" @@ -1495,25 +1465,14 @@ hpack.js@^2.1.6: wbuf "^1.1.0" html-entities@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.2.tgz#760b404685cb1d794e4f4b744332e3b00dcfe488" - integrity sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ== + version "2.3.3" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.3.tgz#117d7626bece327fc8baace8868fa6f5ef856e46" + integrity sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA== http-deceiver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" - integrity sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc= - -http-errors@1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" - integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== - dependencies: - depd "~1.1.2" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.1" + integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== http-errors@2.0.0: version "2.0.0" @@ -1529,7 +1488,7 @@ http-errors@2.0.0: http-errors@~1.6.2: version "1.6.3" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" - integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== dependencies: depd "~1.1.2" inherits "2.0.3" @@ -1537,9 +1496,9 @@ http-errors@~1.6.2: statuses ">= 1.4.0 < 2" http-parser-js@>=0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.5.tgz#d7c30d5d3c90d865b4a2e870181f9d6f22ac7ac5" - integrity sha512-x+JVEkO2PoM8qqpbPbOL3cqHPwerep7OwzK7Ay+sMQjKzaKCqWvjoXm5tqMP9tXWWTnTzAjIhXg+J99XYuPhPA== + version "0.5.8" + resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.8.tgz#af23090d9ac4e24573de6f6aecc9d84a48bf20e3" + integrity sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q== http-proxy-middleware@^2.0.3: version "2.0.6" @@ -1581,9 +1540,9 @@ iconv-lite@^0.6.3: safer-buffer ">= 2.1.2 < 3.0.0" import-local@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.3.tgz#4d51c2c495ca9393da259ec66b62e022920211e0" - integrity sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA== + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -1591,7 +1550,7 @@ import-local@^3.0.2: inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" wrappy "1" @@ -1604,7 +1563,7 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: inherits@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== interpret@^2.2.0: version "2.2.0" @@ -1642,13 +1601,6 @@ is-core-module@^2.11.0: dependencies: has "^1.0.3" -is-core-module@^2.2.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" - integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== - dependencies: - has "^1.0.3" - is-docker@^2.0.0, is-docker@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" @@ -1657,7 +1609,7 @@ is-docker@^2.0.0, is-docker@^2.1.1: is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-fullwidth-code-point@^3.0.0: version "3.0.0" @@ -1725,22 +1677,22 @@ is-wsl@^2.2.0: isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== isbinaryfile@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.8.tgz#5d34b94865bd4946633ecc78a026fc76c5b11fcf" - integrity sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w== + version "4.0.10" + resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3" + integrity sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw== isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== jest-worker@^26.2.1: version "26.6.2" @@ -1751,10 +1703,10 @@ jest-worker@^26.2.1: merge-stream "^2.0.0" supports-color "^7.0.0" -jest-worker@^27.4.1: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.4.5.tgz#d696e3e46ae0f24cff3fa7195ffba22889262242" - integrity sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg== +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== dependencies: "@types/node" "*" merge-stream "^2.0.0" @@ -1790,7 +1742,7 @@ json-schema-traverse@^1.0.0: jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== optionalDependencies: graceful-fs "^4.1.6" @@ -1860,9 +1812,9 @@ kind-of@^6.0.2: integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== loader-runner@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.2.0.tgz#d7022380d66d14c5fb1d496b89864ebcfd478384" - integrity sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw== + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== locate-path@^5.0.0: version "5.0.0" @@ -1892,15 +1844,15 @@ log-symbols@4.1.0: is-unicode-supported "^0.1.0" log4js@^6.4.1: - version "6.7.1" - resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.7.1.tgz#06e12b1ac915dd1067146ffad8215f666f7d2c51" - integrity sha512-lzbd0Eq1HRdWM2abSD7mk6YIVY0AogGJzb/z+lqzRk+8+XJP+M6L1MS5FUSc3jjGru4dbKjEMJmqlsoYYpuivQ== + version "6.9.1" + resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.9.1.tgz#aba5a3ff4e7872ae34f8b4c533706753709e38b6" + integrity sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g== dependencies: date-format "^4.0.14" debug "^4.3.4" flatted "^3.2.7" rfdc "^1.3.0" - streamroller "^3.1.3" + streamroller "^3.1.5" magic-string@^0.25.7: version "0.25.9" @@ -1912,19 +1864,19 @@ magic-string@^0.25.7: media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== memfs@^3.4.3: - version "3.4.12" - resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.4.12.tgz#d00f8ad8dab132dc277c659dc85bfd14b07d03bd" - integrity sha512-BcjuQn6vfqP+k100e0E9m61Hyqa//Brp+I3f0OBmN0ATHlFA8vx3Lt8z57R3u2bPqe3WGDBC+nF72fTH7isyEw== + version "3.5.1" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.5.1.tgz#f0cd1e2bfaef58f6fe09bfb9c2288f07fea099ec" + integrity sha512-UWbFJKvj5k+nETdteFndTpYxdeTMox/ULeqX5k/dpaQJCCFmj5EeKv3dBcyO2xmkRAx2vppRu5dVG7SOtsGOzA== dependencies: fs-monkey "^1.0.3" merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= + integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== merge-stream@^2.0.0: version "2.0.0" @@ -1934,34 +1886,22 @@ merge-stream@^2.0.0: methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== micromatch@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" - integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== dependencies: - braces "^3.0.1" - picomatch "^2.2.3" - -mime-db@1.51.0, "mime-db@>= 1.43.0 < 2": - version "1.51.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" - integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== + braces "^3.0.2" + picomatch "^2.3.1" -mime-db@1.52.0: +mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24: - version "2.1.34" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" - integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== - dependencies: - mime-db "1.51.0" - -mime-types@~2.1.34: +mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -1995,31 +1935,24 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^3.1.1: +minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -minimist@^1.2.3, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimist@^1.2.3, minimist@^1.2.6: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== mkdirp@^0.5.5: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + version "0.5.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== dependencies: - minimist "^1.2.5" + minimist "^1.2.6" mocha@10.0.0: version "10.0.0" @@ -2052,7 +1985,7 @@ mocha@10.0.0: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== ms@2.1.2: version "2.1.2" @@ -2077,11 +2010,6 @@ nanoid@3.3.3: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== -negotiator@0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" - integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== - negotiator@0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" @@ -2097,10 +2025,10 @@ node-forge@^1: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== -node-releases@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" - integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== +node-releases@^2.0.8: + version "2.0.10" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.10.tgz#c311ebae3b6a148c89b1813fd7c4d3c024ef537f" + integrity sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" @@ -2117,12 +2045,12 @@ npm-run-path@^4.0.1: object-assign@^4: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== object-inspect@^1.9.0: - version "1.12.2" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" - integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== + version "1.12.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" + integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== obuf@^1.0.0, obuf@^1.1.2: version "1.1.2" @@ -2139,7 +2067,7 @@ on-finished@2.4.1: on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= + integrity sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww== dependencies: ee-first "1.1.1" @@ -2151,7 +2079,7 @@ on-headers@~1.0.2: once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" @@ -2163,9 +2091,9 @@ onetime@^5.1.2: mimic-fn "^2.1.0" open@^8.0.9: - version "8.4.0" - resolved "https://registry.yarnpkg.com/open/-/open-8.4.0.tgz#345321ae18f8138f82565a910fdc6b39e8c244f8" - integrity sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q== + version "8.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" + integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== dependencies: define-lazy-prop "^2.0.0" is-docker "^2.1.1" @@ -2200,11 +2128,11 @@ p-locate@^5.0.0: p-limit "^3.0.2" p-retry@^4.5.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.1.tgz#8fcddd5cdf7a67a0911a9cf2ef0e5df7f602316c" - integrity sha512-e2xXGNhZOZ0lfgR9kL34iGlU8N/KO0xZnQxVEwdeOvpqNDQfdnxIYizvWtK8RglUa3bGqI8g0R/BdfzLMxRkiA== + version "4.6.2" + resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.2.tgz#9baae7184057edd4e17231cee04264106e092a16" + integrity sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ== dependencies: - "@types/retry" "^0.12.0" + "@types/retry" "0.12.0" retry "^0.13.1" p-try@^2.0.0: @@ -2225,14 +2153,14 @@ path-exists@^4.0.0: path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6, path-parse@^1.0.7: +path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -2240,19 +2168,14 @@ path-parse@^1.0.6, path-parse@^1.0.7: path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= + integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" - integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== - -picomatch@^2.2.2: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -2278,9 +2201,9 @@ proxy-addr@~2.0.7: ipaddr.js "1.9.1" punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== qjobs@^1.2.0: version "1.2.0" @@ -2294,11 +2217,6 @@ qs@6.11.0: dependencies: side-channel "^1.0.4" -qs@6.9.6: - version "6.9.6" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee" - integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ== - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -2311,16 +2229,6 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.2.tgz#baf3e9c21eebced59dd6533ac872b71f7b61cb32" - integrity sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ== - dependencies: - bytes "3.1.1" - http-errors "1.8.1" - iconv-lite "0.4.24" - unpipe "1.0.0" - raw-body@2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" @@ -2331,10 +2239,20 @@ raw-body@2.5.1: iconv-lite "0.4.24" unpipe "1.0.0" +raw-body@2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + readable-stream@^2.0.1: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -2345,9 +2263,9 @@ readable-stream@^2.0.1: util-deprecate "~1.0.1" readable-stream@^3.0.6: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -2370,7 +2288,7 @@ rechoir@^0.7.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== require-from-string@^2.0.2: version "2.0.2" @@ -2380,7 +2298,7 @@ require-from-string@^2.0.2: requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== resolve-cwd@^3.0.0: version "3.0.0" @@ -2394,7 +2312,7 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve@^1.17.0, resolve@^1.19.0: +resolve@^1.17.0, resolve@^1.19.0, resolve@^1.9.0: version "1.22.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== @@ -2403,14 +2321,6 @@ resolve@^1.17.0, resolve@^1.19.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.9.0: - version "1.20.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== - dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" - retry@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" @@ -2469,28 +2379,28 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== schema-utils@^3.1.0, schema-utils@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.1.tgz#bc74c4b6b6995c1d88f76a8b77bea7219e0c8281" - integrity sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw== + version "3.1.2" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.2.tgz#36c10abca6f7577aeae136c804b0c741edeadc99" + integrity sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg== dependencies: "@types/json-schema" "^7.0.8" ajv "^6.12.5" ajv-keywords "^3.5.2" schema-utils@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.0.0.tgz#60331e9e3ae78ec5d16353c467c34b3a0a1d3df7" - integrity sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg== + version "4.0.1" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.0.1.tgz#eb2d042df8b01f4b5c276a2dfd41ba0faab72e8d" + integrity sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ== dependencies: "@types/json-schema" "^7.0.9" - ajv "^8.8.0" + ajv "^8.9.0" ajv-formats "^2.1.1" - ajv-keywords "^5.0.0" + ajv-keywords "^5.1.0" select-hose@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" - integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= + integrity sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg== selfsigned@^2.0.1: version "2.1.1" @@ -2518,7 +2428,7 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" -serialize-javascript@6.0.0, serialize-javascript@^6.0.0: +serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== @@ -2532,10 +2442,17 @@ serialize-javascript@^4.0.0: dependencies: randombytes "^2.1.0" +serialize-javascript@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c" + integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w== + dependencies: + randombytes "^2.1.0" + serve-index@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" - integrity sha1-03aNabHn2C5c4FD/9bRTvqEqkjk= + integrity sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw== dependencies: accepts "~1.3.4" batch "0.6.1" @@ -2594,33 +2511,35 @@ side-channel@^1.0.4: object-inspect "^1.9.0" signal-exit@^3.0.3: - version "3.0.6" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af" - integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ== + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -socket.io-adapter@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz#b50a4a9ecdd00c34d4c8c808224daa1a786152a6" - integrity sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg== +socket.io-adapter@~2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz#5de9477c9182fdc171cd8c8364b9a8894ec75d12" + integrity sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA== + dependencies: + ws "~8.11.0" socket.io-parser@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.1.tgz#01c96efa11ded938dcb21cbe590c26af5eff65e5" - integrity sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g== + version "4.2.2" + resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.2.tgz#1dd384019e25b7a3d374877f492ab34f2ad0d206" + integrity sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw== dependencies: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" socket.io@^4.4.1: - version "4.5.4" - resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.5.4.tgz#a4513f06e87451c17013b8d13fdfaf8da5a86a90" - integrity sha512-m3GC94iK9MfIEeIBfbhJs5BqFibMtkRk8ZpKwG2QwxV0m/eEhPIV4ara6XCF1LWNAus7z58RodiZlAH71U3EhQ== + version "4.6.1" + resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.6.1.tgz#62ec117e5fce0692fa50498da9347cfb52c3bc70" + integrity sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA== dependencies: accepts "~1.3.4" base64id "~2.0.0" debug "~4.3.2" - engine.io "~6.2.1" - socket.io-adapter "~2.4.0" + engine.io "~6.4.1" + socket.io-adapter "~2.5.2" socket.io-parser "~4.2.1" sockjs@^0.3.24: @@ -2667,11 +2586,6 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@~0.7.2: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - sourcemap-codec@^1.4.8: version "1.4.8" resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" @@ -2705,15 +2619,15 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: +"statuses@>= 1.4.0 < 2", statuses@~1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== -streamroller@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.1.3.tgz#d95689a8c29b30d093525d0baffe6616fd62ca7e" - integrity sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w== +streamroller@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.1.5.tgz#1263182329a45def1ffaef58d31b15d13d2ee7ff" + integrity sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw== dependencies: date-format "^4.0.14" debug "^4.3.4" @@ -2791,17 +2705,17 @@ tapable@^2.1.1, tapable@^2.2.0: integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== terser-webpack-plugin@^5.1.3: - version "5.3.0" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz#21641326486ecf91d8054161c816e464435bae9f" - integrity sha512-LPIisi3Ol4chwAaPP8toUJ3L4qCM1G0wao7L3qNv57Drezxj6+VEyySpPw4B1HSO2Eg/hDY/MNF5XihCAoqnsQ== + version "5.3.8" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.8.tgz#415e03d2508f7de63d59eca85c5d102838f06610" + integrity sha512-WiHL3ElchZMsK27P8uIUh4604IgJyAW47LVXGbEoB21DbQcZ+OuMpGjVYnEUaqcWM6dO8uS2qUbA7LSCWqvsbg== dependencies: - jest-worker "^27.4.1" + "@jridgewell/trace-mapping" "^0.3.17" + jest-worker "^27.4.5" schema-utils "^3.1.1" - serialize-javascript "^6.0.0" - source-map "^0.6.1" - terser "^5.7.2" + serialize-javascript "^6.0.1" + terser "^5.16.8" -terser@^5.0.0: +terser@^5.0.0, terser@^5.16.8: version "5.17.1" resolved "https://registry.yarnpkg.com/terser/-/terser-5.17.1.tgz#948f10830454761e2eeedc6debe45c532c83fd69" integrity sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw== @@ -2811,15 +2725,6 @@ terser@^5.0.0: commander "^2.20.0" source-map-support "~0.5.20" -terser@^5.7.2: - version "5.10.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc" - integrity sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA== - dependencies: - commander "^2.20.0" - source-map "~0.7.2" - source-map-support "~0.5.20" - thunky@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" @@ -2873,9 +2778,9 @@ typescript@^3.7.2: integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== ua-parser-js@^0.7.30: - version "0.7.32" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211" - integrity sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw== + version "0.7.35" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.35.tgz#8bda4827be4f0b1dda91699a29499575a1f1d307" + integrity sha512-veRf7dawaj9xaWEu9HoTVn5Pggtc/qj+kqTOFvNiN1l0YdxwC1kvel57UCjThjGa3BHBihE8/UJAHI+uQHmd/g== universalify@^0.1.0: version "0.1.2" @@ -2885,7 +2790,15 @@ universalify@^0.1.0: unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + +update-browserslist-db@^1.0.10: + version "1.0.11" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" + integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" uri-js@^4.2.2: version "4.4.1" @@ -2897,12 +2810,12 @@ uri-js@^4.2.2: util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== uuid@^8.3.2: version "8.3.2" @@ -2912,12 +2825,12 @@ uuid@^8.3.2: vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== void-elements@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" - integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w= + integrity sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung== watchpack@^2.4.0: version "2.4.0" @@ -3077,9 +2990,9 @@ which@^2.0.1: isexe "^2.0.0" wildcard@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" - integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== + version "2.0.1" + resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" + integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== workerpool@6.2.1: version "6.2.1" @@ -3098,18 +3011,18 @@ wrap-ansi@^7.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== ws@^8.4.2: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + +ws@~8.11.0: version "8.11.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== -ws@~8.2.3: - version "8.2.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.3.tgz#63a56456db1b04367d0b721a0b80cae6d8becbba" - integrity sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA== - y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" diff --git a/typescript-declarations/package-lock.json b/typescript-declarations/package-lock.json index b8556c3e7..4d4b238b3 100644 --- a/typescript-declarations/package-lock.json +++ b/typescript-declarations/package-lock.json @@ -1,6 +1,6 @@ { "name": "typescript-declarations", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -15,20 +15,19 @@ "carp-studies-core" ], "dependencies": { - "@js-joda/core": "5.2.0", - "big.js": "6.1.1" + "@js-joda/core": "5.5.3" }, "devDependencies": { - "@types/chai": "4.3.0", - "@types/mocha": "9.1.0", - "@types/node": "17.0.23", - "@typescript-eslint/typescript-estree": "5.17.0", - "chai": "4.3.0", - "jsdom": "19.0.0", + "@types/chai": "4.3.5", + "@types/mocha": "10.0.1", + "@types/node": "20.1.0", + "@typescript-eslint/typescript-estree": "5.59.2", + "chai": "4.3.7", + "jsdom": "22.0.0", "jsdom-global": "3.0.2", - "mocha": "9.1.0", - "ts-node": "10.7.0", - "typescript": "4.6.3" + "mocha": "10.2.0", + "ts-node": "10.9.1", + "typescript": "5.0.4" } }, "carp-common": { @@ -95,31 +94,47 @@ "resolved": "carp-studies-core", "link": true }, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "engines": { - "node": ">= 12" - } - }, "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" + "@jridgewell/trace-mapping": "0.3.9" }, "engines": { "node": ">=12" } }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@js-joda/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@js-joda/core/-/core-5.2.0.tgz", - "integrity": "sha512-0OriPYIaMLB3XiLQMe0BXKVIqeriTn3H7JMOzTsHEtt7Zqq+TetCu97KnAhU3ckiQZKBxfZshft+H1OC4D1lXw==" + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/@js-joda/core/-/core-5.5.3.tgz", + "integrity": "sha512-7dqNYwG8gCt4hfg5PKgM7xLEcgSBcx/UgC92OMnhMmvAnq11QzDFPrxUkNR/u5kn17WWLZ8beZ4A3Qrz4pZcmQ==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -166,51 +181,51 @@ } }, "node_modules/@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", "dev": true }, "node_modules/@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", "dev": true }, "node_modules/@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", "dev": true }, "node_modules/@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, "node_modules/@types/chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", "dev": true }, "node_modules/@types/mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", "dev": true }, "node_modules/@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", - "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", + "version": "20.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.0.tgz", + "integrity": "sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==", "dev": true }, "node_modules/@typescript-eslint/types": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.17.0.tgz", - "integrity": "sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw==", + "version": "5.59.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.2.tgz", + "integrity": "sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -221,17 +236,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.17.0.tgz", - "integrity": "sha512-X1gtjEcmM7Je+qJRhq7ZAAaNXYhTgqMkR10euC4Si6PIjb+kwEQHSxGazXUQXFyqfEXdkGf6JijUu5R0uceQzg==", + "version": "5.59.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz", + "integrity": "sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.17.0", - "@typescript-eslint/visitor-keys": "5.17.0", - "debug": "^4.3.2", - "globby": "^11.0.4", + "@typescript-eslint/types": "5.59.2", + "@typescript-eslint/visitor-keys": "5.59.2", + "debug": "^4.3.4", + "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.5", + "semver": "^7.3.7", "tsutils": "^3.21.0" }, "engines": { @@ -248,13 +263,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.17.0.tgz", - "integrity": "sha512-6K/zlc4OfCagUu7Am/BD5k8PSWQOgh34Nrv9Rxe2tBzlJ7uOeJ/h7ugCGDCeEZHT6k2CJBhbk9IsbkPI0uvUkA==", + "version": "5.59.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz", + "integrity": "sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.17.0", - "eslint-visitor-keys": "^3.0.0" + "@typescript-eslint/types": "5.59.2", + "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -264,44 +279,16 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, "node_modules/abab": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, - "dependencies": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - } - }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -311,9 +298,9 @@ } }, "node_modules/acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, "engines": { "node": ">=0.4.0" @@ -365,9 +352,9 @@ } }, "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "dependencies": { "normalize-path": "^3.0.0", @@ -410,7 +397,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, "node_modules/balanced-match": { @@ -419,18 +406,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/big.js": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-6.1.1.tgz", - "integrity": "sha512-1vObw81a8ylZO5ePrtMay0n018TcftpTA5HFKDaSuiUDBo8biRBtjIobw60OpwuvrGk+FsxKamqN4cnmj/eXdg==", - "engines": { - "node": "*" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/bigjs" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -441,13 +416,12 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -462,12 +436,6 @@ "node": ">=8" } }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -487,26 +455,27 @@ } }, "node_modules/chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/BFd2J30EcOwmdOgXvVsmM48l0Br0nmZPlO0uOW4XKh6kpsUumRXBgPV+IlaqFaqr9cYbeoZAM1Npx0i4A+aiA==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", - "deep-eql": "^3.0.1", + "deep-eql": "^4.1.2", "get-func-name": "^2.0.0", - "pathval": "^1.1.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", "type-detect": "^4.0.5" }, "engines": { - "node": ">=8" + "node": ">=4" } }, "node_modules/chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { "ansi-styles": "^4.1.0", @@ -519,15 +488,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -543,17 +503,23 @@ "node_modules/check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", "dev": true, "engines": { "node": "*" } }, "node_modules/chokidar": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", - "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -614,7 +580,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/create-require": { @@ -623,48 +589,36 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, - "node_modules/cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true - }, "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", "dev": true, "dependencies": { - "cssom": "~0.3.6" + "rrweb-cssom": "^0.6.0" }, "engines": { - "node": ">=8" + "node": ">=14" } }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - }, "node_modules/data-urls": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz", - "integrity": "sha512-Ds554NeT5Gennfoo9KN50Vh6tpgtvYEwraYjejXnyTpu1C7oXKxdFk75REooENHE8ndTVOJuv+BEs4/J/xcozw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", + "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", "dev": true, "dependencies": { - "abab": "^2.0.3", + "abab": "^2.0.6", "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^10.0.0" + "whatwg-url": "^12.0.0" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -691,42 +645,36 @@ } }, "node_modules/decimal.js": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", - "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==", + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", "dev": true }, "node_modules/deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, "dependencies": { "type-detect": "^4.0.0" }, "engines": { - "node": ">=0.12" + "node": ">=6" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true, "engines": { "node": ">=0.3.1" @@ -762,6 +710,18 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -783,72 +743,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -861,16 +771,10 @@ "node": ">=8.6.0" } }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -930,7 +834,7 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/fsevents": { @@ -959,10 +863,30 @@ "node_modules/get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -977,6 +901,28 @@ "node": ">= 6" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -997,13 +943,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { - "node": ">=4.x" + "node": ">=8" } }, "node_modules/he": { @@ -1042,9 +988,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, "dependencies": { "agent-base": "6", @@ -1067,9 +1013,9 @@ } }, "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" @@ -1078,7 +1024,7 @@ "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", @@ -1106,7 +1052,7 @@ "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -1169,12 +1115,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -1188,41 +1128,37 @@ } }, "node_modules/jsdom": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-19.0.0.tgz", - "integrity": "sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==", - "dev": true, - "dependencies": { - "abab": "^2.0.5", - "acorn": "^8.5.0", - "acorn-globals": "^6.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.1", - "decimal.js": "^10.3.1", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.0.0.tgz", + "integrity": "sha512-p5ZTEb5h+O+iU02t0GfEjAnkdYPrQSkfuTSMkMYyIoMvUNEHsbG0bHHbfXIcfTqD2UfvjQX7mmgiFsyRwGscVw==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "cssstyle": "^3.0.0", + "data-urls": "^4.0.0", + "decimal.js": "^10.4.3", "domexception": "^4.0.0", - "escodegen": "^2.0.0", "form-data": "^4.0.0", "html-encoding-sniffer": "^3.0.0", "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "saxes": "^5.0.1", + "nwsapi": "^2.2.4", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", + "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^3.0.0", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", "webidl-conversions": "^7.0.0", "whatwg-encoding": "^2.0.0", "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^10.0.0", - "ws": "^8.2.3", + "whatwg-url": "^12.0.1", + "ws": "^8.13.0", "xml-name-validator": "^4.0.0" }, "engines": { - "node": ">=12" + "node": ">=16" }, "peerDependencies": { "canvas": "^2.5.0" @@ -1236,25 +1172,12 @@ "node_modules/jsdom-global": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/jsdom-global/-/jsdom-global-3.0.2.tgz", - "integrity": "sha1-a9KZwTsMRiay2iwDk81DhdYGrLk=", + "integrity": "sha512-t1KMcBkz/pT5JrvcJbpUR2u/w1kO9jXctaaGJ0vZDzwFnIvGWw9IDSRciT83kIs8Bnw4qpOl8bQK08V01YgMPg==", "dev": true, "peerDependencies": { "jsdom": ">=10.0.0" } }, - "node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -1286,6 +1209,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -1326,236 +1258,127 @@ "node": ">=8.6" } }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { - "mime-db": "1.51.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=10" } }, "node_modules/mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-Kjg/XxYOFFUi0h/FwMOeb6RoroiZ+P1yOfya6NK7h3dNhahrJx1r2XIT3ge4ZQvJM86mdjNA+W5phqRQh7DwCg==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", "dev": true, "dependencies": { - "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.5.2", - "debug": "4.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.1.7", - "growl": "1.10.5", + "glob": "7.2.0", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", - "minimatch": "3.0.4", + "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.1.23", + "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", - "which": "2.0.2", - "wide-align": "1.1.3", - "workerpool": "6.1.5", + "workerpool": "6.2.1", "yargs": "16.2.0", "yargs-parser": "20.2.4", "yargs-unparser": "2.0.0" }, "bin": { "_mocha": "bin/_mocha", - "mocha": "bin/mocha" + "mocha": "bin/mocha.js" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true }, - "node_modules/mocha/node_modules/debug/node_modules/ms": { + "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/mocha/node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "node_modules/nanoid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", + "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, "engines": { - "node": ">=0.3.1" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/mocha/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/mocha/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node": ">=0.10.0" } }, "node_modules/nwsapi": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", - "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.4.tgz", + "integrity": "sha512-NHj4rzRo0tQdijE9ZqAx6kYDcoRwYwSYzCA8MY3JzfxlrvEU0jhnhJT9BhqhJs7I/dKcrDm6TyulaRqZPIhN5g==", "dev": true }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, - "node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -1587,10 +1410,16 @@ } }, "node_modules/parse5": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", - "dev": true + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } }, "node_modules/path-exists": { "version": "4.0.0", @@ -1604,7 +1433,7 @@ "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -1629,9 +1458,9 @@ } }, "node_modules/picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -1640,30 +1469,27 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", "dev": true }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -1708,12 +1534,18 @@ "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -1724,6 +1556,12 @@ "node": ">=0.10.0" } }, + "node_modules/rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", + "dev": true + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -1774,21 +1612,21 @@ "dev": true }, "node_modules/saxes": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", - "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, "dependencies": { "xmlchars": "^2.2.0" }, "engines": { - "node": ">=10" + "node": ">=v12.22.7" } }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -1818,16 +1656,6 @@ "node": ">=8" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -1866,6 +1694,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -1885,38 +1728,39 @@ } }, "node_modules/tough-cookie": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", - "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", "dev": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", - "universalify": "^0.1.2" + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { "node": ">=6" } }, "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", "dev": true, "dependencies": { - "punycode": "^2.1.1" + "punycode": "^2.3.0" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "dependencies": { - "@cspotcode/source-map-support": "0.7.0", + "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -1927,7 +1771,7 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "bin": { @@ -1953,13 +1797,13 @@ } } }, - "node_modules/ts-node/node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true, "engines": { - "node": ">=0.4.0" + "node": ">=0.3.1" } }, "node_modules/tslib": { @@ -1983,18 +1827,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -2005,52 +1837,53 @@ } }, "node_modules/typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true, "engines": { "node": ">= 4.0.0" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dev": true, "dependencies": { - "browser-process-hrtime": "^1.0.0" + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/w3c-xmlserializer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-3.0.0.tgz", - "integrity": "sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", "dev": true, "dependencies": { "xml-name-validator": "^4.0.0" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/webidl-conversions": { @@ -2084,98 +1917,22 @@ } }, "node_modules/whatwg-url": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-10.0.0.tgz", - "integrity": "sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", "dev": true, "dependencies": { - "tr46": "^3.0.0", + "tr46": "^4.1.1", "webidl-conversions": "^7.0.0" }, "engines": { - "node": ">=12" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node": ">=14" } }, "node_modules/workerpool": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", - "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", "dev": true }, "node_modules/wrap-ansi": { @@ -2198,20 +1955,20 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "dev": true, "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -2315,1627 +2072,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@cachet/carp-common": { - "version": "file:carp-common" - }, - "@cachet/carp-data-core": { - "version": "file:carp-data-core" - }, - "@cachet/carp-deployments-core": { - "version": "file:carp-deployments-core" - }, - "@cachet/carp-kotlin": { - "version": "file:carp-kotlin" - }, - "@cachet/carp-kotlinx-datetime": { - "version": "file:carp-kotlinx-datetime" - }, - "@cachet/carp-kotlinx-serialization": { - "version": "file:carp-kotlinx-serialization" - }, - "@cachet/carp-protocols-core": { - "version": "file:carp-protocols-core" - }, - "@cachet/carp-studies-core": { - "version": "file:carp-studies-core" - }, - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true - }, - "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "requires": { - "@cspotcode/source-map-consumer": "0.8.0" - } - }, - "@js-joda/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@js-joda/core/-/core-5.2.0.tgz", - "integrity": "sha512-0OriPYIaMLB3XiLQMe0BXKVIqeriTn3H7JMOzTsHEtt7Zqq+TetCu97KnAhU3ckiQZKBxfZshft+H1OC4D1lXw==" - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true - }, - "@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true - }, - "@types/chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", - "dev": true - }, - "@types/mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", - "dev": true - }, - "@types/node": { - "version": "17.0.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", - "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", - "dev": true - }, - "@typescript-eslint/types": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.17.0.tgz", - "integrity": "sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.17.0.tgz", - "integrity": "sha512-X1gtjEcmM7Je+qJRhq7ZAAaNXYhTgqMkR10euC4Si6PIjb+kwEQHSxGazXUQXFyqfEXdkGf6JijUu5R0uceQzg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.17.0", - "@typescript-eslint/visitor-keys": "5.17.0", - "debug": "^4.3.2", - "globby": "^11.0.4", - "is-glob": "^4.0.3", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.17.0.tgz", - "integrity": "sha512-6K/zlc4OfCagUu7Am/BD5k8PSWQOgh34Nrv9Rxe2tBzlJ7uOeJ/h7ugCGDCeEZHT6k2CJBhbk9IsbkPI0uvUkA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.17.0", - "eslint-visitor-keys": "^3.0.0" - } - }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "abab": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", - "dev": true - }, - "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true - }, - "acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - } - } - }, - "acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "big.js": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-6.1.1.tgz", - "integrity": "sha512-1vObw81a8ylZO5ePrtMay0n018TcftpTA5HFKDaSuiUDBo8biRBtjIobw60OpwuvrGk+FsxKamqN4cnmj/eXdg==" - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/BFd2J30EcOwmdOgXvVsmM48l0Br0nmZPlO0uOW4XKh6kpsUumRXBgPV+IlaqFaqr9cYbeoZAM1Npx0i4A+aiA==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", - "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - } - } - }, - "data-urls": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz", - "integrity": "sha512-Ds554NeT5Gennfoo9KN50Vh6tpgtvYEwraYjejXnyTpu1C7oXKxdFk75REooENHE8ndTVOJuv+BEs4/J/xcozw==", - "dev": true, - "requires": { - "abab": "^2.0.3", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^10.0.0" - } - }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "decimal.js": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", - "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==", - "dev": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "domexception": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", - "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", - "dev": true, - "requires": { - "webidl-conversions": "^7.0.0" - } - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "html-encoding-sniffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", - "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", - "dev": true, - "requires": { - "whatwg-encoding": "^2.0.0" - } - }, - "http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "requires": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - }, - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-potential-custom-element-name": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "jsdom": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-19.0.0.tgz", - "integrity": "sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==", - "dev": true, - "requires": { - "abab": "^2.0.5", - "acorn": "^8.5.0", - "acorn-globals": "^6.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.1", - "decimal.js": "^10.3.1", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "saxes": "^5.0.1", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^3.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^10.0.0", - "ws": "^8.2.3", - "xml-name-validator": "^4.0.0" - } - }, - "jsdom-global": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/jsdom-global/-/jsdom-global-3.0.2.tgz", - "integrity": "sha1-a9KZwTsMRiay2iwDk81DhdYGrLk=", - "dev": true, - "requires": {} - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "dependencies": { - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - } - } - }, - "mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", - "dev": true - }, - "mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", - "dev": true, - "requires": { - "mime-db": "1.51.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-Kjg/XxYOFFUi0h/FwMOeb6RoroiZ+P1yOfya6NK7h3dNhahrJx1r2XIT3ge4ZQvJM86mdjNA+W5phqRQh7DwCg==", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.2", - "debug": "4.3.1", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.1.7", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "3.0.4", - "ms": "2.1.3", - "nanoid": "3.1.23", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "wide-align": "1.1.3", - "workerpool": "6.1.5", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "nwsapi": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", - "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "parse5": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "saxes": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", - "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", - "dev": true, - "requires": { - "xmlchars": "^2.2.0" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "tough-cookie": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", - "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", - "dev": true, - "requires": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.1.2" - } - }, - "tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dev": true, - "requires": { - "punycode": "^2.1.1" - } - }, - "ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - }, - "dependencies": { - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - } - } - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "typescript": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", - "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, - "v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } - }, - "w3c-xmlserializer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-3.0.0.tgz", - "integrity": "sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==", - "dev": true, - "requires": { - "xml-name-validator": "^4.0.0" - } - }, - "webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "dev": true - }, - "whatwg-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", - "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", - "dev": true, - "requires": { - "iconv-lite": "0.6.3" - } - }, - "whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", - "dev": true - }, - "whatwg-url": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-10.0.0.tgz", - "integrity": "sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w==", - "dev": true, - "requires": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "workerpool": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", - "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "requires": {} - }, - "xml-name-validator": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", - "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", - "dev": true - }, - "xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } } } diff --git a/typescript-declarations/package.json b/typescript-declarations/package.json index a6dec4cd8..272e5a667 100644 --- a/typescript-declarations/package.json +++ b/typescript-declarations/package.json @@ -13,19 +13,18 @@ "carp-studies-core" ], "dependencies": { - "@js-joda/core": "5.2.0", - "big.js": "6.1.1" + "@js-joda/core": "5.5.3" }, "devDependencies": { - "@types/node": "17.0.23", - "chai": "4.3.0", - "@types/chai": "4.3.0", - "mocha": "9.1.0", - "@types/mocha": "9.1.0", - "@typescript-eslint/typescript-estree": "5.17.0", - "jsdom": "19.0.0", + "@types/node": "20.1.0", + "chai": "4.3.7", + "@types/chai": "4.3.5", + "mocha": "10.2.0", + "@types/mocha": "10.0.1", + "@typescript-eslint/typescript-estree": "5.59.2", + "jsdom": "22.0.0", "jsdom-global": "3.0.2", - "ts-node": "10.7.0", - "typescript": "4.6.3" + "ts-node": "10.9.1", + "typescript": "5.0.4" } }