@memberjunction/core-actions 2.102.0 → 2.104.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 +18 -12
@@ -0,0 +1,82 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Configuration schema for external API integrations used by Core Actions
4
+ */
5
+ declare const apiIntegrationsSchema: z.ZodObject<{
6
+ /**
7
+ * Perplexity AI API Key for AI-powered web search
8
+ * Used by: Perplexity Search action
9
+ * Get your API key from: https://www.perplexity.ai/settings/api
10
+ */
11
+ perplexityApiKey: z.ZodOptional<z.ZodString>;
12
+ /**
13
+ * Gamma API Key for presentation generation
14
+ * Used by: Gamma Generate Presentation action
15
+ * Get your API key from: https://gamma.app/settings (requires Pro or higher account)
16
+ * API keys follow format: sk-gamma-xxxxxxxx
17
+ */
18
+ gammaApiKey: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ perplexityApiKey?: string;
21
+ gammaApiKey?: string;
22
+ }, {
23
+ perplexityApiKey?: string;
24
+ gammaApiKey?: string;
25
+ }>;
26
+ /**
27
+ * Complete configuration schema for Core Actions package
28
+ */
29
+ declare const coreActionsConfigSchema: z.ZodObject<{
30
+ /**
31
+ * API integrations configuration for external services
32
+ */
33
+ apiIntegrations: z.ZodDefault<z.ZodOptional<z.ZodObject<{
34
+ /**
35
+ * Perplexity AI API Key for AI-powered web search
36
+ * Used by: Perplexity Search action
37
+ * Get your API key from: https://www.perplexity.ai/settings/api
38
+ */
39
+ perplexityApiKey: z.ZodOptional<z.ZodString>;
40
+ /**
41
+ * Gamma API Key for presentation generation
42
+ * Used by: Gamma Generate Presentation action
43
+ * Get your API key from: https://gamma.app/settings (requires Pro or higher account)
44
+ * API keys follow format: sk-gamma-xxxxxxxx
45
+ */
46
+ gammaApiKey: z.ZodOptional<z.ZodString>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ perplexityApiKey?: string;
49
+ gammaApiKey?: string;
50
+ }, {
51
+ perplexityApiKey?: string;
52
+ gammaApiKey?: string;
53
+ }>>>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ apiIntegrations?: {
56
+ perplexityApiKey?: string;
57
+ gammaApiKey?: string;
58
+ };
59
+ }, {
60
+ apiIntegrations?: {
61
+ perplexityApiKey?: string;
62
+ gammaApiKey?: string;
63
+ };
64
+ }>;
65
+ export type CoreActionsConfig = z.infer<typeof coreActionsConfigSchema>;
66
+ export type ApiIntegrationsConfig = z.infer<typeof apiIntegrationsSchema>;
67
+ /**
68
+ * Gets the Core Actions configuration, loading it from mj.config.cjs if not already loaded
69
+ * @returns The Core Actions configuration object
70
+ */
71
+ export declare function getCoreActionsConfig(): CoreActionsConfig;
72
+ /**
73
+ * Gets the API integrations configuration
74
+ * @returns The API integrations configuration object
75
+ */
76
+ export declare function getApiIntegrationsConfig(): ApiIntegrationsConfig;
77
+ /**
78
+ * Clears the cached configuration (useful for testing)
79
+ */
80
+ export declare function clearCoreActionsConfig(): void;
81
+ export {};
82
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,QAAA,MAAM,qBAAqB;IACzB;;;;OAIG;;IAGH;;;;;OAKG;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,uBAAuB;IAC3B;;OAEG;;QAtBH;;;;WAIG;;QAGH;;;;;WAKG;;;;;;;;;;;;;;;;;;;EAYH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAI1E;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CA2BxD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CAGhE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
package/dist/config.js ADDED
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearCoreActionsConfig = exports.getApiIntegrationsConfig = exports.getCoreActionsConfig = void 0;
4
+ const zod_1 = require("zod");
5
+ const cosmiconfig_1 = require("cosmiconfig");
6
+ const core_1 = require("@memberjunction/core");
7
+ const explorer = (0, cosmiconfig_1.cosmiconfigSync)('mj', { searchStrategy: 'global' });
8
+ /**
9
+ * Configuration schema for external API integrations used by Core Actions
10
+ */
11
+ const apiIntegrationsSchema = zod_1.z.object({
12
+ /**
13
+ * Perplexity AI API Key for AI-powered web search
14
+ * Used by: Perplexity Search action
15
+ * Get your API key from: https://www.perplexity.ai/settings/api
16
+ */
17
+ perplexityApiKey: zod_1.z.string().optional(),
18
+ /**
19
+ * Gamma API Key for presentation generation
20
+ * Used by: Gamma Generate Presentation action
21
+ * Get your API key from: https://gamma.app/settings (requires Pro or higher account)
22
+ * API keys follow format: sk-gamma-xxxxxxxx
23
+ */
24
+ gammaApiKey: zod_1.z.string().optional(),
25
+ });
26
+ /**
27
+ * Complete configuration schema for Core Actions package
28
+ */
29
+ const coreActionsConfigSchema = zod_1.z.object({
30
+ /**
31
+ * API integrations configuration for external services
32
+ */
33
+ apiIntegrations: apiIntegrationsSchema.optional().default({}),
34
+ });
35
+ let _config = null;
36
+ /**
37
+ * Gets the Core Actions configuration, loading it from mj.config.cjs if not already loaded
38
+ * @returns The Core Actions configuration object
39
+ */
40
+ function getCoreActionsConfig() {
41
+ if (_config) {
42
+ return _config;
43
+ }
44
+ try {
45
+ const result = explorer.search();
46
+ if (!result || result.isEmpty) {
47
+ (0, core_1.LogStatus)('No mj.config.cjs found, using default Core Actions configuration');
48
+ _config = coreActionsConfigSchema.parse({});
49
+ return _config;
50
+ }
51
+ // Extract only the fields relevant to Core Actions
52
+ const rawConfig = {
53
+ apiIntegrations: {
54
+ perplexityApiKey: result.config.perplexityApiKey || process.env.PERPLEXITY_API_KEY,
55
+ gammaApiKey: result.config.gammaApiKey || process.env.GAMMA_API_KEY,
56
+ },
57
+ };
58
+ _config = coreActionsConfigSchema.parse(rawConfig);
59
+ return _config;
60
+ }
61
+ catch (error) {
62
+ (0, core_1.LogError)('Error loading Core Actions configuration', undefined, error);
63
+ throw error;
64
+ }
65
+ }
66
+ exports.getCoreActionsConfig = getCoreActionsConfig;
67
+ /**
68
+ * Gets the API integrations configuration
69
+ * @returns The API integrations configuration object
70
+ */
71
+ function getApiIntegrationsConfig() {
72
+ const config = getCoreActionsConfig();
73
+ return config.apiIntegrations;
74
+ }
75
+ exports.getApiIntegrationsConfig = getApiIntegrationsConfig;
76
+ /**
77
+ * Clears the cached configuration (useful for testing)
78
+ */
79
+ function clearCoreActionsConfig() {
80
+ _config = null;
81
+ }
82
+ exports.clearCoreActionsConfig = clearCoreActionsConfig;
83
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,6CAA8C;AAC9C,+CAA2D;AAE3D,MAAM,QAAQ,GAAG,IAAA,6BAAe,EAAC,IAAI,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC;;;;OAIG;IACH,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,Q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AAwB;IACtC,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,OAAO,MAAM,CAAC,eAAe,CAAC;AAChC,CAAC;AAHD,4DAGC;AAED;;GAEG;AACH,SAAgB,sBAAsB;IACpC,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAFD,wDAEC"}
@@ -0,0 +1,70 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ import { UserInfo } from "@memberjunction/core";
4
+ import { FileStorageProviderEntity } from "@memberjunction/core-entities";
5
+ import { FileStorageBase } from "@memberjunction/storage";
6
+ /**
7
+ * Abstract base class for file storage operations.
8
+ * Provides shared functionality for all file storage action implementations:
9
+ * - Storage provider lookup and initialization
10
+ * - Parameter extraction helpers
11
+ * - Result creation utilities
12
+ * - Error handling patterns
13
+ */
14
+ export declare abstract class BaseFileStorageAction extends BaseAction {
15
+ /**
16
+ * Get storage provider entity by name
17
+ * @param providerName - Name of the storage provider
18
+ * @param contextUser - User context for the operation
19
+ * @returns FileStorageProviderEntity or null if not found
20
+ */
21
+ protected getStorageProvider(providerName: string, contextUser: UserInfo): Promise<FileStorageProviderEntity | null>;
22
+ /**
23
+ * Initialize storage driver from provider entity
24
+ * @param provider - FileStorageProviderEntity to initialize
25
+ * @returns Initialized FileStorageBase driver
26
+ */
27
+ protected initializeDriver(provider: FileStorageProviderEntity): Promise<FileStorageBase>;
28
+ /**
29
+ * Get storage provider and initialize driver in one step
30
+ * @param params - Action parameters containing StorageProvider
31
+ * @returns Initialized driver and result if error occurred
32
+ */
33
+ protected getDriverFromParams(params: RunActionParams): Promise<{
34
+ driver?: FileStorageBase;
35
+ error?: ActionResultSimple;
36
+ }>;
37
+ /**
38
+ * Helper to add output parameter
39
+ */
40
+ protected addOutputParam(params: RunActionParams, name: string, value: unknown): void;
41
+ /**
42
+ * Helper to create success result
43
+ */
44
+ protected createSuccessResult(data: Record<string, unknown>): ActionResultSimple;
45
+ /**
46
+ * Helper to create error result
47
+ */
48
+ protected createErrorResult(message: string, code: string): ActionResultSimple;
49
+ /**
50
+ * Extract parameter value by name (case-insensitive)
51
+ */
52
+ protected getParamValue(params: RunActionParams, paramName: string): string | undefined;
53
+ /**
54
+ * Get string parameter value (guaranteed to be string or undefined)
55
+ */
56
+ protected getStringParam(params: RunActionParams, paramName: string): string | undefined;
57
+ /**
58
+ * Get string parameter value with default
59
+ */
60
+ protected getStringParamWithDefault(params: RunActionParams, paramName: string, defaultValue: string): string;
61
+ /**
62
+ * Get boolean parameter value with default
63
+ */
64
+ protected getBooleanParam(params: RunActionParams, paramName: string, defaultValue?: boolean): boolean;
65
+ /**
66
+ * Get numeric parameter value with default
67
+ */
68
+ protected getNumericParam(params: RunActionParams, paramName: string, defaultValue?: number): number;
69
+ }
70
+ //# sourceMappingURL=base-file-storage.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-file-storage.action.d.ts","sourceRoot":"","sources":["../../../src/custom/files/base-file-storage.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;;;;;;GAOG;AACH,8BAAsB,qBAAsB,SAAQ,UAAU;IAE1D;;;;;OAKG;cACa,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAe1H;;;;OAIG;cACa,gBAAgB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;IAY/F;;;;OAIG;cACa,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC;IAoB/H;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAQrF;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB;IAQhF;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB;IAQ9E;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKvF;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAMxF;;OAEG;IACH,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAI7G;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,OAAO;IAM7G;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM;CAM1G"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseFileStorageAction = void 0;
4
+ const actions_1 = require("@memberjunction/actions");
5
+ const core_1 = require("@memberjunction/core");
6
+ const storage_1 = require("@memberjunction/storage");
7
+ const global_1 = require("@memberjunction/global");
8
+ /**
9
+ * Abstract base class for file storage operations.
10
+ * Provides shared functionality for all file storage action implementations:
11
+ * - Storage provider lookup and initialization
12
+ * - Parameter extraction helpers
13
+ * - Result creation utilities
14
+ * - Error handling patterns
15
+ */
16
+ class BaseFileStorageAction extends actions_1.BaseAction {
17
+ /**
18
+ * Get storage provider entity by name
19
+ * @param providerName - Name of the storage provider
20
+ * @param contextUser - User context for the operation
21
+ * @returns FileStorageProviderEntity or null if not found
22
+ */
23
+ async getStorageProvider(providerName, contextUser) {
24
+ const rv = new core_1.RunView();
25
+ const result = await rv.RunView({
26
+ EntityName: 'File Storage Providers',
27
+ ExtraFilter: `Name='${providerName.replace(/'/g, "''")}'`,
28
+ ResultType: 'entity_object'
29
+ }, contextUser);
30
+ if (result.Success && result.Results && result.Results.length > 0) {
31
+ return result.Results[0];
32
+ }
33
+ return null;
34
+ }
35
+ /**
36
+ * Initialize storage driver from provider entity
37
+ * @param provider - FileStorageProviderEntity to initialize
38
+ * @returns Initialized FileStorageBase driver
39
+ */
40
+ async initializeDriver(provider) {
41
+ const driver = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(storage_1.FileStorageBase, provider.ServerDriverKey);
42
+ // Initialize the driver if it has an initialize method
43
+ await driver.initialize();
44
+ return driver;
45
+ }
46
+ /**
47
+ * Get storage provider and initialize driver in one step
48
+ * @param params - Action parameters containing StorageProvider
49
+ * @returns Initialized driver and result if error occurred
50
+ */
51
+ async getDriverFromParams(params) {
52
+ const providerName = this.getStringParam(params, 'storageprovider');
53
+ if (!providerName) {
54
+ return {
55
+ error: this.createErrorResult("StorageProvider parameter is required", "MISSING_PROVIDER")
56
+ };
57
+ }
58
+ const provider = await this.getStorageProvider(providerName, params.ContextUser);
59
+ if (!provider) {
60
+ return {
61
+ error: this.createErrorResult(`Storage provider '${providerName}' not found`, "PROVIDER_NOT_FOUND")
62
+ };
63
+ }
64
+ const driver = await this.initializeDriver(provider);
65
+ return { driver };
66
+ }
67
+ /**
68
+ * Helper to add output parameter
69
+ */
70
+ addOutputParam(params, name, value) {
71
+ params.Params.push({
72
+ Name: name,
73
+ Type: 'Output',
74
+ Value: value
75
+ });
76
+ }
77
+ /**
78
+ * Helper to create success result
79
+ */
80
+ createSuccessResult(data) {
81
+ return {
82
+ Success: true,
83
+ ResultCode: "SUCCESS",
84
+ Message: JSON.stringify(data, null, 2)
85
+ };
86
+ }
87
+ /**
88
+ * Helper to create error result
89
+ */
90
+ createErrorResult(message, code) {
91
+ return {
92
+ Success: false,
93
+ Message: message,
94
+ ResultCode: code
95
+ };
96
+ }
97
+ /**
98
+ * Extract parameter value by name (case-insensitive)
99
+ */
100
+ getParamValue(params, paramName) {
101
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
102
+ return param?.Value;
103
+ }
104
+ /**
105
+ * Get string parameter value (guaranteed to be string or undefined)
106
+ */
107
+ getStringParam(params, paramName) {
108
+ const value = this.getParamValue(params, paramName);
109
+ if (value === undefined || value === null)
110
+ return undefined;
111
+ return String(value);
112
+ }
113
+ /**
114
+ * Get string parameter value with default
115
+ */
116
+ getStringParamWithDefault(params, paramName, defaultValue) {
117
+ return this.getStringParam(params, paramName) ?? defaultValue;
118
+ }
119
+ /**
120
+ * Get boolean parameter value with default
121
+ */
122
+ getBooleanParam(params, paramName, defaultValue = false) {
123
+ const value = this.getParamValue(params, paramName);
124
+ if (value === undefined || value === null)
125
+ return defaultValue;
126
+ return String(value).toLowerCase() === 'true';
127
+ }
128
+ /**
129
+ * Get numeric parameter value with default
130
+ */
131
+ getNumericParam(params, paramName, defaultValue = 0) {
132
+ const value = this.getParamValue(params, paramName);
133
+ if (value === undefined || value === null)
134
+ return defaultValue;
135
+ const num = Number(value);
136
+ return isNaN(num) ? defaultValue : num;
137
+ }
138
+ }
139
+ exports.BaseFileStorageAction = BaseFileStorageAction;
140
+ //# sourceMappingURL=base-file-storage.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-file-storage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
+ import { BaseFileStorageAction } from "./base-file-storage.action";
3
+ /**
4
+ * Action for copying a file object within a storage provider.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * await runAction({
9
+ * ActionName: 'Copy Storage Object',
10
+ * Params: [{
11
+ * Name: 'StorageProvider',
12
+ * Value: 'Azure Blob Storage'
13
+ * }, {
14
+ * Name: 'SourceObjectName',
15
+ * Value: 'drafts/document.pdf'
16
+ * }, {
17
+ * Name: 'DestinationObjectName',
18
+ * Value: 'archive/document.pdf'
19
+ * }]
20
+ * });
21
+ * ```
22
+ */
23
+ export declare class CopyObjectAction extends BaseFileStorageAction {
24
+ /**
25
+ * Copy a file object
26
+ *
27
+ * @param params - The action parameters:
28
+ * - StorageProvider: Required - Name of the storage provider
29
+ * - SourceObjectName: Required - Source file path
30
+ * - DestinationObjectName: Required - Destination file path
31
+ *
32
+ * @returns Operation result with:
33
+ * - Success: Boolean indicating if the copy succeeded
34
+ */
35
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
36
+ }
37
+ export declare function LoadCopyObjectAction(): void;
38
+ //# sourceMappingURL=copy-object.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-object.action.d.ts","sourceRoot":"","sources":["../../../src/custom/files/copy-object.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,gBAAiB,SAAQ,qBAAqB;IAEvD;;;;;;;;;;OAUG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2C1F;AACD,wBAAgB,oBAAoB,SAEnC"}
@@ -0,0 +1,84 @@
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.LoadCopyObjectAction = exports.CopyObjectAction = 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 copying a file object within a storage provider.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * await runAction({
19
+ * ActionName: 'Copy Storage Object',
20
+ * Params: [{
21
+ * Name: 'StorageProvider',
22
+ * Value: 'Azure Blob Storage'
23
+ * }, {
24
+ * Name: 'SourceObjectName',
25
+ * Value: 'drafts/document.pdf'
26
+ * }, {
27
+ * Name: 'DestinationObjectName',
28
+ * Value: 'archive/document.pdf'
29
+ * }]
30
+ * });
31
+ * ```
32
+ */
33
+ let CopyObjectAction = class CopyObjectAction extends base_file_storage_action_1.BaseFileStorageAction {
34
+ /**
35
+ * Copy a file object
36
+ *
37
+ * @param params - The action parameters:
38
+ * - StorageProvider: Required - Name of the storage provider
39
+ * - SourceObjectName: Required - Source file path
40
+ * - DestinationObjectName: Required - Destination file path
41
+ *
42
+ * @returns Operation result with:
43
+ * - Success: Boolean indicating if the copy succeeded
44
+ */
45
+ async InternalRunAction(params) {
46
+ try {
47
+ // Get and initialize storage driver
48
+ const { driver, error } = await this.getDriverFromParams(params);
49
+ if (error)
50
+ return error;
51
+ // Get required parameters
52
+ const sourceObjectName = this.getStringParam(params, 'sourceobjectname');
53
+ if (!sourceObjectName) {
54
+ return this.createErrorResult("SourceObjectName parameter is required", "MISSING_SOURCE");
55
+ }
56
+ const destinationObjectName = this.getStringParam(params, 'destinationobjectname');
57
+ if (!destinationObjectName) {
58
+ return this.createErrorResult("DestinationObjectName parameter is required", "MISSING_DESTINATION");
59
+ }
60
+ // Execute the copy operation
61
+ const success = await driver.CopyObject(sourceObjectName, destinationObjectName);
62
+ // Add output parameter
63
+ this.addOutputParam(params, 'Success', success);
64
+ return this.createSuccessResult({
65
+ operation: 'CopyObject',
66
+ sourceObjectName,
67
+ destinationObjectName,
68
+ success
69
+ });
70
+ }
71
+ catch (error) {
72
+ return this.createErrorResult(`Copy object operation failed: ${error instanceof Error ? error.message : String(error)}`, "OPERATION_FAILED");
73
+ }
74
+ }
75
+ };
76
+ exports.CopyObjectAction = CopyObjectAction;
77
+ exports.CopyObjectAction = CopyObjectAction = __decorate([
78
+ (0, global_1.RegisterClass)(actions_1.BaseAction, "File Storage: Copy Object")
79
+ ], CopyObjectAction);
80
+ function LoadCopyObjectAction() {
81
+ // Stub function to prevent tree shaking
82
+ }
83
+ exports.LoadCopyObjectAction = LoadCopyObjectAction;
84
+ //# sourceMappingURL=copy-object.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-object.action.js","sourceRoot":"","sources":["../../../src/custom/files/copy-object.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,yEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,gDAAqB;IAEvD;;;;;;;;;;OAUG;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,0BAA0B;YAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;YACzE,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC,iBAAiB,CACzB,wCAAwC,EACxC,gBAAgB,CACnB,CAAC;YACN,CAAC;YAED,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;YACnF,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC,iBAAiB,CACzB,6CAA6C,EAC7C,qBAAqB,CACxB,CAAC;YACN,CAAC;YAED,6BAA6B;YAC7B,MAAM,OAAO,GAAY,MAAM,MAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;YAE3F,uBAAuB;YACvB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAEhD,OAAO,IAAI,CAAC,mBAAmB,CAAC;gBAC5B,SAAS,EAAE,YAAY;gBACvB,gBAAgB;gBAChB,qBAAqB;gBACrB,OAAO;aACV,CAAC,CAAC;QAEP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,iBAAiB,CACzB,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACzF,kBAAkB,CACrB,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AAxDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAa,EAAC,oBAAU,EAAE,2BAA2B,CAAC;GAC1C,gBAAgB,CAwD5B;AACD,SAAgB,oBAAoB;IAChC,wCAAwC;AAC5C,CAAC;AAFD,oDAEC"}
@@ -0,0 +1,34 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseFileStorageAction } from "./base-file-storage.action";
3
+ /**
4
+ * Action for creating a directory in a storage provider.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * await runAction({
9
+ * ActionName: 'Create Storage Directory',
10
+ * Params: [{
11
+ * Name: 'StorageProvider',
12
+ * Value: 'Google Drive'
13
+ * }, {
14
+ * Name: 'DirectoryPath',
15
+ * Value: 'projects/2025/'
16
+ * }]
17
+ * });
18
+ * ```
19
+ */
20
+ export declare class CreateDirectoryAction extends BaseFileStorageAction {
21
+ /**
22
+ * Create a directory
23
+ *
24
+ * @param params - The action parameters:
25
+ * - StorageProvider: Required - Name of the storage provider
26
+ * - DirectoryPath: Required - Path for the new directory
27
+ *
28
+ * @returns Operation result with:
29
+ * - Success: Boolean indicating if the directory was created
30
+ */
31
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
32
+ }
33
+ export declare function LoadCreateDirectoryAction(): void;
34
+ //# sourceMappingURL=create-directory.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-directory.action.d.ts","sourceRoot":"","sources":["../../../src/custom/files/create-directory.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,qBAAsB,SAAQ,qBAAqB;IAE5D;;;;;;;;;OASG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAkC1F;AACD,wBAAgB,yBAAyB,SAExC"}
@@ -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.LoadCreateDirectoryAction = exports.CreateDirectoryAction = 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 creating a directory in a storage provider.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * await runAction({
19
+ * ActionName: 'Create Storage Directory',
20
+ * Params: [{
21
+ * Name: 'StorageProvider',
22
+ * Value: 'Google Drive'
23
+ * }, {
24
+ * Name: 'DirectoryPath',
25
+ * Value: 'projects/2025/'
26
+ * }]
27
+ * });
28
+ * ```
29
+ */
30
+ let CreateDirectoryAction = class CreateDirectoryAction extends base_file_storage_action_1.BaseFileStorageAction {
31
+ /**
32
+ * Create a directory
33
+ *
34
+ * @param params - The action parameters:
35
+ * - StorageProvider: Required - Name of the storage provider
36
+ * - DirectoryPath: Required - Path for the new directory
37
+ *
38
+ * @returns Operation result with:
39
+ * - Success: Boolean indicating if the directory was created
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 directoryPath = this.getStringParam(params, 'directorypath');
49
+ if (!directoryPath) {
50
+ return this.createErrorResult("DirectoryPath parameter is required", "MISSING_DIRECTORYPATH");
51
+ }
52
+ // Execute the create directory operation
53
+ const success = await driver.CreateDirectory(directoryPath);
54
+ // Add output parameter
55
+ this.addOutputParam(params, 'Success', success);
56
+ return this.createSuccessResult({
57
+ operation: 'CreateDirectory',
58
+ directoryPath,
59
+ success
60
+ });
61
+ }
62
+ catch (error) {
63
+ return this.createErrorResult(`Create directory operation failed: ${error instanceof Error ? error.message : String(error)}`, "OPERATION_FAILED");
64
+ }
65
+ }
66
+ };
67
+ exports.CreateDirectoryAction = CreateDirectoryAction;
68
+ exports.CreateDirectoryAction = CreateDirectoryAction = __decorate([
69
+ (0, global_1.RegisterClass)(actions_1.BaseAction, "File Storage: Create Directory")
70
+ ], CreateDirectoryAction);
71
+ function LoadCreateDirectoryAction() {
72
+ // Stub function to prevent tree shaking
73
+ }
74
+ exports.LoadCreateDirectoryAction = LoadCreateDirectoryAction;
75
+ //# sourceMappingURL=create-directory.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-directory.action.js","sourceRoot":"","sources":["../../../src/custom/files/create-directory.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,yEAAmE;AAEnE;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,gDAAqB;IAE5D;;;;;;;;;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,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACnE,IAAI,CAAC,aAAa,EAAE,CAAC;gBACjB,OAAO,IAAI,CAAC,iBAAiB,CACzB,qCAAqC,EACrC,uBAAuB,CAC1B,CAAC;YACN,CAAC;YAED,yCAAyC;YACzC,MAAM,OAAO,GAAY,MAAM,MAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;YAEtE,uBAAuB;YACvB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAEhD,OAAO,IAAI,CAAC,mBAAmB,CAAC;gBAC5B,SAAS,EAAE,iBAAiB;gBAC5B,aAAa;g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