@tokamakdev/platform-macos-x64 0.1.1-beta.151 → 0.1.1-beta.153

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.
@@ -411,9 +411,7 @@ func tokamakResource(
411
411
  _ resources: TokamakResources, _ reply: @escaping TokamakPluginBytesReply,
412
412
  _ method: () throws -> Any
413
413
  ) throws(TokamakPluginError) -> () -> Void {
414
- resources.retain(try catching(method)) {
415
- reply(TokamakPluginResult($0.flatMap(encodePluginValue), done: false))
416
- }
414
+ resources.retain(try catching(method), reply: reply)
417
415
  }
418
416
 
419
417
  func tokamakResource(
@@ -424,10 +422,7 @@ func tokamakResource(
424
422
  let cancel = task {
425
423
  do {
426
424
  let object = try await method()
427
- retained.hold(
428
- resources.retain(object) {
429
- reply(TokamakPluginResult($0.flatMap(encodePluginValue), done: false))
430
- })
425
+ retained.hold(resources.retain(object, reply: reply))
431
426
  } catch {
432
427
  reply(TokamakPluginResult(.failure(TokamakPluginError(error)), done: true))
433
428
  }
@@ -263,23 +263,6 @@ protocol TokamakPlugin: AnyObject {
263
263
  reply: @escaping TokamakPluginReply
264
264
  ) -> (() -> Void)?
265
265
 
266
- /// A call whose `body` of bytes the Worker streams, which the plugin reads
267
- /// one chunk at a time.
268
- func call(
269
- method: String,
270
- arguments: Any,
271
- body: TokamakPluginBody,
272
- reply: @escaping TokamakPluginReply
273
- ) -> (() -> Void)?
274
-
275
- /// Replies with each value until the returned function is called. Throws
276
- /// when the subscription cannot start, which ends it.
277
- func subscribe(
278
- method: String,
279
- arguments: Any,
280
- reply: @escaping TokamakPluginReply
281
- ) throws(TokamakPluginError) -> (() -> Void)
282
-
283
266
  func didRegisterForRemoteNotifications(deviceToken: Data)
284
267
 
285
268
  func didFailToRegisterForRemoteNotifications(error: Error)
@@ -307,17 +290,13 @@ extension TokamakPlugin {
307
290
  method: String, payload: Data, body: TokamakPluginBody,
308
291
  reply: @escaping TokamakPluginBytesReply
309
292
  ) throws(TokamakPluginError) -> (() -> Void)? {
310
- try call(method: method, arguments: decodePluginValue(payload), body: body) {
311
- reply(TokamakPluginResult($0.flatMap(encodePluginValue), done: true))
312
- }
293
+ throw .notSupported("\(id).\(method) does not take a body")
313
294
  }
314
295
 
315
296
  func subscribeBytes(method: String, payload: Data, reply: @escaping TokamakPluginBytesReply)
316
297
  throws(TokamakPluginError) -> (() -> Void)
317
298
  {
318
- try subscribe(method: method, arguments: decodePluginValue(payload)) {
319
- reply(TokamakPluginResult($0.flatMap(encodePluginValue), done: false))
320
- }
299
+ throw .notSupported("\(id).\(method) is not supported")
321
300
  }
322
301
 
323
302
  func call(
@@ -329,24 +308,6 @@ extension TokamakPlugin {
329
308
  return nil
330
309
  }
331
310
 
332
- func call(
333
- method: String,
334
- arguments: Any,
335
- body: TokamakPluginBody,
336
- reply: @escaping TokamakPluginReply
337
- ) -> (() -> Void)? {
338
- reply(.failure(.notSupported("\(id).\(method) does not take a body")))
339
- return nil
340
- }
341
-
342
- func subscribe(
343
- method: String,
344
- arguments: Any,
345
- reply: @escaping TokamakPluginReply
346
- ) throws(TokamakPluginError) -> (() -> Void) {
347
- throw .notSupported("\(id).\(method) is not supported")
348
- }
349
-
350
311
  func didRegisterForRemoteNotifications(deviceToken: Data) {}
351
312
 
352
313
  func didFailToRegisterForRemoteNotifications(error: Error) {}
@@ -485,14 +446,6 @@ final class TokamakPluginRequests<Key: Hashable> {
485
446
  if let request = lock.withLock({ pending.removeValue(forKey: key) }) { cancel(request) }
486
447
  }
487
448
 
488
- func cancelAll() {
489
- let requests = lock.withLock {
490
- defer { pending.removeAll() }
491
- return Array(pending.values)
492
- }
493
- for request in requests { cancel(request) }
494
- }
495
-
496
449
  /// Runs the operation's cancellation on its executor.
497
450
  private func cancel(_ request: Request) {
498
451
  request.queue.async {
@@ -8,10 +8,10 @@ final class TokamakResources {
8
8
 
9
9
  /// Keeps `object`, replies with its ID, and returns the release to return
10
10
  /// from `subscribe`.
11
- func retain(_ object: Any, reply: TokamakPluginReply) -> () -> Void {
11
+ func retain(_ object: Any, reply: TokamakPluginBytesReply) -> () -> Void {
12
12
  let id = UUID().uuidString
13
13
  lock.withLock { objects[id] = object }
14
- reply(.success(id))
14
+ reply(TokamakPluginResult(encodePluginValue(id), done: false))
15
15
  return { [self] in drop(lock.withLock { objects.removeValue(forKey: id) }) }
16
16
  }
17
17
 
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/macos-x64/tools/tokamak-swift-describe
3
3
  size: 34569672 bytes
4
- sha256: 76edf887782e0da5c2f7ac15015ba8ddb4aaf2165e757a0e65556625ff864cad
4
+ sha256: dd1f764ea91e577e3691d87c064c1cd1357203b1d7213010f51e8db033cdbbc7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-macos-x64",
3
- "version": "0.1.1-beta.151",
3
+ "version": "0.1.1-beta.153",
4
4
  "description": "The tokamak platform pack for macos-x64",
5
5
  "repository": {
6
6
  "type": "git",