@lakutata/containerd 0.0.0-stage → 3.0.0-beta.1

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 (301) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +409 -2
  3. package/THIRD_PARTY_NOTICES.md +310 -0
  4. package/dist/cjs/client/BuildKit.d.ts +176 -0
  5. package/dist/cjs/client/BuildKit.js +536 -0
  6. package/dist/cjs/client/BuildKitMessages.d.ts +35 -0
  7. package/dist/cjs/client/BuildKitMessages.js +123 -0
  8. package/dist/cjs/client/ContainerStore.d.ts +558 -0
  9. package/dist/cjs/client/ContainerStore.js +1384 -0
  10. package/dist/cjs/client/ContainerdClient.d.ts +244 -0
  11. package/dist/cjs/client/ContainerdClient.js +455 -0
  12. package/dist/cjs/client/DockerIgnore.d.ts +44 -0
  13. package/dist/cjs/client/DockerIgnore.js +186 -0
  14. package/dist/cjs/client/Fifo.d.ts +31 -0
  15. package/dist/cjs/client/Fifo.js +66 -0
  16. package/dist/cjs/client/ImageStore.d.ts +258 -0
  17. package/dist/cjs/client/ImageStore.js +636 -0
  18. package/dist/cjs/client/Messages.d.ts +103 -0
  19. package/dist/cjs/client/Messages.js +397 -0
  20. package/dist/cjs/client/Networks.d.ts +221 -0
  21. package/dist/cjs/client/Networks.js +630 -0
  22. package/dist/cjs/client/Platforms.d.ts +53 -0
  23. package/dist/cjs/client/Platforms.js +169 -0
  24. package/dist/cjs/client/Reference.d.ts +33 -0
  25. package/dist/cjs/client/Reference.js +70 -0
  26. package/dist/cjs/client/Registry.d.ts +145 -0
  27. package/dist/cjs/client/Registry.js +272 -0
  28. package/dist/cjs/client/Rootfs.d.ts +83 -0
  29. package/dist/cjs/client/Rootfs.js +245 -0
  30. package/dist/cjs/client/Seccomp.d.ts +36 -0
  31. package/dist/cjs/client/Seccomp.js +156 -0
  32. package/dist/cjs/client/Spec.d.ts +151 -0
  33. package/dist/cjs/client/Spec.js +227 -0
  34. package/dist/cjs/client/Volumes.d.ts +42 -0
  35. package/dist/cjs/client/Volumes.js +80 -0
  36. package/dist/cjs/containerd/Containerd.d.ts +442 -0
  37. package/dist/cjs/containerd/Containerd.js +929 -0
  38. package/dist/cjs/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
  39. package/dist/cjs/containerd/exceptions/ContainerdConnectionException.js +16 -0
  40. package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
  41. package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.js +15 -0
  42. package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
  43. package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.js +16 -0
  44. package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
  45. package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.js +17 -0
  46. package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
  47. package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.js +16 -0
  48. package/dist/cjs/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
  49. package/dist/cjs/containerd/exceptions/ContainerdImageExportException.js +16 -0
  50. package/dist/cjs/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
  51. package/dist/cjs/containerd/exceptions/ContainerdImageImportException.js +16 -0
  52. package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
  53. package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.js +16 -0
  54. package/dist/cjs/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
  55. package/dist/cjs/containerd/exceptions/ContainerdImagePullException.js +16 -0
  56. package/dist/cjs/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
  57. package/dist/cjs/containerd/exceptions/ContainerdImagePushException.js +15 -0
  58. package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
  59. package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.js +16 -0
  60. package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
  61. package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.js +16 -0
  62. package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
  63. package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.js +15 -0
  64. package/dist/cjs/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
  65. package/dist/cjs/containerd/exceptions/ContainerdPlatformException.js +16 -0
  66. package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
  67. package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.js +15 -0
  68. package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
  69. package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.js +15 -0
  70. package/dist/cjs/containerd/lib/ContainerdContainer.d.ts +292 -0
  71. package/dist/cjs/containerd/lib/ContainerdContainer.js +536 -0
  72. package/dist/cjs/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
  73. package/dist/cjs/containerd/lib/ContainerdContainerTTY.js +178 -0
  74. package/dist/cjs/containerd/lib/ContainerdErrors.d.ts +6 -0
  75. package/dist/cjs/containerd/lib/ContainerdErrors.js +37 -0
  76. package/dist/cjs/containerd/lib/ContainerdImage.d.ts +149 -0
  77. package/dist/cjs/containerd/lib/ContainerdImage.js +222 -0
  78. package/dist/cjs/containerd/options/ContainerdPruneOptions.d.ts +44 -0
  79. package/dist/cjs/containerd/options/ContainerdPruneOptions.js +51 -0
  80. package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
  81. package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.js +45 -0
  82. package/dist/cjs/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
  83. package/dist/cjs/containerd/options/container/ContainerCommitOptions.js +66 -0
  84. package/dist/cjs/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
  85. package/dist/cjs/containerd/options/container/ContainerCreateOptions.js +239 -0
  86. package/dist/cjs/containerd/options/container/ContainerExecOptions.d.ts +53 -0
  87. package/dist/cjs/containerd/options/container/ContainerExecOptions.js +63 -0
  88. package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
  89. package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.js +45 -0
  90. package/dist/cjs/containerd/options/container/ContainerKillOptions.d.ts +30 -0
  91. package/dist/cjs/containerd/options/container/ContainerKillOptions.js +41 -0
  92. package/dist/cjs/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
  93. package/dist/cjs/containerd/options/container/ContainerLogsOptions.js +44 -0
  94. package/dist/cjs/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
  95. package/dist/cjs/containerd/options/container/ContainerRemoveOptions.js +34 -0
  96. package/dist/cjs/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
  97. package/dist/cjs/containerd/options/container/ContainerResourceOptions.js +67 -0
  98. package/dist/cjs/containerd/options/container/ContainerStopOptions.d.ts +30 -0
  99. package/dist/cjs/containerd/options/container/ContainerStopOptions.js +41 -0
  100. package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
  101. package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
  102. package/dist/cjs/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
  103. package/dist/cjs/containerd/options/container/ContainerTTYOptions.js +63 -0
  104. package/dist/cjs/containerd/options/image/ImageBuildOptions.d.ts +88 -0
  105. package/dist/cjs/containerd/options/image/ImageBuildOptions.js +95 -0
  106. package/dist/cjs/containerd/options/image/ImageExportOptions.d.ts +25 -0
  107. package/dist/cjs/containerd/options/image/ImageExportOptions.js +39 -0
  108. package/dist/cjs/containerd/options/image/ImageImportOptions.d.ts +38 -0
  109. package/dist/cjs/containerd/options/image/ImageImportOptions.js +47 -0
  110. package/dist/cjs/containerd/options/image/ImagePullOptions.d.ts +53 -0
  111. package/dist/cjs/containerd/options/image/ImagePullOptions.js +66 -0
  112. package/dist/cjs/containerd/options/image/ImagePushOptions.d.ts +44 -0
  113. package/dist/cjs/containerd/options/image/ImagePushOptions.js +58 -0
  114. package/dist/cjs/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
  115. package/dist/cjs/containerd/options/network/NetworkCreateOptions.js +83 -0
  116. package/dist/cjs/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
  117. package/dist/cjs/containerd/options/volume/VolumeCreateOptions.js +40 -0
  118. package/dist/cjs/containerd/types/ContainerdBind.d.ts +28 -0
  119. package/dist/cjs/containerd/types/ContainerdBind.js +2 -0
  120. package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
  121. package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.js +2 -0
  122. package/dist/cjs/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
  123. package/dist/cjs/containerd/types/ContainerdContainerNetwork.js +2 -0
  124. package/dist/cjs/containerd/types/ContainerdContainerPort.d.ts +22 -0
  125. package/dist/cjs/containerd/types/ContainerdContainerPort.js +2 -0
  126. package/dist/cjs/containerd/types/ContainerdContainerState.d.ts +42 -0
  127. package/dist/cjs/containerd/types/ContainerdContainerState.js +2 -0
  128. package/dist/cjs/containerd/types/ContainerdContainerStats.d.ts +107 -0
  129. package/dist/cjs/containerd/types/ContainerdContainerStats.js +2 -0
  130. package/dist/cjs/containerd/types/ContainerdDevice.d.ts +25 -0
  131. package/dist/cjs/containerd/types/ContainerdDevice.js +2 -0
  132. package/dist/cjs/containerd/types/ContainerdExecResult.d.ts +18 -0
  133. package/dist/cjs/containerd/types/ContainerdExecResult.js +2 -0
  134. package/dist/cjs/containerd/types/ContainerdImageConfig.d.ts +46 -0
  135. package/dist/cjs/containerd/types/ContainerdImageConfig.js +2 -0
  136. package/dist/cjs/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
  137. package/dist/cjs/containerd/types/ContainerdNetworkInfo.js +2 -0
  138. package/dist/cjs/containerd/types/ContainerdProgressCallback.d.ts +29 -0
  139. package/dist/cjs/containerd/types/ContainerdProgressCallback.js +2 -0
  140. package/dist/cjs/containerd/types/ContainerdPruneResult.d.ts +21 -0
  141. package/dist/cjs/containerd/types/ContainerdPruneResult.js +2 -0
  142. package/dist/cjs/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
  143. package/dist/cjs/containerd/types/ContainerdRestartPolicy.js +2 -0
  144. package/dist/cjs/containerd/types/ContainerdTmpfs.d.ts +20 -0
  145. package/dist/cjs/containerd/types/ContainerdTmpfs.js +2 -0
  146. package/dist/cjs/containerd/types/ContainerdVolume.d.ts +19 -0
  147. package/dist/cjs/containerd/types/ContainerdVolume.js +2 -0
  148. package/dist/cjs/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
  149. package/dist/cjs/containerd/types/ContainerdVolumeInfo.js +2 -0
  150. package/dist/cjs/exports/Containerd.d.ts +69 -0
  151. package/dist/cjs/exports/Containerd.js +87 -0
  152. package/dist/cjs/package.json +1 -0
  153. package/dist/esm/client/BuildKit.js +488 -0
  154. package/dist/esm/client/BuildKitMessages.js +120 -0
  155. package/dist/esm/client/ContainerStore.js +1339 -0
  156. package/dist/esm/client/ContainerdClient.js +416 -0
  157. package/dist/esm/client/DockerIgnore.js +179 -0
  158. package/dist/esm/client/Fifo.js +59 -0
  159. package/dist/esm/client/ImageStore.js +628 -0
  160. package/dist/esm/client/Messages.js +393 -0
  161. package/dist/esm/client/Networks.js +621 -0
  162. package/dist/esm/client/Platforms.js +156 -0
  163. package/dist/esm/client/Reference.js +66 -0
  164. package/dist/esm/client/Registry.js +263 -0
  165. package/dist/esm/client/Rootfs.js +234 -0
  166. package/dist/esm/client/Seccomp.js +152 -0
  167. package/dist/esm/client/Spec.js +220 -0
  168. package/dist/esm/client/Volumes.js +73 -0
  169. package/dist/esm/containerd/Containerd.js +923 -0
  170. package/dist/esm/containerd/exceptions/ContainerdConnectionException.js +12 -0
  171. package/dist/esm/containerd/exceptions/ContainerdContainerNameConflictException.js +11 -0
  172. package/dist/esm/containerd/exceptions/ContainerdContainerNotFoundException.js +12 -0
  173. package/dist/esm/containerd/exceptions/ContainerdContainerStateException.js +13 -0
  174. package/dist/esm/containerd/exceptions/ContainerdImageBuildException.js +12 -0
  175. package/dist/esm/containerd/exceptions/ContainerdImageExportException.js +12 -0
  176. package/dist/esm/containerd/exceptions/ContainerdImageImportException.js +12 -0
  177. package/dist/esm/containerd/exceptions/ContainerdImageNotFoundException.js +12 -0
  178. package/dist/esm/containerd/exceptions/ContainerdImagePullException.js +12 -0
  179. package/dist/esm/containerd/exceptions/ContainerdImagePushException.js +11 -0
  180. package/dist/esm/containerd/exceptions/ContainerdNetworkConflictException.js +12 -0
  181. package/dist/esm/containerd/exceptions/ContainerdNetworkNotFoundException.js +12 -0
  182. package/dist/esm/containerd/exceptions/ContainerdPathNotFoundException.js +11 -0
  183. package/dist/esm/containerd/exceptions/ContainerdPlatformException.js +12 -0
  184. package/dist/esm/containerd/exceptions/ContainerdVolumeInUseException.js +11 -0
  185. package/dist/esm/containerd/exceptions/ContainerdVolumeNotFoundException.js +11 -0
  186. package/dist/esm/containerd/lib/ContainerdContainer.js +533 -0
  187. package/dist/esm/containerd/lib/ContainerdContainerTTY.js +175 -0
  188. package/dist/esm/containerd/lib/ContainerdErrors.js +34 -0
  189. package/dist/esm/containerd/lib/ContainerdImage.js +219 -0
  190. package/dist/esm/containerd/options/ContainerdPruneOptions.js +47 -0
  191. package/dist/esm/containerd/options/ContainerdRegistryAuthOptions.js +41 -0
  192. package/dist/esm/containerd/options/container/ContainerCommitOptions.js +62 -0
  193. package/dist/esm/containerd/options/container/ContainerCreateOptions.js +235 -0
  194. package/dist/esm/containerd/options/container/ContainerExecOptions.js +59 -0
  195. package/dist/esm/containerd/options/container/ContainerExportDirectoryOptions.js +41 -0
  196. package/dist/esm/containerd/options/container/ContainerKillOptions.js +37 -0
  197. package/dist/esm/containerd/options/container/ContainerLogsOptions.js +40 -0
  198. package/dist/esm/containerd/options/container/ContainerRemoveOptions.js +30 -0
  199. package/dist/esm/containerd/options/container/ContainerResourceOptions.js +63 -0
  200. package/dist/esm/containerd/options/container/ContainerStopOptions.js +37 -0
  201. package/dist/esm/containerd/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
  202. package/dist/esm/containerd/options/container/ContainerTTYOptions.js +59 -0
  203. package/dist/esm/containerd/options/image/ImageBuildOptions.js +91 -0
  204. package/dist/esm/containerd/options/image/ImageExportOptions.js +35 -0
  205. package/dist/esm/containerd/options/image/ImageImportOptions.js +43 -0
  206. package/dist/esm/containerd/options/image/ImagePullOptions.js +62 -0
  207. package/dist/esm/containerd/options/image/ImagePushOptions.js +54 -0
  208. package/dist/esm/containerd/options/network/NetworkCreateOptions.js +79 -0
  209. package/dist/esm/containerd/options/volume/VolumeCreateOptions.js +36 -0
  210. package/dist/esm/containerd/types/ContainerdBind.js +1 -0
  211. package/dist/esm/containerd/types/ContainerdBuildOutputCallback.js +1 -0
  212. package/dist/esm/containerd/types/ContainerdContainerNetwork.js +1 -0
  213. package/dist/esm/containerd/types/ContainerdContainerPort.js +1 -0
  214. package/dist/esm/containerd/types/ContainerdContainerState.js +1 -0
  215. package/dist/esm/containerd/types/ContainerdContainerStats.js +1 -0
  216. package/dist/esm/containerd/types/ContainerdDevice.js +1 -0
  217. package/dist/esm/containerd/types/ContainerdExecResult.js +1 -0
  218. package/dist/esm/containerd/types/ContainerdImageConfig.js +1 -0
  219. package/dist/esm/containerd/types/ContainerdNetworkInfo.js +1 -0
  220. package/dist/esm/containerd/types/ContainerdProgressCallback.js +1 -0
  221. package/dist/esm/containerd/types/ContainerdPruneResult.js +1 -0
  222. package/dist/esm/containerd/types/ContainerdRestartPolicy.js +1 -0
  223. package/dist/esm/containerd/types/ContainerdTmpfs.js +1 -0
  224. package/dist/esm/containerd/types/ContainerdVolume.js +1 -0
  225. package/dist/esm/containerd/types/ContainerdVolumeInfo.js +1 -0
  226. package/dist/esm/exports/Containerd.js +68 -0
  227. package/dist/types/client/BuildKit.d.ts +176 -0
  228. package/dist/types/client/BuildKitMessages.d.ts +35 -0
  229. package/dist/types/client/ContainerStore.d.ts +558 -0
  230. package/dist/types/client/ContainerdClient.d.ts +244 -0
  231. package/dist/types/client/DockerIgnore.d.ts +44 -0
  232. package/dist/types/client/Fifo.d.ts +31 -0
  233. package/dist/types/client/ImageStore.d.ts +258 -0
  234. package/dist/types/client/Messages.d.ts +103 -0
  235. package/dist/types/client/Networks.d.ts +221 -0
  236. package/dist/types/client/Platforms.d.ts +53 -0
  237. package/dist/types/client/Reference.d.ts +33 -0
  238. package/dist/types/client/Registry.d.ts +145 -0
  239. package/dist/types/client/Rootfs.d.ts +83 -0
  240. package/dist/types/client/Seccomp.d.ts +36 -0
  241. package/dist/types/client/Spec.d.ts +151 -0
  242. package/dist/types/client/Volumes.d.ts +42 -0
  243. package/dist/types/containerd/Containerd.d.ts +442 -0
  244. package/dist/types/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
  245. package/dist/types/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
  246. package/dist/types/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
  247. package/dist/types/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
  248. package/dist/types/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
  249. package/dist/types/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
  250. package/dist/types/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
  251. package/dist/types/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
  252. package/dist/types/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
  253. package/dist/types/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
  254. package/dist/types/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
  255. package/dist/types/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
  256. package/dist/types/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
  257. package/dist/types/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
  258. package/dist/types/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
  259. package/dist/types/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
  260. package/dist/types/containerd/lib/ContainerdContainer.d.ts +292 -0
  261. package/dist/types/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
  262. package/dist/types/containerd/lib/ContainerdErrors.d.ts +6 -0
  263. package/dist/types/containerd/lib/ContainerdImage.d.ts +149 -0
  264. package/dist/types/containerd/options/ContainerdPruneOptions.d.ts +44 -0
  265. package/dist/types/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
  266. package/dist/types/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
  267. package/dist/types/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
  268. package/dist/types/containerd/options/container/ContainerExecOptions.d.ts +53 -0
  269. package/dist/types/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
  270. package/dist/types/containerd/options/container/ContainerKillOptions.d.ts +30 -0
  271. package/dist/types/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
  272. package/dist/types/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
  273. package/dist/types/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
  274. package/dist/types/containerd/options/container/ContainerStopOptions.d.ts +30 -0
  275. package/dist/types/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
  276. package/dist/types/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
  277. package/dist/types/containerd/options/image/ImageBuildOptions.d.ts +88 -0
  278. package/dist/types/containerd/options/image/ImageExportOptions.d.ts +25 -0
  279. package/dist/types/containerd/options/image/ImageImportOptions.d.ts +38 -0
  280. package/dist/types/containerd/options/image/ImagePullOptions.d.ts +53 -0
  281. package/dist/types/containerd/options/image/ImagePushOptions.d.ts +44 -0
  282. package/dist/types/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
  283. package/dist/types/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
  284. package/dist/types/containerd/types/ContainerdBind.d.ts +28 -0
  285. package/dist/types/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
  286. package/dist/types/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
  287. package/dist/types/containerd/types/ContainerdContainerPort.d.ts +22 -0
  288. package/dist/types/containerd/types/ContainerdContainerState.d.ts +42 -0
  289. package/dist/types/containerd/types/ContainerdContainerStats.d.ts +107 -0
  290. package/dist/types/containerd/types/ContainerdDevice.d.ts +25 -0
  291. package/dist/types/containerd/types/ContainerdExecResult.d.ts +18 -0
  292. package/dist/types/containerd/types/ContainerdImageConfig.d.ts +46 -0
  293. package/dist/types/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
  294. package/dist/types/containerd/types/ContainerdProgressCallback.d.ts +29 -0
  295. package/dist/types/containerd/types/ContainerdPruneResult.d.ts +21 -0
  296. package/dist/types/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
  297. package/dist/types/containerd/types/ContainerdTmpfs.d.ts +20 -0
  298. package/dist/types/containerd/types/ContainerdVolume.d.ts +19 -0
  299. package/dist/types/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
  300. package/dist/types/exports/Containerd.d.ts +69 -0
  301. package/package.json +51 -4
