@activepieces/piece-alai 0.1.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.
- package/README.md +7 -0
- package/package.json +28 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +43 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-slide.d.ts +12 -0
- package/src/lib/actions/add-slide.js +77 -0
- package/src/lib/actions/add-slide.js.map +1 -0
- package/src/lib/actions/delete-presentation.d.ts +5 -0
- package/src/lib/actions/delete-presentation.js +34 -0
- package/src/lib/actions/delete-presentation.js.map +1 -0
- package/src/lib/actions/export-presentation.d.ts +8 -0
- package/src/lib/actions/export-presentation.js +94 -0
- package/src/lib/actions/export-presentation.js.map +1 -0
- package/src/lib/actions/generate-presentation.d.ts +17 -0
- package/src/lib/actions/generate-presentation.js +216 -0
- package/src/lib/actions/generate-presentation.js.map +1 -0
- package/src/lib/actions/get-generation.d.ts +5 -0
- package/src/lib/actions/get-generation.js +35 -0
- package/src/lib/actions/get-generation.js.map +1 -0
- package/src/lib/common/auth.d.ts +3 -0
- package/src/lib/common/auth.js +49 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/props.d.ts +3 -0
- package/src/lib/common/props.js +36 -0
- package/src/lib/common/props.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-alai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"ai": "^6.0.0",
|
|
10
|
+
"axios": "1.13.1",
|
|
11
|
+
"axios-retry": "4.4.1",
|
|
12
|
+
"deepmerge-ts": "7.1.0",
|
|
13
|
+
"form-data": "4.0.4",
|
|
14
|
+
"i18next": "23.13.0",
|
|
15
|
+
"mime-types": "2.1.35",
|
|
16
|
+
"nanoid": "3.3.8",
|
|
17
|
+
"semver": "7.6.0",
|
|
18
|
+
"socket.io-client": "4.8.1",
|
|
19
|
+
"tslib": "^2.3.0",
|
|
20
|
+
"zod": "4.1.13",
|
|
21
|
+
"@activepieces/pieces-common": "0.11.5",
|
|
22
|
+
"@activepieces/pieces-framework": "0.25.2",
|
|
23
|
+
"@activepieces/shared": "0.34.0"
|
|
24
|
+
},
|
|
25
|
+
"resolutions": {
|
|
26
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alai = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const auth_1 = require("./lib/common/auth");
|
|
8
|
+
const generate_presentation_1 = require("./lib/actions/generate-presentation");
|
|
9
|
+
const get_generation_1 = require("./lib/actions/get-generation");
|
|
10
|
+
const export_presentation_1 = require("./lib/actions/export-presentation");
|
|
11
|
+
const add_slide_1 = require("./lib/actions/add-slide");
|
|
12
|
+
const delete_presentation_1 = require("./lib/actions/delete-presentation");
|
|
13
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
14
|
+
exports.alai = (0, pieces_framework_1.createPiece)({
|
|
15
|
+
displayName: 'Alai',
|
|
16
|
+
auth: auth_1.alaiAuth,
|
|
17
|
+
minimumSupportedRelease: '0.36.1',
|
|
18
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/alai.png',
|
|
19
|
+
authors: ['getalai', 'sanket-a11y'],
|
|
20
|
+
description: 'AI-powered presentation generation API. Create, export, and manage professional presentations from text.',
|
|
21
|
+
categories: [
|
|
22
|
+
shared_1.PieceCategory.CONTENT_AND_FILES,
|
|
23
|
+
shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE,
|
|
24
|
+
],
|
|
25
|
+
actions: [
|
|
26
|
+
generate_presentation_1.generatePresentation,
|
|
27
|
+
get_generation_1.getGeneration,
|
|
28
|
+
export_presentation_1.exportPresentation,
|
|
29
|
+
add_slide_1.addSlide,
|
|
30
|
+
delete_presentation_1.deletePresentation,
|
|
31
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
32
|
+
auth: auth_1.alaiAuth,
|
|
33
|
+
baseUrl: () => 'https://slides-api.getalai.com/api/v1',
|
|
34
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
return {
|
|
36
|
+
Authorization: `Bearer ${auth.props.apiKey}`,
|
|
37
|
+
};
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
triggers: [],
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/alai/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,4CAA6C;AAC7C,+EAA2E;AAC3E,iEAA6D;AAC7D,2EAAuE;AACvE,uDAAmD;AACnD,2EAAuE;AACvE,+DAAwE;AAE3D,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC9B,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,eAAQ;IACd,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE,CAAC,SAAS,EAAC,aAAa,CAAC;IAClC,WAAW,EACT,0GAA0G;IAC5G,UAAU,EAAE;QACV,sBAAa,CAAC,iBAAiB;QAC/B,sBAAa,CAAC,uBAAuB;KACtC;IACD,OAAO,EAAE;QACP,4CAAoB;QACpB,8BAAa;QACb,wCAAkB;QAClB,oBAAQ;QACR,wCAAkB;QAClB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,eAAQ;YACd,OAAO,EAAE,GAAG,EAAE,CAAC,uCAAuC;YACtD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;iBAC7C,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const addSlide: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
presentationId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>>;
|
|
7
|
+
slide_context: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
|
+
additionalInstructions: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
slide_order: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
includeAiImages: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
+
imageStyle: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addSlide = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
exports.addSlide = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.alaiAuth,
|
|
11
|
+
name: 'addSlide',
|
|
12
|
+
displayName: 'Add Slide',
|
|
13
|
+
description: 'Add a new slide to an existing presentation.',
|
|
14
|
+
props: {
|
|
15
|
+
presentationId: props_1.presentationId,
|
|
16
|
+
slide_context: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Slide Context',
|
|
18
|
+
description: 'The content or topic for the slide to be generated.',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
additionalInstructions: pieces_framework_1.Property.LongText({
|
|
22
|
+
displayName: 'Additional Instructions',
|
|
23
|
+
description: 'Extra instructions for how the slide should be generated.',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
slide_order: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Slide Order',
|
|
28
|
+
description: 'The position to insert the new slide (e.g., "0" for the first slide, "end" to add at the end).',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
includeAiImages: pieces_framework_1.Property.Checkbox({
|
|
32
|
+
displayName: 'Include AI Images',
|
|
33
|
+
description: 'Whether to include AI-generated images in the slide.',
|
|
34
|
+
required: false,
|
|
35
|
+
defaultValue: true,
|
|
36
|
+
}),
|
|
37
|
+
imageStyle: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Image Style',
|
|
39
|
+
description: 'The style for AI-generated images.',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
run(context) {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const { presentationId, slide_context, additionalInstructions, slide_order, includeAiImages, imageStyle } = context.propsValue;
|
|
46
|
+
const options = {};
|
|
47
|
+
if (additionalInstructions) {
|
|
48
|
+
options['additional_instructions'] = additionalInstructions;
|
|
49
|
+
}
|
|
50
|
+
if (slide_order) {
|
|
51
|
+
options['slide_order'] = isNaN(Number(slide_order)) ? slide_order : Number(slide_order);
|
|
52
|
+
}
|
|
53
|
+
if (includeAiImages) {
|
|
54
|
+
options['num_image_variants'] = imageStyle ? 2 : 1;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
options['num_image_variants'] = 0;
|
|
58
|
+
}
|
|
59
|
+
const body = {
|
|
60
|
+
slide_context: slide_context,
|
|
61
|
+
options,
|
|
62
|
+
export_formats: ['link'],
|
|
63
|
+
};
|
|
64
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
65
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
66
|
+
url: `https://slides-api.getalai.com/api/v1/presentations/${presentationId}/slides`,
|
|
67
|
+
headers: {
|
|
68
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
},
|
|
71
|
+
body,
|
|
72
|
+
});
|
|
73
|
+
return response.body;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=add-slide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-slide.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/actions/add-slide.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA0C;AAC1C,2CAAiD;AAEpC,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACL,cAAc,EAAE,sBAAc;QAC9B,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,sBA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AAC,CAAC;YACpC,CAAC;YAED,MAAM,IAAI,GAA4B;gBACpC,aAAa,EAAE,aAAa;gBAC5B,OAAO;gBACP,cAAc,EAAE,CAAC,MAAM,CAAC;aACzB,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,uDAAuD,cAAc,SAAS;gBACnF,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;oBACpD,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const deletePresentation: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
presentationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deletePresentation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
exports.deletePresentation = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.alaiAuth,
|
|
10
|
+
name: 'deletePresentation',
|
|
11
|
+
displayName: 'Delete Presentation',
|
|
12
|
+
description: 'Delete a presentation by its ID.',
|
|
13
|
+
props: {
|
|
14
|
+
presentationId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Presentation ID',
|
|
16
|
+
description: 'The ID of the presentation to delete.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const { presentationId } = context.propsValue;
|
|
23
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
24
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
25
|
+
url: `https://slides-api.getalai.com/api/v1/presentations/${presentationId}`,
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return response.body;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=delete-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-presentation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/actions/delete-presentation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA0C;AAE7B,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,kCAAkC;IAC/C,KAAK,EAAE;QACL,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC9C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,uDAAuD,cAAc,EAAE;gBAC5E,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;iBACrD;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const exportPresentation: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
presentationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
exportFormats: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
6
|
+
waitForCompletion: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
maxWaitTime: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportPresentation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
exports.exportPresentation = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.alaiAuth,
|
|
11
|
+
name: 'exportPresentation',
|
|
12
|
+
displayName: 'Export Presentation',
|
|
13
|
+
description: 'Export a presentation in the specified formats.',
|
|
14
|
+
props: {
|
|
15
|
+
presentationId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Presentation ID',
|
|
17
|
+
description: 'The ID of the presentation to export.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
exportFormats: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
21
|
+
displayName: 'Export Formats',
|
|
22
|
+
description: 'Formats to export the presentation in.',
|
|
23
|
+
required: true,
|
|
24
|
+
options: {
|
|
25
|
+
options: [
|
|
26
|
+
{ label: 'Link', value: 'link' },
|
|
27
|
+
{ label: 'PDF', value: 'pdf' },
|
|
28
|
+
{ label: 'PowerPoint (PPTX)', value: 'ppt' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
waitForCompletion: pieces_framework_1.Property.Checkbox({
|
|
33
|
+
displayName: 'Wait for Completion',
|
|
34
|
+
description: 'Wait for the presentation generation to complete before returning.',
|
|
35
|
+
required: false,
|
|
36
|
+
defaultValue: false,
|
|
37
|
+
}),
|
|
38
|
+
maxWaitTime: pieces_framework_1.Property.Number({
|
|
39
|
+
displayName: 'Max Wait Time (seconds)',
|
|
40
|
+
description: 'Maximum time to wait for completion (default 300 seconds / 5 minutes).',
|
|
41
|
+
required: false,
|
|
42
|
+
defaultValue: 300,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
const { presentationId, exportFormats, waitForCompletion, maxWaitTime } = context.propsValue;
|
|
49
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
50
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
51
|
+
url: `https://slides-api.getalai.com/api/v1/presentations/${presentationId}/exports`,
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
},
|
|
56
|
+
body: {
|
|
57
|
+
export_formats: exportFormats,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const generationId = (_a = response.body) === null || _a === void 0 ? void 0 : _a.generation_id;
|
|
61
|
+
if (!generationId) {
|
|
62
|
+
throw new Error(`Failed to get generation_id from response: ${JSON.stringify(response.body)}`);
|
|
63
|
+
}
|
|
64
|
+
if (!waitForCompletion) {
|
|
65
|
+
return response.body;
|
|
66
|
+
}
|
|
67
|
+
yield sleep(1000);
|
|
68
|
+
// Poll for completion
|
|
69
|
+
const maxWait = (maxWaitTime || 300) * 1000; // Convert to milliseconds
|
|
70
|
+
const startTime = Date.now();
|
|
71
|
+
const pollInterval = 5000; // Poll every 5 seconds
|
|
72
|
+
while (Date.now() - startTime < maxWait) {
|
|
73
|
+
const statusResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
74
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
75
|
+
url: `https://slides-api.getalai.com/api/v1/generations/${generationId}`,
|
|
76
|
+
headers: {
|
|
77
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const status = (_b = statusResponse.body) === null || _b === void 0 ? void 0 : _b.status;
|
|
81
|
+
if (status === 'completed') {
|
|
82
|
+
return statusResponse.body;
|
|
83
|
+
}
|
|
84
|
+
else if (status === 'failed') {
|
|
85
|
+
throw new Error(`Generation failed: ${((_c = statusResponse.body) === null || _c === void 0 ? void 0 : _c.error) || 'Unknown error'}`);
|
|
86
|
+
}
|
|
87
|
+
// Wait before polling again
|
|
88
|
+
yield sleep(pollInterval);
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Generation timed out after ${maxWaitTime || 300} seconds`);
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=export-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-presentation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/actions/export-presentation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA0C;AAC1C,MAAM,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AAC;gBAEH,MAAM,MAAM,GAAG,MAAA,cAAc,CAAC,IAAI,0CAAE,MAAM,CAAC;gBAE3C,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;oBAC3B,OAAO,cAAc,CAAC,IAAI,CAAC;gBAC7B,CAAC;qBAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC/B,MAAM,IAAI,KAAK,CACb,sBAAsB,CAAA,MAAA,cAAc,CAAC,IAAI,0CAAE,KAAK,KAAI,eAAe,EAAE,CACtE,CAAC;gBACJ,CAAC;gBAED,4BAA4B;gBAC5B,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;YAC5B,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,WAAW,IAAI,GAAG,UAAU,CAAC,CAAC;QAC9E,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const generatePresentation: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
inputText: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
additionalInstructions: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
6
|
+
exportFormats: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
7
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
themeId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
slideRange: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
tone: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
11
|
+
contentMode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
12
|
+
amountMode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
13
|
+
includeAiImages: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
14
|
+
imageStyle: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
15
|
+
waitForCompletion: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
16
|
+
maxWaitTime: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatePresentation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
exports.generatePresentation = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.alaiAuth,
|
|
11
|
+
name: 'generatePresentation',
|
|
12
|
+
displayName: 'Generate Presentation',
|
|
13
|
+
description: 'Create a new AI-generated presentation from text.',
|
|
14
|
+
props: {
|
|
15
|
+
inputText: pieces_framework_1.Property.LongText({
|
|
16
|
+
displayName: 'Input Text',
|
|
17
|
+
description: 'The text content to generate a presentation from.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
additionalInstructions: pieces_framework_1.Property.LongText({
|
|
21
|
+
displayName: 'Additional Instructions',
|
|
22
|
+
description: 'Extra instructions for how the presentation should be generated.',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
exportFormats: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
26
|
+
displayName: 'Export Formats',
|
|
27
|
+
description: 'Formats to export the presentation in after generation.',
|
|
28
|
+
required: false,
|
|
29
|
+
options: {
|
|
30
|
+
options: [
|
|
31
|
+
{ label: 'Link', value: 'link' },
|
|
32
|
+
{ label: 'PDF', value: 'pdf' },
|
|
33
|
+
{ label: 'PowerPoint (PPTX)', value: 'ppt' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
title: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Title',
|
|
39
|
+
description: 'A title for the presentation. If not provided, one will be generated.',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
themeId: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Theme ID',
|
|
44
|
+
description: 'The ID of the presentation theme to use. If not provided, a default theme will be applied.',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
slideRange: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Slide Range',
|
|
49
|
+
description: 'Target slide count: auto, 1, 2-5, 6-10, 11-15, 16-20, 21-25, 26-50.',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
tone: pieces_framework_1.Property.StaticDropdown({
|
|
53
|
+
displayName: 'Tone',
|
|
54
|
+
description: 'The tone of voice for the presentation content.',
|
|
55
|
+
required: false,
|
|
56
|
+
options: {
|
|
57
|
+
options: [
|
|
58
|
+
{ label: 'Default', value: 'DEFAULT' },
|
|
59
|
+
{ label: 'Professional', value: 'PROFESSIONAL' },
|
|
60
|
+
{ label: 'Casual', value: 'CASUAL' },
|
|
61
|
+
{ label: 'Technical', value: 'TECHNICAL' },
|
|
62
|
+
{ label: 'Educational', value: 'EDUCATIONAL' },
|
|
63
|
+
{ label: 'Inspirational', value: 'INSPIRATIONAL' },
|
|
64
|
+
{ label: 'Narrative', value: 'NARRATIVE' },
|
|
65
|
+
{ label: 'Persuasive', value: 'PERSUASIVE' },
|
|
66
|
+
{ label: 'Authoritative', value: 'AUTHORITATIVE' },
|
|
67
|
+
{ label: 'Empathetic', value: 'EMPATHETIC' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
contentMode: pieces_framework_1.Property.StaticDropdown({
|
|
72
|
+
displayName: 'Content Mode',
|
|
73
|
+
description: 'How the input text should be handled.',
|
|
74
|
+
required: false,
|
|
75
|
+
options: {
|
|
76
|
+
options: [
|
|
77
|
+
{ label: 'Preserve', value: 'PRESERVE' },
|
|
78
|
+
{ label: 'Condense', value: 'CONDENSE' },
|
|
79
|
+
{ label: 'Enhance', value: 'ENHANCE' },
|
|
80
|
+
{ label: 'Custom', value: 'CUSTOM' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
amountMode: pieces_framework_1.Property.StaticDropdown({
|
|
85
|
+
displayName: 'Text Density',
|
|
86
|
+
description: 'The amount of text to include per slide.',
|
|
87
|
+
required: false,
|
|
88
|
+
options: {
|
|
89
|
+
options: [
|
|
90
|
+
{ label: 'Minimal', value: 'MINIMAL' },
|
|
91
|
+
{ label: 'Essential', value: 'ESSENTIAL' },
|
|
92
|
+
{ label: 'Balanced', value: 'BALANCED' },
|
|
93
|
+
{ label: 'Detailed', value: 'DETAILED' },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
includeAiImages: pieces_framework_1.Property.Checkbox({
|
|
98
|
+
displayName: 'Include AI Images',
|
|
99
|
+
description: 'Whether to include AI-generated images in the presentation.',
|
|
100
|
+
required: false,
|
|
101
|
+
defaultValue: true,
|
|
102
|
+
}),
|
|
103
|
+
imageStyle: pieces_framework_1.Property.StaticDropdown({
|
|
104
|
+
displayName: 'Image Style',
|
|
105
|
+
description: 'The style for AI-generated images.',
|
|
106
|
+
required: false,
|
|
107
|
+
options: {
|
|
108
|
+
options: [
|
|
109
|
+
{ label: 'Auto', value: 'auto' },
|
|
110
|
+
{ label: 'Realistic', value: 'realistic' },
|
|
111
|
+
{ label: 'Artistic', value: 'artistic' },
|
|
112
|
+
{ label: 'Cartoon', value: 'cartoon' },
|
|
113
|
+
{ label: '3D', value: 'three_d' },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
waitForCompletion: pieces_framework_1.Property.Checkbox({
|
|
118
|
+
displayName: 'Wait for Completion',
|
|
119
|
+
description: 'Wait for the presentation generation to complete before returning.',
|
|
120
|
+
required: false,
|
|
121
|
+
defaultValue: false,
|
|
122
|
+
}),
|
|
123
|
+
maxWaitTime: pieces_framework_1.Property.Number({
|
|
124
|
+
displayName: 'Max Wait Time (seconds)',
|
|
125
|
+
description: 'Maximum time to wait for completion (default 300 seconds / 5 minutes).',
|
|
126
|
+
required: false,
|
|
127
|
+
defaultValue: 300,
|
|
128
|
+
}),
|
|
129
|
+
},
|
|
130
|
+
run(context) {
|
|
131
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
var _a, _b, _c;
|
|
133
|
+
const { inputText, additionalInstructions, exportFormats, title, themeId, slideRange, tone, contentMode, amountMode, includeAiImages, imageStyle, waitForCompletion, maxWaitTime, } = context.propsValue;
|
|
134
|
+
const body = {
|
|
135
|
+
input_text: inputText,
|
|
136
|
+
};
|
|
137
|
+
if (additionalInstructions)
|
|
138
|
+
body['additional_instructions'] = additionalInstructions;
|
|
139
|
+
if (exportFormats && exportFormats.length > 0)
|
|
140
|
+
body['export_formats'] = exportFormats;
|
|
141
|
+
else
|
|
142
|
+
body['export_formats'] = ['link'];
|
|
143
|
+
const presentationOptions = {};
|
|
144
|
+
if (title)
|
|
145
|
+
presentationOptions['title'] = title;
|
|
146
|
+
if (themeId)
|
|
147
|
+
presentationOptions['theme_id'] = themeId;
|
|
148
|
+
if (slideRange)
|
|
149
|
+
presentationOptions['slide_range'] = slideRange;
|
|
150
|
+
if (Object.keys(presentationOptions).length > 0) {
|
|
151
|
+
body['presentation_options'] = presentationOptions;
|
|
152
|
+
}
|
|
153
|
+
const textOptions = {};
|
|
154
|
+
if (tone)
|
|
155
|
+
textOptions['tone'] = tone;
|
|
156
|
+
if (contentMode)
|
|
157
|
+
textOptions['content_mode'] = contentMode;
|
|
158
|
+
if (amountMode)
|
|
159
|
+
textOptions['amount_mode'] = amountMode;
|
|
160
|
+
if (Object.keys(textOptions).length > 0) {
|
|
161
|
+
body['text_options'] = textOptions;
|
|
162
|
+
}
|
|
163
|
+
const imageOptions = {};
|
|
164
|
+
if (includeAiImages !== undefined && includeAiImages !== null) {
|
|
165
|
+
imageOptions['include_ai_images'] = includeAiImages;
|
|
166
|
+
}
|
|
167
|
+
if (imageStyle)
|
|
168
|
+
imageOptions['style'] = imageStyle;
|
|
169
|
+
if (Object.keys(imageOptions).length > 0) {
|
|
170
|
+
body['image_options'] = imageOptions;
|
|
171
|
+
}
|
|
172
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
173
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
174
|
+
url: 'https://slides-api.getalai.com/api/v1/generations',
|
|
175
|
+
headers: {
|
|
176
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
177
|
+
'Content-Type': 'application/json',
|
|
178
|
+
},
|
|
179
|
+
body,
|
|
180
|
+
});
|
|
181
|
+
const generationId = (_a = response.body) === null || _a === void 0 ? void 0 : _a.generation_id;
|
|
182
|
+
if (!generationId) {
|
|
183
|
+
throw new Error(`Failed to get generation_id from response: ${JSON.stringify(response.body)}`);
|
|
184
|
+
}
|
|
185
|
+
if (!waitForCompletion) {
|
|
186
|
+
return response.body;
|
|
187
|
+
}
|
|
188
|
+
// Wait a bit before polling to ensure the generation is indexed in the database
|
|
189
|
+
yield sleep(1000);
|
|
190
|
+
// Poll for completion
|
|
191
|
+
const maxWait = (maxWaitTime || 300) * 1000; // Convert to milliseconds
|
|
192
|
+
const startTime = Date.now();
|
|
193
|
+
const pollInterval = 5000; // Poll every 5 seconds
|
|
194
|
+
while (Date.now() - startTime < maxWait) {
|
|
195
|
+
const statusResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
196
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
197
|
+
url: `https://slides-api.getalai.com/api/v1/generations/${generationId}`,
|
|
198
|
+
headers: {
|
|
199
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
const status = (_b = statusResponse.body) === null || _b === void 0 ? void 0 : _b.status;
|
|
203
|
+
if (status === 'completed') {
|
|
204
|
+
return statusResponse.body;
|
|
205
|
+
}
|
|
206
|
+
else if (status === 'failed') {
|
|
207
|
+
throw new Error(`Generation failed: ${((_c = statusResponse.body) === null || _c === void 0 ? void 0 : _c.error) || 'Unknown error'}`);
|
|
208
|
+
}
|
|
209
|
+
// Wait before polling again
|
|
210
|
+
yield sleep(pollInterval);
|
|
211
|
+
}
|
|
212
|
+
throw new Error(`Generation timed out after ${maxWaitTime || 300} seconds`);
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
//# sourceMappingURL=generate-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-presentation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/actions/generate-presentation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA0C;AAE1C,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEnE,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,mDAAmD;IAChE,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,sBAAsB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxC,WAAW,EAAE,yBAAyB;YACtC,WAAW,EACT,kEAAkE;YACpE,QAAQ,EAA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xE,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;qBACrD;iBACF,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAG,MAAA,cAAc,CAAC,IAAI,0CAAE,MAAM,CAAC;gBAE3C,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;oBAC3B,OAAO,cAAc,CAAC,IAAI,CAAC;gBAC7B,CAAC;qBAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC/B,MAAM,IAAI,KAAK,CACb,sBAAsB,CAAA,MAAA,cAAc,CAAC,IAAI,0CAAE,KAAK,KAAI,eAAe,EAAE,CACtE,CAAC;gBACJ,CAAC;gBAED,4BAA4B;gBAC5B,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;YAC5B,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,WAAW,IAAI,GAAG,UAAU,CAAC,CAAC;QAC9E,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getGeneration: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>, {
|
|
4
|
+
generationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGeneration = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
exports.getGeneration = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.alaiAuth,
|
|
10
|
+
name: 'getGeneration',
|
|
11
|
+
displayName: 'Get Generation',
|
|
12
|
+
description: 'Fetch the status and result of a generation job.',
|
|
13
|
+
props: {
|
|
14
|
+
generationId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Generation ID',
|
|
16
|
+
description: 'The ID of the generation job (from the "Generate Presentation" action).',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const { generationId } = context.propsValue;
|
|
23
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
24
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
+
url: `https://slides-api.getalai.com/api/v1/generations/${generationId}`,
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${context.auth.props.apiKey}`,
|
|
28
|
+
Accept: 'application/json',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return response.body;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=get-generation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-generation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/actions/get-generation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA0C;AAE7B,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC5C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,qDAAqD,YAAY,EAAE;gBACxE,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;oBACpD,MAAM,EAAE,kBAAkB;iBAC3B;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alaiAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const markdownDescription = `
|
|
8
|
+
Follow these steps to get your Alai API Key:
|
|
9
|
+
|
|
10
|
+
1. Go to [**https://getalai.com/api**](https://getalai.com/api) and sign up or log in.
|
|
11
|
+
2. Navigate to the **API Keys** section.
|
|
12
|
+
3. Click **Create API Key** and give it a name (e.g., "Activepieces").
|
|
13
|
+
4. Copy the key and paste it below.
|
|
14
|
+
`;
|
|
15
|
+
exports.alaiAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
16
|
+
description: markdownDescription,
|
|
17
|
+
required: true,
|
|
18
|
+
props: {
|
|
19
|
+
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
20
|
+
displayName: 'API Key',
|
|
21
|
+
description: 'Paste your API key here.',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
validate(auth) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const apiKey = auth.auth.apiKey;
|
|
28
|
+
try {
|
|
29
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
30
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
31
|
+
url: 'https://slides-api.getalai.com/api/v1/ping',
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${apiKey}`,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return { valid: true };
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
if (e instanceof pieces_common_1.HttpError) {
|
|
40
|
+
if (e.response.status === 401) {
|
|
41
|
+
return { valid: false, error: 'Invalid API Key' };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { valid: false, error: 'Failed to connect to Alai API' };
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAgF;AAEhF,MAAM,mBAAmB,GAAG;;;;;;;CAO3B,CAAC;AAEW,QAAA,QAAQ,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,QAAQ,CAAC,IAAI;;YACjB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAChC,IAAI,CAAC;gBACH,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,4CAA4C;oBACjD,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,MAAM,EAAE;qBAClC;iBACF,CAAC,CAAC;gBACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,YAAY,yBAAS,EAAE,CAAC;oBAC3B,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;wBAC9B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;oBACpD,CAAC;gBACH,CAAC;gBACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,EAAE,CAAC;YAClE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.presentationId = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("./auth");
|
|
8
|
+
exports.presentationId = pieces_framework_1.Property.Dropdown({
|
|
9
|
+
auth: auth_1.alaiAuth,
|
|
10
|
+
displayName: 'Presentation',
|
|
11
|
+
description: 'Select a presentation',
|
|
12
|
+
required: true,
|
|
13
|
+
refreshers: [],
|
|
14
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
15
|
+
var _b;
|
|
16
|
+
if (!auth)
|
|
17
|
+
return { options: [] };
|
|
18
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
url: 'https://slides-api.getalai.com/api/v1/presentations',
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${auth.props.apiKey}`,
|
|
23
|
+
Accept: 'application/json',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const presentations = ((_b = response.body) === null || _b === void 0 ? void 0 : _b.presentations) || [];
|
|
27
|
+
return {
|
|
28
|
+
disabled: presentations.length === 0,
|
|
29
|
+
options: presentations.map((presentation) => ({
|
|
30
|
+
label: presentation.title,
|
|
31
|
+
value: presentation.presentation_id,
|
|
32
|
+
})),
|
|
33
|
+
};
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alai/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,qEAA0D;AAC1D,iCAAkC;AAErB,QAAA,cAAc,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC9C,IAAI,EAAE,eAAQ;IACd,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,uBAAuB;IACpC,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACtB,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;YAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,GAAG,EAAE,qDAAqD;YAC1D,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC5C,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;QACH,MAAM,aAAa,GAAG,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,aAAa,KAAI,EAAE,CAAC;QACzD,OAAO;YACL,QAAQ,EAAE,aAAa,CAAC,MAAM,KAAK,CAAC;YACpC,OAAO,EAAE,aAAa,CAAC,GAAG,CACxB,CAAC,YAAwD,EAAE,EAAE,CAAC,CAAC;gBAC7D,KAAK,EAAE,YAAY,CAAC,KAAK;gBACzB,KAAK,EAAE,YAAY,CAAC,eAAe;aACpC,CAAC,CACH;SACF,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|