@executioncontrolprotocol/adobe-firefly-services 0.13.2 → 0.60.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 (281) hide show
  1. package/LICENSE +198 -13
  2. package/README.md +113 -83
  3. package/dist/auth/ims.d.ts +47 -14
  4. package/dist/auth/ims.d.ts.map +1 -1
  5. package/dist/auth/ims.js +127 -26
  6. package/dist/auth/ims.js.map +1 -1
  7. package/dist/config.d.ts +27 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +51 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/errors.d.ts +42 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +53 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/generated/audio-video/capabilities.d.ts +21 -36
  16. package/dist/generated/audio-video/capabilities.d.ts.map +1 -1
  17. package/dist/generated/audio-video/capabilities.js +295 -259
  18. package/dist/generated/audio-video/capabilities.js.map +1 -1
  19. package/dist/generated/audio-video/operations.d.ts +13 -0
  20. package/dist/generated/audio-video/operations.d.ts.map +1 -0
  21. package/dist/generated/audio-video/operations.js +182 -0
  22. package/dist/generated/audio-video/operations.js.map +1 -0
  23. package/dist/generated/audio-video/schemas.d.ts +245 -82
  24. package/dist/generated/audio-video/schemas.d.ts.map +1 -1
  25. package/dist/generated/audio-video/schemas.js +552 -466
  26. package/dist/generated/audio-video/schemas.js.map +1 -1
  27. package/dist/generated/creative-production/capabilities.d.ts +10 -10
  28. package/dist/generated/creative-production/capabilities.d.ts.map +1 -1
  29. package/dist/generated/creative-production/capabilities.js +64 -77
  30. package/dist/generated/creative-production/capabilities.js.map +1 -1
  31. package/dist/generated/creative-production/operations.d.ts +13 -0
  32. package/dist/generated/creative-production/operations.d.ts.map +1 -0
  33. package/dist/generated/creative-production/operations.js +48 -0
  34. package/dist/generated/creative-production/operations.js.map +1 -0
  35. package/dist/generated/creative-production/schemas.d.ts +65 -21
  36. package/dist/generated/creative-production/schemas.d.ts.map +1 -1
  37. package/dist/generated/creative-production/schemas.js +149 -128
  38. package/dist/generated/creative-production/schemas.js.map +1 -1
  39. package/dist/generated/express/capabilities.d.ts +11 -10
  40. package/dist/generated/express/capabilities.d.ts.map +1 -1
  41. package/dist/generated/express/capabilities.js +65 -64
  42. package/dist/generated/express/capabilities.js.map +1 -1
  43. package/dist/generated/express/operations.d.ts +13 -0
  44. package/dist/generated/express/operations.d.ts.map +1 -0
  45. package/dist/generated/express/operations.js +58 -0
  46. package/dist/generated/express/operations.js.map +1 -0
  47. package/dist/generated/express/schemas.d.ts +100 -34
  48. package/dist/generated/express/schemas.d.ts.map +1 -1
  49. package/dist/generated/express/schemas.js +165 -134
  50. package/dist/generated/express/schemas.js.map +1 -1
  51. package/dist/generated/firefly/capabilities.d.ts +18 -28
  52. package/dist/generated/firefly/capabilities.d.ts.map +1 -1
  53. package/dist/generated/firefly/capabilities.js +289 -172
  54. package/dist/generated/firefly/capabilities.js.map +1 -1
  55. package/dist/generated/firefly/operations.d.ts +13 -0
  56. package/dist/generated/firefly/operations.d.ts.map +1 -0
  57. package/dist/generated/firefly/operations.js +145 -0
  58. package/dist/generated/firefly/operations.js.map +1 -0
  59. package/dist/generated/firefly/schemas.d.ts +250 -105
  60. package/dist/generated/firefly/schemas.d.ts.map +1 -1
  61. package/dist/generated/firefly/schemas.js +462 -451
  62. package/dist/generated/firefly/schemas.js.map +1 -1
  63. package/dist/generated/illustrator/capabilities.d.ts +11 -16
  64. package/dist/generated/illustrator/capabilities.d.ts.map +1 -1
  65. package/dist/generated/illustrator/capabilities.js +99 -100
  66. package/dist/generated/illustrator/capabilities.js.map +1 -1
  67. package/dist/generated/illustrator/operations.d.ts +13 -0
  68. package/dist/generated/illustrator/operations.d.ts.map +1 -0
  69. package/dist/generated/illustrator/operations.js +65 -0
  70. package/dist/generated/illustrator/operations.js.map +1 -0
  71. package/dist/generated/illustrator/schemas.d.ts +85 -54
  72. package/dist/generated/illustrator/schemas.d.ts.map +1 -1
  73. package/dist/generated/illustrator/schemas.js +187 -233
  74. package/dist/generated/illustrator/schemas.js.map +1 -1
  75. package/dist/generated/indesign/capabilities.d.ts +19 -32
  76. package/dist/generated/indesign/capabilities.d.ts.map +1 -1
  77. package/dist/generated/indesign/capabilities.js +394 -197
  78. package/dist/generated/indesign/capabilities.js.map +1 -1
  79. package/dist/generated/indesign/operations.d.ts +13 -0
  80. package/dist/generated/indesign/operations.d.ts.map +1 -0
  81. package/dist/generated/indesign/operations.js +133 -0
  82. package/dist/generated/indesign/operations.js.map +1 -0
  83. package/dist/generated/indesign/schemas.d.ts +75 -24
  84. package/dist/generated/indesign/schemas.d.ts.map +1 -1
  85. package/dist/generated/indesign/schemas.js +351 -240
  86. package/dist/generated/indesign/schemas.js.map +1 -1
  87. package/dist/generated/index.d.ts +74 -3
  88. package/dist/generated/index.d.ts.map +1 -1
  89. package/dist/generated/index.js +28 -97
  90. package/dist/generated/index.js.map +1 -1
  91. package/dist/generated/photoshop/capabilities.d.ts +13 -14
  92. package/dist/generated/photoshop/capabilities.d.ts.map +1 -1
  93. package/dist/generated/photoshop/capabilities.js +133 -90
  94. package/dist/generated/photoshop/capabilities.js.map +1 -1
  95. package/dist/generated/photoshop/operations.d.ts +13 -0
  96. package/dist/generated/photoshop/operations.d.ts.map +1 -0
  97. package/dist/generated/photoshop/operations.js +88 -0
  98. package/dist/generated/photoshop/operations.js.map +1 -0
  99. package/dist/generated/photoshop/schemas.d.ts +430 -152
  100. package/dist/generated/photoshop/schemas.d.ts.map +1 -1
  101. package/dist/generated/photoshop/schemas.js +809 -716
  102. package/dist/generated/photoshop/schemas.js.map +1 -1
  103. package/dist/generated/substance3d/capabilities.d.ts +16 -22
  104. package/dist/generated/substance3d/capabilities.d.ts.map +1 -1
  105. package/dist/generated/substance3d/capabilities.js +181 -136
  106. package/dist/generated/substance3d/capabilities.js.map +1 -1
  107. package/dist/generated/substance3d/operations.d.ts +13 -0
  108. package/dist/generated/substance3d/operations.d.ts.map +1 -0
  109. package/dist/generated/substance3d/operations.js +114 -0
  110. package/dist/generated/substance3d/operations.js.map +1 -0
  111. package/dist/generated/substance3d/schemas.d.ts +305 -76
  112. package/dist/generated/substance3d/schemas.d.ts.map +1 -1
  113. package/dist/generated/substance3d/schemas.js +634 -515
  114. package/dist/generated/substance3d/schemas.js.map +1 -1
  115. package/dist/http/async-job.d.ts +24 -14
  116. package/dist/http/async-job.d.ts.map +1 -1
  117. package/dist/http/async-job.js +135 -69
  118. package/dist/http/async-job.js.map +1 -1
  119. package/dist/http/client.d.ts +54 -26
  120. package/dist/http/client.d.ts.map +1 -1
  121. package/dist/http/client.js +136 -53
  122. package/dist/http/client.js.map +1 -1
  123. package/dist/http/request-limit.d.ts +42 -0
  124. package/dist/http/request-limit.d.ts.map +1 -0
  125. package/dist/http/request-limit.js +46 -0
  126. package/dist/http/request-limit.js.map +1 -0
  127. package/dist/index.d.ts +84 -30
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +20 -34
  130. package/dist/index.js.map +1 -1
  131. package/dist/runtime/abort.d.ts +17 -0
  132. package/dist/runtime/abort.d.ts.map +1 -0
  133. package/dist/runtime/abort.js +51 -0
  134. package/dist/runtime/abort.js.map +1 -0
  135. package/dist/runtime/assemble.d.ts +99 -0
  136. package/dist/runtime/assemble.d.ts.map +1 -0
  137. package/dist/runtime/assemble.js +159 -0
  138. package/dist/runtime/assemble.js.map +1 -0
  139. package/dist/runtime/invoke-capability.d.ts +46 -0
  140. package/dist/runtime/invoke-capability.d.ts.map +1 -0
  141. package/dist/runtime/invoke-capability.js +68 -0
  142. package/dist/runtime/invoke-capability.js.map +1 -0
  143. package/dist/runtime/product-shape.d.ts +49 -0
  144. package/dist/runtime/product-shape.d.ts.map +1 -0
  145. package/dist/runtime/product-shape.js +309 -0
  146. package/dist/runtime/product-shape.js.map +1 -0
  147. package/dist/schemas.d.ts +13 -0
  148. package/dist/schemas.d.ts.map +1 -0
  149. package/dist/schemas.js +7 -0
  150. package/dist/schemas.js.map +1 -0
  151. package/ecp.manifest.json +840 -0
  152. package/ecp.schema.json +23498 -0
  153. package/package.json +28 -19
  154. package/dist/generated/audio-video/capabilities.browser.d.ts +0 -37
  155. package/dist/generated/audio-video/capabilities.browser.d.ts.map +0 -1
  156. package/dist/generated/audio-video/capabilities.browser.js +0 -44
  157. package/dist/generated/audio-video/capabilities.browser.js.map +0 -1
  158. package/dist/generated/audio-video/index.d.ts +0 -3
  159. package/dist/generated/audio-video/index.d.ts.map +0 -1
  160. package/dist/generated/audio-video/index.js +0 -3
  161. package/dist/generated/audio-video/index.js.map +0 -1
  162. package/dist/generated/audio-video/shells.d.ts +0 -39
  163. package/dist/generated/audio-video/shells.d.ts.map +0 -1
  164. package/dist/generated/audio-video/shells.js +0 -290
  165. package/dist/generated/audio-video/shells.js.map +0 -1
  166. package/dist/generated/creative-production/capabilities.browser.d.ts +0 -11
  167. package/dist/generated/creative-production/capabilities.browser.d.ts.map +0 -1
  168. package/dist/generated/creative-production/capabilities.browser.js +0 -18
  169. package/dist/generated/creative-production/capabilities.browser.js.map +0 -1
  170. package/dist/generated/creative-production/index.d.ts +0 -3
  171. package/dist/generated/creative-production/index.d.ts.map +0 -1
  172. package/dist/generated/creative-production/index.js +0 -3
  173. package/dist/generated/creative-production/index.js.map +0 -1
  174. package/dist/generated/creative-production/shells.d.ts +0 -13
  175. package/dist/generated/creative-production/shells.d.ts.map +0 -1
  176. package/dist/generated/creative-production/shells.js +0 -108
  177. package/dist/generated/creative-production/shells.js.map +0 -1
  178. package/dist/generated/express/capabilities.browser.d.ts +0 -11
  179. package/dist/generated/express/capabilities.browser.d.ts.map +0 -1
  180. package/dist/generated/express/capabilities.browser.js +0 -18
  181. package/dist/generated/express/capabilities.browser.js.map +0 -1
  182. package/dist/generated/express/index.d.ts +0 -3
  183. package/dist/generated/express/index.d.ts.map +0 -1
  184. package/dist/generated/express/index.js +0 -3
  185. package/dist/generated/express/index.js.map +0 -1
  186. package/dist/generated/express/shells.d.ts +0 -13
  187. package/dist/generated/express/shells.d.ts.map +0 -1
  188. package/dist/generated/express/shells.js +0 -72
  189. package/dist/generated/express/shells.js.map +0 -1
  190. package/dist/generated/firefly/capabilities.browser.d.ts +0 -29
  191. package/dist/generated/firefly/capabilities.browser.d.ts.map +0 -1
  192. package/dist/generated/firefly/capabilities.browser.js +0 -36
  193. package/dist/generated/firefly/capabilities.browser.js.map +0 -1
  194. package/dist/generated/firefly/index.d.ts +0 -3
  195. package/dist/generated/firefly/index.d.ts.map +0 -1
  196. package/dist/generated/firefly/index.js +0 -3
  197. package/dist/generated/firefly/index.js.map +0 -1
  198. package/dist/generated/firefly/shells.d.ts +0 -31
  199. package/dist/generated/firefly/shells.d.ts.map +0 -1
  200. package/dist/generated/firefly/shells.js +0 -199
  201. package/dist/generated/firefly/shells.js.map +0 -1
  202. package/dist/generated/illustrator/capabilities.browser.d.ts +0 -17
  203. package/dist/generated/illustrator/capabilities.browser.d.ts.map +0 -1
  204. package/dist/generated/illustrator/capabilities.browser.js +0 -24
  205. package/dist/generated/illustrator/capabilities.browser.js.map +0 -1
  206. package/dist/generated/illustrator/index.d.ts +0 -3
  207. package/dist/generated/illustrator/index.d.ts.map +0 -1
  208. package/dist/generated/illustrator/index.js +0 -3
  209. package/dist/generated/illustrator/index.js.map +0 -1
  210. package/dist/generated/illustrator/shells.d.ts +0 -19
  211. package/dist/generated/illustrator/shells.d.ts.map +0 -1
  212. package/dist/generated/illustrator/shells.js +0 -106
  213. package/dist/generated/illustrator/shells.js.map +0 -1
  214. package/dist/generated/indesign/capabilities.browser.d.ts +0 -33
  215. package/dist/generated/indesign/capabilities.browser.d.ts.map +0 -1
  216. package/dist/generated/indesign/capabilities.browser.js +0 -40
  217. package/dist/generated/indesign/capabilities.browser.js.map +0 -1
  218. package/dist/generated/indesign/index.d.ts +0 -3
  219. package/dist/generated/indesign/index.d.ts.map +0 -1
  220. package/dist/generated/indesign/index.js +0 -3
  221. package/dist/generated/indesign/index.js.map +0 -1
  222. package/dist/generated/indesign/shells.d.ts +0 -35
  223. package/dist/generated/indesign/shells.d.ts.map +0 -1
  224. package/dist/generated/indesign/shells.js +0 -208
  225. package/dist/generated/indesign/shells.js.map +0 -1
  226. package/dist/generated/index.browser.d.ts +0 -4
  227. package/dist/generated/index.browser.d.ts.map +0 -1
  228. package/dist/generated/index.browser.js +0 -98
  229. package/dist/generated/index.browser.js.map +0 -1
  230. package/dist/generated/photoshop/capabilities.browser.d.ts +0 -15
  231. package/dist/generated/photoshop/capabilities.browser.d.ts.map +0 -1
  232. package/dist/generated/photoshop/capabilities.browser.js +0 -22
  233. package/dist/generated/photoshop/capabilities.browser.js.map +0 -1
  234. package/dist/generated/photoshop/index.d.ts +0 -3
  235. package/dist/generated/photoshop/index.d.ts.map +0 -1
  236. package/dist/generated/photoshop/index.js +0 -3
  237. package/dist/generated/photoshop/index.js.map +0 -1
  238. package/dist/generated/photoshop/shells.d.ts +0 -17
  239. package/dist/generated/photoshop/shells.d.ts.map +0 -1
  240. package/dist/generated/photoshop/shells.js +0 -92
  241. package/dist/generated/photoshop/shells.js.map +0 -1
  242. package/dist/generated/substance3d/capabilities.browser.d.ts +0 -23
  243. package/dist/generated/substance3d/capabilities.browser.d.ts.map +0 -1
  244. package/dist/generated/substance3d/capabilities.browser.js +0 -30
  245. package/dist/generated/substance3d/capabilities.browser.js.map +0 -1
  246. package/dist/generated/substance3d/index.d.ts +0 -3
  247. package/dist/generated/substance3d/index.d.ts.map +0 -1
  248. package/dist/generated/substance3d/index.js +0 -3
  249. package/dist/generated/substance3d/index.js.map +0 -1
  250. package/dist/generated/substance3d/shells.d.ts +0 -25
  251. package/dist/generated/substance3d/shells.d.ts.map +0 -1
  252. package/dist/generated/substance3d/shells.js +0 -146
  253. package/dist/generated/substance3d/shells.js.map +0 -1
  254. package/dist/index.browser.d.ts +0 -19
  255. package/dist/index.browser.d.ts.map +0 -1
  256. package/dist/index.browser.js +0 -27
  257. package/dist/index.browser.js.map +0 -1
  258. package/dist/runtime/invoke.d.ts +0 -67
  259. package/dist/runtime/invoke.d.ts.map +0 -1
  260. package/dist/runtime/invoke.js +0 -69
  261. package/dist/runtime/invoke.js.map +0 -1
  262. package/dist/runtime/photoshop-manifest.d.ts +0 -40
  263. package/dist/runtime/photoshop-manifest.d.ts.map +0 -1
  264. package/dist/runtime/photoshop-manifest.js +0 -115
  265. package/dist/runtime/photoshop-manifest.js.map +0 -1
  266. package/dist/shared.d.ts +0 -11
  267. package/dist/shared.d.ts.map +0 -1
  268. package/dist/shared.js +0 -39
  269. package/dist/shared.js.map +0 -1
  270. package/openapi/audio-video/audio-video-api.json +0 -8333
  271. package/openapi/audio-video/translate-lipsync-openapi.json +0 -1967
  272. package/openapi/content-tagging/SOURCE.md +0 -10
  273. package/openapi/creative-production/workflow-builder-api.yaml +0 -1002
  274. package/openapi/express/ffs-express-api.json +0 -2262
  275. package/openapi/firefly/firefly-api.json +0 -4964
  276. package/openapi/illustrator/illustrator-api-beta.json +0 -1329
  277. package/openapi/illustrator/illustrator-api.json +0 -2447
  278. package/openapi/indesign/indesignapi.json +0 -2907
  279. package/openapi/overlays/schema-fixes.json +0 -95
  280. package/openapi/photoshop/photoshopv2-api.json +0 -5395
  281. package/openapi/substance3d/openapi.yaml +0 -3583
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The abort reason as a throwable, defaulting to a DOMException named AbortError.
3
+ * @category Runtime
4
+ */
5
+ export function abortReason(signal) {
6
+ return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
7
+ }
8
+ /**
9
+ * Wait `ms`, rejecting early with the abort reason when `signal` aborts.
10
+ * @category Runtime
11
+ */
12
+ export function sleep(ms, signal) {
13
+ return new Promise((resolve, reject) => {
14
+ if (signal?.aborted) {
15
+ reject(abortReason(signal));
16
+ return;
17
+ }
18
+ const onAbort = () => {
19
+ clearTimeout(timer);
20
+ reject(abortReason(signal));
21
+ };
22
+ const timer = setTimeout(() => {
23
+ signal?.removeEventListener("abort", onAbort);
24
+ resolve();
25
+ }, ms);
26
+ signal?.addEventListener("abort", onAbort, { once: true });
27
+ });
28
+ }
29
+ /**
30
+ * Settle with `promise`, or reject with the abort reason if `signal` aborts first. The
31
+ * underlying work keeps running; use this for shared work one caller must not cancel.
32
+ * @category Runtime
33
+ */
34
+ export function raceSignal(promise, signal) {
35
+ if (!signal)
36
+ return promise;
37
+ if (signal.aborted)
38
+ return Promise.reject(abortReason(signal));
39
+ return new Promise((resolve, reject) => {
40
+ const onAbort = () => reject(abortReason(signal));
41
+ signal.addEventListener("abort", onAbort, { once: true });
42
+ promise.then((value) => {
43
+ signal.removeEventListener("abort", onAbort);
44
+ resolve(value);
45
+ }, (error) => {
46
+ signal.removeEventListener("abort", onAbort);
47
+ reject(error);
48
+ });
49
+ });
50
+ }
51
+ //# sourceMappingURL=abort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.js","sourceRoot":"","sources":["../../src/runtime/abort.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,OAAO,MAAM,CAAC,MAAM,IAAI,IAAI,YAAY,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAA;AACtF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3B,OAAM;QACR,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAA;YACnB,MAAM,CAAC,WAAW,CAAC,MAAqB,CAAC,CAAC,CAAA;QAC5C,CAAC,CAAA;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC7C,OAAO,EAAE,CAAA;QACX,CAAC,EAAE,EAAE,CAAC,CAAA;QACN,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAI,OAAmB,EAAE,MAAoB;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAA;IAC3B,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9D,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;QACjD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC5C,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC5C,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,99 @@
1
+ import type { z } from "zod";
2
+ /**
3
+ * Which top-level input keys are path, query, header and hoisted JSON-body fields.
4
+ * @category Runtime
5
+ */
6
+ export interface AdobeParameterMap {
7
+ /** Path template parameters. */
8
+ path?: string[];
9
+ /** Query string parameters. */
10
+ query?: string[];
11
+ /** Request headers (never auth). */
12
+ headers?: string[];
13
+ /** JSON body fields hoisted from the request schema. */
14
+ body?: string[];
15
+ }
16
+ /**
17
+ * Request body rules for one operation.
18
+ * @category Runtime
19
+ */
20
+ export interface AdobeBodyRules {
21
+ /** Input key groups. */
22
+ parameters?: AdobeParameterMap;
23
+ /** The API's JSON request schema; the merged body must pass it. */
24
+ bodySchema?: z.ZodType;
25
+ /** The API requires a body, so an empty merge is still validated. */
26
+ bodyRequired?: boolean;
27
+ /** Default `caiClaimVersion` to 2 when the body has an image input (Firefly v3 image APIs). */
28
+ defaultCaiClaimVersion?: boolean;
29
+ /** Body fields supplied as url FileRefs at the capability boundary. */
30
+ fileRefBodyFields?: string[];
31
+ }
32
+ /**
33
+ * HTTP pieces assembled from a flat capability input.
34
+ * @category Runtime
35
+ */
36
+ export interface AssembledAdobeRequest {
37
+ /** Path template values. */
38
+ path: Record<string, string | number | boolean>;
39
+ /** Query string values. */
40
+ query: Record<string, string | number | boolean>;
41
+ /** Extra headers. */
42
+ headers: Record<string, string>;
43
+ /** JSON body after the parameter merge, or undefined when nothing is sent. */
44
+ body?: unknown;
45
+ }
46
+ /**
47
+ * Body keys that mean the request carries an image input (Content Credentials claim).
48
+ * @category Runtime
49
+ */
50
+ export declare const CAI_IMAGE_INPUT_KEYS: readonly ["image", "mask", "structure", "style", "referenceBlobs", "background", "object"];
51
+ /**
52
+ * Shallow-merge a JSON document under explicitly set parameters: `{ ...body, ...set }`.
53
+ * Undefined parameters are omitted so they never wipe a `body` key; nested objects and arrays
54
+ * replace as a whole. A non-object `body` with parameters set is an input error.
55
+ * @category Runtime
56
+ */
57
+ export declare function mergeParameterBody(body: unknown, parameters: Record<string, unknown>): unknown;
58
+ /**
59
+ * Default `caiClaimVersion` to 2 when the body has an image input and the field is unset
60
+ * (Firefly edits of Firefly outputs need claim 2.x).
61
+ * @category Runtime
62
+ */
63
+ export declare function ensureDefaultCaiClaimVersion(body: unknown): unknown;
64
+ /**
65
+ * Build path, query, headers and JSON body from a flat capability input. When the operation
66
+ * has a body schema, the merged body is parsed against it so unknown keys and missing required
67
+ * fields fail here with issue paths instead of reaching Adobe.
68
+ * @category Runtime
69
+ */
70
+ export declare function assembleAdobeOperationInput(input: Record<string, unknown>, rules?: AdobeBodyRules): AssembledAdobeRequest;
71
+ /**
72
+ * Drop the job envelope: a body with a `result` object becomes that object. Other bodies are
73
+ * returned unchanged.
74
+ * @category Runtime
75
+ */
76
+ export declare function unwrapAdobeResult(value: unknown): unknown;
77
+ /**
78
+ * Default generate-manifest output: embedded JSON, so reading layers only needs `image`.
79
+ * @category Runtime
80
+ */
81
+ export declare const DEFAULT_MANIFEST_OUTPUTS: readonly [{
82
+ readonly destination: {
83
+ readonly embedded: "json";
84
+ };
85
+ readonly mediaType: "application/json";
86
+ }];
87
+ /**
88
+ * Fill `outputs` with {@link DEFAULT_MANIFEST_OUTPUTS} when neither the parameter nor `body`
89
+ * sets a non-empty list.
90
+ * @category Runtime
91
+ */
92
+ export declare function withDefaultManifestOutputs(input: Record<string, unknown>): Record<string, unknown>;
93
+ /**
94
+ * Copy embedded manifest JSON from `outputs[i].destination.content` onto `outputs[i].content`
95
+ * without removing `destination`. Parsed when `embedded` is `json` and `content` is a string.
96
+ * @category Runtime
97
+ */
98
+ export declare function liftManifestOutputContent(value: unknown): unknown;
99
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/runtime/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAI5B;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,wDA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AGzD;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;EAAkF,CAAA;AAMvH;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKlG;AAoBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIjE"}
@@ -0,0 +1,159 @@
1
+ import { AdobeServiceError, INPUT_INVALID } from "../errors.js";
2
+ import { expandFileRefInputs, expandNestedFileRefPayload } from "./product-shape.js";
3
+ /**
4
+ * Body keys that mean the request carries an image input (Content Credentials claim).
5
+ * @category Runtime
6
+ */
7
+ export const CAI_IMAGE_INPUT_KEYS = ["image", "mask", "structure", "style", "referenceBlobs", "background", "object"];
8
+ function isPlainObject(value) {
9
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10
+ }
11
+ function pickDefined(input, keys) {
12
+ const out = {};
13
+ for (const key of keys) {
14
+ if (input[key] !== undefined)
15
+ out[key] = input[key];
16
+ }
17
+ return out;
18
+ }
19
+ function scalar(value) {
20
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
21
+ return value;
22
+ return JSON.stringify(value);
23
+ }
24
+ function scalars(values) {
25
+ const out = {};
26
+ for (const [key, value] of Object.entries(values))
27
+ out[key] = scalar(value);
28
+ return out;
29
+ }
30
+ /**
31
+ * Shallow-merge a JSON document under explicitly set parameters: `{ ...body, ...set }`.
32
+ * Undefined parameters are omitted so they never wipe a `body` key; nested objects and arrays
33
+ * replace as a whole. A non-object `body` with parameters set is an input error.
34
+ * @category Runtime
35
+ */
36
+ export function mergeParameterBody(body, parameters) {
37
+ const set = pickDefined(parameters, Object.keys(parameters));
38
+ if (Object.keys(set).length === 0)
39
+ return body;
40
+ if (body === undefined)
41
+ return { ...set };
42
+ if (!isPlainObject(body)) {
43
+ throw new AdobeServiceError(INPUT_INVALID, "body must be a JSON object when body fields are also set as parameters.", {
44
+ issues: [{ path: "body", message: "Expected an object." }],
45
+ });
46
+ }
47
+ return { ...body, ...set };
48
+ }
49
+ /**
50
+ * Default `caiClaimVersion` to 2 when the body has an image input and the field is unset
51
+ * (Firefly edits of Firefly outputs need claim 2.x).
52
+ * @category Runtime
53
+ */
54
+ export function ensureDefaultCaiClaimVersion(body) {
55
+ if (!isPlainObject(body) || body.caiClaimVersion !== undefined)
56
+ return body;
57
+ const hasImageInput = CAI_IMAGE_INPUT_KEYS.some((key) => body[key] !== undefined);
58
+ return hasImageInput ? { ...body, caiClaimVersion: 2 } : body;
59
+ }
60
+ /**
61
+ * Build path, query, headers and JSON body from a flat capability input. When the operation
62
+ * has a body schema, the merged body is parsed against it so unknown keys and missing required
63
+ * fields fail here with issue paths instead of reaching Adobe.
64
+ * @category Runtime
65
+ */
66
+ export function assembleAdobeOperationInput(input, rules = {}) {
67
+ const flat = rules.fileRefBodyFields && rules.fileRefBodyFields.length > 0
68
+ ? expandFileRefInputs(input, rules.fileRefBodyFields)
69
+ : input;
70
+ const parameters = rules.parameters ?? {};
71
+ const path = scalars(pickDefined(flat, parameters.path ?? []));
72
+ const query = scalars(pickDefined(flat, parameters.query ?? []));
73
+ const headers = {};
74
+ for (const [key, value] of Object.entries(pickDefined(flat, parameters.headers ?? [])))
75
+ headers[key] = String(scalar(value));
76
+ const bodyParams = pickDefined(flat, parameters.body ?? []);
77
+ const hasBodyParam = Object.keys(bodyParams).length > 0;
78
+ const hasBody = flat.body !== undefined;
79
+ let body;
80
+ if (rules.bodySchema && (hasBody || hasBodyParam || rules.bodyRequired)) {
81
+ const merged = mergeParameterBody(flat.body, bodyParams) ?? {};
82
+ const parsed = rules.bodySchema.safeParse(merged);
83
+ if (!parsed.success) {
84
+ throw new AdobeServiceError(INPUT_INVALID, "The Adobe request body does not match the API schema.", {
85
+ issues: parsed.error.issues.map((issue) => ({ path: issue.path.join("."), message: issue.message })),
86
+ });
87
+ }
88
+ const normalized = rules.defaultCaiClaimVersion ? ensureDefaultCaiClaimVersion(parsed.data) : parsed.data;
89
+ body = expandNestedFileRefPayload(normalized);
90
+ }
91
+ else if (hasBody) {
92
+ body = flat.body;
93
+ }
94
+ return { path, query, headers, ...(body === undefined ? {} : { body }) };
95
+ }
96
+ /**
97
+ * Drop the job envelope: a body with a `result` object becomes that object. Other bodies are
98
+ * returned unchanged.
99
+ * @category Runtime
100
+ */
101
+ export function unwrapAdobeResult(value) {
102
+ if (!isPlainObject(value))
103
+ return value;
104
+ return isPlainObject(value.result) ? value.result : value;
105
+ }
106
+ /**
107
+ * Default generate-manifest output: embedded JSON, so reading layers only needs `image`.
108
+ * @category Runtime
109
+ */
110
+ export const DEFAULT_MANIFEST_OUTPUTS = [{ destination: { embedded: "json" }, mediaType: "application/json" }];
111
+ function manifestOutputs() {
112
+ return DEFAULT_MANIFEST_OUTPUTS.map((entry) => ({ destination: { ...entry.destination }, mediaType: entry.mediaType }));
113
+ }
114
+ /**
115
+ * Fill `outputs` with {@link DEFAULT_MANIFEST_OUTPUTS} when neither the parameter nor `body`
116
+ * sets a non-empty list.
117
+ * @category Runtime
118
+ */
119
+ export function withDefaultManifestOutputs(input) {
120
+ if (Array.isArray(input.outputs) && input.outputs.length > 0)
121
+ return input;
122
+ const body = input.body;
123
+ if (isPlainObject(body) && Array.isArray(body.outputs) && body.outputs.length > 0)
124
+ return input;
125
+ return { ...input, outputs: manifestOutputs() };
126
+ }
127
+ function parseEmbeddedJsonContent(content, embedded) {
128
+ if (typeof content !== "string" || embedded !== "json")
129
+ return content;
130
+ try {
131
+ return JSON.parse(content);
132
+ }
133
+ catch {
134
+ return content;
135
+ }
136
+ }
137
+ function liftOneManifestOutput(entry) {
138
+ if (!isPlainObject(entry))
139
+ return entry;
140
+ const destination = entry.destination;
141
+ if (!isPlainObject(destination) || !Object.prototype.hasOwnProperty.call(destination, "content"))
142
+ return entry;
143
+ const lifted = parseEmbeddedJsonContent(destination.content, destination.embedded);
144
+ if (!isPlainObject(lifted) && typeof lifted !== "string")
145
+ return entry;
146
+ return { ...entry, content: lifted, destination };
147
+ }
148
+ /**
149
+ * Copy embedded manifest JSON from `outputs[i].destination.content` onto `outputs[i].content`
150
+ * without removing `destination`. Parsed when `embedded` is `json` and `content` is a string.
151
+ * @category Runtime
152
+ */
153
+ export function liftManifestOutputContent(value) {
154
+ if (!isPlainObject(value) || !Array.isArray(value.outputs))
155
+ return value;
156
+ const outputs = value.outputs.map((entry) => liftOneManifestOutput(entry));
157
+ return { ...value, outputs };
158
+ }
159
+ //# sourceMappingURL=assemble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../src/runtime/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAiDpF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAA;AAE9H,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,SAAS,WAAW,CAAC,KAA8B,EAAE,IAAuB;IAC1E,MAAM,GAAG,GAA4B,EAAE,CAAA;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACrD,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI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AO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAA;IAChB,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACvC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAA;IACrC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC9G,MAAM,MAAM,GAAG,wBAAwB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAClF,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACtE,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAA;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACxE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1E,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { HandlerContext } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { type AdobeHttpMethod } from "../http/client.js";
3
+ import { type AdobeBodyRules } from "./assemble.js";
4
+ import { type AdobeProductShape } from "./product-shape.js";
5
+ /**
6
+ * One generated operation: the HTTP call behind a capability. Generated into
7
+ * `src/generated/<family>/operations.ts`.
8
+ * @category Runtime
9
+ */
10
+ export interface AdobeOperation extends AdobeBodyRules {
11
+ /** HTTP method. */
12
+ method: AdobeHttpMethod;
13
+ /** OpenAPI path template. */
14
+ path: string;
15
+ /** Server URL from the spec; the config's `baseUrl` replaces it. */
16
+ serverUrl: string;
17
+ /** `submit` polls the returned status URL and returns the job result; `none` returns the response. */
18
+ asyncMode: "submit" | "none";
19
+ /** Fill photoshop generate-manifest `outputs` with embedded JSON when unset. */
20
+ defaultManifestOutputs?: boolean;
21
+ /** How to map the API document to product-shaped capability output. */
22
+ productShape?: AdobeProductShape;
23
+ /** Body fields that accept a url FileRef at the capability boundary. */
24
+ fileRefBodyFields?: string[];
25
+ }
26
+ /**
27
+ * Handler shared by every generated capability.
28
+ * @category Runtime
29
+ */
30
+ export type AdobeHandler = (input: unknown, ctx: HandlerContext) => Promise<unknown>;
31
+ /**
32
+ * Module shape a lazy `handler` thunk resolves to.
33
+ * @category Runtime
34
+ */
35
+ export interface AdobeHandlerModule {
36
+ /** The handler. */
37
+ default: AdobeHandler;
38
+ }
39
+ /**
40
+ * Build the handler for one generated operation: validate config, assemble the request, call
41
+ * Adobe with an IMS token cached per credential set, poll async jobs (honouring
42
+ * `ctx.signal`) and return the result document.
43
+ * @category Runtime
44
+ */
45
+ export declare function createAdobeHandler(name: string, operation: AdobeOperation): AdobeHandler;
46
+ //# sourceMappingURL=invoke-capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke-capability.d.ts","sourceRoot":"","sources":["../../src/runtime/invoke-capability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAK1E,OAAO,EAA8C,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEpG,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE7E;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,mBAAmB;IACnB,MAAM,EAAE,eAAe,CAAA;IACvB,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAA;IACjB,sGAAsG;IACtG,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC5B,gFAAgF;IAChF,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,uEAAuE;IACvE,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAEpF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB;IACnB,OAAO,EAAE,YAAY,CAAA;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,YAAY,CAuDxF"}
@@ -0,0 +1,68 @@
1
+ import { getImsTokenProvider } from "../auth/ims.js";
2
+ import { resolveAdobeConfig } from "../config.js";
3
+ import { AdobeServiceError, INPUT_INVALID, PROVIDER_ERROR } from "../errors.js";
4
+ import { extractAdobeStatusUrl, pollAdobeJob } from "../http/async-job.js";
5
+ import { buildUrl, createAdobeHttpClient, redactUrl } from "../http/client.js";
6
+ import { sharedRequestLimiter } from "../http/request-limit.js";
7
+ import { assembleAdobeOperationInput, liftManifestOutputContent, unwrapAdobeResult, withDefaultManifestOutputs, } from "./assemble.js";
8
+ import { shapeAdobeOutput } from "./product-shape.js";
9
+ /**
10
+ * Build the handler for one generated operation: validate config, assemble the request, call
11
+ * Adobe with an IMS token cached per credential set, poll async jobs (honouring
12
+ * `ctx.signal`) and return the result document.
13
+ * @category Runtime
14
+ */
15
+ export function createAdobeHandler(name, operation) {
16
+ return async (input, ctx) => {
17
+ const config = resolveAdobeConfig(ctx.config);
18
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
19
+ throw new AdobeServiceError(INPUT_INVALID, `${name} input must be a JSON object.`, {
20
+ issues: [{ path: "", message: "Expected an object." }],
21
+ });
22
+ }
23
+ const flat = operation.defaultManifestOutputs
24
+ ? withDefaultManifestOutputs(input)
25
+ : input;
26
+ const assembled = assembleAdobeOperationInput(flat, operation);
27
+ const getAccessToken = getImsTokenProvider(config);
28
+ const limiter = config.maxRequestsPerMinute === undefined
29
+ ? undefined
30
+ : sharedRequestLimiter({
31
+ clientId: config.clientId,
32
+ baseUrl: config.baseUrl,
33
+ maxRequestsPerMinute: config.maxRequestsPerMinute,
34
+ });
35
+ const client = createAdobeHttpClient({ clientId: config.clientId, getAccessToken, limiter });
36
+ const url = buildUrl(config.baseUrl ?? operation.serverUrl, operation.path, assembled.path, assembled.query);
37
+ const response = await client.request({
38
+ method: operation.method,
39
+ url,
40
+ body: assembled.body,
41
+ headers: assembled.headers,
42
+ signal: ctx.signal,
43
+ });
44
+ if (operation.asyncMode !== "submit") {
45
+ return shapeAdobeOutput(response ?? {}, operation.productShape, flat);
46
+ }
47
+ const statusUrl = extractAdobeStatusUrl(response);
48
+ if (!statusUrl) {
49
+ throw new AdobeServiceError(PROVIDER_ERROR, `Adobe accepted ${name} but returned no job status URL.`, {
50
+ method: operation.method,
51
+ url: redactUrl(url),
52
+ });
53
+ }
54
+ ctx.logger.debug(`Adobe job submitted for ${name}; polling.`, { statusUrl: redactUrl(statusUrl) });
55
+ const final = await pollAdobeJob({
56
+ statusUrl,
57
+ client,
58
+ signal: ctx.signal,
59
+ intervalMs: config.pollIntervalMs,
60
+ timeoutMs: config.pollTimeoutMs,
61
+ });
62
+ let unwrapped = unwrapAdobeResult(final) ?? {};
63
+ if (operation.defaultManifestOutputs)
64
+ unwrapped = liftManifestOutputContent(unwrapped);
65
+ return shapeAdobeOutput(unwrapped, operation.productShape, flat);
66
+ };
67
+ }
68
+ //# sourceMappingURL=invoke-capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke-capability.js","sourceRoot":"","sources":["../../src/runtime/invoke-capability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,EAAwB,MAAM,mBAAmB,CAAA;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,GAE3B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAA0B,MAAM,oBAAoB,CAAA;AAuC7E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,SAAyB;IACxE,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC7C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,MAAM,IAAI,iBAAiB,CAAC,aAAa,EAAE,GAAG,IAAI,+BAA+B,EAAE;gBACjF,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;a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AAC,QAAQ,CAAC,CAAA;QACjD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,iBAAiB,CAAC,cAAc,EAAE,kBAAkB,IAAI,kCAAkC,EAAE;gBACpG,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;aACpB,CAAC,CAAA;QACJ,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,IAAI,YAAY,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAClG,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;YAC/B,SAAS;YACT,MAAM;YACN,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,UAAU,EAAE,MAAM,CAAC,cAAc;YACjC,SAAS,EAAE,MAAM,CAAC,aAAa;SAChC,CAAC,CAAA;QACF,IAAI,SAAS,GAAY,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;QACvD,IAAI,SAAS,CAAC,sBAAsB;YAAE,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAA;QACtF,OAAO,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAClE,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,49 @@
1
+ /** Path-safe key for a multi-output FileRef from its media type. @category Runtime */
2
+ export declare function mediaTypeToken(mediaType: string): string;
3
+ /**
4
+ * Product-shape instructions emitted by the generator into operations.ts.
5
+ * @category Runtime
6
+ */
7
+ export type AdobeProductShape = {
8
+ kind: "image-job";
9
+ mediaArray: "images";
10
+ } | {
11
+ kind: "video-job";
12
+ mediaArray: "videos";
13
+ } | {
14
+ kind: "upscaler";
15
+ } | {
16
+ kind: "photoshop-multi";
17
+ } | {
18
+ kind: "manifest";
19
+ } | {
20
+ kind: "url-blob";
21
+ } | {
22
+ kind: "passthrough";
23
+ };
24
+ /**
25
+ * Resolve media type for a presigned asset URL (response → request → path → default).
26
+ * @category Runtime
27
+ */
28
+ export declare function resolveMediaType(options: {
29
+ responseMediaType?: string;
30
+ requestedMediaType?: string;
31
+ url: string;
32
+ familyDefault?: string;
33
+ }): string;
34
+ /**
35
+ * Turn the Adobe API document into the capability's product-shaped output.
36
+ * @category Runtime
37
+ */
38
+ export declare function shapeAdobeOutput(raw: unknown, shape: AdobeProductShape | undefined, input: Record<string, unknown>): unknown;
39
+ /**
40
+ * Expand url FileRefs in capability input into Adobe request envelopes before HTTP.
41
+ * @category Runtime
42
+ */
43
+ export declare function expandFileRefInputs(input: Record<string, unknown>, bodyFields: readonly string[]): Record<string, unknown>;
44
+ /**
45
+ * Walk nested capability input and expand url FileRefs into Adobe request shapes.
46
+ * @category Runtime
47
+ */
48
+ export declare function expandNestedFileRefPayload(value: unknown, path?: string): unknown;
49
+ //# sourceMappingURL=product-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-shape.d.ts","sourceRoot":"","sources":["../../src/runtime/product-shape.ts"],"names":[],"mappings":"AAYA,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,QAAQ,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,QAAQ,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAA;AAkC3B;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,iBAAiB,CAAC,E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