magic-hour 0.6.1 → 0.7.0

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 (378) hide show
  1. package/README.md +5 -1
  2. package/dist/core/api-promise.d.ts +14 -6
  3. package/dist/core/api-promise.js +184 -10
  4. package/dist/core/core-client.d.ts +5 -3
  5. package/dist/core/core-client.js +7 -3
  6. package/dist/core/form-data.d.ts +1 -2
  7. package/dist/core/form-data.js +6 -7
  8. package/dist/core/index.d.ts +2 -1
  9. package/dist/core/index.js +4 -1
  10. package/dist/core/zod.d.ts +15 -0
  11. package/dist/core/zod.js +60 -0
  12. package/dist/environment.js +1 -1
  13. package/dist/index.js +17 -7
  14. package/dist/resources/index.js +17 -7
  15. package/dist/resources/v1/ai-headshot-generator/request-types.d.ts +24 -3
  16. package/dist/resources/v1/ai-headshot-generator/request-types.js +70 -0
  17. package/dist/resources/v1/ai-headshot-generator/resource-client.js +4 -1
  18. package/dist/resources/v1/ai-image-generator/request-types.d.ts +29 -3
  19. package/dist/resources/v1/ai-image-generator/request-types.js +78 -0
  20. package/dist/resources/v1/ai-image-generator/resource-client.js +4 -1
  21. package/dist/resources/v1/ai-image-upscaler/request-types.d.ts +29 -3
  22. package/dist/resources/v1/ai-image-upscaler/request-types.js +79 -0
  23. package/dist/resources/v1/ai-image-upscaler/resource-client.js +4 -1
  24. package/dist/resources/v1/ai-photo-editor/request-types.d.ts +37 -3
  25. package/dist/resources/v1/ai-photo-editor/request-types.js +83 -0
  26. package/dist/resources/v1/ai-photo-editor/resource-client.js +4 -1
  27. package/dist/resources/v1/ai-qr-code-generator/request-types.d.ts +26 -3
  28. package/dist/resources/v1/ai-qr-code-generator/request-types.js +74 -0
  29. package/dist/resources/v1/ai-qr-code-generator/resource-client.js +4 -1
  30. package/dist/resources/v1/animation/request-types.d.ts +50 -3
  31. package/dist/resources/v1/animation/request-types.js +91 -0
  32. package/dist/resources/v1/animation/resource-client.js +4 -1
  33. package/dist/resources/v1/face-swap/request-types.d.ts +44 -3
  34. package/dist/resources/v1/face-swap/request-types.js +86 -0
  35. package/dist/resources/v1/face-swap/resource-client.js +4 -1
  36. package/dist/resources/v1/face-swap-photo/request-types.d.ts +24 -3
  37. package/dist/resources/v1/face-swap-photo/request-types.js +70 -0
  38. package/dist/resources/v1/face-swap-photo/resource-client.js +4 -1
  39. package/dist/resources/v1/files/index.js +17 -7
  40. package/dist/resources/v1/files/upload-urls/request-types.d.ts +16 -3
  41. package/dist/resources/v1/files/upload-urls/request-types.js +66 -0
  42. package/dist/resources/v1/files/upload-urls/resource-client.js +4 -1
  43. package/dist/resources/v1/image-background-remover/index.d.ts +5 -0
  44. package/dist/resources/v1/image-background-remover/index.js +8 -0
  45. package/dist/resources/v1/image-background-remover/request-types.d.ts +31 -0
  46. package/dist/resources/v1/image-background-remover/request-types.js +75 -0
  47. package/dist/resources/v1/image-background-remover/resource-client.d.ts +15 -0
  48. package/dist/resources/v1/image-background-remover/resource-client.js +32 -0
  49. package/dist/resources/v1/image-projects/request-types.d.ts +27 -2
  50. package/dist/resources/v1/image-projects/request-types.js +94 -0
  51. package/dist/resources/v1/image-projects/resource-client.js +2 -0
  52. package/dist/resources/v1/image-to-video/request-types.d.ts +42 -3
  53. package/dist/resources/v1/image-to-video/request-types.js +87 -0
  54. package/dist/resources/v1/image-to-video/resource-client.js +4 -1
  55. package/dist/resources/v1/index.d.ts +1 -0
  56. package/dist/resources/v1/index.js +19 -8
  57. package/dist/resources/v1/lip-sync/request-types.d.ts +49 -3
  58. package/dist/resources/v1/lip-sync/request-types.js +90 -0
  59. package/dist/resources/v1/lip-sync/resource-client.js +4 -1
  60. package/dist/resources/v1/resource-client.d.ts +2 -0
  61. package/dist/resources/v1/resource-client.js +2 -0
  62. package/dist/resources/v1/text-to-video/request-types.d.ts +32 -3
  63. package/dist/resources/v1/text-to-video/request-types.js +78 -0
  64. package/dist/resources/v1/text-to-video/resource-client.js +4 -1
  65. package/dist/resources/v1/video-projects/request-types.d.ts +27 -2
  66. package/dist/resources/v1/video-projects/request-types.js +94 -0
  67. package/dist/resources/v1/video-projects/resource-client.js +2 -0
  68. package/dist/resources/v1/video-to-video/request-types.d.ts +55 -3
  69. package/dist/resources/v1/video-to-video/request-types.js +95 -0
  70. package/dist/resources/v1/video-to-video/resource-client.js +4 -1
  71. package/dist/types/delete-v1-image-projects-id-response400.d.ts +14 -1
  72. package/dist/types/delete-v1-image-projects-id-response400.js +65 -0
  73. package/dist/types/delete-v1-image-projects-id-response401-message-enum.d.ts +9 -1
  74. package/dist/types/delete-v1-image-projects-id-response401.d.ts +16 -3
  75. package/dist/types/delete-v1-image-projects-id-response401.js +65 -0
  76. package/dist/types/delete-v1-image-projects-id-response404-message-enum.d.ts +9 -1
  77. package/dist/types/delete-v1-image-projects-id-response404.d.ts +16 -3
  78. package/dist/types/delete-v1-image-projects-id-response404.js +65 -0
  79. package/dist/types/delete-v1-video-projects-id-response400.d.ts +14 -1
  80. package/dist/types/delete-v1-video-projects-id-response400.js +65 -0
  81. package/dist/types/delete-v1-video-projects-id-response401-message-enum.d.ts +9 -1
  82. package/dist/types/delete-v1-video-projects-id-response401.d.ts +16 -3
  83. package/dist/types/delete-v1-video-projects-id-response401.js +65 -0
  84. package/dist/types/delete-v1-video-projects-id-response404-message-enum.d.ts +9 -1
  85. package/dist/types/delete-v1-video-projects-id-response404.d.ts +16 -3
  86. package/dist/types/delete-v1-video-projects-id-response404.js +65 -0
  87. package/dist/types/delete-v1-video-projects-id-response422.d.ts +14 -1
  88. package/dist/types/delete-v1-video-projects-id-response422.js +65 -0
  89. package/dist/types/get-v1-image-projects-id-response-downloads-item.d.ts +15 -1
  90. package/dist/types/get-v1-image-projects-id-response-downloads-item.js +69 -0
  91. package/dist/types/get-v1-image-projects-id-response-error.d.ts +15 -1
  92. package/dist/types/get-v1-image-projects-id-response-error.js +69 -0
  93. package/dist/types/get-v1-image-projects-id-response-status-enum.d.ts +9 -1
  94. package/dist/types/get-v1-image-projects-id-response-type-enum.d.ts +9 -1
  95. package/dist/types/get-v1-image-projects-id-response.d.ts +34 -9
  96. package/dist/types/get-v1-image-projects-id-response.js +133 -0
  97. package/dist/types/get-v1-image-projects-id-response400.d.ts +14 -1
  98. package/dist/types/get-v1-image-projects-id-response400.js +65 -0
  99. package/dist/types/get-v1-image-projects-id-response401-message-enum.d.ts +9 -1
  100. package/dist/types/get-v1-image-projects-id-response401.d.ts +16 -3
  101. package/dist/types/get-v1-image-projects-id-response401.js +65 -0
  102. package/dist/types/get-v1-image-projects-id-response404-message-enum.d.ts +9 -1
  103. package/dist/types/get-v1-image-projects-id-response404.d.ts +16 -3
  104. package/dist/types/get-v1-image-projects-id-response404.js +65 -0
  105. package/dist/types/get-v1-video-projects-id-response-download.d.ts +16 -2
  106. package/dist/types/get-v1-video-projects-id-response-download.js +69 -0
  107. package/dist/types/get-v1-video-projects-id-response-downloads-item.d.ts +24 -0
  108. package/dist/types/get-v1-video-projects-id-response-downloads-item.js +74 -0
  109. package/dist/types/get-v1-video-projects-id-response-error.d.ts +15 -1
  110. package/dist/types/get-v1-video-projects-id-response-error.js +69 -0
  111. package/dist/types/get-v1-video-projects-id-response-status-enum.d.ts +9 -1
  112. package/dist/types/get-v1-video-projects-id-response-type-enum.d.ts +9 -1
  113. package/dist/types/get-v1-video-projects-id-response.d.ts +44 -12
  114. package/dist/types/get-v1-video-projects-id-response.js +152 -0
  115. package/dist/types/get-v1-video-projects-id-response400.d.ts +14 -1
  116. package/dist/types/get-v1-video-projects-id-response400.js +65 -0
  117. package/dist/types/get-v1-video-projects-id-response401-message-enum.d.ts +9 -1
  118. package/dist/types/get-v1-video-projects-id-response401.d.ts +16 -3
  119. package/dist/types/get-v1-video-projects-id-response401.js +65 -0
  120. package/dist/types/get-v1-video-projects-id-response404-message-enum.d.ts +9 -1
  121. package/dist/types/get-v1-video-projects-id-response404.d.ts +16 -3
  122. package/dist/types/get-v1-video-projects-id-response404.js +65 -0
  123. package/dist/types/index.d.ts +10 -0
  124. package/dist/types/post-v1-ai-headshot-generator-body-assets.d.ts +14 -1
  125. package/dist/types/post-v1-ai-headshot-generator-body-assets.js +65 -0
  126. package/dist/types/post-v1-ai-headshot-generator-body.d.ts +18 -4
  127. package/dist/types/post-v1-ai-headshot-generator-body.js +70 -0
  128. package/dist/types/post-v1-ai-headshot-generator-response.d.ts +19 -2
  129. package/dist/types/post-v1-ai-headshot-generator-response.js +69 -0
  130. package/dist/types/post-v1-ai-headshot-generator-response400.d.ts +14 -1
  131. package/dist/types/post-v1-ai-headshot-generator-response400.js +65 -0
  132. package/dist/types/post-v1-ai-headshot-generator-response401-message-enum.d.ts +9 -1
  133. package/dist/types/post-v1-ai-headshot-generator-response401.d.ts +16 -3
  134. package/dist/types/post-v1-ai-headshot-generator-response401.js +65 -0
  135. package/dist/types/post-v1-ai-headshot-generator-response404-message-enum.d.ts +9 -1
  136. package/dist/types/post-v1-ai-headshot-generator-response404.d.ts +16 -3
  137. package/dist/types/post-v1-ai-headshot-generator-response404.js +65 -0
  138. package/dist/types/post-v1-ai-headshot-generator-response422.d.ts +14 -1
  139. package/dist/types/post-v1-ai-headshot-generator-response422.js +65 -0
  140. package/dist/types/post-v1-ai-image-generator-body-orientation-enum.d.ts +9 -1
  141. package/dist/types/post-v1-ai-image-generator-body-style.d.ts +14 -1
  142. package/dist/types/post-v1-ai-image-generator-body-style.js +65 -0
  143. package/dist/types/post-v1-ai-image-generator-body.d.ts +23 -6
  144. package/dist/types/post-v1-ai-image-generator-body.js +78 -0
  145. package/dist/types/post-v1-ai-image-generator-response.d.ts +19 -2
  146. package/dist/types/post-v1-ai-image-generator-response.js +69 -0
  147. package/dist/types/post-v1-ai-image-generator-response400.d.ts +14 -1
  148. package/dist/types/post-v1-ai-image-generator-response400.js +65 -0
  149. package/dist/types/post-v1-ai-image-generator-response401-message-enum.d.ts +9 -1
  150. package/dist/types/post-v1-ai-image-generator-response401.d.ts +16 -3
  151. package/dist/types/post-v1-ai-image-generator-response401.js +65 -0
  152. package/dist/types/post-v1-ai-image-generator-response404-message-enum.d.ts +9 -1
  153. package/dist/types/post-v1-ai-image-generator-response404.d.ts +16 -3
  154. package/dist/types/post-v1-ai-image-generator-response404.js +65 -0
  155. package/dist/types/post-v1-ai-image-generator-response422.d.ts +14 -1
  156. package/dist/types/post-v1-ai-image-generator-response422.js +65 -0
  157. package/dist/types/post-v1-ai-image-upscaler-body-assets.d.ts +14 -1
  158. package/dist/types/post-v1-ai-image-upscaler-body-assets.js +65 -0
  159. package/dist/types/post-v1-ai-image-upscaler-body-style-enhancement-enum.d.ts +9 -1
  160. package/dist/types/post-v1-ai-image-upscaler-body-style.d.ts +18 -4
  161. package/dist/types/post-v1-ai-image-upscaler-body-style.js +69 -0
  162. package/dist/types/post-v1-ai-image-upscaler-body.d.ts +22 -5
  163. package/dist/types/post-v1-ai-image-upscaler-body.js +79 -0
  164. package/dist/types/post-v1-ai-image-upscaler-response.d.ts +19 -2
  165. package/dist/types/post-v1-ai-image-upscaler-response.js +69 -0
  166. package/dist/types/post-v1-ai-image-upscaler-response400.d.ts +14 -1
  167. package/dist/types/post-v1-ai-image-upscaler-response400.js +65 -0
  168. package/dist/types/post-v1-ai-image-upscaler-response401-message-enum.d.ts +9 -1
  169. package/dist/types/post-v1-ai-image-upscaler-response401.d.ts +16 -3
  170. package/dist/types/post-v1-ai-image-upscaler-response401.js +65 -0
  171. package/dist/types/post-v1-ai-image-upscaler-response404-message-enum.d.ts +9 -1
  172. package/dist/types/post-v1-ai-image-upscaler-response404.d.ts +16 -3
  173. package/dist/types/post-v1-ai-image-upscaler-response404.js +65 -0
  174. package/dist/types/post-v1-ai-image-upscaler-response422.d.ts +14 -1
  175. package/dist/types/post-v1-ai-image-upscaler-response422.js +65 -0
  176. package/dist/types/post-v1-ai-photo-editor-body-assets.d.ts +14 -1
  177. package/dist/types/post-v1-ai-photo-editor-body-assets.js +65 -0
  178. package/dist/types/post-v1-ai-photo-editor-body-style.d.ts +24 -6
  179. package/dist/types/post-v1-ai-photo-editor-body-style.js +85 -0
  180. package/dist/types/post-v1-ai-photo-editor-body.d.ts +24 -6
  181. package/dist/types/post-v1-ai-photo-editor-body.js +83 -0
  182. package/dist/types/post-v1-ai-photo-editor-response.d.ts +19 -2
  183. package/dist/types/post-v1-ai-photo-editor-response.js +69 -0
  184. package/dist/types/post-v1-ai-photo-editor-response400.d.ts +14 -1
  185. package/dist/types/post-v1-ai-photo-editor-response400.js +65 -0
  186. package/dist/types/post-v1-ai-photo-editor-response401-message-enum.d.ts +9 -1
  187. package/dist/types/post-v1-ai-photo-editor-response401.d.ts +16 -3
  188. package/dist/types/post-v1-ai-photo-editor-response401.js +65 -0
  189. package/dist/types/post-v1-ai-photo-editor-response404-message-enum.d.ts +9 -1
  190. package/dist/types/post-v1-ai-photo-editor-response404.d.ts +16 -3
  191. package/dist/types/post-v1-ai-photo-editor-response404.js +65 -0
  192. package/dist/types/post-v1-ai-photo-editor-response422.d.ts +14 -1
  193. package/dist/types/post-v1-ai-photo-editor-response422.js +65 -0
  194. package/dist/types/post-v1-ai-qr-code-generator-body-style.d.ts +14 -1
  195. package/dist/types/post-v1-ai-qr-code-generator-body-style.js +65 -0
  196. package/dist/types/post-v1-ai-qr-code-generator-body.d.ts +19 -4
  197. package/dist/types/post-v1-ai-qr-code-generator-body.js +74 -0
  198. package/dist/types/post-v1-ai-qr-code-generator-response.d.ts +19 -2
  199. package/dist/types/post-v1-ai-qr-code-generator-response.js +69 -0
  200. package/dist/types/post-v1-ai-qr-code-generator-response400.d.ts +14 -1
  201. package/dist/types/post-v1-ai-qr-code-generator-response400.js +65 -0
  202. package/dist/types/post-v1-ai-qr-code-generator-response401-message-enum.d.ts +9 -1
  203. package/dist/types/post-v1-ai-qr-code-generator-response401.d.ts +16 -3
  204. package/dist/types/post-v1-ai-qr-code-generator-response401.js +65 -0
  205. package/dist/types/post-v1-ai-qr-code-generator-response404-message-enum.d.ts +9 -1
  206. package/dist/types/post-v1-ai-qr-code-generator-response404.d.ts +16 -3
  207. package/dist/types/post-v1-ai-qr-code-generator-response404.js +65 -0
  208. package/dist/types/post-v1-ai-qr-code-generator-response422.d.ts +14 -1
  209. package/dist/types/post-v1-ai-qr-code-generator-response422.js +65 -0
  210. package/dist/types/post-v1-animation-body-assets-audio-source-enum.d.ts +9 -1
  211. package/dist/types/post-v1-animation-body-assets.d.ts +22 -6
  212. package/dist/types/post-v1-animation-body-assets.js +77 -0
  213. package/dist/types/post-v1-animation-body-style-art-style-enum.d.ts +9 -1
  214. package/dist/types/post-v1-animation-body-style-camera-effect-enum.d.ts +9 -1
  215. package/dist/types/post-v1-animation-body-style-prompt-type-enum.d.ts +12 -1
  216. package/dist/types/post-v1-animation-body-style.d.ts +27 -7
  217. package/dist/types/post-v1-animation-body-style.js +287 -0
  218. package/dist/types/post-v1-animation-body.d.ts +26 -6
  219. package/dist/types/post-v1-animation-body.js +91 -0
  220. package/dist/types/post-v1-animation-response.d.ts +16 -2
  221. package/dist/types/post-v1-animation-response.js +69 -0
  222. package/dist/types/post-v1-animation-response400.d.ts +14 -1
  223. package/dist/types/post-v1-animation-response400.js +65 -0
  224. package/dist/types/post-v1-animation-response401-message-enum.d.ts +9 -1
  225. package/dist/types/post-v1-animation-response401.d.ts +16 -3
  226. package/dist/types/post-v1-animation-response401.js +65 -0
  227. package/dist/types/post-v1-animation-response404-message-enum.d.ts +9 -1
  228. package/dist/types/post-v1-animation-response404.d.ts +16 -3
  229. package/dist/types/post-v1-animation-response404.js +65 -0
  230. package/dist/types/post-v1-animation-response422.d.ts +14 -1
  231. package/dist/types/post-v1-animation-response422.js +65 -0
  232. package/dist/types/post-v1-face-swap-body-assets-video-source-enum.d.ts +9 -1
  233. package/dist/types/post-v1-face-swap-body-assets.d.ts +22 -6
  234. package/dist/types/post-v1-face-swap-body-assets.js +77 -0
  235. package/dist/types/post-v1-face-swap-body.d.ts +24 -6
  236. package/dist/types/post-v1-face-swap-body.js +86 -0
  237. package/dist/types/post-v1-face-swap-photo-body-assets.d.ts +16 -2
  238. package/dist/types/post-v1-face-swap-photo-body-assets.js +69 -0
  239. package/dist/types/post-v1-face-swap-photo-body.d.ts +18 -4
  240. package/dist/types/post-v1-face-swap-photo-body.js +70 -0
  241. package/dist/types/post-v1-face-swap-photo-response.d.ts +19 -2
  242. package/dist/types/post-v1-face-swap-photo-response.js +69 -0
  243. package/dist/types/post-v1-face-swap-photo-response400.d.ts +14 -1
  244. package/dist/types/post-v1-face-swap-photo-response400.js +65 -0
  245. package/dist/types/post-v1-face-swap-photo-response401-message-enum.d.ts +9 -1
  246. package/dist/types/post-v1-face-swap-photo-response401.d.ts +16 -3
  247. package/dist/types/post-v1-face-swap-photo-response401.js +65 -0
  248. package/dist/types/post-v1-face-swap-photo-response404-message-enum.d.ts +9 -1
  249. package/dist/types/post-v1-face-swap-photo-response404.d.ts +16 -3
  250. package/dist/types/post-v1-face-swap-photo-response404.js +65 -0
  251. package/dist/types/post-v1-face-swap-photo-response422.d.ts +14 -1
  252. package/dist/types/post-v1-face-swap-photo-response422.js +65 -0
  253. package/dist/types/post-v1-face-swap-response.d.ts +16 -2
  254. package/dist/types/post-v1-face-swap-response.js +69 -0
  255. package/dist/types/post-v1-face-swap-response400.d.ts +14 -1
  256. package/dist/types/post-v1-face-swap-response400.js +65 -0
  257. package/dist/types/post-v1-face-swap-response401-message-enum.d.ts +9 -1
  258. package/dist/types/post-v1-face-swap-response401.d.ts +16 -3
  259. package/dist/types/post-v1-face-swap-response401.js +65 -0
  260. package/dist/types/post-v1-face-swap-response404-message-enum.d.ts +9 -1
  261. package/dist/types/post-v1-face-swap-response404.d.ts +16 -3
  262. package/dist/types/post-v1-face-swap-response404.js +65 -0
  263. package/dist/types/post-v1-face-swap-response422.d.ts +14 -1
  264. package/dist/types/post-v1-face-swap-response422.js +65 -0
  265. package/dist/types/post-v1-files-upload-urls-body-items-item-type-enum.d.ts +9 -1
  266. package/dist/types/post-v1-files-upload-urls-body-items-item.d.ts +17 -3
  267. package/dist/types/post-v1-files-upload-urls-body-items-item.js +69 -0
  268. package/dist/types/post-v1-files-upload-urls-body.d.ts +16 -3
  269. package/dist/types/post-v1-files-upload-urls-body.js +66 -0
  270. package/dist/types/post-v1-files-upload-urls-response-items-item.d.ts +18 -3
  271. package/dist/types/post-v1-files-upload-urls-response-items-item.js +73 -0
  272. package/dist/types/post-v1-files-upload-urls-response.d.ts +16 -3
  273. package/dist/types/post-v1-files-upload-urls-response.js +66 -0
  274. package/dist/types/post-v1-files-upload-urls-response400.d.ts +14 -1
  275. package/dist/types/post-v1-files-upload-urls-response400.js +65 -0
  276. package/dist/types/post-v1-files-upload-urls-response401-message-enum.d.ts +9 -1
  277. package/dist/types/post-v1-files-upload-urls-response401.d.ts +16 -3
  278. package/dist/types/post-v1-files-upload-urls-response401.js +65 -0
  279. package/dist/types/post-v1-files-upload-urls-response404-message-enum.d.ts +9 -1
  280. package/dist/types/post-v1-files-upload-urls-response404.d.ts +16 -3
  281. package/dist/types/post-v1-files-upload-urls-response404.js +65 -0
  282. package/dist/types/post-v1-files-upload-urls-response422.d.ts +14 -1
  283. package/dist/types/post-v1-files-upload-urls-response422.js +65 -0
  284. package/dist/types/post-v1-image-background-remover-body-assets.d.ts +25 -0
  285. package/dist/types/post-v1-image-background-remover-body-assets.js +70 -0
  286. package/dist/types/post-v1-image-background-remover-body.d.ts +31 -0
  287. package/dist/types/post-v1-image-background-remover-body.js +75 -0
  288. package/dist/types/post-v1-image-background-remover-response.d.ts +30 -0
  289. package/dist/types/post-v1-image-background-remover-response.js +74 -0
  290. package/dist/types/post-v1-image-background-remover-response400.d.ts +22 -0
  291. package/dist/types/post-v1-image-background-remover-response400.js +70 -0
  292. package/dist/types/post-v1-image-background-remover-response401-message-enum.d.ts +12 -0
  293. package/dist/types/post-v1-image-background-remover-response401-message-enum.js +2 -0
  294. package/dist/types/post-v1-image-background-remover-response401.d.ts +23 -0
  295. package/dist/types/post-v1-image-background-remover-response401.js +70 -0
  296. package/dist/types/post-v1-image-background-remover-response404-message-enum.d.ts +12 -0
  297. package/dist/types/post-v1-image-background-remover-response404-message-enum.js +2 -0
  298. package/dist/types/post-v1-image-background-remover-response404.d.ts +23 -0
  299. package/dist/types/post-v1-image-background-remover-response404.js +70 -0
  300. package/dist/types/post-v1-image-background-remover-response422.d.ts +22 -0
  301. package/dist/types/post-v1-image-background-remover-response422.js +70 -0
  302. package/dist/types/post-v1-image-to-video-body-assets.d.ts +14 -1
  303. package/dist/types/post-v1-image-to-video-body-assets.js +65 -0
  304. package/dist/types/post-v1-image-to-video-body-style.d.ts +15 -2
  305. package/dist/types/post-v1-image-to-video-body-style.js +65 -0
  306. package/dist/types/post-v1-image-to-video-body.d.ts +25 -6
  307. package/dist/types/post-v1-image-to-video-body.js +87 -0
  308. package/dist/types/post-v1-image-to-video-response.d.ts +16 -2
  309. package/dist/types/post-v1-image-to-video-response.js +69 -0
  310. package/dist/types/post-v1-image-to-video-response400.d.ts +14 -1
  311. package/dist/types/post-v1-image-to-video-response400.js +65 -0
  312. package/dist/types/post-v1-image-to-video-response401-message-enum.d.ts +9 -1
  313. package/dist/types/post-v1-image-to-video-response401.d.ts +16 -3
  314. package/dist/types/post-v1-image-to-video-response401.js +65 -0
  315. package/dist/types/post-v1-image-to-video-response404-message-enum.d.ts +9 -1
  316. package/dist/types/post-v1-image-to-video-response404.d.ts +16 -3
  317. package/dist/types/post-v1-image-to-video-response404.js +65 -0
  318. package/dist/types/post-v1-image-to-video-response422.d.ts +14 -1
  319. package/dist/types/post-v1-image-to-video-response422.js +65 -0
  320. package/dist/types/post-v1-lip-sync-body-assets-video-source-enum.d.ts +9 -1
  321. package/dist/types/post-v1-lip-sync-body-assets.d.ts +22 -6
  322. package/dist/types/post-v1-lip-sync-body-assets.js +77 -0
  323. package/dist/types/post-v1-lip-sync-body.d.ts +26 -7
  324. package/dist/types/post-v1-lip-sync-body.js +90 -0
  325. package/dist/types/post-v1-lip-sync-response.d.ts +16 -2
  326. package/dist/types/post-v1-lip-sync-response.js +69 -0
  327. package/dist/types/post-v1-lip-sync-response400.d.ts +14 -1
  328. package/dist/types/post-v1-lip-sync-response400.js +65 -0
  329. package/dist/types/post-v1-lip-sync-response401-message-enum.d.ts +9 -1
  330. package/dist/types/post-v1-lip-sync-response401.d.ts +16 -3
  331. package/dist/types/post-v1-lip-sync-response401.js +65 -0
  332. package/dist/types/post-v1-lip-sync-response404-message-enum.d.ts +9 -1
  333. package/dist/types/post-v1-lip-sync-response404.d.ts +16 -3
  334. package/dist/types/post-v1-lip-sync-response404.js +65 -0
  335. package/dist/types/post-v1-lip-sync-response422.d.ts +14 -1
  336. package/dist/types/post-v1-lip-sync-response422.js +65 -0
  337. package/dist/types/post-v1-text-to-video-body-orientation-enum.d.ts +9 -1
  338. package/dist/types/post-v1-text-to-video-body-style.d.ts +14 -1
  339. package/dist/types/post-v1-text-to-video-body-style.js +65 -0
  340. package/dist/types/post-v1-text-to-video-body.d.ts +23 -6
  341. package/dist/types/post-v1-text-to-video-body.js +78 -0
  342. package/dist/types/post-v1-text-to-video-response.d.ts +16 -2
  343. package/dist/types/post-v1-text-to-video-response.js +69 -0
  344. package/dist/types/post-v1-text-to-video-response400.d.ts +14 -1
  345. package/dist/types/post-v1-text-to-video-response400.js +65 -0
  346. package/dist/types/post-v1-text-to-video-response401-message-enum.d.ts +9 -1
  347. package/dist/types/post-v1-text-to-video-response401.d.ts +16 -3
  348. package/dist/types/post-v1-text-to-video-response401.js +65 -0
  349. package/dist/types/post-v1-text-to-video-response404-message-enum.d.ts +9 -1
  350. package/dist/types/post-v1-text-to-video-response404.d.ts +16 -3
  351. package/dist/types/post-v1-text-to-video-response404.js +65 -0
  352. package/dist/types/post-v1-text-to-video-response422.d.ts +14 -1
  353. package/dist/types/post-v1-text-to-video-response422.js +65 -0
  354. package/dist/types/post-v1-video-to-video-body-assets-video-source-enum.d.ts +9 -1
  355. package/dist/types/post-v1-video-to-video-body-assets.d.ts +20 -5
  356. package/dist/types/post-v1-video-to-video-body-assets.js +73 -0
  357. package/dist/types/post-v1-video-to-video-body-fps-resolution-enum.d.ts +11 -1
  358. package/dist/types/post-v1-video-to-video-body-style-art-style-enum.d.ts +9 -1
  359. package/dist/types/post-v1-video-to-video-body-style-model-enum.d.ts +12 -1
  360. package/dist/types/post-v1-video-to-video-body-style-prompt-type-enum.d.ts +11 -1
  361. package/dist/types/post-v1-video-to-video-body-style-version-enum.d.ts +11 -1
  362. package/dist/types/post-v1-video-to-video-body-style.d.ts +27 -7
  363. package/dist/types/post-v1-video-to-video-body-style.js +211 -0
  364. package/dist/types/post-v1-video-to-video-body.d.ts +30 -8
  365. package/dist/types/post-v1-video-to-video-body.js +95 -0
  366. package/dist/types/post-v1-video-to-video-response.d.ts +16 -2
  367. package/dist/types/post-v1-video-to-video-response.js +69 -0
  368. package/dist/types/post-v1-video-to-video-response400.d.ts +14 -1
  369. package/dist/types/post-v1-video-to-video-response400.js +65 -0
  370. package/dist/types/post-v1-video-to-video-response401-message-enum.d.ts +9 -1
  371. package/dist/types/post-v1-video-to-video-response401.d.ts +16 -3
  372. package/dist/types/post-v1-video-to-video-response401.js +65 -0
  373. package/dist/types/post-v1-video-to-video-response404-message-enum.d.ts +9 -1
  374. package/dist/types/post-v1-video-to-video-response404.d.ts +16 -3
  375. package/dist/types/post-v1-video-to-video-response404.js +65 -0
  376. package/dist/types/post-v1-video-to-video-response422.d.ts +14 -1
  377. package/dist/types/post-v1-video-to-video-response422.js +65 -0
  378. package/package.json +12 -11
