@tokamakdev/platform-macos-x64 0.1.1-beta.152 → 0.1.1-beta.154
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.
- package/macos-x64/frameworks/TokamakRuntime.framework/TokamakRuntime +0 -0
- package/macos-x64/native-shell/TokamakExports.swift +2 -7
- package/macos-x64/native-shell/TokamakPlugins.swift +2 -49
- package/macos-x64/native-shell/TokamakResources.swift +2 -2
- package/macos-x64/tools/tokamak-swift-describe +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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:
|
|
11
|
+
func retain(_ object: Any, reply: TokamakPluginBytesReply) -> () -> Void {
|
|
12
12
|
let id = UUID().uuidString
|
|
13
13
|
lock.withLock { objects[id] = object }
|
|
14
|
-
reply(
|
|
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:
|
|
4
|
+
sha256: 020048e744fe97f7c874aec5395f0ca717cacd52c7c038019e4c1257e46900c3
|