@@ -0,0 +1,929 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Containerd = void 0;
16
+ const core_1 = require("@lakutata/core");
17
+ const di_1 = require("@lakutata/core/decorator/di");
18
+ const dto_1 = require("@lakutata/core/decorator/dto");
19
+ const ContainerdClient_js_1 = require("../client/ContainerdClient.js");
20
+ const ImageStore_js_1 = require("../client/ImageStore.js");
21
+ const ContainerStore_js_1 = require("../client/ContainerStore.js");
22
+ const Platforms_js_1 = require("../client/Platforms.js");
23
+ const Reference_js_1 = require("../client/Reference.js");
24
+ const Networks_js_1 = require("../client/Networks.js");
25
+ const grpc_1 = require("@lakutata/grpc");
26
+ const BuildKit_js_1 = require("../client/BuildKit.js");
27
+ const promises_1 = require("node:fs/promises");
28
+ const node_path_1 = __importDefault(require("node:path"));
29
+ const node_crypto_1 = require("node:crypto");
30
+ const ContainerdImage_js_1 = require("./lib/ContainerdImage.js");
31
+ const ContainerdContainer_js_1 = require("./lib/ContainerdContainer.js");
32
+ const ContainerdContainerTTY_js_1 = require("./lib/ContainerdContainerTTY.js");
33
+ const ContainerdPruneOptions_js_1 = require("./options/ContainerdPruneOptions.js");
34
+ const VolumeCreateOptions_js_1 = require("./options/volume/VolumeCreateOptions.js");
35
+ const ContainerdVolumeNotFoundException_js_1 = require("./exceptions/ContainerdVolumeNotFoundException.js");
36
+ const ContainerdVolumeInUseException_js_1 = require("./exceptions/ContainerdVolumeInUseException.js");
37
+ const Volumes_js_1 = require("../client/Volumes.js");
38
+ const Time_1 = require("@lakutata/utils/Time");
39
+ const ContainerdErrors_js_1 = require("./lib/ContainerdErrors.js");
40
+ const ImagePullOptions_js_1 = require("./options/image/ImagePullOptions.js");
41
+ const ImageImportOptions_js_1 = require("./options/image/ImageImportOptions.js");
42
+ const ImageExportOptions_js_1 = require("./options/image/ImageExportOptions.js");
43
+ const ContainerCreateOptions_js_1 = require("./options/container/ContainerCreateOptions.js");
44
+ const ContainerdConnectionException_js_1 = require("./exceptions/ContainerdConnectionException.js");
45
+ const ContainerdImageNotFoundException_js_1 = require("./exceptions/ContainerdImageNotFoundException.js");
46
+ const ContainerdImagePullException_js_1 = require("./exceptions/ContainerdImagePullException.js");
47
+ const ContainerdImageImportException_js_1 = require("./exceptions/ContainerdImageImportException.js");
48
+ const ContainerdImageExportException_js_1 = require("./exceptions/ContainerdImageExportException.js");
49
+ const ContainerdContainerNotFoundException_js_1 = require("./exceptions/ContainerdContainerNotFoundException.js");
50
+ const ContainerdNetworkNotFoundException_js_1 = require("./exceptions/ContainerdNetworkNotFoundException.js");
51
+ const ContainerdNetworkConflictException_js_1 = require("./exceptions/ContainerdNetworkConflictException.js");
52
+ const NetworkCreateOptions_js_1 = require("./options/network/NetworkCreateOptions.js");
53
+ const ImageBuildOptions_js_1 = require("./options/image/ImageBuildOptions.js");
54
+ const ContainerdImageBuildException_js_1 = require("./exceptions/ContainerdImageBuildException.js");
55
+ /**
56
+ * The containerd component: manages the images, containers, CNI networks and volumes of one containerd namespace by
57
+ * talking to containerd's gRPC socket directly, without a Docker daemon and without nerdctl. Use it on the Linux machines
58
+ * running containerd alone (embedded devices, servers without Docker); the application needs access to the socket (root,
59
+ * or a member of the group owning it). Register it in the `components` of an application (`{class: Containerd, ...}`)
60
+ * and get it with `getObject()` or `@Inject`; it is a singleton.
61
+ *
62
+ * Its API follows the Docker component's (`pullImage`, `createContainer`, `container.exec()`…). The containers it creates
63
+ * are nerdctl's: they carry nerdctl's labels (`nerdctl/name`…), so `nerdctl ps` lists them; containerd's shim writes
64
+ * their output to a log file and containerd's restart monitor applies their restart policy, also while the application
65
+ * is not running. The component pulls, pushes, imports and exports the images itself; it sends the builds to BuildKit
66
+ * (a local or remote `buildkitd`).
67
+ *
68
+ * The component connects when it is created: it fails with {@link ContainerdConnectionException} when containerd does
69
+ * not answer on `socketPath` (or `buildkitTLS` is given with a unix socket), and it creates its namespace when the
70
+ * namespace does not exist. BuildKit is only reached by
71
+ * the builds. When the component is destroyed, it ends its event streams, aborts its pulls, pushes and builds in
72
+ * progress, and closes its connections.
73
+ * @example
74
+ * ```typescript
75
+ * import {Application} from 'lakutata'
76
+ * import {Containerd, type ContainerdContainer, type ContainerdExecResult, type ContainerdImage} from 'lakutata/com/containerd'
77
+ *
78
+ * Application
79
+ * .run(() => ({
80
+ * id: 'device.app',
81
+ * name: 'Device',
82
+ * components: {
83
+ * containerd: {
84
+ * class: Containerd,
85
+ * socketPath: '/run/containerd/containerd.sock',
86
+ * namespace: 'default',
87
+ * registryAuths: {'registry.example.com': {username: 'deploy', password: 'secret'}}
88
+ * }
89
+ * },
90
+ * bootstrap: ['containerd']
91
+ * }))
92
+ * .onLaunched(async (app: Application): Promise<void> => {
93
+ * const containerd: Containerd = await app.getObject('containerd')
94
+ * //Pulled for the machine's platform, unpacked into the snapshotter
95
+ * const image: ContainerdImage = await containerd.pullImage({image: 'alpine:3.20'})
96
+ * const container: ContainerdContainer = await containerd.createContainer({
97
+ * image: image.name,
98
+ * name: 'worker',
99
+ * cmd: ['sleep', 'infinity'],
100
+ * //Restarted by containerd, even when the application is not running
101
+ * restartPolicy: 'always'
102
+ * })
103
+ * await container.start()
104
+ * const result: ContainerdExecResult = await container.exec({cmd: 'cat /etc/os-release'})
105
+ * console.log(result.exitCode, result.stdout)
106
+ * })
107
+ * ```
108
+ */
109
+ let Containerd = class Containerd extends core_1.Component {
110
+ #client;
111
+ #images;
112
+ #containers;
113
+ #networks;
114
+ #buildkit;
115
+ #platforms;
116
+ #abortController = new AbortController();
117
+ /**
118
+ * Connect to containerd and create the namespace when it does not exist.
119
+ * @throws {ContainerdConnectionException} containerd does not answer on `socketPath` (not running, no access to the
120
+ * socket), or `buildkitTLS` is given with a unix socket `buildkitAddress`.
121
+ * @protected
122
+ */
123
+ async init() {
124
+ await Promise.all([
125
+ this.container.register(ContainerdImage_js_1.ContainerdImage),
126
+ this.container.register(ContainerdContainer_js_1.ContainerdContainer),
127
+ this.container.register(ContainerdContainerTTY_js_1.ContainerdContainerTTY)
128
+ ]);
129
+ //Not connected until a build: its options checked
130
+ try {
131
+ this.#buildkit = new grpc_1.GRPCConnection(this.buildkitAddress, this.buildkitTLS);
132
+ }
133
+ catch (e) {
134
+ throw new ContainerdConnectionException_js_1.ContainerdConnectionException(`Cannot connect to BuildKit (${this.buildkitAddress}): ${e.message}`);
135
+ }
136
+ this.#client = new ContainerdClient_js_1.ContainerdClient(this.socketPath, this.namespace);
137
+ try {
138
+ await this.#client.version();
139
+ await this.#client.ensureNamespace();
140
+ }
141
+ catch (e) {
142
+ throw new ContainerdConnectionException_js_1.ContainerdConnectionException(`Cannot connect to containerd (${this.socketPath}): ${e.message}`);
143
+ }
144
+ //The platforms of the machine unpacked by the pulls and the imports
145
+ this.#images = new ImageStore_js_1.ImageStore(this.#client, this.snapshotter, node_path_1.default.join(this.dataRoot, 'tmp'), () => this.#platforms.map(Platforms_js_1.parsePlatform));
146
+ this.#networks = new Networks_js_1.NetworkStore(this.cniConfigPath, this.cniPath);
147
+ this.#containers = new ContainerStore_js_1.ContainerStore(this.#client, this.#images, this.#networks, {
148
+ snapshotter: this.snapshotter,
149
+ runtime: this.runtime,
150
+ cgroupManager: this.cgroupManager,
151
+ dataRoot: this.dataRoot,
152
+ logMaxSize: this.logMaxSize
153
+ });
154
+ this.#platforms = (0, Platforms_js_1.supportedPlatforms)().map(Platforms_js_1.formatPlatform);
155
+ }
156
+ /**
157
+ * End the event streams, abort the pulls, pushes and builds in progress, and close the connections to containerd and
158
+ * BuildKit. The containers keep running.
159
+ * @protected
160
+ */
161
+ async destroy() {
162
+ this.#abortController.abort();
163
+ this.#client?.close();
164
+ this.#buildkit?.close();
165
+ }
166
+ /**
167
+ * Build the registry options of a pull, a push or a build: the configured credentials (`auth` replacing the ones of
168
+ * the reference's registry), the insecure registries, and the component's abort signal.
169
+ * @param reference The image reference whose registry gets `auth` (`registry.example.com/team/app:1.0`).
170
+ * @param auth The credentials of the reference's registry; ignored without `reference`.
171
+ * @returns The registry options.
172
+ * @protected
173
+ */
174
+ registryOptions(reference, auth) {
175
+ const credentials = { ...this.registryAuths ?? {} };
176
+ if (reference && auth)
177
+ credentials[(0, Reference_js_1.parseReference)(reference).registry] = auth;
178
+ return { credentials: credentials, insecure: this.insecureRegistries ?? [], signal: this.#abortController.signal };
179
+ }
180
+ /** Containerd Common Operations **/
181
+ /**
182
+ * Get the version of containerd.
183
+ * @returns Its version (`1.7.36`, `v2.4.1`) and its git revision.
184
+ * @throws {GRPCError} containerd no longer answers (from `@lakutata/grpc`).
185
+ */
186
+ async version() {
187
+ return await this.#client.version();
188
+ }
189
+ /**
190
+ * List the platforms this machine runs containers of: its own, and the ones of the emulators registered in
191
+ * `binfmt_misc` (QEMU, Rosetta), as detected when the component was created or by
192
+ * {@link Containerd.detectPlatforms}. An image is described for the first of its platforms in this list.
193
+ * @returns A copy of the list, formatted `os/architecture[/variant]` (`linux/arm64/v8`, `linux/amd64`).
194
+ */
195
+ supportedPlatforms() {
196
+ return [...this.#platforms];
197
+ }
198
+ /**
199
+ * Detect again the platforms this machine runs, after emulators were registered or removed in `binfmt_misc`.
200
+ * @returns The platforms detected, as {@link Containerd.supportedPlatforms} returns them from now on.
201
+ */
202
+ detectPlatforms() {
203
+ this.#platforms = (0, Platforms_js_1.supportedPlatforms)().map(Platforms_js_1.formatPlatform);
204
+ return this.supportedPlatforms();
205
+ }
206
+ /**
207
+ * Stream containerd's events in the component's namespace (`/tasks/exit`, `/containers/create`, `/images/delete`…)
208
+ * as they happen. The stream ends without an error when `signal` aborts or when the component is destroyed. The
209
+ * fields of the task, container, image and snapshot events are decoded; the other events have an empty `event`.
210
+ * @param signal Ends the stream when aborted; without it, the stream lasts as long as the component.
211
+ * @returns The events, in their order.
212
+ * @throws {GRPCError} The connection to containerd fails or is lost (from `@lakutata/grpc`).
213
+ */
214
+ async *events(signal) {
215
+ const abort = signal ? AbortSignal.any([signal, this.#abortController.signal]) : this.#abortController.signal;
216
+ yield* this.#client.subscribe([`namespace==${this.namespace}`], abort);
217
+ }
218
+ /** Containerd Image Operations **/
219
+ /**
220
+ * List the images of the namespace, each one described as {@link Containerd.getImage} does. The images whose content
221
+ * is not complete (a pull in progress, content collected) or that have none of their platforms' content are left
222
+ * out.
223
+ * @returns The images.
224
+ */
225
+ async listImages() {
226
+ const images = await this.#client.listImages();
227
+ const result = [];
228
+ for (const image of images) {
229
+ try {
230
+ result.push(await this.getImage(image.name));
231
+ }
232
+ catch (error) {
233
+ //An image whose content is not complete (pulled meanwhile, collected)
234
+ if (!(error instanceof ContainerdImageNotFoundException_js_1.ContainerdImageNotFoundException) && error.errno !== 'E_CONTAINERD_PLATFORM')
235
+ throw error;
236
+ }
237
+ }
238
+ return result;
239
+ }
240
+ /**
241
+ * Get an image present in containerd; it is not pulled. The image is described for the first platform it has among
242
+ * {@link Containerd.supportedPlatforms}, or for the first platform it has.
243
+ * @param name Its name or a reference, normalized as Docker does (`alpine` is `docker.io/library/alpine:latest`).
244
+ * @returns The image.
245
+ * @throws {ContainerdImageNotFoundException} No image has this name.
246
+ * @throws {ContainerdPlatformException} The content of none of its platforms is present.
247
+ */
248
+ async getImage(name) {
249
+ return await this.getObject(ContainerdImage_js_1.ContainerdImage, {
250
+ getStore: () => this.#images,
251
+ getContainerd: () => this,
252
+ getRegistryOptions: () => this.registryOptions(),
253
+ name: name
254
+ });
255
+ }
256
+ /**
257
+ * Pull an image from its registry: the manifests of the platforms asked, their configurations and layers, then
258
+ * unpack the ones the machine runs ({@link Containerd.supportedPlatforms}) into the snapshotter so that containers
259
+ * can run them; the other platforms are only stored. The image is named by its normalized reference
260
+ * (`docker.io/library/alpine:3.20`); an image of the same name is replaced. The pull is aborted when the component
261
+ * is destroyed.
262
+ * @param options The reference, the platforms (the machine's by default, `'all'` for every one), the registry
263
+ * credentials (`auth`, else the `registryAuths` of its registry), `unpack` and the progress callback.
264
+ * @returns The image pulled.
265
+ * @throws {ContainerdPlatformException} The image has no manifest for one of the platforms asked.
266
+ * @throws {ContainerdImagePullException} The registry cannot be reached, refuses the credentials, or does not have
267
+ * the reference; the transfer fails or is aborted; the unpacking fails (the image is stored).
268
+ */
269
+ async pullImage(options) {
270
+ let platforms;
271
+ if (options.platform === 'all' || (Array.isArray(options.platform) && options.platform.includes('all')))
272
+ platforms = 'all';
273
+ else if (options.platform)
274
+ platforms = (Array.isArray(options.platform) ? options.platform : [options.platform]).map(Platforms_js_1.parsePlatform);
275
+ let name;
276
+ try {
277
+ name = await this.#images.pull(options.image, {
278
+ platforms: platforms,
279
+ registry: this.registryOptions(options.image, options.auth),
280
+ unpack: options.unpack,
281
+ progress: options.progressCallback
282
+ });
283
+ }
284
+ catch (error) {
285
+ throw (0, ContainerdErrors_js_1.containerdError)(error, ContainerdImagePullException_js_1.ContainerdImagePullException);
286
+ }
287
+ return await this.getImage(name);
288
+ }
289
+ /**
290
+ * Get the version of the BuildKit daemon at `buildkitAddress`.
291
+ * @returns Its package (`github.com/moby/buildkit`), version and revision.
292
+ * @throws {ContainerdImageBuildException} BuildKit cannot be reached.
293
+ */
294
+ async buildkitVersion() {
295
+ try {
296
+ return await (0, BuildKit_js_1.buildKitVersion)(this.#buildkit);
297
+ }
298
+ catch (error) {
299
+ throw new ContainerdImageBuildException_js_1.ContainerdImageBuildException(`Cannot connect to BuildKit (${this.buildkitAddress}): ${error.message}`);
300
+ }
301
+ }
302
+ /**
303
+ * List the platforms the BuildKit daemon builds for: the ones of its workers, including the emulators of its own
304
+ * machine.
305
+ * @returns The platforms, formatted `os/architecture[/variant]`.
306
+ * @throws {ContainerdImageBuildException} BuildKit cannot be reached.
307
+ */
308
+ async buildkitPlatforms() {
309
+ try {
310
+ return (await (0, BuildKit_js_1.buildKitPlatforms)(this.#buildkit)).map(Platforms_js_1.formatPlatform);
311
+ }
312
+ catch (error) {
313
+ throw new ContainerdImageBuildException_js_1.ContainerdImageBuildException(`Cannot connect to BuildKit (${this.buildkitAddress}): ${error.message}`);
314
+ }
315
+ }
316
+ /**
317
+ * Build an image with BuildKit (the local or remote daemon at `buildkitAddress`), as `docker buildx build` does: the
318
+ * build context (without the files its `.dockerignore` excludes) and the Dockerfile are sent over a BuildKit session,
319
+ * then the image built is imported into containerd, named by `repoTag`, and pushed when `push` is set. The base
320
+ * images are pulled by BuildKit with the component's registry credentials (or `auth`). The build is aborted when the
321
+ * component is destroyed.
322
+ * @param options The context directory, the Dockerfile, the name, the platforms (the machine's by default), the build
323
+ * arguments, labels and target, `nocache`, `pull`, `push`, the credentials and the output callback.
324
+ * @returns The image built.
325
+ * @throws {ContainerdImageBuildException} BuildKit cannot be reached, the build fails, or its import fails.
326
+ * @throws {ContainerdImagePushException} With `push`, the push fails; the image is built and imported.
327
+ */
328
+ async buildImage(options) {
329
+ const name = (0, Reference_js_1.parseReference)(options.repoTag).name;
330
+ const platforms = options.platform ? (Array.isArray(options.platform) ? options.platform : [options.platform]).map(Platforms_js_1.parsePlatform) : [(0, Platforms_js_1.hostPlatform)()];
331
+ const temporary = node_path_1.default.join(this.dataRoot, 'tmp');
332
+ await (0, promises_1.mkdir)(temporary, { recursive: true });
333
+ const archive = node_path_1.default.join(temporary, `lakutata-build-${(0, node_crypto_1.randomBytes)(8).toString('hex')}.tar`);
334
+ const registry = this.registryOptions(options.repoTag, options.auth);
335
+ try {
336
+ await (0, BuildKit_js_1.buildKitBuild)(this.#buildkit, {
337
+ context: options.workdir,
338
+ dockerfile: options.dockerfile,
339
+ target: options.target || undefined,
340
+ buildArgs: options.buildargs,
341
+ labels: options.labels,
342
+ platforms: platforms,
343
+ noCache: options.nocache,
344
+ pull: options.pull,
345
+ name: name,
346
+ output: archive,
347
+ credentials: (host) => registry.credentials?.[host],
348
+ progress: options.outputCallback,
349
+ signal: this.#abortController.signal
350
+ });
351
+ await this.#images.import(archive, { name: name });
352
+ }
353
+ catch (error) {
354
+ throw new ContainerdImageBuildException_js_1.ContainerdImageBuildException(error.message);
355
+ }
356
+ finally {
357
+ await (0, promises_1.rm)(archive, { force: true });
358
+ }
359
+ const image = await this.getImage(name);
360
+ if (options.push)
361
+ await image.push({ auth: options.auth });
362
+ return image;
363
+ }
364
+ /**
365
+ * Import the images of an archive: an OCI image layout (`nerdctl save`, `docker save` of Docker 25+, the archives of
366
+ * {@link Containerd.exportImages}) or an older `docker save` archive. The images are named as the archive names
367
+ * them (or by `name`, for an archive of one image), replace the images of the same names, and the platforms the
368
+ * machine runs ({@link Containerd.supportedPlatforms}) are unpacked unless `unpack: false`. The images of an OCI
369
+ * layout without a name annotation are not imported unless `name` is given.
370
+ * @param options The archive (a file path or a readable stream), the name to give, and `unpack`.
371
+ * @returns The images imported.
372
+ * @throws {ContainerdImageImportException} The archive cannot be read or is not an image archive; `name` is given
373
+ * with an archive of several images (nothing is imported); the unpacking fails (the images are stored and named).
374
+ */
375
+ async importImage(options) {
376
+ let names;
377
+ try {
378
+ names = await this.#images.import(options.source, { name: options.name, unpack: options.unpack });
379
+ }
380
+ catch (error) {
381
+ throw (0, ContainerdErrors_js_1.containerdError)(error, ContainerdImageImportException_js_1.ContainerdImageImportException);
382
+ }
383
+ return await Promise.all(names.map((name) => this.getImage(name)));
384
+ }
385
+ /**
386
+ * Export images into one archive: an OCI image layout with the `manifest.json` of `docker load`, loaded by
387
+ * `docker load`, `nerdctl load` and {@link Containerd.importImage}. The archive has the platforms each image has in
388
+ * containerd.
389
+ * @param names The names or references of the images (one at least).
390
+ * @param options The destination: a file path (created or replaced) or a writable stream.
391
+ * @throws {ContainerdImageNotFoundException} One of the images does not exist.
392
+ * @throws {ContainerdImageExportException} The archive cannot be written.
393
+ */
394
+ async exportImages(names, options) {
395
+ try {
396
+ await this.#images.export(names, options.destination);
397
+ }
398
+ catch (error) {
399
+ throw (0, ContainerdErrors_js_1.containerdError)(error, ContainerdImageExportException_js_1.ContainerdImageExportException);
400
+ }
401
+ }
402
+ /** Containerd Network Operations **/
403
+ /**
404
+ * Describe a CNI network.
405
+ * @param network The network, as read from its configuration file.
406
+ * @returns Its information.
407
+ * @protected
408
+ */
409
+ networkInfo(network) {
410
+ const main = network.plugins[0] ?? {};
411
+ return {
412
+ id: network.id,
413
+ name: network.name,
414
+ driver: network.driver,
415
+ reserved: !network.managed || network.labels['nerdctl/default-network'] === 'true',
416
+ internal: network.driver === 'bridge' && main.isGateway === false && main.ipMasq === false,
417
+ enableIPv6: network.subnets.some((subnet) => subnet.includes(':')),
418
+ subnets: network.subnets,
419
+ gateways: network.gateways,
420
+ labels: network.labels,
421
+ file: network.file
422
+ };
423
+ }
424
+ /**
425
+ * List the networks: `host` and `none`, then the CNI networks of `cniConfigPath`, among them nerdctl's default
426
+ * `bridge` once it exists (it is created when a container or {@link Containerd.getNetwork} first asks for it).
427
+ * @returns The networks.
428
+ */
429
+ async listNetworks() {
430
+ const system = ['host', 'none'].map((name) => ({ id: name, name: name, driver: name, reserved: true, internal: name === 'none', enableIPv6: false, subnets: [], gateways: [], labels: {} }));
431
+ return [...system, ...(await this.#networks.list()).map((network) => this.networkInfo(network))];
432
+ }
433
+ /**
434
+ * Get a network. Asking for `bridge` creates nerdctl's default network when it does not exist.
435
+ * @param nameOrId Its name, its identifier, or a prefix of its identifier (3 characters at least).
436
+ * @returns The network.
437
+ * @throws {ContainerdNetworkNotFoundException} No network matches.
438
+ */
439
+ async getNetwork(nameOrId) {
440
+ if (nameOrId === 'host' || nameOrId === 'none')
441
+ return (await this.listNetworks()).find((network) => network.name === nameOrId);
442
+ const network = await this.#networks.get(nameOrId);
443
+ if (!network)
444
+ throw new ContainerdNetworkNotFoundException_js_1.ContainerdNetworkNotFoundException(`The network ${nameOrId} does not exist`);
445
+ return this.networkInfo(network);
446
+ }
447
+ /**
448
+ * Create a CNI network as `nerdctl network create` does: its configuration `nerdctl-<name>.conflist` written in
449
+ * `cniConfigPath`, so nerdctl sees it. Its bridge and firewall rules are set up when the first container joins it.
450
+ * @param options Its name, driver (`bridge`, `macvlan`, `ipvlan`), IPv4 subnet (a free one of `10.4.0.0/16` by
451
+ * default), gateway and range, IPv6 subnet, parent interface, `internal`, MTU and labels.
452
+ * @returns The network created.
453
+ * @throws {ContainerdNetworkConflictException} The name is taken (`host`, `none` and `bridge` included), or the subnet
454
+ * overlaps another network's.
455
+ */
456
+ async createNetwork(options) {
457
+ try {
458
+ return this.networkInfo(await this.#networks.create(options));
459
+ }
460
+ catch (error) {
461
+ if (error.code === 'CONFLICT')
462
+ throw new ContainerdNetworkConflictException_js_1.ContainerdNetworkConflictException(error.message);
463
+ throw error;
464
+ }
465
+ }
466
+ /**
467
+ * Remove a CNI network created by nerdctl or by the component, as `nerdctl network rm` does: its configuration, its
468
+ * bridge and the leases of its addresses.
469
+ * @param nameOrId Its name, its identifier, or a prefix of its identifier.
470
+ * @throws {ContainerdNetworkNotFoundException} No network matches (`host` and `none` included).
471
+ * @throws {ContainerdNetworkConflictException} A container of the namespace uses it, it is the default `bridge`, or
472
+ * it was not created by nerdctl (its configuration is left to remove by hand).
473
+ */
474
+ async removeNetwork(nameOrId) {
475
+ const network = nameOrId === Networks_js_1.DEFAULT_NETWORK ? (await this.#networks.list()).find((item) => item.name === nameOrId) : await this.#networks.get(nameOrId);
476
+ if (!network)
477
+ throw new ContainerdNetworkNotFoundException_js_1.ContainerdNetworkNotFoundException(`The network ${nameOrId} does not exist`);
478
+ const users = (await this.#containers.list())
479
+ .filter((record) => {
480
+ try {
481
+ return JSON.parse(record.labels?.['nerdctl/networks'] ?? '[]').includes(network.name);
482
+ }
483
+ catch {
484
+ return false;
485
+ }
486
+ })
487
+ .map((record) => ContainerStore_js_1.ContainerStore.Name(record));
488
+ if (users.length)
489
+ throw new ContainerdNetworkConflictException_js_1.ContainerdNetworkConflictException(`The network ${network.name} is used by the containers ${users.join(', ')}`);
490
+ try {
491
+ await this.#networks.remove(network);
492
+ }
493
+ catch (error) {
494
+ throw new ContainerdNetworkConflictException_js_1.ContainerdNetworkConflictException(error.message);
495
+ }
496
+ }
497
+ /** Containerd Container Operations **/
498
+ /**
499
+ * List the containers of the namespace, running or not, the ones created by nerdctl included.
500
+ * @param labels Only the containers having all these labels with these values (`{app: 'web'}`); all of them by
501
+ * default.
502
+ * @returns The containers.
503
+ */
504
+ async listContainers(labels) {
505
+ const filters = labels && Object.keys(labels).length ? [Object.entries(labels).map(([key, value]) => `labels."${key}"==${value}`).join(',')] : [];
506
+ const records = await this.#containers.list(filters);
507
+ const result = [];
508
+ for (const record of records) {
509
+ try {
510
+ result.push(await this.getContainer(record.id));
511
+ }
512
+ catch (error) {
513
+ //Removed meanwhile
514
+ if (!(error instanceof ContainerdContainerNotFoundException_js_1.ContainerdContainerNotFoundException))
515
+ throw error;
516
+ }
517
+ }
518
+ return result;
519
+ }
520
+ /**
521
+ * Get a container.
522
+ * @param idOrName Its identifier, its name, or a prefix of its identifier (3 hexadecimal characters at least).
523
+ * @returns The container, its information read from containerd.
524
+ * @throws {ContainerdContainerNotFoundException} No container matches.
525
+ * @throws {Error} The prefix matches several containers.
526
+ */
527
+ async getContainer(idOrName) {
528
+ return await this.getObject(ContainerdContainer_js_1.ContainerdContainer, {
529
+ getStore: () => this.#containers,
530
+ getClient: () => this.#client,
531
+ getContainerd: () => this,
532
+ id: idOrName
533
+ });
534
+ }
535
+ /**
536
+ * Create a container of an image present in containerd (it is not pulled): its snapshot, its OCI specification and
537
+ * its state directory (log file, `hosts`, `resolv.conf`, `hostname`). The container is not started. It joins the
538
+ * default CNI network `bridge` by default (created when first used, the CNI plugins needed), as with Docker; `network:
539
+ * 'host'` gives it the host's network. Its `ports` are published on its first CNI network. Its system calls are filtered by containerd's default seccomp profile, unless it is privileged or
540
+ * `seccompProfile` says otherwise. The settings are kept so that {@link ContainerdContainer.update} can create it
541
+ * again.
542
+ * @param options The image and the container's settings (name, command, environment, user, mounts, devices,
543
+ * networks, ports, resources, restart policy…).
544
+ * @returns The container created.
545
+ * @throws {ContainerdImageNotFoundException} The image does not exist.
546
+ * @throws {ContainerdPlatformException} The image has no manifest for the platform asked (the machine's by default).
547
+ * @throws {ContainerdContainerNameConflictException} Another container has the name.
548
+ * @throws {ContainerdNetworkNotFoundException} One of the CNI networks does not exist.
549
+ * @throws {Error} The settings cannot be applied: ports without a CNI network, no command, no CNI plugin installed, a
550
+ * device or a seccomp profile file that cannot be read.
551
+ */
552
+ async createContainer(options) {
553
+ const mounts = [
554
+ ...(options.binds ?? []).map((bind) => ({ type: 'bind', source: bind.hostPath, target: bind.containerPath, readonly: bind.rw === false, options: bind.propagation ? [bind.propagation] : undefined })),
555
+ ...(options.tmpfs ?? []).map((tmpfs) => ({ type: 'tmpfs', target: tmpfs.containerPath, options: [...tmpfs.size ? [`size=${tmpfs.size}`] : [], ...tmpfs.mode ? [`mode=${tmpfs.mode}`] : []] })),
556
+ ...(options.volumes ?? []).map((volume) => ({ type: 'volume', source: volume.volumeName, target: volume.containerPath, readonly: volume.readonly }))
557
+ ];
558
+ const ports = (options.ports ?? []).flatMap((port) => port.hostPorts.map((hostPort) => ({ hostPort: hostPort, containerPort: port.port, protocol: port.type ?? 'tcp', hostIP: port.hostIP })));
559
+ let record;
560
+ try {
561
+ record = await this.#containers.create({
562
+ image: options.image,
563
+ platform: options.platform ? (0, Platforms_js_1.parsePlatform)(options.platform) : undefined,
564
+ name: options.name,
565
+ hostname: options.hostname,
566
+ cmd: options.cmd,
567
+ entrypoint: options.entrypoint,
568
+ env: options.env,
569
+ workingDir: options.workingDir,
570
+ user: options.user,
571
+ labels: options.labels,
572
+ privileged: options.privileged,
573
+ readonlyRootfs: options.readonlyRootfs,
574
+ capAdd: options.capabilities,
575
+ capDrop: options.capabilitiesDrop,
576
+ seccompProfile: options.seccompProfile,
577
+ mounts: mounts,
578
+ devices: (options.devices ?? []).map(device => ({ hostPath: device.hostPath, containerPath: device.containerPath, permissions: device.cgroupPermissions })),
579
+ deviceCgroupRules: options.deviceCgroupRules,
580
+ //Without network: the default CNI network bridge, as Docker and nerdctl
581
+ network: options.networks?.length
582
+ ? options.networks.map((network) => ({ name: network.networkName, ip: network.ip || undefined, ipv6: network.ipv6 || undefined }))
583
+ : options.network ?? [{ name: Networks_js_1.DEFAULT_NETWORK }],
584
+ ports: ports,
585
+ pidHost: options.pidMode === 'host',
586
+ ipcHost: options.ipcMode === 'host',
587
+ cgroupns: options.cgroupns,
588
+ memory: options.memoryLimit || undefined,
589
+ memorySwap: options.memorySwap,
590
+ cpus: options.cpus,
591
+ cpuShares: options.cpuShares,
592
+ cpuset: options.cpuSet?.length ? options.cpuSet.join(',') : undefined,
593
+ pidsLimit: options.pidsLimit,
594
+ oomKillDisable: options.OOMKillDisable,
595
+ sysctls: options.sysctls,
596
+ shmSize: options.shmSize,
597
+ restart: options.restartPolicy || undefined,
598
+ stopSignal: options.stopSignal,
599
+ extraHosts: options.extraHosts,
600
+ dns: options.dns
601
+ });
602
+ }
603
+ catch (error) {
604
+ throw (0, ContainerdErrors_js_1.containerdError)(error);
605
+ }
606
+ //Its settings: the ones it is created again with by its update
607
+ await this.#containers.writeSettings(record.id, Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined && typeof value !== 'function')));
608
+ return await this.getContainer(record.id);
609
+ }
610
+ /**
611
+ * Replace a container by a new one created with other settings, as {@link ContainerdContainer.update} does: the old
612
+ * container is renamed, the new one created with `options`, then the old one removed by force, and the new one
613
+ * started when the old one was running or paused. When the creation fails, the old container gets its name back
614
+ * and keeps running.
615
+ * @param record The containerd record of the container to replace.
616
+ * @param options The complete settings of the new container.
617
+ * @returns The new container.
618
+ * @throws {ContainerdContainerNotFoundException} The container no longer exists.
619
+ * @throws {ContainerdImageNotFoundException} From the creation, as {@link Containerd.createContainer} throws.
620
+ */
621
+ async recreateContainer(record, options) {
622
+ const old = await this.getContainer(record.id);
623
+ const running = old.state.running || old.state.paused;
624
+ const name = old.name;
625
+ await this.#containers.rename(record, `${name}-replaced-${(0, node_crypto_1.randomBytes)(4).toString('hex')}`);
626
+ let created;
627
+ try {
628
+ created = await this.createContainer(options);
629
+ }
630
+ catch (error) {
631
+ await this.#containers.rename((await this.#containers.find(record.id)), name).catch(() => undefined);
632
+ throw error;
633
+ }
634
+ await old.remove({ force: true });
635
+ if (running)
636
+ await created.start();
637
+ return created;
638
+ }
639
+ /** Containerd Volume Operations **/
640
+ /**
641
+ * Describe a named volume.
642
+ * @param volume The volume, as read from its directory.
643
+ * @returns Its information.
644
+ * @protected
645
+ */
646
+ volumeInfo(volume) {
647
+ return { name: volume.name, mountpoint: volume.mountpoint, labels: volume.labels, createdAt: new Time_1.Time(volume.createdAt) };
648
+ }
649
+ /**
650
+ * The store of the namespace's named volumes, under `<dataRoot>/volumes/<namespace>`.
651
+ * @protected
652
+ */
653
+ get volumes() {
654
+ return this.#containers.volumes;
655
+ }
656
+ /**
657
+ * List the containers mounting a volume, running or not.
658
+ * @param name The volume's name.
659
+ * @returns The names of the containers.
660
+ * @protected
661
+ */
662
+ async volumeUsers(name) {
663
+ return (await this.#containers.list())
664
+ .filter((record) => ContainerStore_js_1.ContainerStore.Volumes(record).includes(name))
665
+ .map((record) => ContainerStore_js_1.ContainerStore.Name(record));
666
+ }
667
+ /**
668
+ * List the named volumes of the namespace, sorted by name.
669
+ * @returns The volumes.
670
+ */
671
+ async listVolumes() {
672
+ return (await this.volumes.list()).map((volume) => this.volumeInfo(volume));
673
+ }
674
+ /**
675
+ * Get a named volume.
676
+ * @param name The volume's name.
677
+ * @returns The volume: its host directory (`mountpoint`), labels and creation time.
678
+ * @throws {ContainerdVolumeNotFoundException} The volume does not exist, or the name is not a valid one.
679
+ */
680
+ async getVolume(name) {
681
+ const volume = Volumes_js_1.VolumeStore.ValidName(name) ? await this.volumes.get(name) : undefined;
682
+ if (!volume)
683
+ throw new ContainerdVolumeNotFoundException_js_1.ContainerdVolumeNotFoundException(`The volume ${name} does not exist`);
684
+ return this.volumeInfo(volume);
685
+ }
686
+ /**
687
+ * Create a named volume: a directory under `dataRoot` that containers mount by name. As Docker does, a volume that
688
+ * exists is returned unchanged (its labels are not updated). A container mounting a missing volume creates it too.
689
+ * @param options The name (letters, digits, `_`, `.` and `-`) and the labels.
690
+ * @returns The volume.
691
+ */
692
+ async createVolume(options) {
693
+ return this.volumeInfo(await this.volumes.create(options.name, options.labels ?? {}));
694
+ }
695
+ /**
696
+ * Remove a named volume and its data.
697
+ * @param name The volume's name.
698
+ * @throws {ContainerdVolumeNotFoundException} The volume does not exist.
699
+ * @throws {ContainerdVolumeInUseException} A container of the namespace mounts it, even a stopped one.
700
+ */
701
+ async removeVolume(name) {
702
+ await this.getVolume(name);
703
+ const users = await this.volumeUsers(name);
704
+ if (users.length)
705
+ throw new ContainerdVolumeInUseException_js_1.ContainerdVolumeInUseException(`The volume ${name} is used by the containers ${users.join(', ')}`);
706
+ await this.volumes.remove(name);
707
+ }
708
+ /** Containerd Common Operations **/
709
+ /**
710
+ * Remove the unused resources of the namespace, in this order: the containers that are not running (created or
711
+ * exited), the images no container uses (the dangling ones, without a tag, or all of them with `allImages`), the CNI
712
+ * networks no container uses (except the default `bridge` and the ones nerdctl did not create), and the volumes no
713
+ * container mounts. A container, image, network or volume that fails to be removed is skipped (left out of the
714
+ * result).
715
+ * @param options What to remove: `containers` and `images` by default, `allImages`, `networks` and `volumes` when
716
+ * set.
717
+ * @returns The names (identifiers of the containers) of what was removed.
718
+ */
719
+ async prune(options) {
720
+ if (!options)
721
+ return await this.prune({});
722
+ const result = { containers: [], images: [], networks: [], volumes: [] };
723
+ if (options.containers) {
724
+ for (const container of await this.listContainers()) {
725
+ if (container.state.status !== 'exited' && container.state.status !== 'created')
726
+ continue;
727
+ await container.remove({ force: false }).then(() => result.containers.push(container.id), () => undefined);
728
+ }
729
+ }
730
+ const records = await this.#containers.list();
731
+ if (options.images || options.allImages) {
732
+ const used = new Set(records.map((record) => record.image));
733
+ for (const image of await this.#client.listImages()) {
734
+ if (used.has(image.name))
735
+ continue;
736
+ const dangling = (() => {
737
+ try {
738
+ return !(0, Reference_js_1.parseReference)(image.name).tag;
739
+ }
740
+ catch {
741
+ return true;
742
+ }
743
+ })();
744
+ if (!options.allImages && !dangling)
745
+ continue;
746
+ await this.#images.remove(image.name).then(() => result.images.push(image.name), () => undefined);
747
+ }
748
+ }
749
+ if (options.networks) {
750
+ const usedNetworks = new Set(records.flatMap((record) => {
751
+ try {
752
+ return JSON.parse(record.labels?.['nerdctl/networks'] ?? '[]');
753
+ }
754
+ catch {
755
+ return [];
756
+ }
757
+ }));
758
+ for (const network of await this.#networks.list()) {
759
+ if (!network.managed || network.labels['nerdctl/default-network'] === 'true' || usedNetworks.has(network.name))
760
+ continue;
761
+ await this.#networks.remove(network).then(() => result.networks.push(network.name), () => undefined);
762
+ }
763
+ }
764
+ if (options.volumes) {
765
+ const usedVolumes = new Set(records.flatMap((record) => ContainerStore_js_1.ContainerStore.Volumes(record)));
766
+ for (const volume of await this.volumes.list()) {
767
+ if (usedVolumes.has(volume.name))
768
+ continue;
769
+ await this.volumes.remove(volume.name).then(() => result.volumes.push(volume.name), () => undefined);
770
+ }
771
+ }
772
+ return result;
773
+ }
774
+ };
775
+ exports.Containerd = Containerd;
776
+ __decorate([
777
+ (0, di_1.Configurable)(core_1.DTO.String().optional().default('/run/containerd/containerd.sock')),
778
+ __metadata("design:type", String)
779
+ ], Containerd.prototype, "socketPath", void 0);
780
+ __decorate([
781
+ (0, di_1.Configurable)(core_1.DTO.String().pattern(/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/).optional().default('default')),
782
+ __metadata("design:type", String)
783
+ ], Containerd.prototype, "namespace", void 0);
784
+ __decorate([
785
+ (0, di_1.Configurable)(core_1.DTO.String().optional().default('overlayfs')),
786
+ __metadata("design:type", String)
787
+ ], Containerd.prototype, "snapshotter", void 0);
788
+ __decorate([
789
+ (0, di_1.Configurable)(core_1.DTO.String().optional().default('io.containerd.runc.v2')),
790
+ __metadata("design:type", String)
791
+ ], Containerd.prototype, "runtime", void 0);
792
+ __decorate([
793
+ (0, di_1.Configurable)(core_1.DTO.String().valid('cgroupfs', 'systemd').optional().default('cgroupfs')),
794
+ __metadata("design:type", String)
795
+ ], Containerd.prototype, "cgroupManager", void 0);
796
+ __decorate([
797
+ (0, di_1.Configurable)(core_1.DTO.String().optional().default('/var/lib/lakutata/containerd')),
798
+ __metadata("design:type", String)
799
+ ], Containerd.prototype, "dataRoot", void 0);
800
+ __decorate([
801
+ (0, di_1.Configurable)(core_1.DTO.Number().integer().min(0).optional().default(0)),
802
+ __metadata("design:type", Number)
803
+ ], Containerd.prototype, "logMaxSize", void 0);
804
+ __decorate([
805
+ (0, di_1.Configurable)(core_1.DTO.String().optional().default('/etc/cni/net.d')),
806
+ __metadata("design:type", String)
807
+ ], Containerd.prototype, "cniConfigPath", void 0);
808
+ __decorate([
809
+ (0, di_1.Configurable)(core_1.DTO.Array(core_1.DTO.String()).optional().default(['/opt/cni/bin', '/usr/lib/cni', '/usr/libexec/cni'])),
810
+ __metadata("design:type", Array)
811
+ ], Containerd.prototype, "cniPath", void 0);
812
+ __decorate([
813
+ (0, di_1.Configurable)(core_1.DTO.String().pattern(/^(\/|unix:\/\/\/|tcp:\/\/)/).optional().default('unix:///run/buildkit/buildkitd.sock')),
814
+ __metadata("design:type", String)
815
+ ], Containerd.prototype, "buildkitAddress", void 0);
816
+ __decorate([
817
+ (0, di_1.Configurable)(core_1.DTO.Object({
818
+ ca: core_1.DTO.Alternatives(core_1.DTO.String(), core_1.DTO.Binary()).optional(),
819
+ cert: core_1.DTO.Alternatives(core_1.DTO.String(), core_1.DTO.Binary()).optional(),
820
+ key: core_1.DTO.Alternatives(core_1.DTO.String(), core_1.DTO.Binary()).optional(),
821
+ servername: core_1.DTO.String().optional()
822
+ }).optional()),
823
+ __metadata("design:type", Object)
824
+ ], Containerd.prototype, "buildkitTLS", void 0);
825
+ __decorate([
826
+ (0, di_1.Configurable)(core_1.DTO.Object().pattern(core_1.DTO.String(), core_1.DTO.Object({
827
+ username: core_1.DTO.String().optional(),
828
+ password: core_1.DTO.String().optional(),
829
+ identityToken: core_1.DTO.String().optional()
830
+ })).optional()),
831
+ __metadata("design:type", Object)
832
+ ], Containerd.prototype, "registryAuths", void 0);
833
+ __decorate([
834
+ (0, di_1.Configurable)(core_1.DTO.Array(core_1.DTO.String()).optional()),
835
+ __metadata("design:type", Array)
836
+ ], Containerd.prototype, "insecureRegistries", void 0);
837
+ __decorate([
838
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
839
+ __metadata("design:type", Function),
840
+ __metadata("design:paramtypes", [String]),
841
+ __metadata("design:returntype", Promise)
842
+ ], Containerd.prototype, "getImage", null);
843
+ __decorate([
844
+ (0, dto_1.Accept)(ImagePullOptions_js_1.ImagePullOptions.required()),
845
+ __metadata("design:type", Function),
846
+ __metadata("design:paramtypes", [ImagePullOptions_js_1.ImagePullOptions]),
847
+ __metadata("design:returntype", Promise)
848
+ ], Containerd.prototype, "pullImage", null);
849
+ __decorate([
850
+ (0, dto_1.Accept)(ImageBuildOptions_js_1.ImageBuildOptions.required()),
851
+ __metadata("design:type", Function),
852
+ __metadata("design:paramtypes", [ImageBuildOptions_js_1.ImageBuildOptions]),
853
+ __metadata("design:returntype", Promise)
854
+ ], Containerd.prototype, "buildImage", null);
855
+ __decorate([
856
+ (0, dto_1.Accept)(ImageImportOptions_js_1.ImageImportOptions.required()),
857
+ __metadata("design:type", Function),
858
+ __metadata("design:paramtypes", [ImageImportOptions_js_1.ImageImportOptions]),
859
+ __metadata("design:returntype", Promise)
860
+ ], Containerd.prototype, "importImage", null);
861
+ __decorate([
862
+ (0, dto_1.Accept)(core_1.DTO.Array(core_1.DTO.String()).min(1).required(), ImageExportOptions_js_1.ImageExportOptions.required()),
863
+ __metadata("design:type", Function),
864
+ __metadata("design:paramtypes", [Array, ImageExportOptions_js_1.ImageExportOptions]),
865
+ __metadata("design:returntype", Promise)
866
+ ], Containerd.prototype, "exportImages", null);
867
+ __decorate([
868
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
869
+ __metadata("design:type", Function),
870
+ __metadata("design:paramtypes", [String]),
871
+ __metadata("design:returntype", Promise)
872
+ ], Containerd.prototype, "getNetwork", null);
873
+ __decorate([
874
+ (0, dto_1.Accept)(NetworkCreateOptions_js_1.NetworkCreateOptions.required()),
875
+ __metadata("design:type", Function),
876
+ __metadata("design:paramtypes", [NetworkCreateOptions_js_1.NetworkCreateOptions]),
877
+ __metadata("design:returntype", Promise)
878
+ ], Containerd.prototype, "createNetwork", null);
879
+ __decorate([
880
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
881
+ __metadata("design:type", Function),
882
+ __metadata("design:paramtypes", [String]),
883
+ __metadata("design:returntype", Promise)
884
+ ], Containerd.prototype, "removeNetwork", null);
885
+ __decorate([
886
+ (0, dto_1.Accept)(core_1.DTO.Object().pattern(core_1.DTO.String(), core_1.DTO.String().allow('')).optional()),
887
+ __metadata("design:type", Function),
888
+ __metadata("design:paramtypes", [Object]),
889
+ __metadata("design:returntype", Promise)
890
+ ], Containerd.prototype, "listContainers", null);
891
+ __decorate([
892
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
893
+ __metadata("design:type", Function),
894
+ __metadata("design:paramtypes", [String]),
895
+ __metadata("design:returntype", Promise)
896
+ ], Containerd.prototype, "getContainer", null);
897
+ __decorate([
898
+ (0, dto_1.Accept)(ContainerCreateOptions_js_1.ContainerCreateOptions.required()),
899
+ __metadata("design:type", Function),
900
+ __metadata("design:paramtypes", [ContainerCreateOptions_js_1.ContainerCreateOptions]),
901
+ __metadata("design:returntype", Promise)
902
+ ], Containerd.prototype, "createContainer", null);
903
+ __decorate([
904
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
905
+ __metadata("design:type", Function),
906
+ __metadata("design:paramtypes", [String]),
907
+ __metadata("design:returntype", Promise)
908
+ ], Containerd.prototype, "getVolume", null);
909
+ __decorate([
910
+ (0, dto_1.Accept)(VolumeCreateOptions_js_1.VolumeCreateOptions.required()),
911
+ __metadata("design:type", Function),
912
+ __metadata("design:paramtypes", [VolumeCreateOptions_js_1.VolumeCreateOptions]),
913
+ __metadata("design:returntype", Promise)
914
+ ], Containerd.prototype, "createVolume", null);
915
+ __decorate([
916
+ (0, dto_1.Accept)(core_1.DTO.String().required()),
917
+ __metadata("design:type", Function),
918
+ __metadata("design:paramtypes", [String]),
919
+ __metadata("design:returntype", Promise)
920
+ ], Containerd.prototype, "removeVolume", null);
921
+ __decorate([
922
+ (0, dto_1.Accept)(ContainerdPruneOptions_js_1.ContainerdPruneOptions.optional()),
923
+ __metadata("design:type", Function),
924
+ __metadata("design:paramtypes", [ContainerdPruneOptions_js_1.ContainerdPruneOptions]),
925
+ __metadata("design:returntype", Promise)
926
+ ], Containerd.prototype, "prune", null);
927
+ exports.Containerd = Containerd = __decorate([
928
+ (0, di_1.Singleton)()
929
+ ], Containerd);