@credal/actions 0.2.99 → 0.2.100
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.
|
@@ -571,11 +571,11 @@ export const slackSendMessageDefinition = {
|
|
|
571
571
|
properties: {
|
|
572
572
|
success: {
|
|
573
573
|
type: "boolean",
|
|
574
|
-
description: "Whether the
|
|
574
|
+
description: "Whether the message was sent successfully",
|
|
575
575
|
},
|
|
576
576
|
error: {
|
|
577
577
|
type: "string",
|
|
578
|
-
description: "The error that occurred if the
|
|
578
|
+
description: "The error that occurred if the message was not sent successfully",
|
|
579
579
|
},
|
|
580
580
|
messageId: {
|
|
581
581
|
type: "string",
|
|
@@ -6746,6 +6746,7 @@ export const googleOauthGetPresentationDefinition = {
|
|
|
6746
6746
|
properties: {
|
|
6747
6747
|
objectId: "string",
|
|
6748
6748
|
text: "string",
|
|
6749
|
+
styling: "string",
|
|
6749
6750
|
},
|
|
6750
6751
|
},
|
|
6751
6752
|
},
|
|
@@ -11,9 +11,37 @@ import { axiosClient } from "../../util/axiosClient.js";
|
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
// Zod schemas for Google Slides API response structure
|
|
14
|
+
const TextStyleSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
fontSize: z
|
|
17
|
+
.object({
|
|
18
|
+
magnitude: z.number().optional(),
|
|
19
|
+
unit: z.string().optional(),
|
|
20
|
+
})
|
|
21
|
+
.optional(),
|
|
22
|
+
foregroundColor: z
|
|
23
|
+
.object({
|
|
24
|
+
opaqueColor: z
|
|
25
|
+
.object({
|
|
26
|
+
rgbColor: z
|
|
27
|
+
.object({
|
|
28
|
+
red: z.number().optional(),
|
|
29
|
+
green: z.number().optional(),
|
|
30
|
+
blue: z.number().optional(),
|
|
31
|
+
})
|
|
32
|
+
.optional(),
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
fontFamily: z.string().optional(),
|
|
38
|
+
bold: z.boolean().optional(),
|
|
39
|
+
})
|
|
40
|
+
.passthrough();
|
|
14
41
|
const TextRunSchema = z
|
|
15
42
|
.object({
|
|
16
43
|
content: z.string().optional(),
|
|
44
|
+
style: TextStyleSchema.optional(),
|
|
17
45
|
})
|
|
18
46
|
.passthrough();
|
|
19
47
|
const TextElementSchema = z
|
|
@@ -49,6 +77,35 @@ const GoogleSlidesResponseSchema = z
|
|
|
49
77
|
slides: z.array(SlideSchema).optional(),
|
|
50
78
|
})
|
|
51
79
|
.passthrough();
|
|
80
|
+
/**
|
|
81
|
+
* Formats text styling information into a concatenated string
|
|
82
|
+
*/
|
|
83
|
+
const formatStyling = (textStyle) => {
|
|
84
|
+
var _a, _b, _c, _d;
|
|
85
|
+
if (!textStyle)
|
|
86
|
+
return "";
|
|
87
|
+
const parts = [];
|
|
88
|
+
if (((_a = textStyle.fontSize) === null || _a === void 0 ? void 0 : _a.magnitude) && ((_b = textStyle.fontSize) === null || _b === void 0 ? void 0 : _b.unit)) {
|
|
89
|
+
parts.push(`size: ${textStyle.fontSize.magnitude}${textStyle.fontSize.unit}`);
|
|
90
|
+
}
|
|
91
|
+
if ((_d = (_c = textStyle.foregroundColor) === null || _c === void 0 ? void 0 : _c.opaqueColor) === null || _d === void 0 ? void 0 : _d.rgbColor) {
|
|
92
|
+
const { red = 0, green = 0, blue = 0 } = textStyle.foregroundColor.opaqueColor.rgbColor;
|
|
93
|
+
const hexColor = "#" +
|
|
94
|
+
[red, green, blue]
|
|
95
|
+
.map(c => Math.round(c * 255)
|
|
96
|
+
.toString(16)
|
|
97
|
+
.padStart(2, "0"))
|
|
98
|
+
.join("");
|
|
99
|
+
parts.push(`color: ${hexColor}`);
|
|
100
|
+
}
|
|
101
|
+
if (textStyle.fontFamily) {
|
|
102
|
+
parts.push(`family: ${textStyle.fontFamily}`);
|
|
103
|
+
}
|
|
104
|
+
if (textStyle.bold) {
|
|
105
|
+
parts.push(`bold`);
|
|
106
|
+
}
|
|
107
|
+
return parts.join(", ");
|
|
108
|
+
};
|
|
52
109
|
/**
|
|
53
110
|
* Gets a Google Slides presentation by ID using OAuth authentication
|
|
54
111
|
*/
|
|
@@ -80,14 +137,22 @@ const getPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
|
80
137
|
var _a;
|
|
81
138
|
return ({
|
|
82
139
|
objectId: slide.objectId,
|
|
83
|
-
pageElements: ((_a = slide.pageElements) === null || _a === void 0 ? void 0 : _a.
|
|
84
|
-
var _a, _b
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
140
|
+
pageElements: ((_a = slide.pageElements) === null || _a === void 0 ? void 0 : _a.flatMap(element => {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
const textElements = ((_b = (_a = element.shape) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.textElements) || [];
|
|
143
|
+
return textElements
|
|
144
|
+
.map(textElement => {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const content = ((_a = textElement.textRun) === null || _a === void 0 ? void 0 : _a.content) || "";
|
|
147
|
+
const styling = formatStyling((_b = textElement.textRun) === null || _b === void 0 ? void 0 : _b.style);
|
|
148
|
+
return {
|
|
149
|
+
objectId: `${element.objectId}`,
|
|
150
|
+
text: content,
|
|
151
|
+
styling,
|
|
152
|
+
};
|
|
153
|
+
})
|
|
154
|
+
.filter(textRun => textRun.text.trim());
|
|
155
|
+
}).filter(Boolean)) || [],
|
|
91
156
|
});
|
|
92
157
|
})) || [],
|
|
93
158
|
};
|