-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add wasmJs target * add comment * crash
- Loading branch information
1 parent
84f0f92
commit 1c939f9
Showing
42 changed files
with
1,017 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...src/wasmJsMain/kotlin/com/apollographql/apollo3/annotations/ApolloAdaptableWith.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.apollographql.apollo3.annotations | ||
|
||
import kotlin.reflect.AssociatedObjectKey | ||
import kotlin.reflect.ExperimentalAssociatedObjects | ||
import kotlin.reflect.KClass | ||
|
||
@OptIn(ExperimentalAssociatedObjects::class) | ||
@AssociatedObjectKey | ||
@Retention(AnnotationRetention.BINARY) | ||
actual annotation class ApolloAdaptableWith(public actual val adapter: KClass<*>) |
6 changes: 6 additions & 0 deletions
6
...ries/apollo-api/src/wasmJsMain/kotlin/com/apollographql/apollo3/api/-FileSystem.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.apollographql.apollo3.api | ||
|
||
import okio.FileSystem | ||
|
||
internal actual val systemFileSystem: FileSystem | ||
get() = throw IllegalStateException("There is no SYSTEM filesystem on JS") |
5 changes: 5 additions & 0 deletions
5
...apollo-api/src/wasmJsMain/kotlin/com/apollographql/apollo3/api/apolloUnsafeCast.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.apollographql.apollo3.api | ||
|
||
actual inline fun <reified T> Any.apolloUnsafeCast(): T { | ||
TODO() | ||
} |
17 changes: 17 additions & 0 deletions
17
libraries/apollo-api/src/wasmJsMain/kotlin/com/apollographql/apollo3/api/toJson.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.apollographql.apollo3.api | ||
|
||
import com.apollographql.apollo3.annotations.ApolloAdaptableWith | ||
import com.apollographql.apollo3.api.json.JsonWriter | ||
import kotlin.reflect.ExperimentalAssociatedObjects | ||
import kotlin.reflect.findAssociatedObject | ||
|
||
@OptIn(ExperimentalAssociatedObjects::class) | ||
actual fun Operation.Data.toJson( | ||
jsonWriter: JsonWriter, | ||
customScalarAdapters: CustomScalarAdapters, | ||
) { | ||
@Suppress("UNCHECKED_CAST") | ||
val adapter = this::class.findAssociatedObject<ApolloAdaptableWith>() as Adapter<Any> | ||
|
||
adapter.obj(false).toJson(jsonWriter, customScalarAdapters, this) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/host.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.apollographql.apollo3.ast | ||
|
||
import okio.FileSystem | ||
|
||
internal expect val HOST_FILESYSTEM: FileSystem |
6 changes: 6 additions & 0 deletions
6
libraries/apollo-ast/src/wasmJsMain/kotlin/com/apollographql/apollo3/ast/host.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.apollographql.apollo3.ast | ||
|
||
import okio.FileSystem | ||
|
||
internal actual val HOST_FILESYSTEM: FileSystem | ||
get() = TODO("Not yet implemented") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ apolloLibrary( | |
withLinux = false, | ||
withApple = false, | ||
withJs = false, | ||
withWasm = false | ||
) | ||
|
||
kotlin { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...mockserver/src/wasmJsMain/kotlin/com/apollographql/apollo3/mockserver/TcpServer.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.apollographql.apollo3.mockserver | ||
|
||
import com.apollographql.apollo3.annotations.ApolloExperimental | ||
|
||
@ApolloExperimental | ||
actual fun TcpServer(port: Int): TcpServer { | ||
TODO("Not yet implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ expect fun currentThreadName(): String | |
enum class Platform { | ||
Jvm, | ||
Native, | ||
Js | ||
Js, | ||
WasmJs | ||
} | ||
|
||
/** | ||
|
18 changes: 18 additions & 0 deletions
18
...ries/apollo-mpp-utils/src/wasmJsMain/kotlin/com/apollographql/apollo3/mpp/utils.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.apollographql.apollo3.mpp | ||
|
||
private fun currentTimeMillis2(): Double = js("(new Date()).getTime()") | ||
actual fun currentTimeMillis(): Long { | ||
return currentTimeMillis2().toLong() | ||
} | ||
|
||
actual fun currentTimeFormatted(): String = js("(new Date()).toISOString()") | ||
|
||
actual fun currentThreadId(): String { | ||
return "wasm-js" | ||
} | ||
|
||
actual fun currentThreadName(): String { | ||
return currentThreadId() | ||
} | ||
|
||
actual fun platform() = Platform.WasmJs |
7 changes: 7 additions & 0 deletions
7
...Main/kotlin/com/apollographql/apollo3/cache/normalized/api/internal/-cache-lock.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.apollographql.apollo3.cache.normalized.api.internal | ||
|
||
internal actual class CacheLock actual constructor() { | ||
actual fun <T> lock(block: () -> T): T { | ||
return block() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...Main/kotlin/com/apollographql/apollo3/cache/normalized/api/internal/-cache-lock.wasmJs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.apollographql.apollo3.cache.normalized.api.internal | ||
|
||
internal actual class CacheLock actual constructor() { | ||
actual fun <T> lock(block: () -> T): T { | ||
return block() | ||
} | ||
} |
Oops, something went wrong.