@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.
- package/lib/apps/boards.d.ts +14 -3
- package/lib/apps/boards.js +4 -0
- package/package.json +1 -1
package/lib/apps/boards.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
|
|
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
|
*
|
package/lib/apps/boards.js
CHANGED
|
@@ -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