@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
@@ -1,75 +1,158 @@
1
+ import { AdobeServiceError, errorMessage, isAbortError, PROVIDER_ERROR } from "../errors.js";
2
+ import { sleep } from "../runtime/abort.js";
1
3
  /**
4
+ * Default retry budget for 429 (any method) and 502/503/504 (GET only).
2
5
  * @category Http
3
- * Typed Adobe Firefly Services HTTP error.
4
6
  */
5
- export class AdobeHttpError extends Error {
6
- /** HTTP status code. */
7
- status;
8
- /** Response body text. */
9
- bodyText;
10
- /** Request URL. */
11
- url;
12
- constructor(status, bodyText, url) {
13
- super(`Adobe API ${status} for ${url}: ${bodyText.slice(0, 500)}`);
14
- this.name = "AdobeHttpError";
15
- this.status = status;
16
- this.bodyText = bodyText;
17
- this.url = url;
18
- }
19
- }
7
+ export const DEFAULT_MAX_RETRIES = 2;
8
+ const MAX_RETRY_WAIT_MS = 10_000;
9
+ const GATEWAY_STATUSES = new Set([502, 503, 504]);
10
+ const MAX_ERROR_BODY_CHARS = 2000;
20
11
  /**
21
- * Create an Adobe HTTP client.
12
+ * Create the Adobe HTTP client (Bearer token plus `x-api-key`). A 429 is retried for any
13
+ * method because Adobe has not accepted the request; gateway errors are retried for GET only
14
+ * so a job is never submitted twice.
22
15
  * @category Http
23
16
  */
