@tokamakdev/platform-android-arm64 0.1.1-beta.50 → 0.1.1-beta.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -38,8 +38,8 @@ class TokamakApplication : Application(), TokamakHost {
38
38
  requireNotNull(metadata()?.getString(HOST_METADATA)) { "$HOST_METADATA is required" }
39
39
  }
40
40
 
41
- override fun dispatch(event: String, payload: String, timeoutMillis: Long): String? =
42
- runtime.dispatch(event, payload, timeoutMillis)
41
+ override fun call(name: String, body: String, timeoutMillis: Long): String =
42
+ runtime.call(name, body, timeoutMillis)
43
43
 
44
44
  override fun plugin(id: String): TokamakPlugin? = plugins[id]
45
45
 
@@ -15,12 +15,11 @@ internal class TokamakRuntime private constructor(private val handle: Long) {
15
15
  fun resume() = nativeResume(handle)
16
16
 
17
17
  /**
18
- * Runs the Worker's [event] handler with a JSON [payload], blocking until it settles or
19
- * [timeoutMillis] passes. Returns the handler's JSON result, or null when the Worker has
20
- * no such handler.
18
+ * Posts the JSON [body] to the Worker's `/tokamak/<name>` endpoint, blocking until it
19
+ * responds 200 or [timeoutMillis] passes, and returns the response body.
21
20
  */
22
- fun dispatch(event: String, payload: String, timeoutMillis: Long): String? =
23
- nativeDispatch(handle, event, payload, timeoutMillis)
21
+ fun call(name: String, body: String, timeoutMillis: Long): String =
22
+ nativeCall(handle, name, body, timeoutMillis)
24
23
 
25
24
  /**
26
25
  * The authority a server certificate for [host] must chain to, or null
@@ -77,12 +76,12 @@ internal class TokamakRuntime private constructor(private val handle: Long) {
77
76
  private external fun nativeResume(handle: Long)
78
77
 
79
78
  @JvmStatic
80
- private external fun nativeDispatch(
79
+ private external fun nativeCall(
81
80
  handle: Long,
82
- event: String,
83
- payload: String,
81
+ name: String,
82
+ body: String,
84
83
  timeoutMillis: Long,
85
- ): String?
84
+ ): String
86
85
 
87
86
  @JvmStatic
88
87
  private external fun nativeServerAuthority(handle: Long, host: String): ByteArray?
@@ -52,12 +52,11 @@ interface TokamakHost {
52
52
  val activity: Activity?
53
53
 
54
54
  /**
55
- * Runs the Worker's [event] handler with a JSON [payload], including work it passes to
56
- * `ctx.waitUntil`, and returns the handler's JSON result; null when the Worker has no
57
- * handler for [event]. Starts the runtime when it is not running. Blocks, so call it
58
- * off the main thread; throws when the handler fails or runs longer than [timeoutMillis].
55
+ * Posts the JSON [body] to the Worker's `/tokamak/<name>` endpoint and returns the
56
+ * response body. Starts the runtime when it is not running. Blocks, so call it off the main
57
+ * thread; throws unless the Worker responds 200 within [timeoutMillis].
59
58
  */
60
- fun dispatch(event: String, payload: String, timeoutMillis: Long): String?
59
+ fun call(name: String, body: String, timeoutMillis: Long): String
61
60
 
62
61
  /** The plugin with [id], or null when the app does not include it. */
63
62
  fun plugin(id: String): TokamakPlugin?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-android-arm64",
3
- "version": "0.1.1-beta.50",
3
+ "version": "0.1.1-beta.51",
4
4
  "description": "The tokamak platform pack for android-arm64",
5
5
  "repository": {
6
6
  "type": "git",