@memberjunction/core-actions 2.103.0 → 2.105.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 (77) hide show
  1. package/dist/config.d.ts +82 -0
  2. package/dist/config.d.ts.map +1 -0
  3. package/dist/config.js +83 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/custom/files/base-file-storage.action.d.ts +70 -0
  6. package/dist/custom/files/base-file-storage.action.d.ts.map +1 -0
  7. package/dist/custom/files/base-file-storage.action.js +140 -0
  8. package/dist/custom/files/base-file-storage.action.js.map +1 -0
  9. package/dist/custom/files/copy-object.action.d.ts +38 -0
  10. package/dist/custom/files/copy-object.action.d.ts.map +1 -0
  11. package/dist/custom/files/copy-object.action.js +84 -0
  12. package/dist/custom/files/copy-object.action.js.map +1 -0
  13. package/dist/custom/files/create-directory.action.d.ts +34 -0
  14. package/dist/custom/files/create-directory.action.d.ts.map +1 -0
  15. package/dist/custom/files/create-directory.action.js +75 -0
  16. package/dist/custom/files/create-directory.action.js.map +1 -0
  17. package/dist/custom/files/delete-directory.action.d.ts +38 -0
  18. package/dist/custom/files/delete-directory.action.d.ts.map +1 -0
  19. package/dist/custom/files/delete-directory.action.js +82 -0
  20. package/dist/custom/files/delete-directory.action.js.map +1 -0
  21. package/dist/custom/files/delete-object.action.d.ts +34 -0
  22. package/dist/custom/files/delete-object.action.d.ts.map +1 -0
  23. package/dist/custom/files/delete-object.action.js +75 -0
  24. package/dist/custom/files/delete-object.action.js.map +1 -0
  25. package/dist/custom/files/directory-exists.action.d.ts +34 -0
  26. package/dist/custom/files/directory-exists.action.d.ts.map +1 -0
  27. package/dist/custom/files/directory-exists.action.js +75 -0
  28. package/dist/custom/files/directory-exists.action.js.map +1 -0
  29. package/dist/custom/files/get-download-url.action.d.ts +34 -0
  30. package/dist/custom/files/get-download-url.action.d.ts.map +1 -0
  31. package/dist/custom/files/get-download-url.action.js +75 -0
  32. package/dist/custom/files/get-download-url.action.js.map +1 -0
  33. package/dist/custom/files/get-metadata.action.d.ts +42 -0
  34. package/dist/custom/files/get-metadata.action.d.ts.map +1 -0
  35. package/dist/custom/files/get-metadata.action.js +95 -0
  36. package/dist/custom/files/get-metadata.action.js.map +1 -0
  37. package/dist/custom/files/get-object.action.d.ts +35 -0
  38. package/dist/custom/files/get-object.action.d.ts.map +1 -0
  39. package/dist/custom/files/get-object.action.js +80 -0
  40. package/dist/custom/files/get-object.action.js.map +1 -0
  41. package/dist/custom/files/get-upload-url.action.d.ts +35 -0
  42. package/dist/custom/files/get-upload-url.action.d.ts.map +1 -0
  43. package/dist/custom/files/get-upload-url.action.js +80 -0
  44. package/dist/custom/files/get-upload-url.action.js.map +1 -0
  45. package/dist/custom/files/index.d.ts +23 -0
  46. package/dist/custom/files/index.d.ts.map +1 -0
  47. package/dist/custom/files/index.js +39 -0
  48. package/dist/custom/files/index.js.map +1 -0
  49. package/dist/custom/files/list-objects.action.d.ts +50 -0
  50. package/dist/custom/files/list-objects.action.d.ts.map +1 -0
  51. package/dist/custom/files/list-objects.action.js +95 -0
  52. package/dist/custom/files/list-objects.action.js.map +1 -0
  53. package/dist/custom/files/move-object.action.d.ts +38 -0
  54. package/dist/custom/files/move-object.action.d.ts.map +1 -0
  55. package/dist/custom/files/move-object.action.js +84 -0
  56. package/dist/custom/files/move-object.action.js.map +1 -0
  57. package/dist/custom/files/object-exists.action.d.ts +34 -0
  58. package/dist/custom/files/object-exists.action.d.ts.map +1 -0
  59. package/dist/custom/files/object-exists.action.js +75 -0
  60. package/dist/custom/files/object-exists.action.js.map +1 -0
  61. package/dist/custom/integration/gamma-generate-presentation.action.d.ts +108 -0
  62. package/dist/custom/integration/gamma-generate-presentation.action.d.ts.map +1 -0
  63. package/dist/custom/integration/gamma-generate-presentation.action.js +315 -0
  64. package/dist/custom/integration/gamma-generate-presentation.action.js.map +1 -0
  65. package/dist/custom/web/perplexity-search.action.d.ts +98 -0
  66. package/dist/custom/web/perplexity-search.action.d.ts.map +1 -0
  67. package/dist/custom/web/perplexity-search.action.js +269 -0
  68. package/dist/custom/web/perplexity-search.action.js.map +1 -0
  69. package/dist/custom/web/web-page-content.action.d.ts +74 -27
  70. package/dist/custom/web/web-page-content.action.d.ts.map +1 -1
  71. package/dist/custom/web/web-page-content.action.js +458 -226
  72. package/dist/custom/web/web-page-content.action.js.map +1 -1
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +32 -0
  76. package/dist/index.js.map +1 -1
  77. package/package.json +16 -10
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LoadObjectExistsAction = exports.ObjectExistsAction = void 0;
10
+ const global_1 = require("@memberjunction/global");
11
+ const actions_1 = require("@memberjunction/actions");
12
+ const base_file_storage_action_1 = require("./base-file-storage.action");
13
+ /**
14
+ * Action for checking if a file object exists in a storage provider.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * await runAction({
19
+ * ActionName: 'Check Storage Object Exists',
20
+ * Params: [{
21
+ * Name: 'StorageProvider',
22
+ * Value: 'Google Drive'
23
+ * }, {
24
+ * Name: 'ObjectName',
25
+ * Value: 'reports/monthly.xlsx'
26
+ * }]
27
+ * });
28
+ * ```
29
+ */
30
+ let ObjectExistsAction = class ObjectExistsAction extends base_file_storage_action_1.BaseFileStorageAction {
31
+ /**
32
+ * Check if a file object exists
33
+ *
34
+ * @param params - The action parameters:
35
+ * - StorageProvider: Required - Name of the storage provider
36
+ * - ObjectName: Required - Name/path of the object
37
+ *
38
+ * @returns Operation result with:
39
+ * - Exists: Boolean indicating if the object exists
40
+ */
41
+ async InternalRunAction(params) {
42
+ try {
43
+ // Get and initialize storage driver
44
+ const { driver, error } = await this.getDriverFromParams(params);
45
+ if (error)
46
+ return error;
47
+ // Get required parameter
48
+ const objectName = this.getStringParam(params, 'objectname');
49
+ if (!objectName) {
50
+ return this.createErrorResult("ObjectName parameter is required", "MISSING_OBJECTNAME");
51
+ }
52
+ // Execute the object exists operation
53
+ const exists = await driver.ObjectExists(objectName);
54
+ // Add output parameter
55
+ this.addOutputParam(params, 'Exists', exists);
56
+ return this.createSuccessResult({
57
+ operation: 'ObjectExists',
58
+ objectName,
59
+ exists
60
+ });
61
+ }
62
+ catch (error) {
63
+ return this.createErrorResult(`Object exists check failed: ${error instanceof Error ? error.message : String(error)}`, "OPERATION_FAILED");
64
+ }
65
+ }
66
+ };
67
+ exports.ObjectExistsAction = ObjectExistsAction;
68
+ exports.ObjectExistsAction = ObjectExistsAction = __decorate([
69
+ (0, global_1.RegisterClass)(actions_1.BaseAction, "File Storage: Check Object Exists")
70
+ ], ObjectExistsAction);
71
+ function LoadObjectExistsAction() {
72
+ // Stub function to prevent tree shaking
73
+ }
74
+ exports.LoadObjectExistsAction = LoadObjectExistsAction;
75
+ //# sourceMappingURL=object-exists.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-exists.action.js","sourceRoot":"","sources":["../../../src/custom/files/object-exists.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,yEAAmE;AAEnE;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,gDAAqB;IAEzD;;;;;;;;;OASG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,oCAAoC;YACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACjE,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;YAExB,yBAAyB;YACzB,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,OAAO,IAAI,CAAC,iBAAiB,CACzB,kCAAkC,EAClC,oBAAoB,CACvB,CAAC;YACN,CAAC;YAED,sCAAsC;YACtC,MAAM,MAAM,GAAY,MAAM,MAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YAE9C,OAAO,IAAI,CAAC,mBAAmB,CAAC;gBAC5B,SAAS,EAAE,cAAc;gBACzB,UAAU;gBACV,MAAM;aACT,CAAC,CAAC;QAEP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,iBAAiB,CACzB,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACvF,kBAAkB,CACrB,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AA9CY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAa,EAAC,oBAAU,EAAE,mCAAmC,CAAC;GAClD,kBAAkB,CA8C9B;AACD,SAAgB,sBAAsB;IAClC,wCAAwC;AAC5C,CAAC;AAFD,wDAEC"}
@@ -0,0 +1,108 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ /**
4
+ * Action that generates presentations using Gamma's Generations API
5
+ * Creates presentations, documents, or social media posts from text input
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Generate a basic presentation
10
+ * await runAction({
11
+ * ActionName: 'Gamma Generate Presentation',
12
+ * Params: [{
13
+ * Name: 'InputText',
14
+ * Value: 'Create a presentation about climate change impacts and solutions'
15
+ * }]
16
+ * });
17
+ *
18
+ * // Generate with specific format and options
19
+ * await runAction({
20
+ * ActionName: 'Gamma Generate Presentation',
21
+ * Params: [{
22
+ * Name: 'InputText',
23
+ * Value: 'Quarterly sales report with revenue trends and projections'
24
+ * }, {
25
+ * Name: 'Format',
26
+ * Value: 'presentation'
27
+ * }, {
28
+ * Name: 'TextMode',
29
+ * Value: 'generate'
30
+ * }, {
31
+ * Name: 'NumCards',
32
+ * Value: 10
33
+ * }, {
34
+ * Name: 'ThemeName',
35
+ * Value: 'Modern'
36
+ * }]
37
+ * });
38
+ *
39
+ * // Generate and export as PDF
40
+ * await runAction({
41
+ * ActionName: 'Gamma Generate Presentation',
42
+ * Params: [{
43
+ * Name: 'InputText',
44
+ * Value: 'Product launch announcement'
45
+ * }, {
46
+ * Name: 'ExportAs',
47
+ * Value: 'pdf'
48
+ * }]
49
+ * });
50
+ * ```
51
+ */
52
+ export declare class GammaGeneratePresentationAction extends BaseAction {
53
+ /**
54
+ * Executes the Gamma presentation generation
55
+ *
56
+ * @param params - The action parameters containing:
57
+ * - InputText: Text to generate content from (required, 1-750,000 characters)
58
+ * - Format: Output format - 'presentation' (default), 'document', 'social'
59
+ * - TextMode: How to process text - 'generate' (default), 'condense', 'preserve'
60
+ * - ThemeName: Visual theme name (optional)
61
+ * - NumCards: Number of slides/cards (1-75, depends on tier)
62
+ * - CardSplit: How to split cards - 'auto' (default) or 'inputTextBreaks'
63
+ * - AdditionalInstructions: Custom guidance for content generation (optional)
64
+ * - ExportAs: Export format - 'pdf' or 'pptx' (optional)
65
+ * - TextAmount: Amount of text - 'auto', 'minimal', 'moderate', 'detailed'
66
+ * - TextTone: Tone of text - 'auto', 'professional', 'casual', 'educational'
67
+ * - TextAudience: Target audience description (optional)
68
+ * - TextLanguage: Language for content (e.g., 'en', 'es', 'fr')
69
+ * - ImageSource: Image source - 'auto', 'web', 'ai', 'none'
70
+ * - ImageModel: AI image model - 'dall-e-3', 'sd-3-large', 'firefly-3'
71
+ * - ImageStyle: AI image style - 'auto', 'photographic', 'digital-art', 'illustration'
72
+ * - PollStatus: Poll for completion status (default: true)
73
+ * - PollInterval: Seconds between status checks (default: 5)
74
+ * - MaxPollTime: Maximum seconds to poll (default: 300)
75
+ *
76
+ * @returns Generation results with Gamma URL and status
77
+ */
78
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
79
+ /**
80
+ * Sleep helper for polling
81
+ */
82
+ private sleep;
83
+ /**
84
+ * Get string parameter value
85
+ */
86
+ private getStringParam;
87
+ /**
88
+ * Get boolean parameter value with default
89
+ */
90
+ private getBooleanParam;
91
+ /**
92
+ * Get numeric parameter value with optional default
93
+ */
94
+ private getNumericParam;
95
+ /**
96
+ * Add output parameter
97
+ */
98
+ private addOutputParam;
99
+ /**
100
+ * Create error result
101
+ */
102
+ private createErrorResult;
103
+ }
104
+ /**
105
+ * Loader function to ensure the GammaGeneratePresentationAction class is included in the bundle.
106
+ */
107
+ export declare function LoadGammaGeneratePresentationAction(): void;
108
+ //# sourceMappingURL=gamma-generate-presentation.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamma-generate-presentation.action.d.ts","sourceRoot":"","sources":["../../../src/custom/integration/gamma-generate-presentation.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBACa,+BAAgC,SAAQ,UAAU;IAE3D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+MvF;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAO5B;AAED;;GAEG;AACH,wBAAgB,mCAAmC,SAElD"}
@@ -0,0 +1,315 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LoadGammaGeneratePresentationAction = exports.GammaGeneratePresentationAction = void 0;
13
+ const actions_1 = require("@memberjunction/actions");
14
+ const global_1 = require("@memberjunction/global");
15
+ const axios_1 = __importDefault(require("axios"));
16
+ const config_1 = require("../../config");
17
+ /**
18
+ * Action that generates presentations using Gamma's Generations API
19
+ * Creates presentations, documents, or social media posts from text input
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Generate a basic presentation
24
+ * await runAction({
25
+ * ActionName: 'Gamma Generate Presentation',
26
+ * Params: [{
27
+ * Name: 'InputText',
28
+ * Value: 'Create a presentation about climate change impacts and solutions'
29
+ * }]
30
+ * });
31
+ *
32
+ * // Generate with specific format and options
33
+ * await runAction({
34
+ * ActionName: 'Gamma Generate Presentation',
35
+ * Params: [{
36
+ * Name: 'InputText',
37
+ * Value: 'Quarterly sales report with revenue trends and projections'
38
+ * }, {
39
+ * Name: 'Format',
40
+ * Value: 'presentation'
41
+ * }, {
42
+ * Name: 'TextMode',
43
+ * Value: 'generate'
44
+ * }, {
45
+ * Name: 'NumCards',
46
+ * Value: 10
47
+ * }, {
48
+ * Name: 'ThemeName',
49
+ * Value: 'Modern'
50
+ * }]
51
+ * });
52
+ *
53
+ * // Generate and export as PDF
54
+ * await runAction({
55
+ * ActionName: 'Gamma Generate Presentation',
56
+ * Params: [{
57
+ * Name: 'InputText',
58
+ * Value: 'Product launch announcement'
59
+ * }, {
60
+ * Name: 'ExportAs',
61
+ * Value: 'pdf'
62
+ * }]
63
+ * });
64
+ * ```
65
+ */
66
+ let GammaGeneratePresentationAction = class GammaGeneratePresentationAction extends actions_1.BaseAction {
67
+ /**
68
+ * Executes the Gamma presentation generation
69
+ *
70
+ * @param params - The action parameters containing:
71
+ * - InputText: Text to generate content from (required, 1-750,000 characters)
72
+ * - Format: Output format - 'presentation' (default), 'document', 'social'
73
+ * - TextMode: How to process text - 'generate' (default), 'condense', 'preserve'
74
+ * - ThemeName: Visual theme name (optional)
75
+ * - NumCards: Number of slides/cards (1-75, depends on tier)
76
+ * - CardSplit: How to split cards - 'auto' (default) or 'inputTextBreaks'
77
+ * - AdditionalInstructions: Custom guidance for content generation (optional)
78
+ * - ExportAs: Export format - 'pdf' or 'pptx' (optional)
79
+ * - TextAmount: Amount of text - 'auto', 'minimal', 'moderate', 'detailed'
80
+ * - TextTone: Tone of text - 'auto', 'professional', 'casual', 'educational'
81
+ * - TextAudience: Target audience description (optional)
82
+ * - TextLanguage: Language for content (e.g., 'en', 'es', 'fr')
83
+ * - ImageSource: Image source - 'auto', 'web', 'ai', 'none'
84
+ * - ImageModel: AI image model - 'dall-e-3', 'sd-3-large', 'firefly-3'
85
+ * - ImageStyle: AI image style - 'auto', 'photographic', 'digital-art', 'illustration'
86
+ * - PollStatus: Poll for completion status (default: true)
87
+ * - PollInterval: Seconds between status checks (default: 5)
88
+ * - MaxPollTime: Maximum seconds to poll (default: 300)
89
+ *
90
+ * @returns Generation results with Gamma URL and status
91
+ */
92
+ async InternalRunAction(params) {
93
+ try {
94
+ // Get required parameters
95
+ const inputText = this.getStringParam(params, 'inputtext');
96
+ if (!inputText) {
97
+ return this.createErrorResult("InputText parameter is required", "MISSING_INPUT_TEXT");
98
+ }
99
+ if (inputText.length < 1 || inputText.length > 750000) {
100
+ return this.createErrorResult("InputText must be between 1 and 750,000 characters", "INVALID_INPUT_TEXT_LENGTH");
101
+ }
102
+ // Get API key from config
103
+ const apiConfig = (0, config_1.getApiIntegrationsConfig)();
104
+ const apiKey = apiConfig.gammaApiKey;
105
+ if (!apiKey) {
106
+ return this.createErrorResult("Gamma API key not found. Set gammaApiKey in mj.config.cjs or GAMMA_API_KEY environment variable", "MISSING_API_KEY");
107
+ }
108
+ // Get optional parameters
109
+ const format = this.getStringParam(params, 'format') || 'presentation';
110
+ const textMode = this.getStringParam(params, 'textmode') || 'generate';
111
+ const themeName = this.getStringParam(params, 'themename');
112
+ const numCards = this.getNumericParam(params, 'numcards');
113
+ const cardSplit = this.getStringParam(params, 'cardsplit') || 'auto';
114
+ const additionalInstructions = this.getStringParam(params, 'additionalinstructions');
115
+ const exportAs = this.getStringParam(params, 'exportas');
116
+ // Text options
117
+ const textAmount = this.getStringParam(params, 'textamount');
118
+ const textTone = this.getStringParam(params, 'texttone');
119
+ const textAudience = this.getStringParam(params, 'textaudience');
120
+ const textLanguage = this.getStringParam(params, 'textlanguage');
121
+ // Image options
122
+ const imageSource = this.getStringParam(params, 'imagesource');
123
+ const imageModel = this.getStringParam(params, 'imagemodel');
124
+ const imageStyle = this.getStringParam(params, 'imagestyle');
125
+ // Polling options
126
+ const pollStatus = this.getBooleanParam(params, 'pollstatus', true);
127
+ const pollInterval = this.getNumericParam(params, 'pollinterval', 5);
128
+ const maxPollTime = this.getNumericParam(params, 'maxpolltime', 300);
129
+ // Build request body
130
+ const requestBody = {
131
+ inputText,
132
+ format,
133
+ textMode,
134
+ cardSplit
135
+ };
136
+ // Add optional top-level parameters
137
+ if (themeName)
138
+ requestBody.themeName = themeName;
139
+ if (numCards)
140
+ requestBody.numCards = numCards;
141
+ if (additionalInstructions)
142
+ requestBody.additionalInstructions = additionalInstructions;
143
+ if (exportAs)
144
+ requestBody.exportAs = exportAs;
145
+ // Build text options
146
+ const textOptions = {};
147
+ if (textAmount)
148
+ textOptions.amount = textAmount;
149
+ if (textTone)
150
+ textOptions.tone = textTone;
151
+ if (textAudience)
152
+ textOptions.audience = textAudience;
153
+ if (textLanguage)
154
+ textOptions.language = textLanguage;
155
+ if (Object.keys(textOptions).length > 0) {
156
+ requestBody.textOptions = textOptions;
157
+ }
158
+ // Build image options
159
+ const imageOptions = {};
160
+ if (imageSource)
161
+ imageOptions.source = imageSource;
162
+ if (imageModel)
163
+ imageOptions.model = imageModel;
164
+ if (imageStyle)
165
+ imageOptions.style = imageStyle;
166
+ if (Object.keys(imageOptions).length > 0) {
167
+ requestBody.imageOptions = imageOptions;
168
+ }
169
+ // Make API request to start generation
170
+ const response = await axios_1.default.post('https://public-api.gamma.app/v0.2/generations', requestBody, {
171
+ headers: {
172
+ 'X-API-KEY': apiKey,
173
+ 'Content-Type': 'application/json'
174
+ },
175
+ timeout: 60000 // 60 second timeout
176
+ });
177
+ if (!response.data || !response.data.generationId) {
178
+ return this.createErrorResult("Invalid response from Gamma API", "INVALID_RESPONSE");
179
+ }
180
+ const generationId = response.data.generationId;
181
+ this.addOutputParam(params, 'GenerationId', generationId);
182
+ // If polling is disabled, return immediately
183
+ if (!pollStatus) {
184
+ return {
185
+ Success: true,
186
+ ResultCode: "GENERATION_STARTED",
187
+ Message: JSON.stringify({
188
+ generationId,
189
+ status: 'pending',
190
+ message: 'Generation started. Use the generationId to check status.'
191
+ }, null, 2)
192
+ };
193
+ }
194
+ // Poll for completion
195
+ const startTime = Date.now();
196
+ const pollIntervalMs = pollInterval * 1000;
197
+ const maxPollTimeMs = maxPollTime * 1000;
198
+ while (Date.now() - startTime < maxPollTimeMs) {
199
+ await this.sleep(pollIntervalMs);
200
+ const statusResponse = await axios_1.default.get(`https://public-api.gamma.app/v0.2/generations/${generationId}`, {
201
+ headers: {
202
+ 'X-API-KEY': apiKey
203
+ },
204
+ timeout: 30000
205
+ });
206
+ const statusData = statusResponse.data;
207
+ if (statusData.status === 'completed') {
208
+ // Add output parameters
209
+ this.addOutputParam(params, 'GammaUrl', statusData.gammaUrl);
210
+ this.addOutputParam(params, 'Status', 'completed');
211
+ this.addOutputParam(params, 'Credits', statusData.credits);
212
+ return {
213
+ Success: true,
214
+ ResultCode: "SUCCESS",
215
+ Message: JSON.stringify({
216
+ generationId,
217
+ status: 'completed',
218
+ gammaUrl: statusData.gammaUrl,
219
+ credits: statusData.credits
220
+ }, null, 2)
221
+ };
222
+ }
223
+ else if (statusData.status === 'failed') {
224
+ return this.createErrorResult(`Generation failed: ${statusData.error || 'Unknown error'}`, "GENERATION_FAILED");
225
+ }
226
+ // Status is still 'pending', continue polling
227
+ }
228
+ // Timeout reached
229
+ return this.createErrorResult(`Generation timed out after ${maxPollTime} seconds. Use GenerationId to check status later.`, "GENERATION_TIMEOUT");
230
+ }
231
+ catch (error) {
232
+ if (axios_1.default.isAxiosError(error)) {
233
+ const status = error.response?.status;
234
+ const errorData = error.response?.data;
235
+ if (status === 401) {
236
+ return this.createErrorResult("Invalid Gamma API key. Verify your API key is correct and has proper permissions.", "INVALID_API_KEY");
237
+ }
238
+ if (status === 429) {
239
+ return this.createErrorResult("Gamma API rate limit exceeded (50 presentations per day during beta)", "RATE_LIMITED");
240
+ }
241
+ if (status === 400) {
242
+ return this.createErrorResult(`Invalid request parameters: ${errorData?.error || error.message}`, "INVALID_PARAMETERS");
243
+ }
244
+ return this.createErrorResult(`Gamma API error: ${errorData?.error || error.message}`, "API_ERROR");
245
+ }
246
+ return this.createErrorResult(`Failed to generate presentation: ${error instanceof Error ? error.message : String(error)}`, "GENERATION_FAILED");
247
+ }
248
+ }
249
+ /**
250
+ * Sleep helper for polling
251
+ */
252
+ sleep(ms) {
253
+ return new Promise(resolve => setTimeout(resolve, ms));
254
+ }
255
+ /**
256
+ * Get string parameter value
257
+ */
258
+ getStringParam(params, paramName) {
259
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
260
+ if (param?.Value === undefined || param?.Value === null)
261
+ return undefined;
262
+ return String(param.Value);
263
+ }
264
+ /**
265
+ * Get boolean parameter value with default
266
+ */
267
+ getBooleanParam(params, paramName, defaultValue = false) {
268
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
269
+ if (param?.Value === undefined || param?.Value === null)
270
+ return defaultValue;
271
+ return String(param.Value).toLowerCase() === 'true';
272
+ }
273
+ /**
274
+ * Get numeric parameter value with optional default
275
+ */
276
+ getNumericParam(params, paramName, defaultValue) {
277
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
278
+ if (param?.Value === undefined || param?.Value === null)
279
+ return defaultValue;
280
+ const num = Number(param.Value);
281
+ return isNaN(num) ? defaultValue : num;
282
+ }
283
+ /**
284
+ * Add output parameter
285
+ */
286
+ addOutputParam(params, name, value) {
287
+ params.Params.push({
288
+ Name: name,
289
+ Type: 'Output',
290
+ Value: value
291
+ });
292
+ }
293
+ /**
294
+ * Create error result
295
+ */
296
+ createErrorResult(message, code) {
297
+ return {
298
+ Success: false,
299
+ Message: message,
300
+ ResultCode: code
301
+ };
302
+ }
303
+ };
304
+ exports.GammaGeneratePresentationAction = GammaGeneratePresentationAction;
305
+ exports.GammaGeneratePresentationAction = GammaGeneratePresentationAction = __decorate([
306
+ (0, global_1.RegisterClass)(actions_1.BaseAction, "Gamma Generate Presentation")
307
+ ], GammaGeneratePresentationAction);
308
+ /**
309
+ * Loader function to ensure the GammaGeneratePresentationAction class is included in the bundle.
310
+ */
311
+ function LoadGammaGeneratePresentationAction() {
312
+ // this function is a stub that is used to force the bundler to include the above class in the final bundle and not tree shake them out
313
+ }
314
+ exports.LoadGammaGeneratePresentationAction = LoadGammaGeneratePresentationAction;
315
+ //# sourceMappingURL=gamma-generate-presentation.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamma-generate-presentation.action.js","sourceRoot":"","sources":["../../../src/custom/integration/gamma-generate-presentation.action.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAAqD;AACrD,mDAAuD;AACvD,kDAA0B;AAC1B,yCAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEI,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,oBAAU;IAE3D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,0BAA0B;YAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAC3D,IAAI,CAAC,SAAS,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC,iBAAiB,CAAC,iCAAiC,EAAE,oBAAoB,CAAC,CAAC;YAC3F,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpD,OAAO,IAAI,CAAC,iBAAiB,CACzB,oDAAoD,EACpD,2BAA2B,CAC9B,CAAC;YACN,CAAC;YAED,0BAA0B;YAC1B,MAAM,SAAS,GAAG,IAAA,iCAAwB,GAAE,CAAC;YAC7C,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC;YACrC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC,iBAAiB,CACzB,iGAAiG,EACjG,iBAAiB,CACpB,CAAC;YACN,CAAC;YAED,0BAA0B;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,c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AAC;IAED;;OAEG;IACK,cAAc,CAAC,MAAuB,EAAE,IAAY,EAAE,KAAc;QACxE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK;SACf,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,OAAe,EAAE,IAAY;QACnD,OAAO;YACH,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,IAAI;SACnB,CAAC;IACN,CAAC;CACJ,CAAA;AAlSY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,sBAAa,EAAC,oBAAU,EAAE,6BAA6B,CAAC;GAC5C,+BAA+B,CAkS3C;AAED;;GAEG;AACH,SAAgB,mCAAmC;IAC/C,uIAAuI;AAC3I,CAAC;AAFD,kFAEC"}
@@ -0,0 +1,98 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ /**
4
+ * Action that performs AI-powered web search using Perplexity's Search API
5
+ * Returns comprehensive search results with citations and related questions
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Basic search with Perplexity
10
+ * await runAction({
11
+ * ActionName: 'Perplexity Search',
12
+ * Params: [{
13
+ * Name: 'Query',
14
+ * Value: 'latest developments in quantum computing'
15
+ * }]
16
+ * });
17
+ *
18
+ * // Search with specific model and parameters
19
+ * await runAction({
20
+ * ActionName: 'Perplexity Search',
21
+ * Params: [{
22
+ * Name: 'Query',
23
+ * Value: 'climate change research papers 2024'
24
+ * }, {
25
+ * Name: 'Model',
26
+ * Value: 'llama-3.1-sonar-large-128k-online'
27
+ * }, {
28
+ * Name: 'ReturnRelatedQuestions',
29
+ * Value: true
30
+ * }, {
31
+ * Name: 'ReturnImages',
32
+ * Value: true
33
+ * }]
34
+ * });
35
+ *
36
+ * // Search with domain filtering
37
+ * await runAction({
38
+ * ActionName: 'Perplexity Search',
39
+ * Params: [{
40
+ * Name: 'Query',
41
+ * Value: 'machine learning tutorials'
42
+ * }, {
43
+ * Name: 'SearchDomainFilter',
44
+ * Value: ['github.com', 'arxiv.org', 'medium.com']
45
+ * }]
46
+ * });
47
+ * ```
48
+ */
49
+ export declare class PerplexitySearchAction extends BaseAction {
50
+ /**
51
+ * Executes the Perplexity AI search
52
+ *
53
+ * @param params - The action parameters containing:
54
+ * - Query: Search query text (required)
55
+ * - Model: Perplexity model to use (default: 'llama-3.1-sonar-small-128k-online')
56
+ * Options: llama-3.1-sonar-small-128k-online, llama-3.1-sonar-large-128k-online,
57
+ * llama-3.1-sonar-huge-128k-online
58
+ * - MaxTokens: Maximum tokens in response (default: 1000)
59
+ * - Temperature: Sampling temperature 0-2 (default: 0.2)
60
+ * - TopP: Nucleus sampling threshold (default: 0.9)
61
+ * - ReturnImages: Include images in results (default: false)
62
+ * - ReturnRelatedQuestions: Include related questions (default: false)
63
+ * - SearchDomainFilter: Array of domains to limit/exclude search (use '-' prefix to exclude)
64
+ * - SearchRecencyFilter: Filter by recency - 'day', 'week', 'month', 'year' (optional)
65
+ *
66
+ * @returns Search results with content, citations, and related questions
67
+ */
68
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
69
+ /**
70
+ * Get string parameter value
71
+ */
72
+ private getStringParam;
73
+ /**
74
+ * Get parameter value (any type)
75
+ */
76
+ private getParamValue;
77
+ /**
78
+ * Get boolean parameter value with default
79
+ */
80
+ private getBooleanParam;
81
+ /**
82
+ * Get numeric parameter value with default
83
+ */
84
+ private getNumericParam;
85
+ /**
86
+ * Add output parameter
87
+ */
88
+ private addOutputParam;
89
+ /**
90
+ * Create error result
91
+ */
92
+ private createErrorResult;
93
+ }
94
+ /**
95
+ * Loader function to ensure the PerplexitySearchAction class is included in the bundle.
96
+ */
97
+ export declare function LoadPerplexitySearchAction(): void;
98
+ //# sourceMappingURL=perplexity-search.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perplexity-search.action.d.ts","sourceRoot":"","sources":["../../../src/custom/web/perplexity-search.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IAElD;;;;;;;;;;;;;;;;;OAiBG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6JvF;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAKrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAO5B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,SAEzC"}