24
17
  export function createAdobeHttpClient(options) {
25
- const fetchImpl = options.fetchImpl ?? fetch;
18
+ const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
19
+ const retryBaseMs = options.retryBaseMs ?? 1000;
26
20
  return {
27
21
  async request(req) {
28
- const token = await options.getAccessToken();
29
- const headers = {
30
- Authorization: `Bearer ${token}`,
31
- "x-api-key": options.clientId,
32
- Accept: "application/json",
33
- ...(req.headers ?? {}),
34
- };
35
- let body;
36
- if (req.body !== undefined) {
37
- headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
38
- body = JSON.stringify(req.body);
39
- }
40
- const res = await fetchImpl(req.url, { method: req.method, headers, body });
41
- const text = await res.text();
42
- if (!res.ok) {
43
- throw new AdobeHttpError(res.status, text, req.url);
44
- }
45
- if (!text)
46
- return undefined;
47
- try {
48
- return JSON.parse(text);
49
- }
50
- catch {
51
- throw new Error(`Adobe API returned non-JSON body for ${req.url}`);
22
+ const fetchImpl = options.fetchImpl ?? fetch;
23
+ for (let attempt = 0;; attempt++) {
24
+ const token = await options.getAccessToken(req.signal);
25
+ const headers = {
26
+ accept: "application/json",
27
+ ...(req.headers ?? {}),
28
+ authorization: `Bearer ${token}`,
29
+ "x-api-key": options.clientId,
30
+ };
31
+ let body;
32
+ if (req.body !== undefined) {
33
+ headers["content-type"] = "application/json";
34
+ body = JSON.stringify(req.body);
35
+ }
36
+ if (options.limiter && req.method !== "GET")
37
+ await options.limiter.acquire(req.signal);
38
+ let res;
39
+ try {
40
+ res = await fetchImpl(req.url, { method: req.method, headers, body, signal: req.signal });
41
+ }
42
+ catch (error) {
43
+ if (isAbortError(error))
44
+ throw error;
45
+ throw new AdobeServiceError(PROVIDER_ERROR, `Adobe API request failed: ${errorMessage(error)}`, {
46
+ method: req.method,
47
+ url: redactUrl(req.url),
48
+ });
49
+ }
50
+ const text = await res.text();
51
+ if (res.ok) {
52
+ if (!text)
53
+ return undefined;
54
+ try {
55
+ return JSON.parse(text);
56
+ }
57
+ catch {
58
+ throw new AdobeServiceError(PROVIDER_ERROR, "Adobe API returned a non-JSON success body.", {
59
+ method: req.method,
60
+ url: redactUrl(req.url),
61
+ status: res.status,
62
+ });
63
+ }
64
+ }
65
+ const retryable = res.status === 429 || (req.method === "GET" && GATEWAY_STATUSES.has(res.status));
66
+ if (retryable && attempt < maxRetries) {
67
+ await sleep(retryDelayMs(res.headers.get("retry-after"), attempt, retryBaseMs), req.signal);
68
+ continue;
69
+ }
70
+ const errorBody = parseErrorBody(text);
71
+ throw new AdobeServiceError(PROVIDER_ERROR, adobeHttpErrorMessage(res.status, req.method, pathOf(req.url), errorBody), {
72
+ method: req.method,
73
+ url: redactUrl(req.url),
74
+ status: res.status,
75
+ body: errorBody,
76
+ });
52
77
  }
53
78
  },
54
79
  };
55
80
  }
56
81
  /**
57
- * Substitute `{param}` placeholders in an OpenAPI path template.
82
+ * Delay before a retry: the Retry-After header (seconds) when present, else exponential
83
+ * backoff. Capped at ten seconds.
58
84
  * @category Http
59
85
  */
60
- export function buildUrl(baseUrl, pathTemplate, pathParams, queryParams) {
86
+ export function retryDelayMs(retryAfter, attempt, baseMs) {
87
+ const seconds = retryAfter === null ? Number.NaN : Number(retryAfter);
88
+ const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds * 1000 : baseMs * 2 ** attempt;
89
+ return Math.min(wait, MAX_RETRY_WAIT_MS);
90
+ }
91
+ /**
92
+ * Substitute `{param}` placeholders in an OpenAPI path template and append query values.
93
+ * @category Http
94
+ */
95
+ export function buildUrl(serverUrl, pathTemplate, pathParams, queryParams = {}) {
61
96
  let path = pathTemplate;
62
97
  for (const [key, value] of Object.entries(pathParams)) {
63
- path = path.replace(new RegExp(`\\{${key}\\}`, "g"), encodeURIComponent(String(value)));
64
- }
65
- const url = new URL(path.replace(/^\//, ""), baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`);
66
- if (queryParams) {
67
- for (const [key, value] of Object.entries(queryParams)) {
68
- if (value === undefined)
69
- continue;
70
- url.searchParams.set(key, String(value));
71
- }
98
+ path = path.split(`{${key}}`).join(encodeURIComponent(String(value)));
72
99
  }
100
+ const base = serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`;
101
+ const url = new URL(path.replace(/^\//, ""), base);
102
+ for (const [key, value] of Object.entries(queryParams))
103
+ url.searchParams.set(key, String(value));
73
104
  return url.toString();
74
105
  }
106
+ /**
107
+ * URL without its query string, so presigned tokens never reach step records or logs.
108
+ * @category Http
109
+ */
110
+ export function redactUrl(url) {
111
+ try {
112
+ const parsed = new URL(url);
113
+ return `${parsed.origin}${parsed.pathname}`;
114
+ }
115
+ catch {
116
+ return url.split("?")[0] ?? url;
117
+ }
118
+ }
119
+ function pathOf(url) {
120
+ try {
121
+ return new URL(url).pathname;
122
+ }
123
+ catch {
124
+ return url;
125
+ }
126
+ }
127
+ function parseErrorBody(text) {
128
+ if (!text)
129
+ return undefined;
130
+ try {
131
+ return JSON.parse(text);
132
+ }
133
+ catch {
134
+ return text.slice(0, MAX_ERROR_BODY_CHARS);
135
+ }
136
+ }
137
+ function adobeHttpErrorMessage(status, method, path, body) {
138
+ const detail = providerDetail(body);
139
+ const base = `Adobe API returned HTTP ${status} for ${method} ${path}`;
140
+ return detail ? `${base}: ${detail}` : `${base}.`;
141
+ }
142
+ function providerDetail(body) {
143
+ if (!isRecord(body))
144
+ return typeof body === "string" && body.length > 0 ? body.slice(0, 500) : undefined;
145
+ if (typeof body.error_description === "string")
146
+ return body.error_description;
147
+ if (typeof body.message === "string")
148
+ return body.message;
149
+ if (typeof body.error === "string")
150
+ return body.error;
151
+ if (isRecord(body.error) && typeof body.error.message === "string")
152
+ return body.error.message;
153
+ return undefined;
154
+ }
155
+ function isRecord(value) {
156
+ return typeof value === "object" && value !== null && !Array.isArray(value);
157
+ }
75
158
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/http/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,wBAAwB;IACf,MAAM,CAAQ;IACvB,0BAA0B;IACjB,QAAQ,CAAQ;IACzB,mBAAmB;IACV,GAAG,CAAQ;IAEpB,YAAY,MAAc,EAAE,QAAgB,EAAE,GAAW;QACvD,KAAK,CAAC,aAAa,MAAM,QAAQ,GAAG,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;QAClE,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;CACF;AA0BD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAOrC;IACC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAA;IAE5C,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,GAAG;YACf,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAA;YAC5C,MAAM,OAAO,GAA2B;gBACtC,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,WAAW,EAAE,OAAO,CAAC,QAAQ;gBAC7B,MAAM,EAAE,kBAAkB;gBAC1B,GAAG,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;aACvB,CAAA;YACD,IAAI,IAAwB,CAA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AAI,GAAG,2BAA2B,MAAM,QAAQ,MAAM,IAAI,IAAI,EAAE,CAAA;IACtE,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAA;AACnD,CAAC;AAED,SAAS,cAAc,CAAC,IAAa;IACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACxG,IAAI,OAAO,IAAI,CAAC,iBAAiB,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,iBAAiB,CAAA;IAC7E,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,OAAO,CAAA;IACzD,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAA;IACrD,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;IAC7F,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Spaces request starts so a credential set stays under a per-minute request limit.
3
+ * @category Http
4
+ */
5
+ export interface RequestLimiter {
6
+ /** Wait for this request's turn. Rejects with the abort reason if `signal` aborts while waiting. */
7
+ acquire(signal?: AbortSignal): Promise<void>;
8
+ }
9
+ /**
10
+ * Clock seam for {@link createRequestLimiter}.
11
+ * @category Http
12
+ */
13
+ export interface RequestLimiterClock {
14
+ /** Current time in milliseconds. */
15
+ now(): number;
16
+ /** Wait `ms`, rejecting when `signal` aborts. */
17
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
18
+ }
19
+ /**
20
+ * Create a limiter that starts at most `maxRequestsPerMinute` requests in any minute by keeping
21
+ * `60000 / maxRequestsPerMinute` ms between starts (no bursts). Each call reserves the next free
22
+ * slot up front, so concurrent callers queue in call order; a caller that aborts while waiting
23
+ * gives up its slot without it being reused, which only ever errs on the slow side.
24
+ * @category Http
25
+ */
26
+ export declare function createRequestLimiter(maxRequestsPerMinute: number, clock?: RequestLimiterClock): RequestLimiter;
27
+ /**
28
+ * The limiter shared by every step in this process that uses the same client id, endpoint and limit,
29
+ * so concurrent steps and items draw on one budget.
30
+ * @category Http
31
+ */
32
+ export declare function sharedRequestLimiter(options: {
33
+ clientId: string;
34
+ baseUrl?: string;
35
+ maxRequestsPerMinute: number;
36
+ }): RequestLimiter;
37
+ /**
38
+ * Forget the shared limiters (tests).
39
+ * @category Http
40
+ */
41
+ export declare function resetSharedRequestLimiters(): void;
42
+ //# sourceMappingURL=request-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-limit.d.ts","sourceRoot":"","sources":["../../src/http/request-limit.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,oGAAoG;IACpG,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7C;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,GAAG,IAAI,MAAM,CAAA;IACb,iDAAiD;IACjD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvD;AAID;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,EAAE,MAAM,EAAE,KAAK,GAAE,mBAAiC,GAAG,cAAc,CAY3H;AAID;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAQlI;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
@@ -0,0 +1,46 @@
1
+ import { sleep as abortableSleep } from "../runtime/abort.js";
2
+ const systemClock = { now: () => Date.now(), sleep: abortableSleep };
3
+ /**
4
+ * Create a limiter that starts at most `maxRequestsPerMinute` requests in any minute by keeping
5
+ * `60000 / maxRequestsPerMinute` ms between starts (no bursts). Each call reserves the next free
6
+ * slot up front, so concurrent callers queue in call order; a caller that aborts while waiting
7
+ * gives up its slot without it being reused, which only ever errs on the slow side.
8
+ * @category Http
9
+ */
10
+ export function createRequestLimiter(maxRequestsPerMinute, clock = systemClock) {
11
+ const spacingMs = 60_000 / maxRequestsPerMinute;
12
+ let nextStart = Number.NEGATIVE_INFINITY;
13
+ return {
14
+ async acquire(signal) {
15
+ signal?.throwIfAborted();
16
+ const now = clock.now();
17
+ const start = Math.max(now, nextStart);
18
+ nextStart = start + spacingMs;
19
+ if (start > now)
20
+ await clock.sleep(start - now, signal);
21
+ },
22
+ };
23
+ }
24
+ const shared = new Map();
25
+ /**
26
+ * The limiter shared by every step in this process that uses the same client id, endpoint and limit,
27
+ * so concurrent steps and items draw on one budget.
28
+ * @category Http
29
+ */
30
+ export function sharedRequestLimiter(options) {
31
+ const key = JSON.stringify([options.clientId, options.baseUrl ?? "", options.maxRequestsPerMinute]);
32
+ let limiter = shared.get(key);
33
+ if (!limiter) {
34
+ limiter = createRequestLimiter(options.maxRequestsPerMinute);
35
+ shared.set(key, limiter);
36
+ }
37
+ return limiter;
38
+ }
39
+ /**
40
+ * Forget the shared limiters (tests).
41
+ * @category Http
42
+ */
43
+ export function resetSharedRequestLimiters() {
44
+ shared.clear();
45
+ }
46
+ //# sourceMappingURL=request-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-limit.js","sourceRoot":"","sources":["../../src/http/request-limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAsB7D,MAAM,WAAW,GAAwB,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAA;AAEzF;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,oBAA4B,EAAE,QAA6B,WAAW;IACzG,MAAM,SAAS,GAAG,MAAM,GAAG,oBAAoB,CAAA;IAC/C,IAAI,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAA;IACxC,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,MAAM;YAClB,MAAM,EAAE,cAAc,EAAE,CAAA;YACxB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,SAAS,GAAG,KAAK,GAAG,SAAS,CAAA;YAC7B,IAAI,KAAK,GAAG,GAAG;gBAAE,MAAM,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,CAAC,CAAA;QACzD,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA6E;IAChH,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACnG,IAAI,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;QAC5D,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IACxC,MAAM,CAAC,KAAK,EAAE,CAAA;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,35 +1,89 @@
1
- import { type Registry } from "@executioncontrolprotocol/core";
2
- import { adobeGeneratedCapabilities, ADOBE_GENERATED_OPERATION_COUNT } from "./generated/index.js";
1
+ export { adobeConfigSchema } from "./config.js";
2
+ export type { AdobeConfig } from "./config.js";
3
+ export { GENERATED_CAPABILITY_COUNT, generatedCapabilities } from "./generated/index.js";
3
4
  /**
4
- * `@executioncontrolprotocol/adobe-firefly-services` — Adobe Firefly Services extension.
5
- *
6
- * One capability per OpenAPI operation across Firefly Services families
7
- * (`firefly`, `photoshop` v2, `express`, `indesign`, `substance3d`, `illustrator`,
8
- * `creative-production`, `audio-video`). Capability ids are family-prefixed kebab, e.g.
9
- * `@executioncontrolprotocol/adobe-firefly-services.firefly-generate-images-v5-async`.
10
- *
11
- * Auth uses OAuth Server-to-Server (`client_credentials`). Bind secrets via
12
- * `secrets("adobe-firefly-services/client-id")` /
13
- * `secrets("adobe-firefly-services/client-secret")` or `env(...)`.
14
- *
15
- * @category Extensions
5
+ * Plugin id. Capability ids are `${PLUGIN_ID}.<family>-<operation>`.
6
+ * @category Plugins
16
7
  */
17
- export declare const adobeFireflyServicesExtension: import("@executioncontrolprotocol/core").ExtensionDefinition;
8
+ export declare const PLUGIN_ID = "@executioncontrolprotocol/adobe-firefly-services";
18
9
  /**
19
- * Register `@executioncontrolprotocol/adobe-firefly-services` on a registry.
20
- *
21
- * @category Extensions
10
+ * Adobe Firefly Services plugin. Capabilities are generated from the vendored OpenAPI specs;
11
+ * handler code loads on first call.
12
+ * @category Plugins
22
13
  */
23
- export declare function registerAdobeFireflyServicesExtension(registry?: Registry): Promise<void>;
24
- export { ADOBE_GENERATED_OPERATION_COUNT, adobeGeneratedCapabilities };
25
- export { EXT_ID, HOST_HOP_MESSAGE, buildAdobeFireflyServicesExtension } from "./shared.js";
26
- export { createImsTokenProvider, DEFAULT_FIREFLY_SCOPES, DEFAULT_IMS_TOKEN_URL, } from "./auth/ims.js";
27
- export type { AdobeImsConfig, AdobeAccessToken } from "./auth/ims.js";
28
- export { AdobeHttpError, buildUrl, createAdobeHttpClient } from "./http/client.js";
29
- export type { AdobeHttpClient, AdobeRequestOptions } from "./http/client.js";
30
- export { extractAdobeStatusUrl, pollAdobeJob } from "./http/async-job.js";
31
- export type { PollAdobeJobOptions } from "./http/async-job.js";
32
- export { collectManifestDestinationUrls, extractEmbeddedManifestJson, materializePhotoshopManifest, photoshopManifestDocumentSchema, photoshopManifestLayerSchema, } from "./runtime/photoshop-manifest.js";
33
- export type { AdobeAsyncMode, AdobeMaterializeMode, AdobeOperationInput } from "./runtime/invoke.js";
34
- export default adobeFireflyServicesExtension;
14
+ declare const _default: import("@executioncontrolprotocol/plugin-sdk").PluginDefinition<import("zod").ZodObject<{
15
+ clientId: import("zod").ZodString;
16
+ clientSecret: import("zod").ZodString;
17
+ scopes: import("zod").ZodOptional<import("zod").ZodString>;
18
+ imsEndpoint: import("zod").ZodOptional<import("zod").ZodURL>;
19
+ baseUrl: import("zod").ZodOptional<import("zod").ZodURL>;
20
+ pollIntervalMs: import("zod").ZodOptional<import("zod").ZodNumber>;
21
+ pollTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
22
+ maxRequestsPerMinute: import("zod").ZodOptional<import("zod").ZodNumber>;
23
+ }, import("zod/v4/core").$strip>, {
24
+ "substance3d-create-space-from-frame-io-v2": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
25
+ "substance3d-create-space-from-next-frame-io-v2": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
26
+ "substance3d-create-space-url-v2": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
27
+ "substance3d-v1-composites-compose": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
28
+ "substance3d-v1-scenes-assemble": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
29
+ "substance3d-v1-scenes-convert": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
30
+ "substance3d-v1-scenes-describe": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
31
+ "substance3d-v1-scenes-render": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
32
+ "substance3d-v1-scenes-render-basic": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
33
+ "photoshop-actions": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
34
+ "photoshop-auto-crop": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
35
+ "photoshop-create-artboard": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
36
+ "photoshop-create-composite": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
37
+ "photoshop-edit": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
38
+ "photoshop-generate-manifest": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
39
+ "indesign-convert-pdfto-in-design": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
40
+ "indesign-data-merge": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
41
+ "indesign-data-merge-tags": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
42
+ "indesign-delete-custom-script": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
43
+ "indesign-execute-custom-script": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
44
+ "indesign-get-custom-script-details": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
45
+ "indesign-get-document-info": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
46
+ "indesign-list-app-versions": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
47
+ "indesign-list-custom-scripts": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
48
+ "indesign-remap-links": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
49
+ "indesign-rendition-job": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
50
+ "indesign-update-script-app-version": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
51
+ "illustrator-create-rendition": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
52
+ "illustrator-data-merge": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
53
+ "illustrator-execute-custom-script-capability": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
54
+ "illustrator-trace-image": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
55
+ "firefly-adaptive-composite": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
56
+ "firefly-expand-images-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
57
+ "firefly-fill-images-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
58
+ "firefly-generate-images-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
59
+ "firefly-generate-images-v5-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
60
+ "firefly-generate-object-composite-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
61
+ "firefly-generate-similar-images-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
62
+ "firefly-generate-video-v3": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
63
+ "firefly-get-custom-models": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
64
+ "firefly-precise-composite": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
65
+ "firefly-precise-upsampler-v3-async": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
66
+ "express-export-rendition": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
67
+ "express-generate-variation": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
68
+ "express-tagged-document-details": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
69
+ "express-tagged-documents": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
70
+ "creative-production-batch-execute": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
71
+ "creative-production-list-batch-executions": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
72
+ "creative-production-list-batches": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
73
+ "audio-video-avatars": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
74
+ "audio-video-dub": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
75
+ "audio-video-dub-translate-lipsync": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
76
+ "audio-video-generate-avatar": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
77
+ "audio-video-generate-reframed-video": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
78
+ "audio-video-generate-reframed-video-v2": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
79
+ "audio-video-generate-speech": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
80
+ "audio-video-get-presets": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
81
+ "audio-video-list-render-jobs": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
82
+ "audio-video-template-describe": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
83
+ "audio-video-template-render": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
84
+ "audio-video-transcribe": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
85
+ "audio-video-transcribe-translate-lipsync": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
86
+ "audio-video-voices": import("@executioncontrolprotocol/plugin-sdk").CapabilityDefinition<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | undefined>;
87
+ }>;
88
+ export default _default;
35
89
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B,8DAExC,CAAA;AAIF;;;;GAIG;AACH,wBAAsB,qCAAqC,CACzD,QAAQ,GAAE,QAAyB,GAClC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAClF,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACzE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEpG,eAAe,6BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAExF;;;GAGG;AACH,eAAO,MAAM,SAAS,qDAAqD,CAAA;AAE3E;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBASE"}
package/dist/index.js CHANGED
@@ -1,39 +1,25 @@
1
- import { globalRegistry, catalogExtension, } from "@executioncontrolprotocol/core";
2
- import { adobeGeneratedCapabilities, ADOBE_GENERATED_OPERATION_COUNT, } from "./generated/index.js";
3
- import { buildAdobeFireflyServicesExtension, EXT_ID } from "./shared.js";
1
+ import { definePlugin } from "@executioncontrolprotocol/plugin-sdk";
2
+ import { adobeConfigSchema } from "./config.js";
3
+ import { generatedCapabilities } from "./generated/index.js";
4
+ export { adobeConfigSchema } from "./config.js";
5
+ export { GENERATED_CAPABILITY_COUNT, generatedCapabilities } from "./generated/index.js";
4
6
  /**
5
- * `@executioncontrolprotocol/adobe-firefly-services` — Adobe Firefly Services extension.
6
- *
7
- * One capability per OpenAPI operation across Firefly Services families
8
- * (`firefly`, `photoshop` v2, `express`, `indesign`, `substance3d`, `illustrator`,
9
- * `creative-production`, `audio-video`). Capability ids are family-prefixed kebab, e.g.
10
- * `@executioncontrolprotocol/adobe-firefly-services.firefly-generate-images-v5-async`.
11
- *
12
- * Auth uses OAuth Server-to-Server (`client_credentials`). Bind secrets via
13
- * `secrets("adobe-firefly-services/client-id")` /
14
- * `secrets("adobe-firefly-services/client-secret")` or `env(...)`.
15
- *
16
- * @category Extensions
7
+ * Plugin id. Capability ids are `${PLUGIN_ID}.<family>-<operation>`.
8
+ * @category Plugins
17
9
  */
18
- export const adobeFireflyServicesExtension = buildAdobeFireflyServicesExtension([
19
- ...adobeGeneratedCapabilities,
20
- ]);
21
- catalogExtension(adobeFireflyServicesExtension);
10
+ export const PLUGIN_ID = "@executioncontrolprotocol/adobe-firefly-services";
22
11
  /**
23
- * Register `@executioncontrolprotocol/adobe-firefly-services` on a registry.
24
- *
25
- * @category Extensions
12
+ * Adobe Firefly Services plugin. Capabilities are generated from the vendored OpenAPI specs;
13
+ * handler code loads on first call.
14
+ * @category Plugins
26
15
  */
27
- export async function registerAdobeFireflyServicesExtension(registry = globalRegistry) {
28
- if (!registry.getExtension(EXT_ID)) {
29
- await registry.registerExtension(adobeFireflyServicesExtension);
30
- }
31
- }
32
- export { ADOBE_GENERATED_OPERATION_COUNT, adobeGeneratedCapabilities };
33
- export { EXT_ID, HOST_HOP_MESSAGE, buildAdobeFireflyServicesExtension } from "./shared.js";
34
- export { createImsTokenProvider, DEFAULT_FIREFLY_SCOPES, DEFAULT_IMS_TOKEN_URL, } from "./auth/ims.js";
35
- export { AdobeHttpError, buildUrl, createAdobeHttpClient } from "./http/client.js";
36
- export { extractAdobeStatusUrl, pollAdobeJob } from "./http/async-job.js";
37
- export { collectManifestDestinationUrls, extractEmbeddedManifestJson, materializePhotoshopManifest, photoshopManifestDocumentSchema, photoshopManifestLayerSchema, } from "./runtime/photoshop-manifest.js";
38
- export default adobeFireflyServicesExtension;
16
+ export default definePlugin({
17
+ id: PLUGIN_ID,
18
+ summary: "Adobe Firefly Services: Firefly image and video generation and Photoshop document edits.",
19
+ description: "One capability per Firefly Services API operation, generated from Adobe's OpenAPI specs: Firefly image generation, expand, fill, composites, upscaling and video, and Photoshop document edits, actions, UXP scripts, artboards and layer manifests. The config object holds OAuth server-to-server credentials (client id and secret as secret references). Async jobs are polled inside the step, which returns the job result. Request fields are top-level parameters; an optional body carries the rest of the JSON document. Files move by URL: pass presigned storage URLs as sources and output destinations.",
20
+ config: adobeConfigSchema,
21
+ capabilities: {
22
+ ...generatedCapabilities,
23
+ },
24
+ });
39
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,GAEjB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAExE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,kCAAkC,CAAC;IAC9E,GAAG,0BAA0B;CAC9B,CAAC,CAAA;AAEF,gBAAgB,CAAC,6BAA6B,CAAC,CAAA;AAE/C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,WAAqB,cAAc;IAEnC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC,iBAAiB,CAAC,6BAA6B,CAAC,CAAA;IACjE,CAAC;AACH,CAAC;AAED,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAElF,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEzE,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAA;AAGxC,eAAe,6BAA6B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAExF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,kDAAkD,CAAA;AAE3E;;;;GAIG;AACH,eAAe,YAAY,CAAC;IAC1B,EAAE,EAAE,SAAS;IACb,OAAO,EAAE,0FAA0F;IACnG,WAAW,EACT,ulBAAulB;IACzlB,MAAM,EAAE,iBAAiB;IACzB,YAAY,EAAE;QACZ,GAAG,qBAAqB;KACzB;CACF,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The abort reason as a throwable, defaulting to a DOMException named AbortError.
3
+ * @category Runtime
4
+ */
5
+ export declare function abortReason(signal: AbortSignal): unknown;
6
+ /**
7
+ * Wait `ms`, rejecting early with the abort reason when `signal` aborts.
8
+ * @category Runtime
9
+ */
10
+ export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
11
+ /**
12
+ * Settle with `promise`, or reject with the abort reason if `signal` aborts first. The
13
+ * underlying work keeps running; use this for shared work one caller must not cancel.
14
+ * @category Runtime
15
+ */
16
+ export declare function raceSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
17
+ //# sourceMappingURL=abort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../src/runtime/abort.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBrE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBnF"}