@contrail/extensions-sdk 1.0.29 → 1.0.30

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.
@@ -20,9 +20,20 @@ export interface ClipboardItemsPayload {
20
20
  }
21
21
  /** One image in a composition, placed in fractions of the output box. */
22
22
  export interface ComposeContentLayer {
23
- /** The content to draw. The host resolves it to an image, so no URL is needed - and none can
24
- * expire between planning the layout and composing it. */
25
- contentId: string;
23
+ /**
24
+ * The content to draw. The host resolves it to an image, so no URL is needed - and none can
25
+ * expire between planning the layout and composing it.
26
+ *
27
+ * Supply this or {@link fileId}, not both.
28
+ */
29
+ contentId?: string;
30
+ /**
31
+ * A file to draw, for images that exist as files without a content wrapper - the output of a
32
+ * background-removal operation, for instance, which returns a file id.
33
+ *
34
+ * Supply this or {@link contentId}, not both.
35
+ */
36
+ fileId?: string;
26
37
  /**
27
38
  * Top-left corner as a fraction of the composition box, so `{x: 0.5, y: 0}` is the top middle.
28
39
  *
@@ -124,6 +124,10 @@ class BoardsApp {
124
124
  if (!(request === null || request === void 0 ? void 0 : request.contentHolderReference)) {
125
125
  throw new Error('composeContent requires a contentHolderReference, e.g. `item:<id>`.');
126
126
  }
127
+ const unsourced = request.layers.findIndex((layer) => !(layer === null || layer === void 0 ? void 0 : layer.contentId) && !(layer === null || layer === void 0 ? void 0 : layer.fileId));
128
+ if (unsourced >= 0) {
129
+ throw new Error(`composeContent layer ${unsourced} needs either a contentId or a fileId.`);
130
+ }
127
131
  const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({
128
132
  command: BoardCommand.COMPOSE_CONTENT,
129
133
  data: request,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/extensions-sdk",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "Client library for interfacing with VibeIQ's services and apps from an extension.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",