package/README.md CHANGED
@@ -72,10 +72,14 @@ const client = new Client({ token: process.env["API_TOKEN"]!! });
72
72
 
73
73
  * [create](src/resources/v1/files/upload-urls/README.md#create) - Generate asset upload urls
74
74
 
75
+ ### [v1.image_background_remover](src/resources/v1/image-background-remover/README.md)
76
+
77
+ * [create](src/resources/v1/image-background-remover/README.md#create) - Image Background Remover
78
+
75
79
  ### [v1.image_projects](src/resources/v1/image-projects/README.md)
76
80
 
77
81
  * [delete](src/resources/v1/image-projects/README.md#delete) - Delete image
78
- * [get](src/resources/v1/image-projects/README.md#get) - Get image project details
82
+ * [get](src/resources/v1/image-projects/README.md#get) - Get image details
79
83
 
80
84
  ### [v1.image_to_video](src/resources/v1/image-to-video/README.md)
81
85
 
@@ -1,21 +1,29 @@
1
1
  /**
2
2
  * Generated by Sideko (sideko.dev)
3
3
  **/
4
+ import * as z from "zod";
4
5
  import { Response as NodeResponse } from "node-fetch";
5
6
  import { ResponseType } from "./core-client";
6
7
  export interface ApiPromiseProps {
7
- response: Response | NodeResponse;
8
- responseType: ResponseType | undefined;
8
+ responsePromise: Promise<Response | NodeResponse>;
9
+ responseType?: ResponseType | undefined;
10
+ responseSchema?: z.Schema | undefined;
9
11
  }
10
- export declare class ApiPromise<T> extends Promise<T> {
11
- private responsePromise;
12
- constructor(responsePromise: Promise<ApiPromiseProps>);
12
+ export type EventSourceResponse<T> = AsyncIterableIterator<T>;
13
+ export declare class ApiPromise<T> extends Promise<T> implements AsyncIterator<T>, AsyncIterable<T> {
14
+ private responseProps;
15
+ constructor(responseProps: ApiPromiseProps);
13
16
  /**
14
- * Gets the raw response as rentured by `fetch` rather than automatically
17
+ * Gets the raw response as returned by `fetch` rather than automatically
15
18
  * parsing the response.
16
19
  */
17
20
  asResponse(): Promise<Response | NodeResponse>;
18
21
  private parseResponse;
22
+ private handleNodeStream;
23
+ private handleWebStream;
24
+ asEventStream(): AsyncIterableIterator<T>;
25
+ next(): Promise<IteratorResult<T>>;
26
+ [Symbol.asyncIterator](): AsyncIterator<T>;
19
27
  then<Result1 = T, Result2 = never>(onfulfilled?: ((value: T) => Result1 | PromiseLike<Result1>) | undefined | null, onrejected?: ((reason: any) => Result2 | PromiseLike<Result2>) | undefined | null): Promise<Result1 | Result2>;
20
28
  catch<Result = never>(onrejected?: ((reason: any) => Result | PromiseLike<Result>) | undefined | null): Promise<T | Result>;
21
29
  finally(onfinally?: (() => void) | undefined | null): Promise<T>;
@@ -11,31 +11,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  step((generator = generator.apply(thisArg, _arguments || [])).next());
12
12
  });
13
13
  };
14
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
15
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
16
+ var m = o[Symbol.asyncIterator], i;
17
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
18
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
19
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
20
+ };
21
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
22
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
23
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
24
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
25
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
26
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
27
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
28
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
29
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
30
+ function fulfill(value) { resume("next", value); }
31
+ function reject(value) { resume("throw", value); }
32
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
33
+ };
34
+ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
35
+ var i, p;
36
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
37
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
38
+ };
14
39
  Object.defineProperty(exports, "__esModule", { value: true });
15
40
  exports.ApiPromise = void 0;
16
41
  const binary_response_1 = require("./binary-response");
17
42
  class ApiPromise extends Promise {
18
- constructor(responsePromise) {
43
+ constructor(responseProps) {
19
44
  super((resolve) => {
20
- // left purposely as a no-op to avoid automatically parsing the response
21
- // body. Instead, .then, .catch, and .finally overridden to explicitly
22
- // parse the response
23
45
  resolve(null);
24
46
  });
25
- this.responsePromise = responsePromise;
47
+ this.responseProps = responseProps;
26
48
  }
27
49
  /**
28
- * Gets the raw response as rentured by `fetch` rather than automatically
50
+ * Gets the raw response as returned by `fetch` rather than automatically
29
51
  * parsing the response.
30
52
  */
31
53
  asResponse() {
32
54
  return __awaiter(this, void 0, void 0, function* () {
33
- return (yield this.responsePromise).response;
55
+ return yield this.responseProps.responsePromise;
34
56
  });
35
57
  }
36
58
  parseResponse() {
37
59
  return __awaiter(this, void 0, void 0, function* () {
38
- const { response, responseType } = yield this.responsePromise;
60
+ const { responsePromise, responseType, responseSchema } = this.responseProps;
61
+ const response = yield responsePromise;
39
62
  const contentType = response.headers.get("content-type");
40
63
  if (response.status === 204) {
41
64
  return null;
@@ -44,17 +67,122 @@ class ApiPromise extends Promise {
44
67
  return new binary_response_1.BinaryResponse(yield response.blob(), contentType);
45
68
  }
46
69
  // use a pattern to match json content type to handle
47
- // base case of application/json as well as vendor specfic
70
+ // base case of application/json as well as vendor specific
48
71
  // headers e.g. application/vnd.github+json
49
72
  const jsonPattern = /application\/.*json/g;
50
73
  if (contentType === null || contentType === void 0 ? void 0 : contentType.match(jsonPattern)) {
51
- return (yield response.json());
74
+ const rawJson = yield response.json();
75
+ return responseSchema ? responseSchema.parse(rawJson) : rawJson;
52
76
  }
53
77
  // fall back on text
54
78
  return (yield response.text());
55
79
  });
56
80
  }
81
+ handleNodeStream(stream) {
82
+ return __asyncGenerator(this, arguments, function* handleNodeStream_1() {
83
+ var _a, e_1, _b, _c;
84
+ const { responseSchema } = this.responseProps;
85
+ const parser = new EventSourceParser();
86
+ try {
87
+ for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
88
+ _c = stream_1_1.value;
89
+ _d = false;
90
+ const chunk = _c;
91
+ const text = chunk.toString();
92
+ const messages = parser.parse(text);
93
+ for (const message of messages) {
94
+ if (message.data) {
95
+ const rawJson = { data: JSON.parse(message.data) };
96
+ yield yield __await(responseSchema ? responseSchema.parse(rawJson) : rawJson);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
102
+ finally {
103
+ try {
104
+ if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
105
+ }
106
+ finally { if (e_1) throw e_1.error; }
107
+ }
108
+ });
109
+ }
110
+ handleWebStream(stream) {
111
+ return __asyncGenerator(this, arguments, function* handleWebStream_1() {
112
+ const { responseSchema } = this.responseProps;
113
+ const reader = stream.getReader();
114
+ const decoder = new TextDecoder();
115
+ const parser = new EventSourceParser();
116
+ try {
117
+ while (true) {
118
+ const { done, value } = yield __await(reader.read());
119
+ if (done) {
120
+ break;
121
+ }
122
+ const chunk = decoder.decode(value, { stream: true });
123
+ const messages = parser.parse(chunk);
124
+ for (const message of messages) {
125
+ if (message.data) {
126
+ const rawJson = { data: JSON.parse(message.data) };
127
+ yield yield __await(responseSchema ? responseSchema.parse(rawJson) : rawJson);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ finally {
133
+ reader.releaseLock();
134
+ }
135
+ });
136
+ }
137
+ asEventStream() {
138
+ return __asyncGenerator(this, arguments, function* asEventStream_1() {
139
+ const { responsePromise, responseType } = this.responseProps;
140
+ if (responseType !== "event-stream") {
141
+ throw new Error("Response is not an event stream");
142
+ }
143
+ const response = yield __await(responsePromise);
144
+ if (!response.body) {
145
+ throw new Error("Response body is undefined");
146
+ }
147
+ // Check if we're in Node.js environment
148
+ if ("pipe" in response.body && typeof response.body.pipe === "function") {
149
+ yield __await(yield* __asyncDelegator(__asyncValues(this.handleNodeStream(response.body))));
150
+ }
151
+ else {
152
+ yield __await(yield* __asyncDelegator(__asyncValues(this.handleWebStream(response.body))));
153
+ }
154
+ });
155
+ }
156
+ next() {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ const { responseType } = this.responseProps;
159
+ if (responseType === "event-stream") {
160
+ const iterator = this.asEventStream();
161
+ const result = yield iterator.next();
162
+ return result;
163
+ }
164
+ const value = yield this.parseResponse();
165
+ return { value, done: true };
166
+ });
167
+ }
168
+ [Symbol.asyncIterator]() {
169
+ const iterator = {
170
+ next: () => __awaiter(this, void 0, void 0, function* () {
171
+ const { responseType } = this.responseProps;
172
+ if (responseType === "event-stream") {
173
+ const stream = this.asEventStream();
174
+ return stream.next();
175
+ }
176
+ const value = yield this.parseResponse();
177
+ return { value, done: true };
178
+ }),
179
+ };
180
+ return iterator;
181
+ }
57
182
  then(onfulfilled, onrejected) {
183
+ if (this.responseProps.responseType === "event-stream") {
184
+ return Promise.resolve(this.asEventStream());
185
+ }
58
186
  return this.parseResponse().then(onfulfilled, onrejected);
59
187
  }
60
188
  catch(onrejected) {
@@ -65,3 +193,49 @@ class ApiPromise extends Promise {
65
193
  }
66
194
  }
67
195
  exports.ApiPromise = ApiPromise;
196
+ class EventSourceParser {
197
+ constructor() {
198
+ this.buffer = "";
199
+ }
200
+ parse(chunk) {
201
+ this.buffer += chunk;
202
+ const messages = [];
203
+ const lines = this.buffer.split("\n");
204
+ // Keep the last line in buffer if it's not complete
205
+ this.buffer = lines.pop() || "";
206
+ let currentMessage = {};
207
+ for (const line of lines) {
208
+ if (line.trim() === "") {
209
+ if (currentMessage.data) {
210
+ const message = {
211
+ event: currentMessage.event,
212
+ data: currentMessage.data,
213
+ id: currentMessage.id,
214
+ };
215
+ messages.push(message);
216
+ }
217
+ currentMessage = {};
218
+ continue;
219
+ }
220
+ const [fieldName, ...fieldValue] = line.split(":");
221
+ const value = fieldValue.join(":").trim();
222
+ switch (fieldName) {
223
+ case "event":
224
+ currentMessage.event = value;
225
+ break;
226
+ case "data":
227
+ currentMessage.data = currentMessage.data
228
+ ? currentMessage.data + "\n" + value
229
+ : value;
230
+ break;
231
+ case "id":
232
+ currentMessage.id = value;
233
+ break;
234
+ case "retry":
235
+ // Handle retry if needed
236
+ break;
237
+ }
238
+ }
239
+ return messages;
240
+ }
241
+ }
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * Generated by Sideko (sideko.dev)
3
3
  **/
4
+ import * as z from "zod";
4
5
  import { AuthProvider } from "./auth";
5
6
  import { ApiPromise } from "./api-promise";
6
7
  export interface CoreClientProps {
7
8
  baseUrl: string;
8
9
  timeout?: number | undefined;
9
10
  }
10
- export declare type HttpMethod = "get" | "post" | "put" | "patch" | "delete";
11
- export declare type ResponseType = "json" | "blob" | "unknown";
12
- export declare type RequestConfig = {
11
+ export type HttpMethod = "get" | "post" | "put" | "patch" | "delete";
12
+ export type ResponseType = "json" | "blob" | "unknown" | "event-stream";
13
+ export type RequestConfig = {
13
14
  method: HttpMethod;
14
15
  path: string;
15
16
  responseType: ResponseType;
17
+ responseSchema?: z.Schema;
16
18
  auth?: string[];
17
19
  query?: string[];
18
20
  body?: any;
@@ -111,8 +111,8 @@ class CoreClient {
111
111
  return reqInit;
112
112
  }
113
113
  request(cfg) {
114
- var _a, _b;
115
114
  return __awaiter(this, void 0, void 0, function* () {
115
+ var _a, _b;
116
116
  const fetcherFn = runtime_1.RUNTIME.type === "node" || typeof fetch !== "function"
117
117
  ? require("node-fetch").default
118
118
  : fetch;
@@ -133,11 +133,15 @@ class CoreClient {
133
133
  if (!response.ok) {
134
134
  throw new api_error_1.ApiError(cfg, response);
135
135
  }
136
- return { response, responseType: cfg.responseType };
136
+ return response;
137
137
  });
138
138
  }
139
139
  makeRequest(cfg) {
140
- return new api_promise_1.ApiPromise(this.request(cfg));
140
+ return new api_promise_1.ApiPromise({
141
+ responsePromise: this.request(cfg),
142
+ responseType: cfg.responseType,
143
+ responseSchema: cfg.responseSchema,
144
+ });
141
145
  }
142
146
  }
143
147
  exports.CoreClient = CoreClient;
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * Generated by Sideko (sideko.dev)
3
3
  **/
4
- /// <reference types="node" />
5
4
  import { type ReadStream as NodeReadStream } from "node:fs";
6
- export declare type UploadFile = FileLike | NodeReadStream;
5
+ export type UploadFile = FileLike | NodeReadStream;
7
6
  export declare function isUploadFile(val: any): val is UploadFile;
8
7
  export declare function isNodeReadStream(val: any): val is NodeReadStream;
9
8
  /**
@@ -3,14 +3,17 @@
3
3
  * Generated by Sideko (sideko.dev)
4
4
  **/
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createForm = exports.isBlobLike = exports.isFileLike = exports.isNodeReadStream = exports.isUploadFile = void 0;
6
+ exports.isUploadFile = isUploadFile;
7
+ exports.isNodeReadStream = isNodeReadStream;
8
+ exports.isFileLike = isFileLike;
9
+ exports.isBlobLike = isBlobLike;
10
+ exports.createForm = createForm;
7
11
  const runtime_1 = require("./runtime");
8
12
  function isUploadFile(val) {
9
13
  return isFileLike(val) || isNodeReadStream(val);
10
14
  }
11
- exports.isUploadFile = isUploadFile;
12
15
  function isNodeReadStream(val) {
13
- // node read stream ducktyping check
16
+ // node read stream duck-typing check
14
17
  return (runtime_1.RUNTIME.type === "node" &&
15
18
  typeof val === "object" &&
16
19
  typeof val.bytesRead === "number" &&
@@ -27,7 +30,6 @@ function isNodeReadStream(val) {
27
30
  typeof val.unshift === "function" &&
28
31
  typeof val.wrap === "function");
29
32
  }
30
- exports.isNodeReadStream = isNodeReadStream;
31
33
  function isFileLike(val) {
32
34
  // https://developer.mozilla.org/docs/Web/API/File
33
35
  // https://github.com/node-fetch/fetch-blob/blob/main/file.js
@@ -35,7 +37,6 @@ function isFileLike(val) {
35
37
  typeof (val === null || val === void 0 ? void 0 : val.name) === "string" &&
36
38
  isBlobLike(val));
37
39
  }
38
- exports.isFileLike = isFileLike;
39
40
  function isBlobLike(val) {
40
41
  // https://developer.mozilla.org/docs/Web/API/Blob
41
42
  // https://github.com/node-fetch/fetch-blob/blob/main/index.js
@@ -45,7 +46,6 @@ function isBlobLike(val) {
45
46
  typeof (val === null || val === void 0 ? void 0 : val.text) === "function" &&
46
47
  typeof (val === null || val === void 0 ? void 0 : val.arrayBuffer) === "function");
47
48
  }
48
- exports.isBlobLike = isBlobLike;
49
49
  function appendFormData(form, key, val) {
50
50
  if (val === null || typeof val === "undefined") {
51
51
  return;
@@ -84,4 +84,3 @@ function createForm(data) {
84
84
  }
85
85
  return form;
86
86
  }
87
- exports.createForm = createForm;
@@ -4,7 +4,8 @@
4
4
  export { CoreClient, CoreClientProps, CoreResourceClient, RequestOptions, } from "./core-client";
5
5
  export { AuthProvider, AuthBasic, AuthBearer, AuthKeyQuery, AuthKeyHeader, AuthCookieHeader, } from "./auth";
6
6
  export { RUNTIME } from "./runtime";
7
- export { ApiPromise } from "./api-promise";
7
+ export { ApiPromise, EventSourceResponse } from "./api-promise";
8
8
  export { BinaryResponse } from "./binary-response";
9
9
  export { ApiError } from "./api-error";
10
10
  export { createForm, UploadFile, isUploadFile } from "./form-data";
11
+ export { zodTransform, zodUploadFile } from "./zod";
@@ -3,7 +3,7 @@
3
3
  * Generated by Sideko (sideko.dev)
4
4
  **/
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isUploadFile = exports.createForm = exports.ApiError = exports.BinaryResponse = exports.ApiPromise = exports.RUNTIME = exports.AuthCookieHeader = exports.AuthKeyHeader = exports.AuthKeyQuery = exports.AuthBearer = exports.AuthBasic = exports.CoreResourceClient = exports.CoreClient = void 0;
6
+ exports.zodUploadFile = exports.zodTransform = exports.isUploadFile = exports.createForm = exports.ApiError = exports.BinaryResponse = exports.ApiPromise = exports.RUNTIME = exports.AuthCookieHeader = exports.AuthKeyHeader = exports.AuthKeyQuery = exports.AuthBearer = exports.AuthBasic = exports.CoreResourceClient = exports.CoreClient = void 0;
7
7
  var core_client_1 = require("./core-client");
8
8
  Object.defineProperty(exports, "CoreClient", { enumerable: true, get: function () { return core_client_1.CoreClient; } });
9
9
  Object.defineProperty(exports, "CoreResourceClient", { enumerable: true, get: function () { return core_client_1.CoreResourceClient; } });
@@ -24,3 +24,6 @@ Object.defineProperty(exports, "ApiError", { enumerable: true, get: function ()
24
24
  var form_data_1 = require("./form-data");
25
25
  Object.defineProperty(exports, "createForm", { enumerable: true, get: function () { return form_data_1.createForm; } });
26
26
  Object.defineProperty(exports, "isUploadFile", { enumerable: true, get: function () { return form_data_1.isUploadFile; } });
27
+ var zod_1 = require("./zod");
28
+ Object.defineProperty(exports, "zodTransform", { enumerable: true, get: function () { return zod_1.zodTransform; } });
29
+ Object.defineProperty(exports, "zodUploadFile", { enumerable: true, get: function () { return zod_1.zodUploadFile; } });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generated by Sideko (sideko.dev)
3
+ **/
4
+ import * as z from "zod";
5
+ import { UploadFile } from "./form-data";
6
+ /**
7
+ * Generic function to transform an objects keys from one string to another.
8
+ * If the incoming object does not have a transform key, the original key is retained.
9
+ * If the incoming object has a key that maps to a `null` transform key, then
10
+ * the value is skipped.
11
+ */
12
+ export declare function zodTransform<Input extends Record<string, unknown>, const Transformer extends {
13
+ [k in keyof Input]?: string | null;
14
+ }>(input: Input, transformer: Transformer): any;
15
+ export declare const zodUploadFile: z.ZodType<UploadFile, z.ZodTypeDef, UploadFile>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by Sideko (sideko.dev)
4
+ **/
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.zodUploadFile = void 0;
40
+ exports.zodTransform = zodTransform;
41
+ const z = __importStar(require("zod"));
42
+ const form_data_1 = require("./form-data");
43
+ /**
44
+ * Generic function to transform an objects keys from one string to another.
45
+ * If the incoming object does not have a transform key, the original key is retained.
46
+ * If the incoming object has a key that maps to a `null` transform key, then
47
+ * the value is skipped.
48
+ */
49
+ function zodTransform(input, transformer) {
50
+ let transformed = {};
51
+ for (const [key, val] of Object.entries(input)) {
52
+ const toKey = transformer[key];
53
+ if (toKey === null) {
54
+ continue;
55
+ }
56
+ transformed[toKey !== null && toKey !== void 0 ? toKey : key] = val;
57
+ }
58
+ return transformed;
59
+ }
60
+ exports.zodUploadFile = z.custom((val) => (0, form_data_1.isUploadFile)(val));
@@ -7,4 +7,4 @@ exports.Environment = void 0;
7
7
  var Environment;
8
8
  (function (Environment) {
9
9
  Environment["Environment"] = "https://api.magichour.ai";
10
- })(Environment = exports.Environment || (exports.Environment = {}));
10
+ })(Environment || (exports.Environment = Environment = {}));
package/dist/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.types = exports.resources = exports.Environment = exports.isUploadFile = exports.BinaryResponse = exports.ApiError = exports.default = void 0;
27
37
  var client_1 = require("./client");
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.v1 = void 0;
27
37
  exports.v1 = __importStar(require("./v1"));
@@ -1,10 +1,31 @@
1
1
  /**
2
2
  * Generated by Sideko (sideko.dev)
3
3
  **/
4
- import { types } from "../../../index.js";
4
+ import { External$PostV1AiHeadshotGeneratorBodyAssets, PostV1AiHeadshotGeneratorBodyAssets } from "../../../types/post-v1-ai-headshot-generator-body-assets";
5
+ import * as z from "zod";
5
6
  /**
6
7
  * CreateRequest
7
8
  */
8
- export declare type CreateRequest = {
9
- data: types.PostV1AiHeadshotGeneratorBody;
9
+ export type CreateRequest = {
10
+ /**
11
+ * Provide the assets for headshot photo
12
+ */
13
+ assets: PostV1AiHeadshotGeneratorBodyAssets;
14
+ /**
15
+ * The name of image
16
+ */
17
+ name?: string | undefined;
18
+ };
19
+ /**
20
+ * @internal
21
+ * CreateRequest without any key transformation, this is what
22
+ * we expect to come in as network data
23
+ */
24
+ export type External$CreateRequest = {
25
+ assets: External$PostV1AiHeadshotGeneratorBodyAssets;
26
+ name?: string | undefined;
27
+ };
28
+ export declare const Schemas$CreateRequest: {
29
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
30
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
10
31
  };