peachsim 0.1.1738 → 0.1.1744

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.
Files changed (327) hide show
  1. package/README.md +4 -0
  2. package/cli/app-catalog.ts +47 -23
  3. package/cli/app-fonts.ts +19 -1
  4. package/cli/command-registry.ts +3 -0
  5. package/cli/commands/control.ts +67 -16
  6. package/cli/commands/device.ts +3 -1
  7. package/cli/commands/doctor.ts +1 -4
  8. package/cli/commands/inspect/settling.ts +6 -1
  9. package/cli/commands/inspect/wait-ready.ts +22 -2
  10. package/cli/commands/package.ts +22 -20
  11. package/cli/commands/push.ts +56 -0
  12. package/cli/commands/serve.ts +9 -0
  13. package/cli/commands/shell-url.ts +37 -9
  14. package/cli/commands/swift.ts +1 -1
  15. package/cli/current-sim.ts +27 -0
  16. package/cli/drivers/linux-browser-libs.lock.json +323 -1
  17. package/cli/drivers/linux-browser-libs.ts +8 -6
  18. package/cli/drivers/playwright.ts +5 -1
  19. package/cli/internal-child.ts +11 -1
  20. package/cli/main.ts +6 -0
  21. package/cli/native-input.ts +1 -7
  22. package/cli/outbound-endpoints.ts +9 -1
  23. package/cli/packaged-app-launcher.ts +3 -1
  24. package/cli/scene-video.ts +4 -0
  25. package/cli/ws-bridge.ts +3 -1
  26. package/detox/index.ts +9 -4
  27. package/dist-lib/agent-daemon-client.cjs +1 -1
  28. package/dist-lib/agent-events.cjs +1 -1
  29. package/dist-lib/attached-projects.cjs +1 -1
  30. package/dist-lib/auth/shared-session.cjs +1 -1
  31. package/dist-lib/backend-origin.cjs +1 -1
  32. package/dist-lib/beta.cjs +1 -1
  33. package/dist-lib/beta.mjs +1 -1
  34. package/dist-lib/bridge-constants.cjs +1 -1
  35. package/dist-lib/bridge-contract-input.cjs +1 -1
  36. package/dist-lib/bridge-contract-input.mjs +1 -1
  37. package/dist-lib/bridge-contract.cjs +1 -1
  38. package/dist-lib/bridge-contract.mjs +1 -1
  39. package/dist-lib/bundle-channel.cjs +7372 -3675
  40. package/dist-lib/capture-contract.cjs +1 -1
  41. package/dist-lib/capture-contract.mjs +1 -1
  42. package/dist-lib/cloud-contract.cjs +1 -1
  43. package/dist-lib/cloud-contract.mjs +1 -1
  44. package/dist-lib/cloud-test-args.cjs +1 -1
  45. package/dist-lib/cloud-test-args.mjs +1 -1
  46. package/dist-lib/cloud.cjs +1 -1
  47. package/dist-lib/cloud.mjs +1 -1
  48. package/dist-lib/config.cjs +1 -1
  49. package/dist-lib/config.mjs +1 -1
  50. package/dist-lib/detox/index.cjs +22 -8
  51. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  52. package/dist-lib/expo-swift-bundle.cjs +6340 -3064
  53. package/dist-lib/expo-swift-metadata.cjs +14 -2
  54. package/dist-lib/expo-swift-metadata.mjs +14 -2
  55. package/dist-lib/home-paths.cjs +1 -1
  56. package/dist-lib/host/bridge-host.cjs +6524 -2720
  57. package/dist-lib/host/fetch-proxy-handler.cjs +8 -7
  58. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  59. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  60. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  61. package/dist-lib/host/websocket-proxy.cjs +6 -3
  62. package/dist-lib/index.cjs +97 -31
  63. package/dist-lib/jump-to-source-babel.cjs +1 -1
  64. package/dist-lib/jump-to-source-native.cjs +1 -1
  65. package/dist-lib/kotlin-host.cjs +1 -1
  66. package/dist-lib/menu.cjs +1 -1
  67. package/dist-lib/menu.mjs +1 -1
  68. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  69. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  70. package/dist-lib/metro-production-bundle.cjs +1 -1
  71. package/dist-lib/metro-production-bundle.mjs +1 -1
  72. package/dist-lib/metro.cjs +71 -29
  73. package/dist-lib/native-app-identity-project.cjs +53 -22
  74. package/dist-lib/native-app-identity-project.mjs +53 -22
  75. package/dist-lib/native-app-identity.cjs +10 -3
  76. package/dist-lib/native-app-identity.mjs +10 -3
  77. package/dist-lib/native-firebase-metadata.cjs +1 -1
  78. package/dist-lib/native-firebase-metadata.mjs +1 -1
  79. package/dist-lib/plist.cjs +1 -1
  80. package/dist-lib/plist.mjs +1 -1
  81. package/dist-lib/profiles.cjs +1 -1
  82. package/dist-lib/public-brand.cjs +1 -1
  83. package/dist-lib/public-origins-lib-esm.json +25 -23
  84. package/dist-lib/public-origins-lib.json +111 -79
  85. package/dist-lib/react-native-host-modules.cjs +1 -1
  86. package/dist-lib/react-native-host-modules.mjs +1 -1
  87. package/dist-lib/reap-browser.cjs +1 -1
  88. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  89. package/dist-lib/sdk.cjs +4 -1
  90. package/dist-lib/sdk.mjs +4 -1
  91. package/dist-lib/skills.cjs +40549 -37613
  92. package/dist-lib/swift-compile.cjs +2054 -388
  93. package/dist-lib/swift-compile.mjs +1976 -312
  94. package/dist-lib/swift-package.cjs +1 -1
  95. package/dist-lib/swift-package.mjs +1 -1
  96. package/dist-lib/swift-submit.cjs +2 -2
  97. package/dist-lib/swift-submit.mjs +2 -2
  98. package/dist-lib/swift-toolchain.cjs +68 -8
  99. package/dist-lib/swift.cjs +1 -1
  100. package/dist-lib/vite-swift.cjs +5867 -2646
  101. package/dist-lib/vite.cjs +18 -8
  102. package/dist-lib/worklet-executable.cjs +1 -1
  103. package/dist-lib/worklet-executable.mjs +1 -1
  104. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -0
  105. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  106. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +2 -0
  107. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +0 -3
  108. package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -0
  109. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
  110. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +25 -3
  111. package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +1 -15
  112. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +1 -3
  113. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +1 -0
  114. package/dist-types/packages/peach-engine/src/engine/types.d.ts +23 -0
  115. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
  116. package/dist-types/packages/peach-engine/src/metro-identity-contract.d.ts +33 -0
  117. package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +1 -1
  118. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +2 -0
  119. package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
  120. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -0
  121. package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +28 -0
  122. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +21 -1
  123. package/dist-types/packages/peach-engine/src/render-worker/prepared-boot-bundle.d.ts +7 -0
  124. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +8 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +1 -0
  126. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  127. package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +3 -3
  128. package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +1 -0
  129. package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +1 -1
  130. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +1 -0
  131. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +8 -1
  132. package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +1 -4
  133. package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +12 -0
  134. package/dist-types/packages/peach-engine/src/rolldown-production-roles.d.ts +6 -0
  135. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +6 -1
  136. package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +1 -0
  137. package/dist-types/packages/peach-engine/src/shell-events.d.ts +4 -0
  138. package/dist-types/packages/peach-kit/src/capabilities.d.ts +7 -0
  139. package/package.json +2 -1
  140. package/runtime-companion.json +1 -1
  141. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
  142. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkErrors.h +257 -0
  143. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h +305 -0
  144. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +2 -0
  145. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h +204 -0
  146. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h +260 -0
  147. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h +164 -0
  148. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorConversionInfo.h +101 -0
  149. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h +510 -0
  150. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h +1132 -0
  151. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGConvertColorDataWithFormat.h +34 -0
  152. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataConsumer.h +83 -0
  153. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataProvider.h +197 -0
  154. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEXRToneMappingGamma.h +36 -0
  155. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGError.h +38 -0
  156. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h +312 -0
  157. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFunction.h +106 -0
  158. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h +123 -0
  159. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGITUToneMapping.h +31 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h +409 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGLayer.h +78 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h +120 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContentStream.h +55 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h +535 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h +133 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h +252 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFMarkedContentItem.h +37 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFObject.h +67 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFOperatorTable.h +51 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h +101 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFScanner.h +123 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStream.h +44 -0
  173. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFString.h +52 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStructureElement.h +87 -0
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h +441 -0
  176. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPattern.h +89 -0
  177. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGRenderingBufferProvider.h +49 -0
  178. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGShading.h +124 -0
  179. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGToneMapping.h +85 -0
  180. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +44 -252
  181. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +1 -0
  182. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/CFNetworkErrors.h +257 -0
  183. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +0 -6
  184. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +356 -61
  185. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/NSURLSession+Network.h +32 -0
  186. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/Network.h +51 -0
  187. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/advertise_descriptor.h +193 -0
  188. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_descriptor.h +163 -0
  189. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_result.h +207 -0
  190. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browser.h +285 -0
  191. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection.h +714 -0
  192. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_group.h +629 -0
  193. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_report.h +932 -0
  194. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/content_context.h +229 -0
  195. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/endpoint.h +390 -0
  196. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/error.h +135 -0
  197. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ethernet_channel.h +349 -0
  198. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/framer_options.h +1187 -0
  199. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/group_descriptor.h +184 -0
  200. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/interface.h +150 -0
  201. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ip_options.h +351 -0
  202. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/listener.h +438 -0
  203. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/nw_object.h +200 -0
  204. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/parameters.h +1205 -0
  205. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path.h +392 -0
  206. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path_monitor.h +216 -0
  207. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/privacy_context.h +188 -0
  208. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/protocol_options.h +126 -0
  209. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/proxy_config.h +357 -0
  210. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/quic_options.h +889 -0
  211. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/resolver_config.h +94 -0
  212. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tcp_options.h +459 -0
  213. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tls_options.h +115 -0
  214. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/txt_record.h +432 -0
  215. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/udp_options.h +112 -0
  216. package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ws_options.h +743 -0
  217. package/sdk/ios/System/Library/Frameworks/Network.framework/Modules/module.modulemap +9 -0
  218. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h +395 -0
  219. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h +132 -0
  220. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CADisplayLink.h +107 -0
  221. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +153 -0
  222. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +151 -0
  223. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAFrameRateRange.h +40 -0
  224. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +78 -0
  225. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1078 -0
  226. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h +97 -0
  227. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTimingFunction.h +67 -0
  228. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +65 -0
  229. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +64 -0
  230. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +135 -0
  231. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +99 -0
  232. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +67 -0
  233. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransaction.h +124 -0
  234. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h +138 -0
  235. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +40 -0
  236. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +78 -0
  237. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +19 -38
  238. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecureTransport.h +1757 -0
  239. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSAttributedString.h +19 -0
  240. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +28 -0
  241. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +114 -0
  242. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +16 -0
  243. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarAppearance.h +47 -0
  244. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDataDetectors.h +20 -0
  245. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDatePicker.h +13 -0
  246. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +16 -0
  247. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +84 -0
  248. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +119 -0
  249. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +66 -0
  250. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +45 -0
  251. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +161 -37
  252. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h +76 -0
  253. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +8 -0
  254. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBarAppearance.h +78 -0
  255. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITextInputTraits.h +29 -0
  256. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +104 -0
  257. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +19 -0
  258. package/sdk/ios/usr/include/dns_sd.h +3616 -0
  259. package/sdk/ios/usr/include/dnssd.modulemap +4 -0
  260. package/sdk/ios/usr/include/module.modulemap +1 -0
  261. package/sdk/ios/usr/include/sys/socketvar.h +191 -0
  262. package/sdk/ios/usr/include/sys/vsock.h +84 -0
  263. package/sdk/native-hashes.json +1 -1
  264. package/skills/contrast/SKILL.md +6 -5
  265. package/skills/peach-debug/SKILL.md +68 -264
  266. package/skills/peach-debug/references/accessibility.md +37 -73
  267. package/skills/peach-debug/references/commands.md +2 -2
  268. package/skills/peach-debug/references/events.md +74 -0
  269. package/skills/peach-perf/SKILL.md +64 -401
  270. package/skills/peach-perf/references/presentation.md +46 -0
  271. package/skills/peach-perf/references/profiling.md +93 -0
  272. package/skills/peach-perf/references/render-counters.md +57 -0
  273. package/skills/peach-setup/SKILL.md +66 -216
  274. package/skills/peach-setup/references/native-config.md +35 -0
  275. package/skills/peach-setup/references/reporting.md +28 -0
  276. package/skills/peach-test/SKILL.md +68 -284
  277. package/skills/peach-test/references/detox.md +69 -0
  278. package/skills/peach-test/references/maestro.md +95 -0
  279. package/skills/peach-visual/SKILL.md +53 -105
  280. package/src/appPackageContract.ts +12 -1
  281. package/src/assetCatalogContract.ts +8 -1
  282. package/src/bridge-contract.ts +6 -0
  283. package/src/bundle-channel.mjs +133 -59
  284. package/src/cli-runtime.ts +8 -9
  285. package/src/configured-bundle-producer.ts +10 -0
  286. package/src/device-catalog.ts +68 -4
  287. package/src/expo-discovery-cache.ts +3 -0
  288. package/src/expo-native-workspace.ts +81 -17
  289. package/src/expo-swift-host.ts +57 -104
  290. package/src/expo-widget-assets.ts +76 -0
  291. package/src/expoSwiftContract.ts +13 -1
  292. package/src/host/websocket-proxy.ts +7 -2
  293. package/src/native-prebuilt.ts +3 -3
  294. package/src/nitro-adapter.lock.json +263 -263
  295. package/src/nitro-adapter.ts +69 -7
  296. package/src/nitro-bundle.ts +52 -24
  297. package/src/nitro-compile.ts +6 -1
  298. package/src/nitro-source.ts +82 -4
  299. package/src/nitro-superset.lock.json +103 -0
  300. package/src/nitro-superset.ts +137 -0
  301. package/src/nitroContract.ts +5 -1
  302. package/src/react-bridge-importers.ts +1 -0
  303. package/src/settingsContract.ts +26 -1
  304. package/src/swift-compile.ts +267 -68
  305. package/src/swift-compiler-digest.ts +2 -0
  306. package/src/swift-coverage/xcode-packages.ts +61 -1
  307. package/src/swift-coverage/xcode.ts +10 -12
  308. package/src/swift-cxx-reachable.ts +1 -1
  309. package/src/swift-distribution.lock.json +15 -13
  310. package/src/swift-distribution.ts +57 -26
  311. package/src/swift-host.ts +48 -35
  312. package/src/swift-link-roots.ts +45 -18
  313. package/src/swift-objc-compile.ts +78 -2
  314. package/src/swift-objc-standin.ts +3 -0
  315. package/src/swift-shared-sdk.ts +85 -1
  316. package/src/swift-standins.ts +233 -11
  317. package/src/swift-submit.ts +13 -1
  318. package/src/swift-toolchain.ts +82 -7
  319. package/src/swift-wasm-prune.ts +1629 -0
  320. package/src/turbo-bundle.ts +11 -10
  321. package/src/turbo-runtime.lock.json +16 -16
  322. package/src/vite-plugin-one.ts +12 -1
  323. package/src/vite-plugin.ts +82 -23
  324. package/src/wasm-optimize.ts +34 -0
  325. package/src/worker-system-chunks.ts +3 -3
  326. package/src/xcode-project.ts +52 -0
  327. package/src/xcode-target-members.ts +12 -1
