aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-base/build.gradle7
-rw-r--r--kvision-modules/kvision-bootstrap-css/build.gradle9
-rw-r--r--kvision-modules/kvision-bootstrap-css/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-bootstrap-css/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-css/webpack.config.d/bootstrap.js1
-rw-r--r--kvision-modules/kvision-bootstrap-css/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-css/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/build.gradle9
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-dialog/build.gradle6
-rw-r--r--kvision-modules/kvision-bootstrap-dialog/build.gradle.kts44
-rw-r--r--kvision-modules/kvision-bootstrap-dialog/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-dialog/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-dialog/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/build.gradle6
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/build.gradle.kts74
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt4
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-select/build.gradle10
-rw-r--r--kvision-modules/kvision-bootstrap-select/build.gradle.kts68
-rw-r--r--kvision-modules/kvision-bootstrap-select/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-select/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-select/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/build.gradle9
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle6
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle.kts42
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt6
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/build.gradle9
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-bootstrap-upload/build.gradle13
-rw-r--r--kvision-modules/kvision-bootstrap-upload/build.gradle.kts71
-rw-r--r--kvision-modules/kvision-bootstrap-upload/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap-upload/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-bootstrap-upload/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-bootstrap/build.gradle12
-rw-r--r--kvision-modules/kvision-bootstrap/build.gradle.kts49
-rw-r--r--kvision-modules/kvision-bootstrap/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt1
-rw-r--r--kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js1
-rw-r--r--kvision-modules/kvision-bootstrap/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-bootstrap/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-chart/build.gradle9
-rw-r--r--kvision-modules/kvision-chart/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-chart/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-chart/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-chart/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-common-annotations/build.gradle7
-rw-r--r--kvision-modules/kvision-common-annotations/build.gradle.kts49
-rw-r--r--kvision-modules/kvision-common-annotations/src/commonMain/kotlin/pl/treksoft/kvision/annotations/Annotations.kt (renamed from kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/build.gradle10
-rw-r--r--kvision-modules/kvision-common-remote/build.gradle.kts57
-rw-r--r--kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt (renamed from kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceMgr.kt (renamed from kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt)27
-rw-r--r--kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt (renamed from kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt)8
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/CallAgent.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt)2
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt)25
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt)72
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Security.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Socket.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Socket.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Utils.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt)2
-rw-r--r--kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt)22
-rw-r--r--kvision-modules/kvision-common-types/build.gradle7
-rw-r--r--kvision-modules/kvision-common-types/build.gradle.kts52
-rw-r--r--kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Decimal.kt (renamed from kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/KFile.kt (renamed from kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt)31
-rw-r--r--kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Decimal.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Decimal.kt (renamed from kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt)0
-rw-r--r--kvision-modules/kvision-cordova/build.gradle5
-rw-r--r--kvision-modules/kvision-cordova/build.gradle.kts43
-rw-r--r--kvision-modules/kvision-cordova/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-cordova/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-datacontainer/build.gradle1
-rw-r--r--kvision-modules/kvision-datacontainer/build.gradle.kts39
-rw-r--r--kvision-modules/kvision-datacontainer/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-datacontainer/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-datacontainer/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-electron/build.gradle33
-rw-r--r--kvision-modules/kvision-electron/build.gradle.kts43
-rw-r--r--kvision-modules/kvision-electron/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-electron/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-electron/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-event-flow/build.gradle5
-rw-r--r--kvision-modules/kvision-event-flow/build.gradle.kts43
-rw-r--r--kvision-modules/kvision-event-flow/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt8
-rw-r--r--kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-event-flow/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-fontawesome/build.gradle9
-rw-r--r--kvision-modules/kvision-fontawesome/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-fontawesome/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-fontawesome/webpack.config.d/bootstrap.js1
-rw-r--r--kvision-modules/kvision-fontawesome/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-fontawesome/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-handlebars/build.gradle10
-rw-r--r--kvision-modules/kvision-handlebars/build.gradle.kts47
-rw-r--r--kvision-modules/kvision-handlebars/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-handlebars/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-handlebars/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-handlebars/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-i18n/build.gradle9
-rw-r--r--kvision-modules/kvision-i18n/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-i18n/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-i18n/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-i18n/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-maps/build.gradle9
-rw-r--r--kvision-modules/kvision-maps/build.gradle.kts49
-rw-r--r--kvision-modules/kvision-maps/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-maps/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-maps/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-moment/build.gradle9
-rw-r--r--kvision-modules/kvision-moment/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-moment/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-moment/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-moment/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-moment/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-pace/build.gradle9
-rw-r--r--kvision-modules/kvision-pace/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-pace/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-pace/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-pace/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-redux-kotlin/build.gradle6
-rw-r--r--kvision-modules/kvision-redux-kotlin/build.gradle.kts45
-rw-r--r--kvision-modules/kvision-redux-kotlin/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-redux-kotlin/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-redux-kotlin/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-redux/build.gradle16
-rw-r--r--kvision-modules/kvision-redux/build.gradle.kts52
-rw-r--r--kvision-modules/kvision-redux/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt7
-rw-r--r--kvision-modules/kvision-redux/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-redux/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-remote/build.gradle38
-rw-r--r--kvision-modules/kvision-richtext/build.gradle9
-rw-r--r--kvision-modules/kvision-richtext/build.gradle.kts67
-rw-r--r--kvision-modules/kvision-richtext/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-richtext/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-richtext/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-richtext/webpack.config.d/jquery.js14
-rw-r--r--kvision-modules/kvision-server-javalin/build.gradle30
-rw-r--r--kvision-modules/kvision-server-javalin/build.gradle.kts69
-rw-r--r--kvision-modules/kvision-server-javalin/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)9
-rw-r--r--kvision-modules/kvision-server-javalin/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)4
-rw-r--r--kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt (renamed from kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt)0
-rw-r--r--kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)2
-rw-r--r--kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt (renamed from kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt)0
-rw-r--r--kvision-modules/kvision-server-jooby/build.gradle37
-rw-r--r--kvision-modules/kvision-server-jooby/build.gradle.kts68
-rw-r--r--kvision-modules/kvision-server-jooby/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt122
-rw-r--r--kvision-modules/kvision-server-jooby/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt160
-rw-r--r--kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt (renamed from kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt)0
-rw-r--r--kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)2
-rw-r--r--kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt (renamed from kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt)0
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt200
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt47
-rw-r--r--kvision-modules/kvision-server-ktor/build.gradle29
-rw-r--r--kvision-modules/kvision-server-ktor/build.gradle.kts70
-rw-r--r--kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt122
-rw-r--r--kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt160
-rw-r--r--kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt (renamed from kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt)0
-rw-r--r--kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)2
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt200
-rw-r--r--kvision-modules/kvision-server-spring-boot/build.gradle40
-rw-r--r--kvision-modules/kvision-server-spring-boot/build.gradle.kts72
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt (renamed from kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt)4
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt122
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt160
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt)0
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt)0
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt)2
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt)4
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Security.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt)0
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt (renamed from kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt)0
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/jvmMain/resources/META-INF/spring.factories (renamed from kvision-modules/kvision-server-spring-boot/src/main/resources/META-INF/spring.factories)0
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt200
-rw-r--r--kvision-modules/kvision-tabulator-remote/build.gradle6
-rw-r--r--kvision-modules/kvision-tabulator-remote/build.gradle.kts42
-rw-r--r--kvision-modules/kvision-tabulator-remote/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt5
-rw-r--r--kvision-modules/kvision-tabulator-remote/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-tabulator-remote/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-tabulator/build.gradle9
-rw-r--r--kvision-modules/kvision-tabulator/build.gradle.kts46
-rw-r--r--kvision-modules/kvision-tabulator/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-tabulator/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-tabulator/webpack.config.d/file.js9
-rw-r--r--kvision-modules/kvision-testutils/build.gradle61
-rw-r--r--kvision-modules/kvision-testutils/build.gradle.kts48
-rw-r--r--kvision-modules/kvision-testutils/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-testutils/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-testutils/webpack.config.d/file.js9
-rw-r--r--kvision-modules/shared.gradle77
213 files changed, 3114 insertions, 1487 deletions
diff --git a/kvision-modules/kvision-base/build.gradle b/kvision-modules/kvision-base/build.gradle
deleted file mode 100644
index 51970a40..00000000
--- a/kvision-modules/kvision-base/build.gradle
+++ /dev/null
@@ -1,7 +0,0 @@
-apply plugin: 'kotlin-platform-js'
-
-dependencies {
- compile rootProject
- compile project(path: ":", configuration: "tests")
- testCompile rootProject
-}
diff --git a/kvision-modules/kvision-bootstrap-css/build.gradle b/kvision-modules/kvision-bootstrap-css/build.gradle
deleted file mode 100644
index d18cfc13..00000000
--- a/kvision-modules/kvision-bootstrap-css/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("bootstrap", "4.4.1")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-css/build.gradle.kts b/kvision-modules/kvision-bootstrap-css/build.gradle.kts
new file mode 100644
index 00000000..d9df96e0
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-css/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("bootstrap", "4.4.1"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-css/package.json.d/project.info b/kvision-modules/kvision-bootstrap-css/package.json.d/project.info
deleted file mode 100644
index b990974a..00000000
--- a/kvision-modules/kvision-bootstrap-css/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Bootstrap CSS module"
-}
diff --git a/kvision-modules/kvision-bootstrap-css/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-css/webpack.config.d/bootstrap.js
index 32a7c4d0..35b28e6a 100644
--- a/kvision-modules/kvision-bootstrap-css/webpack.config.d/bootstrap.js
+++ b/kvision-modules/kvision-bootstrap-css/webpack.config.d/bootstrap.js
@@ -1,4 +1,3 @@
config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
-config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'});
diff --git a/kvision-modules/kvision-bootstrap-css/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-css/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-css/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-css/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-css/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap-css/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap-css/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-bootstrap-datetime/build.gradle b/kvision-modules/kvision-bootstrap-datetime/build.gradle
deleted file mode 100644
index 54902008..00000000
--- a/kvision-modules/kvision-bootstrap-datetime/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("pc-bootstrap4-datetimepicker", "4.17.50")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-datetime/build.gradle.kts b/kvision-modules/kvision-bootstrap-datetime/build.gradle.kts
new file mode 100644
index 00000000..f2340ad9
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-datetime/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("pc-bootstrap4-datetimepicker", "4.17.50"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-datetime/package.json.d/project.info b/kvision-modules/kvision-bootstrap-datetime/package.json.d/project.info
deleted file mode 100644
index 3d332806..00000000
--- a/kvision-modules/kvision-bootstrap-datetime/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Datetime module"
-}
diff --git a/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-datetime/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-dialog/build.gradle b/kvision-modules/kvision-bootstrap-dialog/build.gradle
deleted file mode 100644
index 652d14d6..00000000
--- a/kvision-modules/kvision-bootstrap-dialog/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile project(":kvision-modules:kvision-bootstrap")
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
-}
diff --git a/kvision-modules/kvision-bootstrap-dialog/build.gradle.kts b/kvision-modules/kvision-bootstrap-dialog/build.gradle.kts
new file mode 100644
index 00000000..1065b02a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-dialog/build.gradle.kts
@@ -0,0 +1,44 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api(project(":kvision-modules:kvision-bootstrap"))
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-bootstrap-dialog/package.json.d/project.info b/kvision-modules/kvision-bootstrap-dialog/package.json.d/project.info
deleted file mode 100644
index 416cd4a7..00000000
--- a/kvision-modules/kvision-bootstrap-dialog/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Dialog module"
-}
diff --git a/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-select-remote/build.gradle b/kvision-modules/kvision-bootstrap-select-remote/build.gradle
deleted file mode 100644
index 7a4dc8fa..00000000
--- a/kvision-modules/kvision-bootstrap-select-remote/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile project(":kvision-modules:kvision-bootstrap-select")
- compile project(":kvision-modules:kvision-remote")
-}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/build.gradle.kts b/kvision-modules/kvision-bootstrap-select-remote/build.gradle.kts
new file mode 100644
index 00000000..e7b28ac8
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select-remote/build.gradle.kts
@@ -0,0 +1,74 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api(project(":kvision-modules:kvision-bootstrap-select"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ compileOnly(project(":kvision-modules:kvision-server-javalin"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+fun copyResources() {
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin")
+ }
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin-dce")
+ }
+ copy {
+ from("${rootProject.projectDir}/kvision-modules/kvision-bootstrap-select/src/main/resources")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin")
+ }
+ copy {
+ from("${rootProject.projectDir}/kvision-modules/kvision-bootstrap-select/src/main/resources")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin-dce")
+ }
+}
+
+tasks {
+ getByName("compileTestKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+ getByName("processDceKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/package.json.d/project.info b/kvision-modules/kvision-bootstrap-select-remote/package.json.d/project.info
deleted file mode 100644
index 5685d581..00000000
--- a/kvision-modules/kvision-bootstrap-select-remote/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Select remote addon module"
-}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
index 6092fd93..e7fd384c 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
@@ -25,7 +25,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.await
import kotlinx.coroutines.launch
import kotlinx.serialization.ImplicitReflectionSerializer
-import kotlinx.serialization.list
+import kotlinx.serialization.builtins.list
import kotlinx.serialization.stringify
import org.w3c.dom.get
import pl.treksoft.kvision.core.Container
@@ -53,7 +53,7 @@ external fun decodeURIComponent(encodedURI: String): String
* @param preload preload all options from remote data source
* @param classes a set of CSS class names
*/
-@UseExperimental(ImplicitReflectionSerializer::class)
+@OptIn(ImplicitReflectionSerializer::class)
open class SelectRemoteInput<T : Any>(
serviceManager: KVServiceManager<T>,
function: suspend T.(String?, String?, String?) -> List<RemoteOption>,
diff --git a/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-select/build.gradle b/kvision-modules/kvision-bootstrap-select/build.gradle
deleted file mode 100644
index 01ec3ad0..00000000
--- a/kvision-modules/kvision-bootstrap-select/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("bootstrap-select", "1.13.12")
- dependency("ajax-bootstrap-select", "1.4.5")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-select/build.gradle.kts b/kvision-modules/kvision-bootstrap-select/build.gradle.kts
new file mode 100644
index 00000000..1db76c5d
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select/build.gradle.kts
@@ -0,0 +1,68 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("bootstrap-select", "1.13.12"))
+ implementation(npm("ajax-bootstrap-select", "1.4.5"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+fun copyResources() {
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin")
+ }
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin-dce")
+ }
+}
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+ getByName("compileTestKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+ getByName("processDceKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-select/package.json.d/project.info b/kvision-modules/kvision-bootstrap-select/package.json.d/project.info
deleted file mode 100644
index 80e675b0..00000000
--- a/kvision-modules/kvision-bootstrap-select/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Select module"
-}
diff --git a/kvision-modules/kvision-bootstrap-select/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-select/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-select/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-select/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-select/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-bootstrap-spinner/build.gradle b/kvision-modules/kvision-bootstrap-spinner/build.gradle
deleted file mode 100644
index 0c3a2940..00000000
--- a/kvision-modules/kvision-bootstrap-spinner/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("bootstrap-touchspin", "4.2.5")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-spinner/build.gradle.kts b/kvision-modules/kvision-bootstrap-spinner/build.gradle.kts
new file mode 100644
index 00000000..19453b54
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-spinner/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("bootstrap-touchspin", "4.2.5"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-spinner/package.json.d/project.info b/kvision-modules/kvision-bootstrap-spinner/package.json.d/project.info
deleted file mode 100644
index fb0c7956..00000000
--- a/kvision-modules/kvision-bootstrap-spinner/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Spinner module"
-}
diff --git a/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap-spinner/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle b/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle
deleted file mode 100644
index cab403d5..00000000
--- a/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile project(":kvision-modules:kvision-bootstrap-typeahead")
- compile project(":kvision-modules:kvision-remote")
-}
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle.kts b/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle.kts
new file mode 100644
index 00000000..a94b0ce9
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead-remote/build.gradle.kts
@@ -0,0 +1,42 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api(project(":kvision-modules:kvision-bootstrap-typeahead"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ compileOnly(project(":kvision-modules:kvision-server-javalin"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/package.json.d/project.info b/kvision-modules/kvision-bootstrap-typeahead-remote/package.json.d/project.info
deleted file mode 100644
index 15dc8333..00000000
--- a/kvision-modules/kvision-bootstrap-typeahead-remote/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Typeahead remote addon module"
-}
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt b/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
index e56468d1..42412ae4 100644
--- a/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
+++ b/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
@@ -22,8 +22,8 @@
package pl.treksoft.kvision.form.text
import kotlinx.serialization.ImplicitReflectionSerializer
-import kotlinx.serialization.list
-import kotlinx.serialization.serializer
+import kotlinx.serialization.builtins.list
+import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.stringify
import org.w3c.dom.get
import pl.treksoft.kvision.core.Container
@@ -46,7 +46,7 @@ import kotlin.browser.window
* @param value text input value
* @param classes a set of CSS class names
*/
-@UseExperimental(ImplicitReflectionSerializer::class)
+@OptIn(ImplicitReflectionSerializer::class)
open class TypeaheadRemoteInput<T : Any>(
serviceManager: KVServiceManager<T>,
function: suspend T.(String?, String?) -> List<String>,
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead-remote/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-typeahead/build.gradle b/kvision-modules/kvision-bootstrap-typeahead/build.gradle
deleted file mode 100644
index e9162b54..00000000
--- a/kvision-modules/kvision-bootstrap-typeahead/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("eam_bootstrap-3-typeahead", "0.0.2")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-typeahead/build.gradle.kts b/kvision-modules/kvision-bootstrap-typeahead/build.gradle.kts
new file mode 100644
index 00000000..a5fbfaf9
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("eam_bootstrap-3-typeahead", "0.0.2"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-typeahead/package.json.d/project.info b/kvision-modules/kvision-bootstrap-typeahead/package.json.d/project.info
deleted file mode 100644
index a212d31d..00000000
--- a/kvision-modules/kvision-bootstrap-typeahead/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Typeahead module"
-}
diff --git a/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap-typeahead/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-bootstrap-upload/build.gradle b/kvision-modules/kvision-bootstrap-upload/build.gradle
deleted file mode 100644
index 208e1e21..00000000
--- a/kvision-modules/kvision-bootstrap-upload/build.gradle
+++ /dev/null
@@ -1,13 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
-}
-
-kotlinFrontend {
-
- npm {
- dependency("bootstrap-fileinput", "5.0.8")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap-upload/build.gradle.kts b/kvision-modules/kvision-bootstrap-upload/build.gradle.kts
new file mode 100644
index 00000000..4fcaa183
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-upload/build.gradle.kts
@@ -0,0 +1,71 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(project(":kvision-modules:kvision-common-types"))
+ api(rootProject)
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ implementation(npm("bootstrap-fileinput", "5.0.8"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+fun copyResources() {
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin")
+ }
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin-dce")
+ }
+}
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+ getByName("compileTestKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+ getByName("processDceKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap-upload/package.json.d/project.info b/kvision-modules/kvision-bootstrap-upload/package.json.d/project.info
deleted file mode 100644
index d789d81b..00000000
--- a/kvision-modules/kvision-bootstrap-upload/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Upload module"
-}
diff --git a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/file.js
index a5c7b5da..653ca21f 100644
--- a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/file.js
+++ b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/file.js
@@ -1,6 +1,9 @@
config.module.rules.push(
{
- test: /\.(jpe?g|png|gif)$/i,
- loader: 'file-loader'
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
}
-); \ No newline at end of file
+);
diff --git a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-bootstrap/build.gradle b/kvision-modules/kvision-bootstrap/build.gradle
deleted file mode 100644
index 3d964668..00000000
--- a/kvision-modules/kvision-bootstrap/build.gradle
+++ /dev/null
@@ -1,12 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("popper.js", "1.16.1")
- dependency("bootstrap", "4.4.1")
- dependency("awesome-bootstrap-checkbox", "1.0.1")
- dependency("element-resize-event", "3.0.3")
- }
-
-}
diff --git a/kvision-modules/kvision-bootstrap/build.gradle.kts b/kvision-modules/kvision-bootstrap/build.gradle.kts
new file mode 100644
index 00000000..bed8be05
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap/build.gradle.kts
@@ -0,0 +1,49 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("popper.js", "1.16.1"))
+ implementation(npm("bootstrap", "4.4.1"))
+ implementation(npm("awesome-bootstrap-checkbox", "1.0.1"))
+ implementation(npm("element-resize-event", "3.0.3"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-bootstrap/package.json.d/project.info b/kvision-modules/kvision-bootstrap/package.json.d/project.info
deleted file mode 100644
index e77a0f47..00000000
--- a/kvision-modules/kvision-bootstrap/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Bootstrap module"
-}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
index 44c0a243..36967e2b 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
@@ -216,6 +216,7 @@ open class TabPanel(
}
content.remove(content.getChildren()[index])
activeIndex = content.activeIndex
+ @Suppress("UnsafeCastFromDynamic")
this@TabPanel.dispatchEvent("tabChange", obj { detail = obj { data = activeIndex } })
return this
}
diff --git a/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js b/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js
index 32a7c4d0..35b28e6a 100644
--- a/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js
+++ b/kvision-modules/kvision-bootstrap/webpack.config.d/bootstrap.js
@@ -1,4 +1,3 @@
config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
-config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'});
diff --git a/kvision-modules/kvision-bootstrap/webpack.config.d/file.js b/kvision-modules/kvision-bootstrap/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-bootstrap/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-bootstrap/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-bootstrap/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-bootstrap/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-chart/build.gradle b/kvision-modules/kvision-chart/build.gradle
deleted file mode 100644
index cc5d9506..00000000
--- a/kvision-modules/kvision-chart/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("chart.js", "2.9.3")
- }
-
-}
diff --git a/kvision-modules/kvision-chart/build.gradle.kts b/kvision-modules/kvision-chart/build.gradle.kts
new file mode 100644
index 00000000..78c4ef43
--- /dev/null
+++ b/kvision-modules/kvision-chart/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("chart.js", "2.9.3"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-chart/package.json.d/project.info b/kvision-modules/kvision-chart/package.json.d/project.info
deleted file mode 100644
index 4b4a6303..00000000
--- a/kvision-modules/kvision-chart/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Chart module"
-}
diff --git a/kvision-modules/kvision-chart/webpack.config.d/bootstrap.js b/kvision-modules/kvision-chart/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-chart/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-chart/webpack.config.d/file.js b/kvision-modules/kvision-chart/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-chart/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-common-annotations/build.gradle b/kvision-modules/kvision-common-annotations/build.gradle
deleted file mode 100644
index f62cd411..00000000
--- a/kvision-modules/kvision-common-annotations/build.gradle
+++ /dev/null
@@ -1,7 +0,0 @@
-apply plugin: 'kotlin-platform-common'
-apply plugin: 'kotlinx-serialization'
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion"
-}
diff --git a/kvision-modules/kvision-common-annotations/build.gradle.kts b/kvision-modules/kvision-common-annotations/build.gradle.kts
new file mode 100644
index 00000000..9ada6145
--- /dev/null
+++ b/kvision-modules/kvision-common-annotations/build.gradle.kts
@@ -0,0 +1,49 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val serializationVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-common-annotations"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt b/kvision-modules/kvision-common-annotations/src/commonMain/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
index 22cf570b..22cf570b 100644
--- a/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
+++ b/kvision-modules/kvision-common-annotations/src/commonMain/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
diff --git a/kvision-modules/kvision-common-remote/build.gradle b/kvision-modules/kvision-common-remote/build.gradle
deleted file mode 100644
index af3703e6..00000000
--- a/kvision-modules/kvision-common-remote/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'kotlin-platform-common'
-apply plugin: 'kotlinx-serialization'
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion"
- testCompile "org.jetbrains.kotlin:kotlin-test-common:$kotlinVersion"
- testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlinVersion"
-}
diff --git a/kvision-modules/kvision-common-remote/build.gradle.kts b/kvision-modules/kvision-common-remote/build.gradle.kts
new file mode 100644
index 00000000..a7daa88e
--- /dev/null
+++ b/kvision-modules/kvision-common-remote/build.gradle.kts
@@ -0,0 +1,57 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val serializationVersion: String by project
+val coroutinesVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+val jqueryKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ implementation("pl.treksoft:jquery-kotlin:$jqueryKotlinVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-common-remote"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
index d82189a0..d82189a0 100644
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
+++ b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceMgr.kt
index 1d37ae51..2d68f1d0 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceMgr.kt
@@ -19,29 +19,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package pl.treksoft.kvision.types
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.math.BigDecimal
+package pl.treksoft.kvision.remote
-actual typealias Decimal = BigDecimal
-
-class BigDecimalSerializer : JsonSerializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun serialize(value: BigDecimal, gen: JsonGenerator, provider: SerializerProvider) {
- gen.writeNumber(value.toDouble())
- }
-}
-
-class BigDecimalDeserializer : JsonDeserializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): BigDecimal? {
- return p.doubleValue.toBigDecimal()
- }
+@Suppress("unused")
+interface KVServiceMgr<T : Any> {
+ fun getCalls(): Map<String, Pair<String, HttpMethod>>
}
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt
index 62b2354b..d96aa30c 100644
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt
+++ b/kvision-modules/kvision-common-remote/src/commonMain/kotlin/pl/treksoft/kvision/remote/RemoteTypes.kt
@@ -23,6 +23,14 @@ package pl.treksoft.kvision.remote
import kotlinx.serialization.Serializable
+enum class HttpMethod {
+ GET,
+ POST,
+ PUT,
+ DELETE,
+ OPTIONS
+}
+
class ServiceException(message: String) : Exception(message)
@Serializable
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 9110d4df..6c1e629c 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -52,7 +52,7 @@ open class CallAgent {
* @param method a HTTP method
* @return a promise of the result
*/
- @UseExperimental(ImplicitReflectionSerializer::class)
+ @OptIn(ImplicitReflectionSerializer::class)
@Suppress("UnsafeCastFromDynamic", "ComplexMethod")
fun jsonRpcCall(
url: String,
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt
index 86d90e4c..62657b3d 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt
@@ -30,7 +30,7 @@ import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.serialization.ImplicitReflectionSerializer
-import kotlinx.serialization.list
+import kotlinx.serialization.builtins.list
import kotlinx.serialization.serializer
import kotlinx.serialization.stringify
import kotlin.reflect.KClass
@@ -39,8 +39,11 @@ import kotlin.reflect.KClass
* Client side agent for JSON-RPC remote calls.
*/
@Suppress("LargeClass", "TooManyFunctions")
-@UseExperimental(ImplicitReflectionSerializer::class, ExperimentalCoroutinesApi::class)
-open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : RemoteAgent {
+@OptIn(
+ ImplicitReflectionSerializer::class, ExperimentalCoroutinesApi::class
+)
+open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceMgr<T>) :
+ RemoteAgent {
val callAgent = CallAgent()
@@ -394,7 +397,13 @@ open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : Rem
val requestJob = launch {
for (par1 in requestChannel) {
val param = serialize(par1)
- val str = JSON.plain.stringify(JsonRpcRequest(0, url, listOf(param)))
+ val str = JSON.plain.stringify(
+ JsonRpcRequest(
+ 0,
+ url,
+ listOf(param)
+ )
+ )
if (!socket.sendOrFalse(str)) break
}
responseJob.cancel()
@@ -464,7 +473,13 @@ open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : Rem
val requestJob = launch {
for (par1 in requestChannel) {
val param = serialize(par1)
- val str = JSON.plain.stringify(JsonRpcRequest(0, url, listOf(param)))
+ val str = JSON.plain.stringify(
+ JsonRpcRequest(
+ 0,
+ url,
+ listOf(param)
+ )
+ )
if (!socket.sendOrFalse(str)) break
}
responseJob.cancel()
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
index 1fb90507..fba6356c 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
@@ -23,25 +23,17 @@ package pl.treksoft.kvision.remote
import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.KSerializer
-import kotlinx.serialization.internal.BooleanSerializer
-import kotlinx.serialization.internal.ByteSerializer
-import kotlinx.serialization.internal.CharSerializer
-import kotlinx.serialization.internal.DoubleSerializer
-import kotlinx.serialization.internal.FloatSerializer
-import kotlinx.serialization.internal.IntSerializer
-import kotlinx.serialization.internal.LongSerializer
-import kotlinx.serialization.internal.ShortSerializer
-import kotlinx.serialization.internal.StringSerializer
-import kotlinx.serialization.list
+import kotlinx.serialization.builtins.list
+import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.serializer
import pl.treksoft.kvision.types.JsonDateSerializer
import pl.treksoft.kvision.types.toStringInternal
import kotlin.js.Date
import kotlin.reflect.KClass
-internal class NotStandardTypeException(type: String) : Exception("Not a standard type: $type!")
+class NotStandardTypeException(type: String) : Exception("Not a standard type: $type!")
-internal class NotEnumTypeException : Exception("Not the Enum type!")
+class NotEnumTypeException : Exception("Not the Enum type!")
/**
* Interface for client side agent for JSON-RPC remote calls.
@@ -52,7 +44,7 @@ interface RemoteAgent {
* @suppress
* Internal function
*/
- @UseExperimental(ImplicitReflectionSerializer::class)
+ @OptIn(ImplicitReflectionSerializer::class)
@Suppress("ComplexMethod", "TooGenericExceptionCaught", "NestedBlockDepth")
fun trySerialize(kClass: KClass<Any>, value: Any): String {
return if (value is List<*>) {
@@ -60,34 +52,34 @@ interface RemoteAgent {
when {
value[0] is String ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(StringSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(String.serializer().list as KSerializer<Any>, value)
value[0] is Date ->
@Suppress("UNCHECKED_CAST")
JSON.plain.stringify(JsonDateSerializer.list as KSerializer<Any>, value)
value[0] is Int ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(IntSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Int.serializer().list as KSerializer<Any>, value)
value[0] is Long ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(LongSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Long.serializer().list as KSerializer<Any>, value)
value[0] is Boolean ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(BooleanSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Boolean.serializer().list as KSerializer<Any>, value)
value[0] is Float ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(FloatSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Float.serializer().list as KSerializer<Any>, value)
value[0] is Double ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(DoubleSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Double.serializer().list as KSerializer<Any>, value)
value[0] is Char ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(CharSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Char.serializer().list as KSerializer<Any>, value)
value[0] is Short ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(ShortSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Short.serializer().list as KSerializer<Any>, value)
value[0] is Byte ->
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(ByteSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(Byte.serializer().list as KSerializer<Any>, value)
value[0] is Enum<*> -> "[" + value.joinToString(",") { "\"$it\"" } + "]"
else -> try {
@Suppress("UNCHECKED_CAST")
@@ -99,7 +91,7 @@ interface RemoteAgent {
} catch (e: Throwable) {
try {
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(StringSerializer.list as KSerializer<Any>, value)
+ JSON.plain.stringify(String.serializer().list as KSerializer<Any>, value)
} catch (e: Throwable) {
value.toString()
}
@@ -132,14 +124,14 @@ interface RemoteAgent {
@Suppress("UNCHECKED_CAST", "ComplexMethod")
fun <RET> deserialize(value: String, jsType: String): RET {
return when (jsType) {
- "String" -> JSON.plain.parse(StringSerializer, value) as RET
- "Number" -> JSON.plain.parse(DoubleSerializer, value) as RET
- "Long" -> JSON.plain.parse(LongSerializer, value) as RET
- "Boolean" -> JSON.plain.parse(BooleanSerializer, value) as RET
- "BoxedChar" -> JSON.plain.parse(CharSerializer, value) as RET
- "Short" -> JSON.plain.parse(ShortSerializer, value) as RET
+ "String" -> JSON.plain.parse(String.serializer(), value) as RET
+ "Number" -> JSON.plain.parse(Double.serializer(), value) as RET
+ "Long" -> JSON.plain.parse(Long.serializer(), value) as RET
+ "Boolean" -> JSON.plain.parse(Boolean.serializer(), value) as RET
+ "BoxedChar" -> JSON.plain.parse(Char.serializer(), value) as RET
+ "Short" -> JSON.plain.parse(Short.serializer(), value) as RET
"Date" -> JSON.plain.parse(JsonDateSerializer, value) as RET
- "Byte" -> JSON.plain.parse(ByteSerializer, value) as RET
+ "Byte" -> JSON.plain.parse(Byte.serializer(), value) as RET
else -> throw NotStandardTypeException(jsType)
}
}
@@ -151,14 +143,14 @@ interface RemoteAgent {
@Suppress("UNCHECKED_CAST", "ComplexMethod")
fun <RET> deserializeList(value: String, jsType: String): List<RET> {
return when (jsType) {
- "String" -> JSON.plain.parse(StringSerializer.list, value) as List<RET>
- "Number" -> JSON.plain.parse(DoubleSerializer.list, value) as List<RET>
- "Long" -> JSON.plain.parse(LongSerializer.list, value) as List<RET>
- "Boolean" -> JSON.plain.parse(BooleanSerializer.list, value) as List<RET>
- "BoxedChar" -> JSON.plain.parse(CharSerializer.list, value) as List<RET>
- "Short" -> JSON.plain.parse(ShortSerializer.list, value) as List<RET>
+ "String" -> JSON.plain.parse(String.serializer().list, value) as List<RET>
+ "Number" -> JSON.plain.parse(Double.serializer().list, value) as List<RET>
+ "Long" -> JSON.plain.parse(Long.serializer().list, value) as List<RET>
+ "Boolean" -> JSON.plain.parse(Boolean.serializer().list, value) as List<RET>
+ "BoxedChar" -> JSON.plain.parse(Char.serializer().list, value) as List<RET>
+ "Short" -> JSON.plain.parse(Short.serializer().list, value) as List<RET>
"Date" -> JSON.plain.parse(JsonDateSerializer.list, value) as List<RET>
- "Byte" -> JSON.plain.parse(ByteSerializer.list, value) as List<RET>
+ "Byte" -> JSON.plain.parse(Byte.serializer().list, value) as List<RET>
else -> throw NotStandardTypeException(jsType)
}
}
@@ -171,7 +163,7 @@ interface RemoteAgent {
fun tryDeserializeEnum(kClass: KClass<Any>, value: String): Any {
return try {
if (kClass.asDynamic().jClass.`$metadata$`.interfaces[0].name == "Enum") {
- findEnumValue(kClass, JSON.plain.parse(StringSerializer, value)) ?: throw NotEnumTypeException()
+ findEnumValue(kClass, JSON.plain.parse(String.serializer(), value)) ?: throw NotEnumTypeException()
} else {
throw NotEnumTypeException()
}
@@ -188,8 +180,8 @@ interface RemoteAgent {
fun tryDeserializeEnumList(kClass: KClass<Any>, value: String): List<Any> {
return try {
if (kClass.asDynamic().jClass.`$metadata$`.interfaces[0].name == "Enum") {
- JSON.plain.parse(StringSerializer.list, value).map {
- findEnumValue(kClass, JSON.plain.parse(StringSerializer, it)) ?: throw NotEnumTypeException()
+ JSON.plain.parse(String.serializer().list, value).map {
+ findEnumValue(kClass, JSON.plain.parse(String.serializer(), it)) ?: throw NotEnumTypeException()
}
} else {
throw NotEnumTypeException()
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Security.kt
index fd2b5cb0..fd2b5cb0 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Security.kt
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Socket.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Socket.kt
index f668d57a..f668d57a 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Socket.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Socket.kt
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Utils.kt
index 465fbf59..98fbaea8 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/remote/Utils.kt
@@ -49,7 +49,7 @@ object JSON {
val plain = Json(context = serializersModuleOf(Date::class, JsonDateSerializer))
val nonstrict = Json(
- configuration = JsonConfiguration.Stable.copy(strictMode = false),
+ configuration = JsonConfiguration.Stable.copy(ignoreUnknownKeys = true),
context = serializersModuleOf(Date::class, JsonDateSerializer)
)
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt
index 78370a70..715eab6c 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-common-remote/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -25,32 +25,22 @@ import kotlinx.serialization.Decoder
import kotlinx.serialization.Encoder
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialDescriptor
-import kotlinx.serialization.internal.SerialClassDescImpl
import kotlin.js.Date
import kotlin.math.absoluteValue
-actual typealias LocalDateTime = Date
-
-actual typealias LocalDate = Date
-
-actual typealias LocalTime = Date
-
-actual typealias OffsetDateTime = Date
-
-actual typealias OffsetTime = Date
/**
* JSON date serializer.
*/
internal object JsonDateSerializer : KSerializer<Date> {
- override val descriptor: SerialDescriptor = SerialClassDescImpl("kotlin.js.Date")
+ override val descriptor: SerialDescriptor = SerialDescriptor("kotlin.js.Date")
override fun deserialize(decoder: Decoder): Date {
return decoder.decodeString().toDateInternal()
}
- override fun serialize(encoder: Encoder, obj: Date) {
- encoder.encodeString(obj.toStringInternal())
+ override fun serialize(encoder: Encoder, value: Date) {
+ encoder.encodeString(value.toStringInternal())
}
}
@@ -77,7 +67,11 @@ internal fun String.toDateInternal(): Date {
dt[0].toInt(),
dt[1].toInt() - 1,
dt[2].toInt(),
- if (utcCheck) { dt[3].toInt() } else { dt[3].toInt() - sign * dt[6].toInt() },
+ if (utcCheck) {
+ dt[3].toInt()
+ } else {
+ dt[3].toInt() - sign * dt[6].toInt()
+ },
dt[4].toInt(),
ds[0].toInt(),
if (ds.size == 2) ds[1].toInt() else 0
diff --git a/kvision-modules/kvision-common-types/build.gradle b/kvision-modules/kvision-common-types/build.gradle
deleted file mode 100644
index f62cd411..00000000
--- a/kvision-modules/kvision-common-types/build.gradle
+++ /dev/null
@@ -1,7 +0,0 @@
-apply plugin: 'kotlin-platform-common'
-apply plugin: 'kotlinx-serialization'
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion"
-}
diff --git a/kvision-modules/kvision-common-types/build.gradle.kts b/kvision-modules/kvision-common-types/build.gradle.kts
new file mode 100644
index 00000000..fec5f5cf
--- /dev/null
+++ b/kvision-modules/kvision-common-types/build.gradle.kts
@@ -0,0 +1,52 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val serializationVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-common-types"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Date.kt
index 3e7152a1..3e7152a1 100644
--- a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Date.kt
diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
index 26d64654..26d64654 100644
--- a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/KFile.kt
index ce4adca4..ce4adca4 100644
--- a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
+++ b/kvision-modules/kvision-common-types/src/commonMain/kotlin/pl/treksoft/kvision/types/KFile.kt
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt
index 1d37ae51..82e913fe 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ b/kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -21,27 +21,16 @@
*/
package pl.treksoft.kvision.types
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.math.BigDecimal
+import kotlin.js.Date
-actual typealias Decimal = BigDecimal
+const val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss"
-class BigDecimalSerializer : JsonSerializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun serialize(value: BigDecimal, gen: JsonGenerator, provider: SerializerProvider) {
- gen.writeNumber(value.toDouble())
- }
-}
+actual typealias LocalDateTime = Date
-class BigDecimalDeserializer : JsonDeserializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): BigDecimal? {
- return p.doubleValue.toBigDecimal()
- }
-}
+actual typealias LocalDate = Date
+
+actual typealias LocalTime = Date
+
+actual typealias OffsetDateTime = Date
+
+actual typealias OffsetTime = Date
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
index d1c0366e..d1c0366e 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ b/kvision-modules/kvision-common-types/src/jsMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Date.kt
index 61f8ba58..61f8ba58 100644
--- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Date.kt
diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
index 1d37ae51..1d37ae51 100644
--- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ b/kvision-modules/kvision-common-types/src/jvmMain/kotlin/pl/treksoft/kvision/types/Decimal.kt
diff --git a/kvision-modules/kvision-cordova/build.gradle b/kvision-modules/kvision-cordova/build.gradle
deleted file mode 100644
index 4aaef76d..00000000
--- a/kvision-modules/kvision-cordova/build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
-}
diff --git a/kvision-modules/kvision-cordova/build.gradle.kts b/kvision-modules/kvision-cordova/build.gradle.kts
new file mode 100644
index 00000000..f31fb11e
--- /dev/null
+++ b/kvision-modules/kvision-cordova/build.gradle.kts
@@ -0,0 +1,43 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-cordova/webpack.config.d/bootstrap.js b/kvision-modules/kvision-cordova/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-cordova/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-cordova/webpack.config.d/file.js b/kvision-modules/kvision-cordova/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-cordova/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-datacontainer/build.gradle b/kvision-modules/kvision-datacontainer/build.gradle
deleted file mode 100644
index 6779c309..00000000
--- a/kvision-modules/kvision-datacontainer/build.gradle
+++ /dev/null
@@ -1 +0,0 @@
-apply from: "../shared.gradle"
diff --git a/kvision-modules/kvision-datacontainer/build.gradle.kts b/kvision-modules/kvision-datacontainer/build.gradle.kts
new file mode 100644
index 00000000..ed57bd2e
--- /dev/null
+++ b/kvision-modules/kvision-datacontainer/build.gradle.kts
@@ -0,0 +1,39 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-datacontainer/package.json.d/project.info b/kvision-modules/kvision-datacontainer/package.json.d/project.info
deleted file mode 100644
index 86ea568f..00000000
--- a/kvision-modules/kvision-datacontainer/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision DataContainer module"
-}
diff --git a/kvision-modules/kvision-datacontainer/webpack.config.d/bootstrap.js b/kvision-modules/kvision-datacontainer/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-datacontainer/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-datacontainer/webpack.config.d/file.js b/kvision-modules/kvision-datacontainer/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-datacontainer/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-electron/build.gradle b/kvision-modules/kvision-electron/build.gradle
deleted file mode 100644
index 8716dd65..00000000
--- a/kvision-modules/kvision-electron/build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-apply plugin: 'kotlin-platform-js'
-apply plugin: 'kotlinx-serialization'
-
-task cleanLibs(type: Delete) {
- delete 'build/js', 'build/libs'
-}
-
-if (project.gradle.startParameter.taskNames.contains("jar")) {
- compileKotlin2Js.dependsOn 'cleanLibs'
-}
-
-jar {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-}
-
-compileKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-compileTestKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
- compile "me.kgustave:node-kt:$nodeKtVersion"
-}
diff --git a/kvision-modules/kvision-electron/build.gradle.kts b/kvision-modules/kvision-electron/build.gradle.kts
new file mode 100644
index 00000000..6cd8beff
--- /dev/null
+++ b/kvision-modules/kvision-electron/build.gradle.kts
@@ -0,0 +1,43 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val nodeKtVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api("me.kgustave:node-kt:$nodeKtVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-electron/webpack.config.d/bootstrap.js b/kvision-modules/kvision-electron/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-electron/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-electron/webpack.config.d/css.js b/kvision-modules/kvision-electron/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-electron/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-electron/webpack.config.d/file.js b/kvision-modules/kvision-electron/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-electron/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-event-flow/build.gradle b/kvision-modules/kvision-event-flow/build.gradle
deleted file mode 100644
index 4aaef76d..00000000
--- a/kvision-modules/kvision-event-flow/build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
-}
diff --git a/kvision-modules/kvision-event-flow/build.gradle.kts b/kvision-modules/kvision-event-flow/build.gradle.kts
new file mode 100644
index 00000000..f31fb11e
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/build.gradle.kts
@@ -0,0 +1,43 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-event-flow/package.json.d/project.info b/kvision-modules/kvision-event-flow/package.json.d/project.info
deleted file mode 100644
index f9d34fd1..00000000
--- a/kvision-modules/kvision-event-flow/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision event flow module"
-}
diff --git a/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt b/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
index 3a93d2a5..f9556e62 100644
--- a/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
+++ b/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
@@ -29,7 +29,7 @@ import org.w3c.dom.events.Event
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.core.onEvent
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline fun <reified T : Widget> T.eventFlow(event: String): Flow<Pair<T, Event>> = callbackFlow {
val id = onEvent {
this.asDynamic()[event] = { e: Event ->
@@ -41,7 +41,7 @@ inline fun <reified T : Widget> T.eventFlow(event: String): Flow<Pair<T, Event>>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.clickFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
@@ -54,7 +54,7 @@ inline val <reified T : Widget> T.clickFlow: Flow<T>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.inputFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
@@ -67,7 +67,7 @@ inline val <reified T : Widget> T.inputFlow: Flow<T>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.changeFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
diff --git a/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js b/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-event-flow/webpack.config.d/file.js b/kvision-modules/kvision-event-flow/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-fontawesome/build.gradle b/kvision-modules/kvision-fontawesome/build.gradle
deleted file mode 100644
index 3df8b70e..00000000
--- a/kvision-modules/kvision-fontawesome/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("@fortawesome/fontawesome-free", "5.12.0")
- }
-
-}
diff --git a/kvision-modules/kvision-fontawesome/build.gradle.kts b/kvision-modules/kvision-fontawesome/build.gradle.kts
new file mode 100644
index 00000000..31231570
--- /dev/null
+++ b/kvision-modules/kvision-fontawesome/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("@fortawesome/fontawesome-free", "5.12.0"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-fontawesome/package.json.d/project.info b/kvision-modules/kvision-fontawesome/package.json.d/project.info
deleted file mode 100644
index 0801ee7b..00000000
--- a/kvision-modules/kvision-fontawesome/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Font Awesome module"
-}
diff --git a/kvision-modules/kvision-fontawesome/webpack.config.d/bootstrap.js b/kvision-modules/kvision-fontawesome/webpack.config.d/bootstrap.js
index 32a7c4d0..35b28e6a 100644
--- a/kvision-modules/kvision-fontawesome/webpack.config.d/bootstrap.js
+++ b/kvision-modules/kvision-fontawesome/webpack.config.d/bootstrap.js
@@ -1,4 +1,3 @@
config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
-config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'});
diff --git a/kvision-modules/kvision-fontawesome/webpack.config.d/file.js b/kvision-modules/kvision-fontawesome/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-fontawesome/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-fontawesome/webpack.config.d/jquery.js b/kvision-modules/kvision-fontawesome/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-fontawesome/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-fontawesome/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-handlebars/build.gradle b/kvision-modules/kvision-handlebars/build.gradle
deleted file mode 100644
index 5a62036c..00000000
--- a/kvision-modules/kvision-handlebars/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("handlebars", "4.7.2")
- dependency("handlebars-loader", "1.7.1")
- }
-
-}
diff --git a/kvision-modules/kvision-handlebars/build.gradle.kts b/kvision-modules/kvision-handlebars/build.gradle.kts
new file mode 100644
index 00000000..a5e3dbbf
--- /dev/null
+++ b/kvision-modules/kvision-handlebars/build.gradle.kts
@@ -0,0 +1,47 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("handlebars", "4.7.2"))
+ implementation(npm("handlebars-loader", "1.7.1"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-handlebars/package.json.d/project.info b/kvision-modules/kvision-handlebars/package.json.d/project.info
deleted file mode 100644
index fd5bb305..00000000
--- a/kvision-modules/kvision-handlebars/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Handlebars module"
-}
diff --git a/kvision-modules/kvision-handlebars/webpack.config.d/bootstrap.js b/kvision-modules/kvision-handlebars/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-handlebars/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-handlebars/webpack.config.d/css.js b/kvision-modules/kvision-handlebars/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-handlebars/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-handlebars/webpack.config.d/file.js b/kvision-modules/kvision-handlebars/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-handlebars/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-i18n/build.gradle b/kvision-modules/kvision-i18n/build.gradle
deleted file mode 100644
index a2b6d3f8..00000000
--- a/kvision-modules/kvision-i18n/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("jed", "1.1.1")
- }
-
-}
diff --git a/kvision-modules/kvision-i18n/build.gradle.kts b/kvision-modules/kvision-i18n/build.gradle.kts
new file mode 100644
index 00000000..80a20619
--- /dev/null
+++ b/kvision-modules/kvision-i18n/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("jed", "1.1.1"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-i18n/package.json.d/project.info b/kvision-modules/kvision-i18n/package.json.d/project.info
deleted file mode 100644
index cefa5d1f..00000000
--- a/kvision-modules/kvision-i18n/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision i18n module"
-}
diff --git a/kvision-modules/kvision-i18n/webpack.config.d/bootstrap.js b/kvision-modules/kvision-i18n/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-i18n/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-i18n/webpack.config.d/file.js b/kvision-modules/kvision-i18n/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-i18n/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-maps/build.gradle b/kvision-modules/kvision-maps/build.gradle
deleted file mode 100644
index f87287f3..00000000
--- a/kvision-modules/kvision-maps/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("leaflet", "1.6.0")
- }
-
-}
diff --git a/kvision-modules/kvision-maps/build.gradle.kts b/kvision-modules/kvision-maps/build.gradle.kts
new file mode 100644
index 00000000..143f0515
--- /dev/null
+++ b/kvision-modules/kvision-maps/build.gradle.kts
@@ -0,0 +1,49 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ implementation(npm("leaflet", "1.6.0"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-maps/package.json.d/project.info b/kvision-modules/kvision-maps/package.json.d/project.info
deleted file mode 100644
index d737fd1c..00000000
--- a/kvision-modules/kvision-maps/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision maps module"
-}
diff --git a/kvision-modules/kvision-maps/webpack.config.d/bootstrap.js b/kvision-modules/kvision-maps/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-maps/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-maps/webpack.config.d/file.js b/kvision-modules/kvision-maps/webpack.config.d/file.js
index a5c7b5da..653ca21f 100644
--- a/kvision-modules/kvision-maps/webpack.config.d/file.js
+++ b/kvision-modules/kvision-maps/webpack.config.d/file.js
@@ -1,6 +1,9 @@
config.module.rules.push(
{
- test: /\.(jpe?g|png|gif)$/i,
- loader: 'file-loader'
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
}
-); \ No newline at end of file
+);
diff --git a/kvision-modules/kvision-moment/build.gradle b/kvision-modules/kvision-moment/build.gradle
deleted file mode 100644
index 4325a38a..00000000
--- a/kvision-modules/kvision-moment/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("moment", "2.24.0")
- }
-
-}
diff --git a/kvision-modules/kvision-moment/build.gradle.kts b/kvision-modules/kvision-moment/build.gradle.kts
new file mode 100644
index 00000000..31193544
--- /dev/null
+++ b/kvision-modules/kvision-moment/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("moment", "2.24.0"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-moment/package.json.d/project.info b/kvision-modules/kvision-moment/package.json.d/project.info
deleted file mode 100644
index c68b247f..00000000
--- a/kvision-modules/kvision-moment/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Moment module"
-}
diff --git a/kvision-modules/kvision-moment/webpack.config.d/bootstrap.js b/kvision-modules/kvision-moment/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-moment/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-moment/webpack.config.d/css.js b/kvision-modules/kvision-moment/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-moment/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-moment/webpack.config.d/file.js b/kvision-modules/kvision-moment/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-moment/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-pace/build.gradle b/kvision-modules/kvision-pace/build.gradle
deleted file mode 100644
index 47b3c704..00000000
--- a/kvision-modules/kvision-pace/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("pace-progressbar", "1.0.9")
- }
-
-} \ No newline at end of file
diff --git a/kvision-modules/kvision-pace/build.gradle.kts b/kvision-modules/kvision-pace/build.gradle.kts
new file mode 100644
index 00000000..2bfd7dd4
--- /dev/null
+++ b/kvision-modules/kvision-pace/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("pace-progressbar", "1.0.9"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-pace/package.json.d/project.info b/kvision-modules/kvision-pace/package.json.d/project.info
deleted file mode 100644
index 98d48a0f..00000000
--- a/kvision-modules/kvision-pace/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Pace module"
-}
diff --git a/kvision-modules/kvision-pace/webpack.config.d/bootstrap.js b/kvision-modules/kvision-pace/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-pace/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-pace/webpack.config.d/file.js b/kvision-modules/kvision-pace/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-pace/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-redux-kotlin/build.gradle b/kvision-modules/kvision-redux-kotlin/build.gradle
deleted file mode 100644
index 0b00ddd8..00000000
--- a/kvision-modules/kvision-redux-kotlin/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile ("org.reduxkotlin:redux-kotlin-js:$reduxKotlinVersion")
- compile ("org.reduxkotlin:redux-kotlin-thunk-js:$reduxKotlinThunkVersion")
-}
diff --git a/kvision-modules/kvision-redux-kotlin/build.gradle.kts b/kvision-modules/kvision-redux-kotlin/build.gradle.kts
new file mode 100644
index 00000000..993eaff6
--- /dev/null
+++ b/kvision-modules/kvision-redux-kotlin/build.gradle.kts
@@ -0,0 +1,45 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val reduxKotlinVersion: String by project
+val reduxKotlinThunkVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api("org.reduxkotlin:redux-kotlin-js:$reduxKotlinVersion")
+ api("org.reduxkotlin:redux-kotlin-thunk-js:$reduxKotlinThunkVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-redux-kotlin/package.json.d/project.info b/kvision-modules/kvision-redux-kotlin/package.json.d/project.info
deleted file mode 100644
index d36f4db0..00000000
--- a/kvision-modules/kvision-redux-kotlin/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Redux Kotlin module"
-}
diff --git a/kvision-modules/kvision-redux-kotlin/webpack.config.d/bootstrap.js b/kvision-modules/kvision-redux-kotlin/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-redux-kotlin/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-redux-kotlin/webpack.config.d/file.js b/kvision-modules/kvision-redux-kotlin/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-redux-kotlin/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-redux/build.gradle b/kvision-modules/kvision-redux/build.gradle
deleted file mode 100644
index d7ed852c..00000000
--- a/kvision-modules/kvision-redux/build.gradle
+++ /dev/null
@@ -1,16 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile ("org.jetbrains:kotlin-redux:$kotlinReduxVersion") {
- exclude group: "org.jetbrains.kotlinx", module: "kotlinx-html-js"
- }
-}
-
-kotlinFrontend {
-
- npm {
- dependency("redux", "4.0.5")
- dependency("redux-thunk", "2.3.0")
- }
-
-}
diff --git a/kvision-modules/kvision-redux/build.gradle.kts b/kvision-modules/kvision-redux/build.gradle.kts
new file mode 100644
index 00000000..15e65cf2
--- /dev/null
+++ b/kvision-modules/kvision-redux/build.gradle.kts
@@ -0,0 +1,52 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+val kotlinReduxVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api("org.jetbrains:kotlin-redux:$kotlinReduxVersion") {
+ exclude("org.jetbrains.kotlinx", "kotlinx-html-js")
+ }
+ implementation(npm("redux", "4.0.5"))
+ implementation(npm("redux-thunk", "2.3.0"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-redux/package.json.d/project.info b/kvision-modules/kvision-redux/package.json.d/project.info
deleted file mode 100644
index f4189f6f..00000000
--- a/kvision-modules/kvision-redux/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Redux module"
-}
diff --git a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
index 474206fc..2c6cb1e9 100644
--- a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
+++ b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
@@ -80,7 +80,12 @@ class ReduxStore<S : Any, A : RAction>(
},
initialState,
@Suppress("SpreadOperator")
- KVManagerRedux.compose(KVManagerRedux.applyMiddleware(KVManagerRedux.reduxThunk, *middlewares), rEnhancer())
+ (KVManagerRedux.compose(
+ KVManagerRedux.applyMiddleware<S, RAction, WrapperAction, Any, Any>(
+ KVManagerRedux.reduxThunk,
+ *middlewares
+ ), rEnhancer()
+ )).asDynamic()
)
}
diff --git a/kvision-modules/kvision-redux/webpack.config.d/bootstrap.js b/kvision-modules/kvision-redux/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-redux/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-redux/webpack.config.d/file.js b/kvision-modules/kvision-redux/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-redux/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-remote/build.gradle b/kvision-modules/kvision-remote/build.gradle
deleted file mode 100644
index e5cac713..00000000
--- a/kvision-modules/kvision-remote/build.gradle
+++ /dev/null
@@ -1,38 +0,0 @@
-apply plugin: 'kotlin-platform-js'
-apply plugin: 'kotlinx-serialization'
-
-task cleanLibs(type: Delete) {
- delete 'build/js', 'build/libs'
-}
-
-if (project.gradle.startParameter.taskNames.contains("jar")) {
- compileKotlin2Js.dependsOn 'cleanLibs'
-}
-
-jar {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-}
-
-compileKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-compileTestKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-dependencies {
- expectedBy project(":kvision-modules:kvision-common-remote")
- expectedBy project(":kvision-modules:kvision-common-types")
- expectedBy project(":kvision-modules:kvision-common-annotations")
- compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion"
- compile "pl.treksoft:jquery-kotlin:$jqueryKotlinVersion"
-}
diff --git a/kvision-modules/kvision-richtext/build.gradle b/kvision-modules/kvision-richtext/build.gradle
deleted file mode 100644
index 75b2c1a1..00000000
--- a/kvision-modules/kvision-richtext/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("trix", "1.2.2")
- }
-
-}
diff --git a/kvision-modules/kvision-richtext/build.gradle.kts b/kvision-modules/kvision-richtext/build.gradle.kts
new file mode 100644
index 00000000..b52b398d
--- /dev/null
+++ b/kvision-modules/kvision-richtext/build.gradle.kts
@@ -0,0 +1,67 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("trix", "1.2.2"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+fun copyResources() {
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin")
+ }
+ copy {
+ from("$buildDir/processedResources/Js/main")
+ into("${rootProject.buildDir}/js/packages/kvision-${project.name}/kotlin-dce")
+ }
+}
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+ getByName("compileTestKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+ getByName("processDceKotlinJs") {
+ doLast {
+ copyResources()
+ }
+ }
+}
diff --git a/kvision-modules/kvision-richtext/package.json.d/project.info b/kvision-modules/kvision-richtext/package.json.d/project.info
deleted file mode 100644
index 856dc500..00000000
--- a/kvision-modules/kvision-richtext/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision RichText module"
-}
diff --git a/kvision-modules/kvision-richtext/webpack.config.d/bootstrap.js b/kvision-modules/kvision-richtext/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-richtext/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-richtext/webpack.config.d/file.js b/kvision-modules/kvision-richtext/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-richtext/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-richtext/webpack.config.d/jquery.js b/kvision-modules/kvision-richtext/webpack.config.d/jquery.js
index bf5a1a20..e6c6b219 100644
--- a/kvision-modules/kvision-richtext/webpack.config.d/jquery.js
+++ b/kvision-modules/kvision-richtext/webpack.config.d/jquery.js
@@ -1,5 +1,9 @@
-config.plugins.push(new webpack.ProvidePlugin({
- $: "jquery",
- jQuery: "jquery",
- "window.jQuery": "jquery"
-}));
+;(function() {
+ const webpack = require('webpack')
+
+ config.plugins.push(new webpack.ProvidePlugin({
+ $: "jquery",
+ jQuery: "jquery",
+ "window.jQuery": "jquery"
+ }));
+})();
diff --git a/kvision-modules/kvision-server-javalin/build.gradle b/kvision-modules/kvision-server-javalin/build.gradle
deleted file mode 100644
index 4664b5d9..00000000
--- a/kvision-modules/kvision-server-javalin/build.gradle
+++ /dev/null
@@ -1,30 +0,0 @@
-apply plugin: 'kotlin-platform-jvm'
-apply plugin: 'kotlinx-serialization'
-
-dependencies {
- expectedBy project(":kvision-modules:kvision-common-types")
- expectedBy project(":kvision-modules:kvision-common-remote")
- expectedBy project(":kvision-modules:kvision-common-annotations")
- compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion"
- compile "io.javalin:javalin:$javalinVersion"
- compile "com.google.inject:guice:$guiceVersion"
- compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion"
- testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common-types")
- testCompile project(":kvision-modules:kvision-common-remote")
- testCompile project(":kvision-modules:kvision-common-annotations")
-}
-
-compileKotlin {
- targetCompatibility = javaVersion
- sourceCompatibility = javaVersion
- kotlinOptions {
- jvmTarget = javaVersion
- }
-}
diff --git a/kvision-modules/kvision-server-javalin/build.gradle.kts b/kvision-modules/kvision-server-javalin/build.gradle.kts
new file mode 100644
index 00000000..daaae81c
--- /dev/null
+++ b/kvision-modules/kvision-server-javalin/build.gradle.kts
@@ -0,0 +1,69 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val kotlinVersion: String by System.getProperties()
+val serializationVersion: String by project
+val coroutinesVersion: String by project
+val javalinVersion: String by project
+val guiceVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ api(project(":kvision-modules:kvision-common-annotations"))
+ api(project(":kvision-modules:kvision-common-types"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependsOn(commonMain)
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation(kotlin("stdlib-jdk8"))
+ implementation(kotlin("reflect"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
+ api("io.javalin:javalin:$javalinVersion")
+ api("com.google.inject:guice:$guiceVersion")
+ api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-server-javalin"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-javalin/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 71c7d641..19da13c0 100644
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-javalin/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -19,20 +19,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
package pl.treksoft.kvision.remote
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlin.reflect.KClass
-enum class HttpMethod {
- GET,
- POST,
- PUT,
- DELETE,
- OPTIONS
-}
-
/**
* Multiplatform service manager.
*/
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-javalin/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index aaf63153..23da6ac5 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-javalin/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -28,7 +28,7 @@ import kotlin.reflect.KClass
/**
* Multiplatform service manager.
*/
-actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KClass<T>) {
+actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KClass<T>): KVServiceMgr<T> {
protected val calls: MutableMap<String, Pair<String, HttpMethod>> = mutableMapOf()
var counter: Int = 0
@@ -155,6 +155,6 @@ actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KCl
/**
* Returns the map of defined paths.
*/
- fun getCalls(): Map<String, Pair<String, HttpMethod>> = calls
+ override fun getCalls(): Map<String, Pair<String, HttpMethod>> = calls
}
diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
index aef6e2f2..aef6e2f2 100644
--- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
+++ b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index ffb2936b..e6428524 100644
--- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -54,7 +54,7 @@ import kotlin.reflect.KClass
* Multiplatform service manager for Javalin.
*/
@Suppress("LargeClass", "TooManyFunctions")
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: KClass<T>) {
companion object {
diff --git a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
index e44cc46f..e44cc46f 100644
--- a/kvision-modules/kvision-server-javalin/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
+++ b/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
diff --git a/kvision-modules/kvision-server-jooby/build.gradle b/kvision-modules/kvision-server-jooby/build.gradle
deleted file mode 100644
index 4d2823e2..00000000
--- a/kvision-modules/kvision-server-jooby/build.gradle
+++ /dev/null
@@ -1,37 +0,0 @@
-apply plugin: "io.spring.dependency-management"
-apply plugin: 'kotlin-platform-jvm'
-apply plugin: 'kotlinx-serialization'
-
-dependencyManagement {
- imports {
- mavenBom "io.jooby:jooby-bom:${joobyVersion}"
- }
-}
-
-dependencies {
- expectedBy project(":kvision-modules:kvision-common-types")
- expectedBy project(":kvision-modules:kvision-common-remote")
- expectedBy project(":kvision-modules:kvision-common-annotations")
- compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
- compile "io.jooby:jooby-netty"
- compile "io.jooby:jooby-guice"
- compile "io.jooby:jooby-jackson"
- compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonModuleKotlinVersion}"
- testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common-types")
- testCompile project(":kvision-modules:kvision-common-remote")
- testCompile project(":kvision-modules:kvision-common-annotations")
-}
-
-compileKotlin {
- targetCompatibility = javaVersion
- sourceCompatibility = javaVersion
- kotlinOptions {
- jvmTarget = javaVersion
- }
-}
diff --git a/kvision-modules/kvision-server-jooby/build.gradle.kts b/kvision-modules/kvision-server-jooby/build.gradle.kts
new file mode 100644
index 00000000..329a6d19
--- /dev/null
+++ b/kvision-modules/kvision-server-jooby/build.gradle.kts
@@ -0,0 +1,68 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val kotlinVersion: String by System.getProperties()
+val serializationVersion: String by project
+val coroutinesVersion: String by project
+val joobyVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ api(project(":kvision-modules:kvision-common-annotations"))
+ api(project(":kvision-modules:kvision-common-types"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependsOn(commonMain)
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation(kotlin("stdlib-jdk8"))
+ implementation(kotlin("reflect"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
+ api("io.jooby:jooby-netty:$joobyVersion")
+ api("io.jooby:jooby-guice:$joobyVersion")
+ api("io.jooby:jooby-jackson:$joobyVersion")
+ api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-server-jooby"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-server-jooby/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..19da13c0
--- /dev/null
+++ b/kvision-modules/kvision-server-jooby/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+expect open class KVServiceManager<T : Any>(serviceClass: KClass<T>) {
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ )
+
+ /**
+ * Binds a given function of the receiver as a web socket connection
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String? = null
+ )
+}
diff --git a/kvision-modules/kvision-server-jooby/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..23da6ac5
--- /dev/null
+++ b/kvision-modules/kvision-server-jooby/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KClass<T>): KVServiceMgr<T> {
+
+ protected val calls: MutableMap<String, Pair<String, HttpMethod>> = mutableMapOf()
+ var counter: Int = 0
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3,
+ reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected actual inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Binds a given web socket connetion with a function of the receiver.
+ * @param function a function of the receiver
+ * @param route a web socket route
+ */
+ protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String?
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kvws/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Returns the map of defined paths.
+ */
+ override fun getCalls(): Map<String, Pair<String, HttpMethod>> = calls
+
+}
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
index 2245e92b..2245e92b 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
+++ b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 4e44162f..6bc2a73a 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -54,7 +54,7 @@ import kotlin.reflect.KClass
* Multiplatform service manager for Jooby.
*/
@Suppress("LargeClass", "TooManyFunctions")
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: KClass<T>) {
companion object {
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
index 06955a07..06955a07 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
+++ b/kvision-modules/kvision-server-jooby/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
deleted file mode 100644
index 61f8ba58..00000000
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.types
-
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.time.LocalDate
-import java.time.LocalDateTime
-import java.time.LocalTime
-import java.time.OffsetDateTime
-import java.time.OffsetTime
-import java.time.format.DateTimeFormatter
-import java.time.format.DateTimeParseException
-
-actual typealias LocalDateTime = LocalDateTime
-
-actual typealias LocalDate = LocalDate
-
-actual typealias LocalTime = LocalTime
-
-actual typealias OffsetDateTime = OffsetDateTime
-
-actual typealias OffsetTime = OffsetTime
-
-fun String.toDateTimeF(): LocalDateTime = LocalDateTime.parse(this)
-
-fun String.toDateF(): LocalDate = LocalDate.parse(this)
-
-fun String.toTimeF(): LocalTime = LocalTime.parse(this)
-
-fun String.toOffsetDateTimeF(): OffsetDateTime = OffsetDateTime.parse(this)
-
-fun String.toOffsetTimeF(): OffsetTime = OffsetTime.parse(this)
-
-fun LocalDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
-
-fun LocalDate.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE)
-
-fun LocalTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_TIME)
-
-fun OffsetDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
-
-fun OffsetTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_TIME)
-
-class LocalDateTimeSerializer : JsonSerializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalDateSerializer : JsonSerializer<LocalDate>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDate, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atStartOfDay().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalTimeSerializer : JsonSerializer<LocalTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class OffsetDateTimeSerializer : JsonSerializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
- val str = p.text
- return try {
- OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
-
-class OffsetTimeSerializer : JsonSerializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
- val str = p.text
- return try {
- OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
deleted file mode 100644
index 1d37ae51..00000000
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Decimal.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.types
-
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.math.BigDecimal
-
-actual typealias Decimal = BigDecimal
-
-class BigDecimalSerializer : JsonSerializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun serialize(value: BigDecimal, gen: JsonGenerator, provider: SerializerProvider) {
- gen.writeNumber(value.toDouble())
- }
-}
-
-class BigDecimalDeserializer : JsonDeserializer<BigDecimal>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): BigDecimal? {
- return p.doubleValue.toBigDecimal()
- }
-}
diff --git a/kvision-modules/kvision-server-ktor/build.gradle b/kvision-modules/kvision-server-ktor/build.gradle
deleted file mode 100644
index 20e21f6d..00000000
--- a/kvision-modules/kvision-server-ktor/build.gradle
+++ /dev/null
@@ -1,29 +0,0 @@
-apply plugin: 'kotlin-platform-jvm'
-apply plugin: 'kotlinx-serialization'
-
-dependencies {
- expectedBy project(":kvision-modules:kvision-common-types")
- expectedBy project(":kvision-modules:kvision-common-remote")
- expectedBy project(":kvision-modules:kvision-common-annotations")
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
- compile "io.ktor:ktor-server-core:$ktorVersion"
- compile "io.ktor:ktor-jackson:$ktorVersion"
- compile "io.ktor:ktor-websockets:$ktorVersion"
- compile "com.google.inject:guice:$guiceVersion"
- compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion"
- testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common-types")
- testCompile project(":kvision-modules:kvision-common-remote")
- testCompile project(":kvision-modules:kvision-common-annotations")
-}
-
-compileKotlin {
- targetCompatibility = javaVersion
- sourceCompatibility = javaVersion
- kotlinOptions {
- jvmTarget = javaVersion
- }
-}
diff --git a/kvision-modules/kvision-server-ktor/build.gradle.kts b/kvision-modules/kvision-server-ktor/build.gradle.kts
new file mode 100644
index 00000000..e9825289
--- /dev/null
+++ b/kvision-modules/kvision-server-ktor/build.gradle.kts
@@ -0,0 +1,70 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val kotlinVersion: String by System.getProperties()
+val serializationVersion: String by project
+val coroutinesVersion: String by project
+val ktorVersion: String by project
+val guiceVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ api(project(":kvision-modules:kvision-common-annotations"))
+ api(project(":kvision-modules:kvision-common-types"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependsOn(commonMain)
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation(kotlin("stdlib-jdk8"))
+ implementation(kotlin("reflect"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
+ api("io.ktor:ktor-server-core:$ktorVersion")
+ api("io.ktor:ktor-jackson:$ktorVersion")
+ api("io.ktor:ktor-websockets:$ktorVersion")
+ api("com.google.inject:guice:$guiceVersion")
+ api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-server-ktor"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..19da13c0
--- /dev/null
+++ b/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+expect open class KVServiceManager<T : Any>(serviceClass: KClass<T>) {
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ )
+
+ /**
+ * Binds a given function of the receiver as a web socket connection
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String? = null
+ )
+}
diff --git a/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..23da6ac5
--- /dev/null
+++ b/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KClass<T>): KVServiceMgr<T> {
+
+ protected val calls: MutableMap<String, Pair<String, HttpMethod>> = mutableMapOf()
+ var counter: Int = 0
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3,
+ reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected actual inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Binds a given web socket connetion with a function of the receiver.
+ * @param function a function of the receiver
+ * @param route a web socket route
+ */
+ protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String?
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kvws/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Returns the map of defined paths.
+ */
+ override fun getCalls(): Map<String, Pair<String, HttpMethod>> = calls
+
+}
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
index 11959ea0..11959ea0 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVModules.kt
+++ b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVModules.kt
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 276ee9a6..d516f2b3 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -64,7 +64,7 @@ import kotlin.reflect.KClass
* Multiplatform service manager for Ktor.
*/
@KtorExperimentalAPI
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
@Suppress("LargeClass", "TooManyFunctions")
actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: KClass<T>) {
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
deleted file mode 100644
index 61f8ba58..00000000
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.types
-
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.time.LocalDate
-import java.time.LocalDateTime
-import java.time.LocalTime
-import java.time.OffsetDateTime
-import java.time.OffsetTime
-import java.time.format.DateTimeFormatter
-import java.time.format.DateTimeParseException
-
-actual typealias LocalDateTime = LocalDateTime
-
-actual typealias LocalDate = LocalDate
-
-actual typealias LocalTime = LocalTime
-
-actual typealias OffsetDateTime = OffsetDateTime
-
-actual typealias OffsetTime = OffsetTime
-
-fun String.toDateTimeF(): LocalDateTime = LocalDateTime.parse(this)
-
-fun String.toDateF(): LocalDate = LocalDate.parse(this)
-
-fun String.toTimeF(): LocalTime = LocalTime.parse(this)
-
-fun String.toOffsetDateTimeF(): OffsetDateTime = OffsetDateTime.parse(this)
-
-fun String.toOffsetTimeF(): OffsetTime = OffsetTime.parse(this)
-
-fun LocalDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
-
-fun LocalDate.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE)
-
-fun LocalTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_TIME)
-
-fun OffsetDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
-
-fun OffsetTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_TIME)
-
-class LocalDateTimeSerializer : JsonSerializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalDateSerializer : JsonSerializer<LocalDate>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDate, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atStartOfDay().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalTimeSerializer : JsonSerializer<LocalTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class OffsetDateTimeSerializer : JsonSerializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
- val str = p.text
- return try {
- OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
-
-class OffsetTimeSerializer : JsonSerializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
- val str = p.text
- return try {
- OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
diff --git a/kvision-modules/kvision-server-spring-boot/build.gradle b/kvision-modules/kvision-server-spring-boot/build.gradle
deleted file mode 100644
index c46a38b1..00000000
--- a/kvision-modules/kvision-server-spring-boot/build.gradle
+++ /dev/null
@@ -1,40 +0,0 @@
-apply plugin: 'kotlin-platform-jvm'
-apply plugin: 'kotlinx-serialization'
-
-repositories {
- mavenCentral()
- jcenter()
- maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" }
- maven { url = 'https://kotlin.bintray.com/kotlinx' }
- maven { url = 'https://dl.bintray.com/rjaros/kotlin' }
- maven { url = "https://repo.spring.io/milestone" }
-}
-
-dependencies {
- expectedBy project(":kvision-modules:kvision-common-types")
- expectedBy project(":kvision-modules:kvision-common-remote")
- expectedBy project(":kvision-modules:kvision-common-annotations")
- compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
- compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutinesVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- compile "org.springframework.boot:spring-boot-starter:$springBootVersion"
- compile "org.springframework.boot:spring-boot-starter-webflux:$springBootVersion"
- compile "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
- compile "org.springframework.data:spring-data-relational:$springDataRelationalVersion"
- compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonModuleKotlinVersion}"
- testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common-types")
- testCompile project(":kvision-modules:kvision-common-remote")
- testCompile project(":kvision-modules:kvision-common-annotations")
-}
-
-compileKotlin {
- kotlinOptions {
- freeCompilerArgs = ["-Xjsr305=strict"]
- jvmTarget = "1.8"
- }
-}
diff --git a/kvision-modules/kvision-server-spring-boot/build.gradle.kts b/kvision-modules/kvision-server-spring-boot/build.gradle.kts
new file mode 100644
index 00000000..d24073d4
--- /dev/null
+++ b/kvision-modules/kvision-server-spring-boot/build.gradle.kts
@@ -0,0 +1,72 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("multiplatform")
+ id("kotlinx-serialization")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val kotlinVersion: String by System.getProperties()
+val serializationVersion: String by project
+val coroutinesVersion: String by project
+val springBootVersion: String by project
+val springDataRelationalVersion: String by project
+val jacksonModuleKotlinVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+ kotlinJvmTargets()
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-common"))
+ api(project(":kvision-modules:kvision-common-annotations"))
+ api(project(":kvision-modules:kvision-common-types"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
+ }
+ }
+ val jsMain by getting {
+ dependencies {
+ implementation(kotlin("stdlib-js"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ }
+ }
+ val jvmMain by getting {
+ dependsOn(commonMain)
+ dependencies {
+ implementation(kotlin("stdlib"))
+ implementation(kotlin("stdlib-jdk7"))
+ implementation(kotlin("stdlib-jdk8"))
+ implementation(kotlin("reflect"))
+ api("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
+ api("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutinesVersion")
+ api("org.springframework.boot:spring-boot-starter:$springBootVersion")
+ api("org.springframework.boot:spring-boot-starter-webflux:$springBootVersion")
+ api("org.springframework.boot:spring-boot-starter-security:$springBootVersion")
+ api("org.springframework.data:spring-data-relational:$springDataRelationalVersion")
+ api("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
+ }
+ }
+ }
+}
+
+publishing {
+ publications.withType<MavenPublication> {
+ if (name == "kotlinMultiplatform") artifactId = "kvision-server-spring-boot"
+ pom {
+ defaultPom()
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt b/kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt
index 3fb82d2e..67fb1de1 100644
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt
@@ -21,10 +21,10 @@
*/
package pl.treksoft.kvision.remote
-@UseExperimental(ExperimentalMultiplatform::class)
+@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
expect annotation class Id()
-@UseExperimental(ExperimentalMultiplatform::class)
+@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
expect annotation class Transient()
diff --git a/kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..19da13c0
--- /dev/null
+++ b/kvision-modules/kvision-server-spring-boot/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+expect open class KVServiceManager<T : Any>(serviceClass: KClass<T>) {
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod = HttpMethod.POST,
+ route: String? = null
+ )
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ )
+
+ /**
+ * Binds a given function of the receiver as a web socket connection
+ * @param function a function of the receiver
+ */
+ protected inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String? = null
+ )
+}
diff --git a/kvision-modules/kvision-server-spring-boot/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
new file mode 100644
index 00000000..23da6ac5
--- /dev/null
+++ b/kvision-modules/kvision-server-spring-boot/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package pl.treksoft.kvision.remote
+
+import kotlinx.coroutines.channels.ReceiveChannel
+import kotlinx.coroutines.channels.SendChannel
+import kotlin.reflect.KClass
+
+/**
+ * Multiplatform service manager.
+ */
+actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KClass<T>): KVServiceMgr<T> {
+
+ protected val calls: MutableMap<String, Pair<String, HttpMethod>> = mutableMapOf()
+ var counter: Int = 0
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified RET> bind(
+ noinline function: suspend T.() -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR, reified RET> bind(
+ noinline function: suspend T.(PAR) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given route with a function of the receiver.
+ * @param function a function of the receiver
+ * @param method a HTTP method
+ * @param route a route
+ */
+ protected actual inline fun <reified PAR1, reified PAR2, reified PAR3,
+ reified PAR4, reified PAR5, reified RET> bind(
+ noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET,
+ method: HttpMethod, route: String?
+ ) {
+ if (method == HttpMethod.GET)
+ throw UnsupportedOperationException("GET method is only supported for methods without parameters")
+ val routeDef = route ?: "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", method)
+ }
+
+ /**
+ * Binds a given function of the receiver as a tabulator component source
+ * @param function a function of the receiver
+ */
+ protected actual inline fun <reified RET> bindTabulatorRemote(
+ noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Binds a given web socket connetion with a function of the receiver.
+ * @param function a function of the receiver
+ * @param route a web socket route
+ */
+ protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
+ noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
+ route: String?
+ ) {
+ val routeDef = "route${this::class.simpleName}${counter++}"
+ calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kvws/$routeDef", HttpMethod.POST)
+ }
+
+ /**
+ * Returns the map of defined paths.
+ */
+ override fun getCalls(): Map<String, Pair<String, HttpMethod>> = calls
+
+}
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt
index 7de82631..7de82631 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Annotations.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Annotations.kt
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt
index 42c4107d..42c4107d 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVRouterConfiguration.kt
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 2ee939ef..4c1d8e6a 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -53,7 +53,7 @@ import kotlin.reflect.KClass
/**
* Multiplatform service manager for Spring Boot.
*/
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
@Suppress("LargeClass", "TooManyFunctions")
actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: KClass<T>) {
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt
index 2c74e611..3c0e4e99 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt
@@ -63,7 +63,9 @@ class KVWebSocketHandler(
}.first()
}
- @UseExperimental(ExperimentalCoroutinesApi::class, FlowPreview::class)
+ @OptIn(
+ ExperimentalCoroutinesApi::class, FlowPreview::class
+ )
override fun handle(session: WebSocketSession): Mono<Void> {
val handler = getHandler(session)
val responseChannel = Channel<String>()
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Security.kt
index 7a9084dc..7a9084dc 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/Security.kt
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
index 63c5a9d1..63c5a9d1 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote/SessionInterfaces.kt
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/resources/META-INF/spring.factories b/kvision-modules/kvision-server-spring-boot/src/jvmMain/resources/META-INF/spring.factories
index 01084666..01084666 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/resources/META-INF/spring.factories
+++ b/kvision-modules/kvision-server-spring-boot/src/jvmMain/resources/META-INF/spring.factories
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
deleted file mode 100644
index 61f8ba58..00000000
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.types
-
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.JsonParser
-import com.fasterxml.jackson.databind.DeserializationContext
-import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonSerializer
-import com.fasterxml.jackson.databind.SerializerProvider
-import java.io.IOException
-import java.time.LocalDate
-import java.time.LocalDateTime
-import java.time.LocalTime
-import java.time.OffsetDateTime
-import java.time.OffsetTime
-import java.time.format.DateTimeFormatter
-import java.time.format.DateTimeParseException
-
-actual typealias LocalDateTime = LocalDateTime
-
-actual typealias LocalDate = LocalDate
-
-actual typealias LocalTime = LocalTime
-
-actual typealias OffsetDateTime = OffsetDateTime
-
-actual typealias OffsetTime = OffsetTime
-
-fun String.toDateTimeF(): LocalDateTime = LocalDateTime.parse(this)
-
-fun String.toDateF(): LocalDate = LocalDate.parse(this)
-
-fun String.toTimeF(): LocalTime = LocalTime.parse(this)
-
-fun String.toOffsetDateTimeF(): OffsetDateTime = OffsetDateTime.parse(this)
-
-fun String.toOffsetTimeF(): OffsetTime = OffsetTime.parse(this)
-
-fun LocalDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
-
-fun LocalDate.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_DATE)
-
-fun LocalTime.toStringF(): String = this.format(DateTimeFormatter.ISO_LOCAL_TIME)
-
-fun OffsetDateTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
-
-fun OffsetTime.toStringF(): String = this.format(DateTimeFormatter.ISO_OFFSET_TIME)
-
-class LocalDateTimeSerializer : JsonSerializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalDateSerializer : JsonSerializer<LocalDate>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalDate, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atStartOfDay().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class LocalTimeSerializer : JsonSerializer<LocalTime>() {
- @Throws(IOException::class)
- override fun serialize(value: LocalTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
- val str = p.text
- try {
- @Suppress("MagicNumber")
- return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- return null
- }
- }
-}
-
-class OffsetDateTimeSerializer : JsonSerializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetDateTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
- val str = p.text
- return try {
- OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
-
-class OffsetTimeSerializer : JsonSerializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun serialize(value: OffsetTime, gen: JsonGenerator, provider: SerializerProvider) {
- try {
- val s = value.atDate(LocalDate.now()).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- gen.writeString(s)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- gen.writeString("")
- }
- }
-}
-
-class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
- @Throws(IOException::class)
- override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
- val str = p.text
- return try {
- OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
- } catch (e: DateTimeParseException) {
- System.err.println(e)
- null
- }
- }
-}
diff --git a/kvision-modules/kvision-tabulator-remote/build.gradle b/kvision-modules/kvision-tabulator-remote/build.gradle
deleted file mode 100644
index d498e275..00000000
--- a/kvision-modules/kvision-tabulator-remote/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile project(":kvision-modules:kvision-tabulator")
- compile project(":kvision-modules:kvision-remote")
-}
diff --git a/kvision-modules/kvision-tabulator-remote/build.gradle.kts b/kvision-modules/kvision-tabulator-remote/build.gradle.kts
new file mode 100644
index 00000000..e6beb1c5
--- /dev/null
+++ b/kvision-modules/kvision-tabulator-remote/build.gradle.kts
@@ -0,0 +1,42 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ api(project(":kvision-modules:kvision-tabulator"))
+ api(project(":kvision-modules:kvision-common-remote"))
+ compileOnly(project(":kvision-modules:kvision-server-javalin"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-tabulator-remote/package.json.d/project.info b/kvision-modules/kvision-tabulator-remote/package.json.d/project.info
deleted file mode 100644
index c6af34cc..00000000
--- a/kvision-modules/kvision-tabulator-remote/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Tabulator remote addon module"
-}
diff --git a/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt b/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
index b413066e..c9e8e208 100644
--- a/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
+++ b/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
@@ -49,7 +49,7 @@ import kotlin.browser.window
* @param types a set of table types
* @param classes a set of CSS class names
*/
-@UseExperimental(ImplicitReflectionSerializer::class)
+@OptIn(ImplicitReflectionSerializer::class)
open class TabulatorRemote<T : Any, E : Any>(
serviceManager: KVServiceManager<E>,
function: suspend E.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<T>,
@@ -72,12 +72,14 @@ open class TabulatorRemote<T : Any, E : Any>(
options.ajaxRequestFunc = { _, _, params ->
val page = params.page
val size = params.size
+
@Suppress("UnsafeCastFromDynamic")
val filters = if (params.filters != null) {
kotlin.js.JSON.stringify(params.filters)
} else {
null
}
+
@Suppress("UnsafeCastFromDynamic")
val sorters = if (params.sorters != null) {
kotlin.js.JSON.stringify(params.sorters)
@@ -85,6 +87,7 @@ open class TabulatorRemote<T : Any, E : Any>(
null
}
val state = stateFunction?.invoke()
+
@Suppress("UnsafeCastFromDynamic")
val data = JSON.plain.stringify(JsonRpcRequest(0, url, listOf(page, size, filters, sorters, state)))
callAgent.remoteCall(url, data, method = HttpMethod.valueOf(method.name)).then { r: dynamic ->
diff --git a/kvision-modules/kvision-tabulator-remote/webpack.config.d/bootstrap.js b/kvision-modules/kvision-tabulator-remote/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-tabulator-remote/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-tabulator-remote/webpack.config.d/file.js b/kvision-modules/kvision-tabulator-remote/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-tabulator-remote/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-tabulator/build.gradle b/kvision-modules/kvision-tabulator/build.gradle
deleted file mode 100644
index 4ac457b1..00000000
--- a/kvision-modules/kvision-tabulator/build.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-apply from: "../shared.gradle"
-
-kotlinFrontend {
-
- npm {
- dependency("tabulator-tables", "4.5.3")
- }
-
-}
diff --git a/kvision-modules/kvision-tabulator/build.gradle.kts b/kvision-modules/kvision-tabulator/build.gradle.kts
new file mode 100644
index 00000000..289483f3
--- /dev/null
+++ b/kvision-modules/kvision-tabulator/build.gradle.kts
@@ -0,0 +1,46 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation(npm("tabulator-tables", "4.5.3"))
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
+
+tasks {
+ getByName("JsJar", Jar::class) {
+ from("${rootProject.buildDir}/js/packages/kvision-${project.name}/package.json")
+ }
+}
diff --git a/kvision-modules/kvision-tabulator/package.json.d/project.info b/kvision-modules/kvision-tabulator/package.json.d/project.info
deleted file mode 100644
index 19e574ef..00000000
--- a/kvision-modules/kvision-tabulator/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision Tabulator module"
-}
diff --git a/kvision-modules/kvision-tabulator/webpack.config.d/bootstrap.js b/kvision-modules/kvision-tabulator/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-tabulator/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-tabulator/webpack.config.d/file.js b/kvision-modules/kvision-tabulator/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-tabulator/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/kvision-testutils/build.gradle b/kvision-modules/kvision-testutils/build.gradle
deleted file mode 100644
index ad0ffd2e..00000000
--- a/kvision-modules/kvision-testutils/build.gradle
+++ /dev/null
@@ -1,61 +0,0 @@
-apply plugin: 'kotlin-platform-js'
-
-task cleanLibs(type: Delete) {
- delete 'build/js', 'build/libs'
-}
-
-if (project.gradle.startParameter.taskNames.contains("jar")) {
- compileKotlin2Js.dependsOn 'cleanLibs'
-}
-
-jar {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-}
-
-task testJar(type: Jar, dependsOn: testClasses) {
- baseName = "${project.archivesBaseName}"
- classifier = "tests"
- from sourceSets.test.output
-}
-
-configurations {
- tests
-}
-
-artifacts {
- tests testJar
-}
-
-publishing {
- publications {
- mavenProject(MavenPublication) {
- artifact testJar {
- classifier 'tests'
- }
- }
- }
-}
-
-compileKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-compileTestKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
- compile "org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion"
- if (!project.gradle.startParameter.taskNames.contains("generatePomFileForMavenProjectPublication")) {
- compile project(":kvision-modules:kvision-base")
- } else {
- compile rootProject
- }
-}
diff --git a/kvision-modules/kvision-testutils/build.gradle.kts b/kvision-modules/kvision-testutils/build.gradle.kts
new file mode 100644
index 00000000..efd29e1b
--- /dev/null
+++ b/kvision-modules/kvision-testutils/build.gradle.kts
@@ -0,0 +1,48 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.test.get().kotlin)
+}
+
+val testJar by tasks.registering(Jar::class) {
+ dependsOn("testClasses")
+ archiveClassifier.set("tests")
+ from(tasks["compileTestKotlinJs"].outputs)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ artifact(tasks["testJar"]) {
+ classifier = "tests"
+ }
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-testutils/webpack.config.d/bootstrap.js b/kvision-modules/kvision-testutils/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-testutils/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-testutils/webpack.config.d/css.js b/kvision-modules/kvision-testutils/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-testutils/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-testutils/webpack.config.d/file.js b/kvision-modules/kvision-testutils/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-testutils/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);
diff --git a/kvision-modules/shared.gradle b/kvision-modules/shared.gradle
deleted file mode 100644
index f6ee1509..00000000
--- a/kvision-modules/shared.gradle
+++ /dev/null
@@ -1,77 +0,0 @@
-apply plugin: 'kotlin-platform-js'
-apply plugin: 'org.jetbrains.kotlin.frontend'
-apply plugin: 'kotlinx-serialization'
-
-kotlinFrontend {
-
- npm {
- devDependency("karma", "4.4.1")
- devDependency("karma-chrome-launcher", "3.1.0")
- devDependency("karma-webpack", "4.0.2")
- devDependency("qunit", "2.9.3")
- }
-
- webpackBundle {
- bundleName = "main"
- contentPath = file('src/main/web')
- mode = production ? "production" : "development"
- }
-
- define "PRODUCTION", production
-
- karma {
- plugins = ["karma-chrome-launcher"]
- browsers = ["ChromeHeadless"]
- }
-}
-
-
-dependencies {
- if (!project.gradle.startParameter.taskNames.contains("generatePomFileForMavenProjectPublication")) {
- compile project(":kvision-modules:kvision-base")
- } else {
- compile rootProject
- }
-}
-
-task cleanLibs(type: Delete) {
- delete 'build/js', 'build/libs'
-}
-
-if (project.gradle.startParameter.taskNames.contains("jar")) {
- compileKotlin2Js.dependsOn 'cleanLibs'
-}
-
-jar {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-}
-
-compileKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-compileTestKotlin2Js {
- kotlinOptions.metaInfo = true
- kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
- kotlinOptions.sourceMap = !production
- kotlinOptions.moduleKind = 'umd'
-}
-
-task copyResources(type: Copy) {
- from "src/main/resources"
- into file(buildDir.path + "/js")
-}
-
-task copyResourcesForTests(type: Copy) {
- from "src/main/resources"
- into file(buildDir.path + "/js-tests/")
-}
-
-afterEvaluate {
- tasks.getByName("webpack-bundle") { dependsOn(copyResources) }
- tasks.getByName("webpack-run") { dependsOn(copyResources) }
- tasks.getByName("karma-start") { dependsOn(copyResources, copyResourcesForTests) }
-}