@@ -0,0 +1,714 @@
1
+ //
2
+ // connection.h
3
+ // Network
4
+ //
5
+ // Copyright (c) 2015-2019, 2021 Apple Inc. All rights reserved.
6
+ //
7
+
8
+ #ifndef __NW_CONNECTION_H__
9
+ #define __NW_CONNECTION_H__
10
+
11
+ #ifndef __NW_INDIRECT__
12
+ #warning "Please include <Network/Network.h> instead of this file directly."
13
+ #endif // __NW_INDIRECT__
14
+
15
+ #include <Network/endpoint.h>
16
+ #include <Network/parameters.h>
17
+ #include <Network/path.h>
18
+ #include <Network/content_context.h>
19
+ #include <Network/error.h>
20
+
21
+
22
+ __BEGIN_DECLS
23
+
24
+ NW_ASSUME_NONNULL_BEGIN
25
+
26
+ /*!
27
+ * @typedef nw_connection_t
28
+ * @abstract
29
+ * A Network Connection is an object that represents a bi-directional data pipe between
30
+ * a local endpoint and a remote endpoint. A connection handles establishment of any
31
+ * transport, security, or application-level protocols required to transmit and receive
32
+ * user data. Multiple protocol instances may be attempted during the establishment phase
33
+ * of the connection. Multiple connections may be multiplexed over a single transport
34
+ * if they make use of a protocol that supports multiplexing.
35
+ *
36
+ * This type supports ARC and the -[description] method. In non-ARC files, use
37
+ * nw_retain() and nw_release() to retain and release the object.
38
+ */
39
+ #ifndef NW_CONNECTION_IMPL
40
+ NW_OBJECT_DECL(nw_connection);
41
+ #endif // NW_CONNECTION_IMPL
42
+
43
+ /*!
44
+ * @typedef nw_connection_state_t
45
+ * @abstract
46
+ * Connection states sent by nw_connection_set_state_changed_handler.
47
+ * States generally progress forward and do not move backwards, with the
48
+ * exception of preparing and waiting, which may alternate before the connection
49
+ * becomes ready or failed.
50
+ */
51
+ typedef enum {
52
+ /*!
53
+ * @const nw_connection_state_invalid The state of the connection is not valid. This state
54
+ * will never be delivered in the connection's state update handler, and can be treated as
55
+ * an unexpected value.
56
+ */
57
+ nw_connection_state_invalid = 0,
58
+ /*! @const nw_connection_state_waiting The connection is waiting for a usable network before re-attempting */
59
+ nw_connection_state_waiting = 1,
60
+ /*! @const nw_connection_state_preparing The connection is in the process of establishing */
61
+ nw_connection_state_preparing = 2,
62
+ /*! @const nw_connection_state_ready The connection is established and ready to send and receive data upon */
63
+ nw_connection_state_ready = 3,
64
+ /*! @const nw_connection_state_failed The connection has irrecoverably closed or failed */
65
+ nw_connection_state_failed = 4,
66
+ /*! @const nw_connection_state_cancelled The connection has been cancelled by the caller */
67
+ nw_connection_state_cancelled = 5,
68
+ } nw_connection_state_t;
69
+
70
+ /*!
71
+ * @function nw_connection_create
72
+ *
73
+ * @abstract
74
+ * Creates a networking connection to an endpoint.
75
+ *
76
+ * @param endpoint
77
+ * The remote endpoint to connect to.
78
+ *
79
+ * @param parameters
80
+ * The parameters to use for the connection. The data mode,
81
+ * either datagram or stream, must be set.
82
+ *
83
+ * @result
84
+ * Returns an allocated nw_connection_t object on success.
85
+ * Callers are responsible for deallocating using nw_release(obj) or [obj release].
86
+ * These objects support ARC.
87
+ * Returns NULL on failure. Fails due to invalid parameters.
88
+ */
89
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
90
+ NW_RETURNS_RETAINED nw_connection_t
91
+ nw_connection_create(nw_endpoint_t endpoint,
92
+ nw_parameters_t parameters);
93
+
94
+ /*!
95
+ * @function nw_connection_copy_endpoint
96
+ *
97
+ * @abstract
98
+ * Retrieves the remote endpoint for a connection.
99
+ *
100
+ * @param connection
101
+ * The connection object.
102
+ *
103
+ * @result
104
+ * Returns an nw_endpoint_t object on success.
105
+ * Returns NULL on failure. Fails due to invalid parameters.
106
+ */
107
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
108
+ NW_RETURNS_RETAINED nw_endpoint_t
109
+ nw_connection_copy_endpoint(nw_connection_t connection);
110
+
111
+ /*!
112
+ * @function nw_connection_copy_parameters
113
+ *
114
+ * @abstract
115
+ * Retrieves the parameters for a connection.
116
+ *
117
+ * @param connection
118
+ * The connection object.
119
+ *
120
+ * @result
121
+ * Returns an nw_parameters_t object on success.
122
+ * Returns NULL on failure. Fails due to invalid parameters.
123
+ */
124
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
125
+ NW_RETURNS_RETAINED nw_parameters_t
126
+ nw_connection_copy_parameters(nw_connection_t connection);
127
+
128
+ #ifdef __BLOCKS__
129
+
130
+ typedef void (^nw_connection_state_changed_handler_t)(nw_connection_state_t state,
131
+ _Nullable nw_error_t error);
132
+
133
+ /*!
134
+ * @function nw_connection_set_state_changed_handler
135
+ *
136
+ * @abstract
137
+ * Sets the state change handler. For clients that need to perform cleanup when the
138
+ * connection has been cancelled, the nw_connection_state_cancelled state will
139
+ * be delivered last.
140
+ *
141
+ * @param connection
142
+ * The connection object.
143
+ *
144
+ * @param handler
145
+ * The state changed handler to call when the connection state changes.
146
+ * Pass NULL to remove the state changed handler.
147
+ */
148
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
149
+ void
150
+ nw_connection_set_state_changed_handler(nw_connection_t connection,
151
+ _Nullable nw_connection_state_changed_handler_t handler);
152
+
153
+ typedef void (^nw_connection_boolean_event_handler_t)(bool value);
154
+
155
+ /*!
156
+ * @function nw_connection_set_viability_changed_handler
157
+ *
158
+ * @abstract
159
+ * Define a callback to be fired when the viability of the connection changes.
160
+ * This indicates whether or not read and write calls will succeed on a ready
161
+ * connection.
162
+ *
163
+ * @param connection
164
+ * The connection object.
165
+ *
166
+ * @param handler
167
+ * The event handler to call when the connection viability changes. The value will
168
+ * be true when the connection is viable, and false otherwise.
169
+ * Pass NULL to remove the event handler.
170
+ */
171
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
172
+ void
173
+ nw_connection_set_viability_changed_handler(nw_connection_t connection,
174
+ _Nullable nw_connection_boolean_event_handler_t handler);
175
+
176
+ /*!
177
+ * @function nw_connection_set_better_path_available_handler
178
+ *
179
+ * @abstract
180
+ * Define a callback to be fired when a better path is available or not.
181
+ * This indicates whether or not a preferred path is available for the
182
+ * connection.
183
+ *
184
+ * @param connection
185
+ * The connection object.
186
+ *
187
+ * @param handler
188
+ * The event handler to call when the better path availability changes. The value
189
+ * will be true when a better path is available, and false otherwise.
190
+ * Pass NULL to remove the event handler.
191
+ */
192
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
193
+ void
194
+ nw_connection_set_better_path_available_handler(nw_connection_t connection,
195
+ _Nullable nw_connection_boolean_event_handler_t handler);
196
+
197
+ typedef void (^nw_connection_path_event_handler_t)(nw_path_t path);
198
+
199
+ /*!
200
+ * @function nw_connection_set_path_changed_handler
201
+ *
202
+ * @abstract
203
+ * Define a callback to be fired when the connection's path changes.
204
+ *
205
+ * @param connection
206
+ * The connection object.
207
+ *
208
+ * @param handler
209
+ * The event handler to call when the connection's path changes.
210
+ * Pass NULL to remove the event handler.
211
+ */
212
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
213
+ void
214
+ nw_connection_set_path_changed_handler(nw_connection_t connection,
215
+ _Nullable nw_connection_path_event_handler_t handler);
216
+ #endif // __BLOCKS__
217
+
218
+ /*!
219
+ * @function nw_connection_set_queue
220
+ *
221
+ * @abstract
222
+ * Sets the client callback queue, on which blocks for events will
223
+ * be scheduled. This must be done before calling nw_connection_start().
224
+ *
225
+ * @param connection
226
+ * The connection object.
227
+ *
228
+ * @param queue
229
+ * The client's dispatch queue.
230
+ */
231
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
232
+ void
233
+ nw_connection_set_queue(nw_connection_t connection,
234
+ dispatch_queue_t queue);
235
+
236
+ /*!
237
+ * @function nw_connection_start
238
+ *
239
+ * @abstract
240
+ * Starts the connection, which will cause the connection
241
+ * to evaluate its path, do resolution, and try to become
242
+ * readable and writable. Once started, a connection
243
+ * must be cancelled using nw_connection_cancel() or
244
+ * nw_connection_force_cancel() when it is no longer needed.
245
+ *
246
+ * @param connection
247
+ * The connection object.
248
+ */
249
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
250
+ void
251
+ nw_connection_start(nw_connection_t connection);
252
+
253
+ /*!
254
+ * @function nw_connection_restart
255
+ *
256
+ * @abstract
257
+ * Connections in the waiting state will normally re-attempt
258
+ * on network changes. Call nw_connection_restart() to force
259
+ * a connection in the waiting state to retry connection
260
+ * establishment even without a network change. Calls to restart
261
+ * for connections that are not in the waiting state will be
262
+ * ignored.
263
+ *
264
+ * @param connection
265
+ * The connection object.
266
+ */
267
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
268
+ void
269
+ nw_connection_restart(nw_connection_t connection);
270
+
271
+ /*!
272
+ * @function nw_connection_cancel
273
+ *
274
+ * @abstract
275
+ * Cancel the connection. This will close the connection, and negotiate over the network
276
+ * if applicable for the protocol. The process of cancellation will be completed
277
+ * asynchronously, and the final callback event delivered to the caller will be a state
278
+ * update with a value of nw_connection_state_cancelled. Once this update is delivered, the
279
+ * caller may clean up any associated memory or objects.
280
+ *
281
+ * Outstanding sends and receives will receive errors before the state changes to cancelled.
282
+ * There is no guarantee that any outstanding sends that have not yet delivered send completion handlers
283
+ * will send data before the connection is closed.
284
+ *
285
+ * @param connection
286
+ * The connection object.
287
+ */
288
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
289
+ void
290
+ nw_connection_cancel(nw_connection_t connection);
291
+
292
+ /*!
293
+ * @function nw_connection_force_cancel
294
+ *
295
+ * @abstract
296
+ * A variant of nw_connection_cancel() that indicates that the protocol stack should
297
+ * not close gracefully, but close as quickly as possible without negotiation. For example,
298
+ * a force close would lead to TCP RST packets being sent, as opposed to negotiating with
299
+ * FIN packets.
300
+ *
301
+ * @param connection
302
+ * The connection object.
303
+ */
304
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
305
+ void
306
+ nw_connection_force_cancel(nw_connection_t connection);
307
+
308
+ /*!
309
+ * @function nw_connection_cancel_current_endpoint
310
+ *
311
+ * @abstract
312
+ * Cancel the currently connected endpoint, causing the connection
313
+ * to fall through to the next endpoint if available, or fail if no
314
+ * more endpoints are available. This is primarily useful for connections
315
+ * which do not have reliable handshakes, such as UDP. If data is sent
316
+ * on the connection with no response, canceling the current endpoint
317
+ * will allow another address or interface to be attempted.
318
+ *
319
+ * @param connection
320
+ * The connection object.
321
+ */
322
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
323
+ void
324
+ nw_connection_cancel_current_endpoint(nw_connection_t connection);
325
+
326
+ #ifdef __BLOCKS__
327
+
328
+ /*!
329
+ * @typedef nw_connection_receive_completion_t
330
+ * @abstract
331
+ * A receive completion is invoked exactly once for a call to nw_connection_receive().
332
+ * The completion indicates that the requested content has been received (in which case
333
+ * the content is delivered), or else an error has occurred.
334
+ *
335
+ * @param content
336
+ * The received content, which has a length constrained by the call to nw_connection_receive().
337
+ * The content may be NULL in two cases: (1) the receive context (logical message) is now complete,
338
+ * and the callback is only delivering the completed event; or, (2) the connection encountered
339
+ * an error and there is no data to deliver. Note that the content may be non-NULL even in the
340
+ * case of an error if there was some data received before the error was encountered. The caller
341
+ * should process all content it receives, and not necessarily ignore data in case of errors.
342
+ *
343
+ * @param context
344
+ * The context (logical message) associated with the received content. This includes protocol metadata
345
+ * that lets the caller introspect information about the received content (such as flags on an IP packet).
346
+ * When the message has been completely received, the context will be delivered along with the
347
+ * is_complete flag.
348
+ *
349
+ * For datagram protocols such as UDP, the context represents the properties of a single received
350
+ * datagram.
351
+ *
352
+ * For protocols that only have a single context for the entire connection, such as stream protocols
353
+ * like TCP, the context will be marked as "final", which can be accessed with
354
+ * nw_content_context_get_is_final(). Once a final context is marked as complete, the recipient
355
+ * may assume that the connection has been closed in the receiving direction (a "read close"). For
356
+ * TCP, this represents receiving a FIN.
357
+ *
358
+ * @param is_complete
359
+ * An indication that this context (logical message) is now complete. Until this flag is
360
+ * set, the recipient should assume that there may be more bytes to read for this context.
361
+ * Note that even when reading datagrams, as from UDP, the context may be read in multiple
362
+ * chunks if the maximum_length was smaller than the full length of the message.
363
+ *
364
+ * If is_complete is marked and the received context is the final context for connection,
365
+ * the caller may assume that the connection has been closed in the receiving direction.
366
+ *
367
+ * @param error
368
+ * An error will be sent if an error was encountered while trying to receive on the connection.
369
+ * There may still be content delivered along with the error, but this content may be shorter
370
+ * than the requested ranges. An error will be sent for any outstanding receive calls when the
371
+ * connection is cancelled.
372
+ */
373
+ typedef void (^nw_connection_receive_completion_t)(_Nullable dispatch_data_t content,
374
+ _Nullable nw_content_context_t context,
375
+ bool is_complete,
376
+ _Nullable nw_error_t error);
377
+ /*!
378
+ * @function nw_connection_receive
379
+ *
380
+ * @abstract
381
+ * Receive data from a connection. This may be called before the connection
382
+ * is ready, in which case the receive request will be queued until the
383
+ * connection is ready. The completion handler will be invoked exactly
384
+ * once for each call, so the client must call this function multiple
385
+ * times to receive multiple chunks of data. For protocols that
386
+ * support flow control, such as TCP, calling receive opens the receive
387
+ * window. If the client stops calling receive, the receive window will
388
+ * fill up and the remote peer will stop sending.
389
+ *
390
+ * @param connection
391
+ * The connection object on which to receive data. The connection should
392
+ * be in the ready state.
393
+ *
394
+ * @param minimum_incomplete_length
395
+ * The minimum length to receive from the connection, until the content
396
+ * is complete. Content will be delivered when at least the minimum is available,
397
+ * or the content is complete, whichever comes first.
398
+ *
399
+ * @param maximum_length
400
+ * The maximum length to receive from the connection.
401
+ *
402
+ * @param completion
403
+ * A callback to be called when content has been received.
404
+ */
405
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
406
+ void
407
+ nw_connection_receive(nw_connection_t connection,
408
+ uint32_t minimum_incomplete_length,
409
+ uint32_t maximum_length,
410
+ nw_connection_receive_completion_t completion);
411
+
412
+ /*!
413
+ * @function nw_connection_receive_message
414
+ *
415
+ * @abstract
416
+ * Receive a single atomic message from a connection. The completion
417
+ * handler will be invoked exactly once for each call, so the client
418
+ * must call this function multiple times to receive multiple messages.
419
+ *
420
+ * @param connection
421
+ * The connection object on which to receive the message. The connection
422
+ * should be in the ready state.
423
+ *
424
+ * @param completion
425
+ * A callback to be called when the message has been received, or an error
426
+ * has occurred.
427
+ */
428
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
429
+ void
430
+ nw_connection_receive_message(nw_connection_t connection,
431
+ nw_connection_receive_completion_t completion);
432
+
433
+ /*!
434
+ * @typedef nw_connection_send_completion_t
435
+ * @abstract
436
+ * A send completion is invoked exactly once for a call to nw_connection_send().
437
+ * The completion indicates that the sent content has been processed by the stack
438
+ * (not necessarily that it has left the host), or else an error has occurred during
439
+ * sending.
440
+ *
441
+ * @param error
442
+ * An error will be sent if the associated content could not be fully sent before an
443
+ * error occurred. An error will be sent for any outstanding sends when the connection
444
+ * is cancelled.
445
+ */
446
+ typedef void (^nw_connection_send_completion_t)(_Nullable nw_error_t error);
447
+
448
+ #define NW_CONNECTION_SEND_TYPE_DECL(name) \
449
+ extern const nw_connection_send_completion_t _nw_connection_send_##name
450
+
451
+ /*!
452
+ * @const NW_CONNECTION_SEND_IDEMPOTENT_CONTENT
453
+ * @discussion A send callback override that causes the write call to
454
+ * be treated as idempotent. Idempotent content is allowed to be sent
455
+ * before the connection is ready, and may be replayed across parallel connection
456
+ * attempts. This content can be sent as part of fast-open protocols, which allows
457
+ * the data to be sent out sooner than if it were required to wait for
458
+ * connection establishment.
459
+ *
460
+ * This override intentionally disallows the client from receiving callbacks
461
+ * for the write calls, since the content may be sent multiple times internally.
462
+ * For any large content, or content that need to be sensitive to sending backpressure,
463
+ * an explicit callback should be used.
464
+ */
465
+ #define NW_CONNECTION_SEND_IDEMPOTENT_CONTENT (_nw_connection_send_idempotent_content)
466
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
467
+ NW_CONNECTION_SEND_TYPE_DECL(idempotent_content);
468
+
469
+ #define NW_CONTENT_CONTEXT_TYPE_DECL(name) \
470
+ extern const nw_content_context_t _nw_content_context_##name
471
+
472
+ /*!
473
+ * @const NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT
474
+ * @discussion Use the default message context to send content with all default properties:
475
+ * default priority, no expiration, and not the final message. Marking this context
476
+ * as complete with a send indicates that the message content is now complete and any
477
+ * other messages that were blocked may be scheduled, but will not close the underlying
478
+ * connection. Use this context for any lightweight sends of datagrams or messages on
479
+ * top of a stream that do not require special properties.
480
+ *
481
+ * This context does not support overriding any properties.
482
+ */
483
+ #define NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT (_nw_content_context_default_message)
484
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
485
+ NW_CONTENT_CONTEXT_TYPE_DECL(default_message);
486
+
487
+ /*!
488
+ * @const NW_CONNECTION_FINAL_MESSAGE_CONTEXT
489
+ * @discussion Use the final message context to indicate that no more sends are expected
490
+ * once this context is complete. Like NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT, all
491
+ * properties are default. Marking a send as complete when using this context will close
492
+ * the sending side of the underlying connection. This is the equivalent of sending a FIN
493
+ * on a TCP stream.
494
+ *
495
+ * This context does not support overriding any properties.
496
+ */
497
+ #define NW_CONNECTION_FINAL_MESSAGE_CONTEXT (_nw_content_context_final_send)
498
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
499
+ NW_CONTENT_CONTEXT_TYPE_DECL(final_send);
500
+
501
+ /*!
502
+ * @const NW_CONNECTION_DEFAULT_STREAM_CONTEXT
503
+ * @discussion Use the default stream context to indicate that this sending context is
504
+ * the one that represents the entire connection. All context properties are default.
505
+ * This context behaves in the same way as NW_CONNECTION_FINAL_MESSAGE_CONTEXT, such
506
+ * that marking the context complete by sending is_complete will close the sending
507
+ * side of the underlying connection (a FIN for a TCP stream).
508
+ *
509
+ * Note that this context is a convenience for sending a single, final context.
510
+ * If the protocol used by the connection is a stream (such as TCP), the caller
511
+ * may still use NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT, NW_CONNECTION_FINAL_MESSAGE_CONTEXT,
512
+ * or a custom context with priorities and metadata to set properties of a particular
513
+ * chunk of stream data relative to other data on the stream.
514
+ *
515
+ * This context does not support overriding any properties.
516
+ */
517
+ #define NW_CONNECTION_DEFAULT_STREAM_CONTEXT (_nw_content_context_default_stream)
518
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
519
+ NW_CONTENT_CONTEXT_TYPE_DECL(default_stream);
520
+
521
+ /*!
522
+ * @function nw_connection_send
523
+ *
524
+ * @abstract
525
+ * Send data on a connection. This may be called before the connection is ready,
526
+ * in which case the send will be enqueued until the connection is ready to send.
527
+ * This is an asynchronous send and the completion block can be used to
528
+ * determine when the send is complete. There is nothing preventing a client
529
+ * from issuing an excessive number of outstanding sends. To minimize memory
530
+ * footprint and excessive latency as a consequence of buffer bloat, it is
531
+ * advisable to keep a low number of outstanding sends. The completion block
532
+ * can be used to pace subsequent sends.
533
+ *
534
+ * @param connection
535
+ * The connection object on which to send data.
536
+ *
537
+ * @param content
538
+ * A data object to send. This may be NULL only if this send is marking a context
539
+ * (a message or complete connection) as complete in the sending direction.
540
+ *
541
+ * @param context
542
+ * The context associated with the content, which represents a logical message
543
+ * to be sent on the connection. All content sent within a single context will
544
+ * be sent as an in-order unit, up until the point that the context is marked
545
+ * complete (see is_complete). Once a context is marked complete, it may be re-used
546
+ * as a new logical message. Protocols like TCP that cannot send multiple
547
+ * independent messages at once (serial streams) will only start processing a new
548
+ * context once the prior context has been marked complete.
549
+ *
550
+ * The context can hold protocol metadata to define how to send content, such
551
+ * as flags for IP packets.
552
+ *
553
+ * The context also can define properties that allow a message to ordered relative
554
+ * to other messages if multiple messages are queued. These properties include
555
+ * relative priority, expiration, and antecedent relationships. Some protocols
556
+ * support re-ordering messages within a single connection. For other protocols
557
+ * that do not, like TCP, these properties still take effect when enqueuing data
558
+ * into the stream's send buffer. The ordering of messages applies to the first
559
+ * calls to send on a given context.
560
+ *
561
+ * In order to close a connection on the sending side (a "write close"), send
562
+ * a context that is marked as "final" and mark is_complete. The convenience definition
563
+ * NW_CONNECTION_FINAL_MESSAGE_CONTEXT may be used to define the default final context
564
+ * for a connection. If the caller wants to treat the entire connection as a single
565
+ * stream, with only one context, set NW_CONNECTION_FINAL_MESSAGE_CONTEXT for all
566
+ * sends; marking is_complete on the final send call will send a "write close".
567
+ * Using NW_CONNECTION_DEFAULT_STREAM_CONTEXT has the same behavior as sending
568
+ * NW_CONNECTION_FINAL_MESSAGE_CONTEXT.
569
+ *
570
+ * To send basic datagrams on a connection, use NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT
571
+ * and pass is_complete as true for each datagram.
572
+ *
573
+ * To send data as a single stream on a connection, use NW_CONNECTION_DEFAULT_STREAM_CONTEXT
574
+ * and pass is_complete as true only to mark the end of the stream.
575
+ *
576
+ * @param is_complete
577
+ * A flag indicating if the caller's sending context (logical message) is now complete.
578
+ *
579
+ * Until a context is marked complete, content sent for other contexts may not
580
+ * be sent immediately (if the protocol requires sending bytes serially, like TCP).
581
+ *
582
+ * For datagram protocols, like UDP, is_complete indicates that the content represents
583
+ * a complete datagram.
584
+ *
585
+ * When sending directly on streaming protocols like TCP, is_complete can be used to
586
+ * indicate that the connection should send a "write close" (a TCP FIN) if the sending
587
+ * context is the final context on the connection. Specifically, to send a "write close",
588
+ * pass NW_CONNECTION_FINAL_MESSAGE_CONTEXT or NW_CONNECTION_DEFAULT_STREAM_CONTEXT for the
589
+ * context (or create a custom context and set nw_content_context_set_is_final()), and pass
590
+ * true for is_complete.
591
+ *
592
+ * @param completion
593
+ * A callback to be called when the data has been sent, or an error has occurred.
594
+ * This callback does not indicate that the remote side has acknowledged the data.
595
+ * This callback does indicate that the data has either been sent or it has been
596
+ * enqueued to be sent.
597
+ */
598
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
599
+ NW_SWIFT_DISABLE_ASYNC
600
+ void
601
+ nw_connection_send(nw_connection_t connection,
602
+ _Nullable dispatch_data_t content,
603
+ nw_content_context_t context,
604
+ bool is_complete,
605
+ nw_connection_send_completion_t completion);
606
+
607
+ /*!
608
+ * @function nw_connection_batch
609
+ *
610
+ * @abstract
611
+ * Batch several send and/or receive operations together, to hint to
612
+ * the connection that multiple send or receive operations are expected
613
+ * in quick succession.
614
+ *
615
+ * @param connection
616
+ * The connection object.
617
+ *
618
+ * @param batch_block
619
+ * The batch block will be invoked immediately upon calling this function.
620
+ * The client may call nw_connection_send() or nw_connection_receive()
621
+ * multiple times within the block, and the connection will attempt to
622
+ * batch these operations when the block returns.
623
+ */
624
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
625
+ void
626
+ nw_connection_batch(nw_connection_t connection,
627
+ NW_NOESCAPE dispatch_block_t batch_block);
628
+
629
+ #endif // __BLOCKS__
630
+
631
+ /*!
632
+ * @function nw_connection_copy_description
633
+ *
634
+ * @abstract
635
+ * Copy a human-readable description of the connection.
636
+ *
637
+ * @param connection
638
+ * The connection object.
639
+ *
640
+ * @result
641
+ * Returns a human-readable string description of the connection.
642
+ * The caller must call free() on the string.
643
+ */
644
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
645
+ char *
646
+ nw_connection_copy_description(nw_connection_t connection);
647
+
648
+ /*!
649
+ * @function nw_connection_copy_current_path
650
+ *
651
+ * @abstract
652
+ * Copy the current path for a connection. If a connection is
653
+ * established, this will reflect the connected path.
654
+ *
655
+ * @param connection
656
+ * The connection object.
657
+ *
658
+ * @result
659
+ * Returns a retained path object, or NULL if the connection
660
+ * has not been started or has been cancelled.
661
+ */
662
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
663
+ NW_RETURNS_RETAINED _Nullable nw_path_t
664
+ nw_connection_copy_current_path(nw_connection_t connection);
665
+
666
+ /*!
667
+ * @function nw_connection_copy_protocol_metadata
668
+ *
669
+ * @abstract
670
+ * Copy the connection-wide metadata for a specific protocol.
671
+ * This allows the caller to introspect per-protocol state,
672
+ * only once the connection has been established. This
673
+ * metadata is also available when receiving data through
674
+ * the content context.
675
+ *
676
+ * @param connection
677
+ * The connection object.
678
+ *
679
+ * @param definition
680
+ * The protocol definition for which metadata will be returned.
681
+ *
682
+ * @result
683
+ * Returns a retained protocol metadata object, or NULL if the connection
684
+ * has not been established yet or is cancelled.
685
+ */
686
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
687
+ NW_RETURNS_RETAINED _Nullable nw_protocol_metadata_t
688
+ nw_connection_copy_protocol_metadata(nw_connection_t connection,
689
+ nw_protocol_definition_t definition);
690
+
691
+ /*!
692
+ * @function nw_connection_get_maximum_datagram_size
693
+ *
694
+ * @abstract
695
+ * Check for the maximum datagram size that can be written
696
+ * on the connection. Any datagrams written should be less
697
+ * than or equal to this size.
698
+ *
699
+ * @param connection
700
+ * The connection object.
701
+ *
702
+ * @result
703
+ * Returns a datagram size based on the current MTU and the
704
+ * overhead of the protocols being used.
705
+ */
706
+ API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0))
707
+ uint32_t
708
+ nw_connection_get_maximum_datagram_size(nw_connection_t connection);
709
+
710
+ NW_ASSUME_NONNULL_END
711
+
712
+ __END_DECLS
713
+
714
+ #endif /* __NW_CONNECTION_H__ */