@memberjunction/core-actions 2.105.0 → 2.107.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 (41) hide show
  1. package/dist/config.d.ts +112 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +34 -2
  4. package/dist/config.js.map +1 -1
  5. package/dist/custom/ai/summarize-content.action.d.ts +72 -0
  6. package/dist/custom/ai/summarize-content.action.d.ts.map +1 -0
  7. package/dist/custom/ai/summarize-content.action.js +388 -0
  8. package/dist/custom/ai/summarize-content.action.js.map +1 -0
  9. package/dist/custom/data/execute-research-query.action.d.ts +96 -0
  10. package/dist/custom/data/execute-research-query.action.d.ts.map +1 -0
  11. package/dist/custom/data/execute-research-query.action.js +413 -0
  12. package/dist/custom/data/execute-research-query.action.js.map +1 -0
  13. package/dist/custom/data/explore-database-schema.action.d.ts +91 -0
  14. package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -0
  15. package/dist/custom/data/explore-database-schema.action.js +406 -0
  16. package/dist/custom/data/explore-database-schema.action.js.map +1 -0
  17. package/dist/custom/files/index.d.ts +2 -0
  18. package/dist/custom/files/index.d.ts.map +1 -1
  19. package/dist/custom/files/index.js +5 -1
  20. package/dist/custom/files/index.js.map +1 -1
  21. package/dist/custom/files/list-storage-providers.action.d.ts +52 -0
  22. package/dist/custom/files/list-storage-providers.action.d.ts.map +1 -0
  23. package/dist/custom/files/list-storage-providers.action.js +175 -0
  24. package/dist/custom/files/list-storage-providers.action.js.map +1 -0
  25. package/dist/custom/files/search-storage-files.action.d.ts +61 -0
  26. package/dist/custom/files/search-storage-files.action.d.ts.map +1 -0
  27. package/dist/custom/files/search-storage-files.action.js +183 -0
  28. package/dist/custom/files/search-storage-files.action.js.map +1 -0
  29. package/dist/custom/web/google-custom-search.action.d.ts +55 -0
  30. package/dist/custom/web/google-custom-search.action.d.ts.map +1 -0
  31. package/dist/custom/web/google-custom-search.action.js +310 -0
  32. package/dist/custom/web/google-custom-search.action.js.map +1 -0
  33. package/dist/generated/action_subclasses.d.ts +51 -3
  34. package/dist/generated/action_subclasses.d.ts.map +1 -1
  35. package/dist/generated/action_subclasses.js +174 -90
  36. package/dist/generated/action_subclasses.js.map +1 -1
  37. package/dist/index.d.ts +4 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +16 -0
  40. package/dist/index.js.map +1 -1
  41. package/package.json +13 -11
@@ -0,0 +1,175 @@
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.LoadListStorageProvidersAction = exports.ListStorageProvidersAction = void 0;
10
+ const global_1 = require("@memberjunction/global");
11
+ const global_2 = require("@memberjunction/global");
12
+ const core_1 = require("@memberjunction/core");
13
+ const storage_1 = require("@memberjunction/storage");
14
+ const base_file_storage_action_1 = require("./base-file-storage.action");
15
+ /**
16
+ * Action that retrieves a list of active and available file storage providers.
17
+ *
18
+ * This action returns storage providers that are:
19
+ * 1. Marked as IsActive=true in the database
20
+ * 2. Actually available/configured in the running environment
21
+ *
22
+ * This is useful for AI agents (particularly Research Agent) to discover
23
+ * what storage providers are available before attempting to search or access files.
24
+ *
25
+ * Providers are configured in the File Storage Providers entity and can include:
26
+ * - Google Drive
27
+ * - SharePoint
28
+ * - Dropbox
29
+ * - Box
30
+ * - AWS S3
31
+ * - Azure Blob Storage
32
+ * - Google Cloud Storage
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Get all available storage providers
37
+ * await runAction({
38
+ * ActionName: 'List Storage Providers',
39
+ * Params: []
40
+ * });
41
+ *
42
+ * // Get only providers that support search
43
+ * await runAction({
44
+ * ActionName: 'List Storage Providers',
45
+ * Params: [{
46
+ * Name: 'SearchSupportedOnly',
47
+ * Value: true
48
+ * }]
49
+ * });
50
+ * ```
51
+ */
52
+ let ListStorageProvidersAction = class ListStorageProvidersAction extends base_file_storage_action_1.BaseFileStorageAction {
53
+ /**
54
+ * List of storage provider driver keys that support native file search.
55
+ * Used to populate the SupportsSearch field in results.
56
+ */
57
+ SEARCH_SUPPORTED_PROVIDERS = [
58
+ 'Google Drive Storage',
59
+ 'SharePoint Storage',
60
+ 'Dropbox Storage',
61
+ 'Box Storage'
62
+ ];
63
+ async InternalRunAction(params) {
64
+ // Optional parameter to filter only providers that support search
65
+ const searchSupportedOnly = this.getBooleanParam(params, "searchsupportedonly", false);
66
+ try {
67
+ // Query for active file storage providers from database
68
+ const rv = new core_1.RunView();
69
+ const result = await rv.RunView({
70
+ EntityName: 'File Storage Providers',
71
+ ExtraFilter: "IsActive=1",
72
+ OrderBy: 'Priority, Name',
73
+ ResultType: 'entity_object'
74
+ }, params.ContextUser);
75
+ if (!result.Success) {
76
+ return this.createErrorResult(`Failed to retrieve storage providers: ${result.ErrorMessage}`, "QUERY_FAILED");
77
+ }
78
+ const dbProviders = result.Results || [];
79
+ const availableProviders = [];
80
+ // Check which providers are actually available in the running environment
81
+ for (const provider of dbProviders) {
82
+ const supportsSearch = this.SEARCH_SUPPORTED_PROVIDERS.includes(provider.ServerDriverKey);
83
+ // Skip if filtering for search-only and this provider doesn't support it
84
+ if (searchSupportedOnly && !supportsSearch) {
85
+ continue;
86
+ }
87
+ try {
88
+ // Instantiate the provider and check if it's properly configured
89
+ const driver = global_2.MJGlobal.Instance.ClassFactory.CreateInstance(storage_1.FileStorageBase, provider.ServerDriverKey);
90
+ if (driver) {
91
+ // Provider is registered - check if it has required configuration
92
+ const isConfigured = driver.IsConfigured;
93
+ availableProviders.push({
94
+ Name: provider.Name,
95
+ Description: provider.Description || '',
96
+ ServerDriverKey: provider.ServerDriverKey,
97
+ SupportsSearch: supportsSearch,
98
+ IsConfigured: isConfigured,
99
+ ConfigurationError: isConfigured ? undefined : 'Missing required configuration (API keys, credentials, etc.)'
100
+ });
101
+ }
102
+ else {
103
+ // Provider exists in DB but not registered in class factory
104
+ availableProviders.push({
105
+ Name: provider.Name,
106
+ Description: provider.Description || '',
107
+ ServerDriverKey: provider.ServerDriverKey,
108
+ SupportsSearch: supportsSearch,
109
+ IsConfigured: false,
110
+ ConfigurationError: 'Provider not registered in class factory'
111
+ });
112
+ }
113
+ }
114
+ catch (error) {
115
+ // Provider exists in DB but failed to instantiate
116
+ const errorMessage = error instanceof Error ? error.message : String(error);
117
+ availableProviders.push({
118
+ Name: provider.Name,
119
+ Description: provider.Description || '',
120
+ ServerDriverKey: provider.ServerDriverKey,
121
+ SupportsSearch: supportsSearch,
122
+ IsConfigured: false,
123
+ ConfigurationError: `Instantiation failed: ${errorMessage}`
124
+ });
125
+ }
126
+ }
127
+ // Calculate counts
128
+ const configuredProviders = availableProviders.filter(p => p.IsConfigured);
129
+ const searchSupportedCount = configuredProviders.filter(p => p.SupportsSearch).length;
130
+ const totalCount = availableProviders.length;
131
+ const configuredCount = configuredProviders.length;
132
+ // Create detailed result message
133
+ let message = `Found ${totalCount} active storage provider(s) in database`;
134
+ if (configuredCount < totalCount) {
135
+ message += `, ${configuredCount} configured and available`;
136
+ }
137
+ else {
138
+ message += `, all configured and available`;
139
+ }
140
+ if (searchSupportedOnly) {
141
+ message += ` with search support`;
142
+ }
143
+ else {
144
+ message += ` (${searchSupportedCount} support search)`;
145
+ }
146
+ // Return results
147
+ return {
148
+ Success: true,
149
+ ResultCode: "SUCCESS",
150
+ Message: message,
151
+ Providers: availableProviders,
152
+ TotalCount: totalCount,
153
+ ConfiguredCount: configuredCount,
154
+ SearchSupportedCount: searchSupportedCount
155
+ };
156
+ }
157
+ catch (error) {
158
+ const errorMessage = error instanceof Error ? error.message : String(error);
159
+ return this.createErrorResult(`Failed to list storage providers: ${errorMessage}`, "LIST_FAILED");
160
+ }
161
+ }
162
+ };
163
+ exports.ListStorageProvidersAction = ListStorageProvidersAction;
164
+ exports.ListStorageProvidersAction = ListStorageProvidersAction = __decorate([
165
+ (0, global_1.RegisterClass)(base_file_storage_action_1.BaseFileStorageAction, "List Storage Providers")
166
+ ], ListStorageProvidersAction);
167
+ /**
168
+ * Load function to ensure the class is registered and not tree-shaken
169
+ */
170
+ function LoadListStorageProvidersAction() {
171
+ // This function call ensures the class decorator executes
172
+ global_2.MJGlobal.Instance.ClassFactory.GetRegistration(base_file_storage_action_1.BaseFileStorageAction, "List Storage Providers");
173
+ }
174
+ exports.LoadListStorageProvidersAction = LoadListStorageProvidersAction;
175
+ //# sourceMappingURL=list-storage-providers.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-storage-providers.action.js","sourceRoot":"","sources":["../../../src/custom/files/list-storage-providers.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,mDAAkD;AAClD,+CAA+C;AAE/C,qDAA0D;AAC1D,yEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,gDAAqB;IAEjE;;;OAGG;IACc,0BAA0B,GAAG;QAC1C,sBAAsB;QACtB,oBAAoB;QACpB,iBAAiB;QACjB,aAAa;KAChB,CAAC;IAEQ,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,kEAAkE;QAClE,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAEvF,IAAI,CAAC;YACD,wDAAwD;YACxD,MAAM,EAAE,GAAG,IAAI,cAAO,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CA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AU,EAAE,CAAC;gBAC/B,OAAO,IAAI,KAAK,eAAe,2BAA2B,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACJ,OAAO,IAAI,gCAAgC,CAAC;YAChD,CAAC;YACD,IAAI,mBAAmB,EAAE,CAAC;gBACtB,OAAO,IAAI,sBAAsB,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACJ,OAAO,IAAI,KAAK,oBAAoB,kBAAkB,CAAC;YAC3D,CAAC;YAED,iBAAiB;YACjB,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,SAAS;gBACrB,OAAO,EAAE,OAAO;gBAChB,SAAS,EAAE,kBAAkB;gBAC7B,UAAU,EAAE,UAAU;gBACtB,eAAe,EAAE,eAAe;gBAChC,oBAAoB,EAAE,oBAAoB;aACvB,CAAC;QAE5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC,iBAAiB,CACzB,qCAAqC,YAAY,EAAE,EACnD,aAAa,CAChB,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AAvIY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,sBAAa,EAAC,gDAAqB,EAAE,wBAAwB,CAAC;GAClD,0BAA0B,CAuItC;AAED;;GAEG;AACH,SAAgB,8BAA8B;IAC1C,0DAA0D;IAC1D,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,CAAC,gDAAqB,EAAE,wBAAwB,CAAC,CAAC;AACpG,CAAC;AAHD,wEAGC"}
@@ -0,0 +1,61 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseFileStorageAction } from "./base-file-storage.action";
3
+ /**
4
+ * Action that searches for files across configured storage providers
5
+ * using each provider's native search capabilities.
6
+ *
7
+ * This action leverages MJStorage's SearchFiles method which uses:
8
+ * - Google Drive: Drive API search with content indexing
9
+ * - SharePoint: Microsoft Graph Search with KQL queries
10
+ * - Dropbox: Search API v2 with filename and content search
11
+ * - Box: Box Search API with Boolean operators
12
+ *
13
+ * Providers without native search (AWS S3, Azure Blob, GCS) will return errors.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Basic file search
18
+ * await runAction({
19
+ * ActionName: 'Search Storage Files',
20
+ * Params: [{
21
+ * Name: 'Query',
22
+ * Value: 'quarterly report'
23
+ * }, {
24
+ * Name: 'StorageProvider',
25
+ * Value: 'Google Drive - Marketing'
26
+ * }]
27
+ * });
28
+ *
29
+ * // Advanced search with filters
30
+ * await runAction({
31
+ * ActionName: 'Search Storage Files',
32
+ * Params: [{
33
+ * Name: 'Query',
34
+ * Value: 'budget 2024'
35
+ * }, {
36
+ * Name: 'StorageProvider',
37
+ * Value: 'SharePoint - Finance'
38
+ * }, {
39
+ * Name: 'FileTypes',
40
+ * Value: 'pdf,xlsx'
41
+ * }, {
42
+ * Name: 'PathPrefix',
43
+ * Value: 'documents/finance'
44
+ * }, {
45
+ * Name: 'SearchContent',
46
+ * Value: true
47
+ * }, {
48
+ * Name: 'MaxResults',
49
+ * Value: 50
50
+ * }]
51
+ * });
52
+ * ```
53
+ */
54
+ export declare class SearchStorageFilesAction extends BaseFileStorageAction {
55
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
56
+ }
57
+ /**
58
+ * Load function to ensure the class is registered and not tree-shaken
59
+ */
60
+ export declare function LoadSearchStorageFilesAction(): void;
61
+ //# sourceMappingURL=search-storage-files.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-storage-files.action.d.ts","sourceRoot":"","sources":["../../../src/custom/files/search-storage-files.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBACa,wBAAyB,SAAQ,qBAAqB;cAE/C,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAkI1F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,SAG3C"}
@@ -0,0 +1,183 @@
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.LoadSearchStorageFilesAction = exports.SearchStorageFilesAction = void 0;
10
+ const global_1 = require("@memberjunction/global");
11
+ const global_2 = require("@memberjunction/global");
12
+ const storage_1 = require("@memberjunction/storage");
13
+ const base_file_storage_action_1 = require("./base-file-storage.action");
14
+ /**
15
+ * Action that searches for files across configured storage providers
16
+ * using each provider's native search capabilities.
17
+ *
18
+ * This action leverages MJStorage's SearchFiles method which uses:
19
+ * - Google Drive: Drive API search with content indexing
20
+ * - SharePoint: Microsoft Graph Search with KQL queries
21
+ * - Dropbox: Search API v2 with filename and content search
22
+ * - Box: Box Search API with Boolean operators
23
+ *
24
+ * Providers without native search (AWS S3, Azure Blob, GCS) will return errors.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Basic file search
29
+ * await runAction({
30
+ * ActionName: 'Search Storage Files',
31
+ * Params: [{
32
+ * Name: 'Query',
33
+ * Value: 'quarterly report'
34
+ * }, {
35
+ * Name: 'StorageProvider',
36
+ * Value: 'Google Drive - Marketing'
37
+ * }]
38
+ * });
39
+ *
40
+ * // Advanced search with filters
41
+ * await runAction({
42
+ * ActionName: 'Search Storage Files',
43
+ * Params: [{
44
+ * Name: 'Query',
45
+ * Value: 'budget 2024'
46
+ * }, {
47
+ * Name: 'StorageProvider',
48
+ * Value: 'SharePoint - Finance'
49
+ * }, {
50
+ * Name: 'FileTypes',
51
+ * Value: 'pdf,xlsx'
52
+ * }, {
53
+ * Name: 'PathPrefix',
54
+ * Value: 'documents/finance'
55
+ * }, {
56
+ * Name: 'SearchContent',
57
+ * Value: true
58
+ * }, {
59
+ * Name: 'MaxResults',
60
+ * Value: 50
61
+ * }]
62
+ * });
63
+ * ```
64
+ */
65
+ let SearchStorageFilesAction = class SearchStorageFilesAction extends base_file_storage_action_1.BaseFileStorageAction {
66
+ async InternalRunAction(params) {
67
+ // Required parameters
68
+ const query = this.getStringParam(params, "query");
69
+ if (!query) {
70
+ return this.createErrorResult("Query parameter is required", "MISSING_QUERY");
71
+ }
72
+ // Get storage driver (uses StorageProvider parameter via base class)
73
+ const { driver, error } = await this.getDriverFromParams(params);
74
+ if (error) {
75
+ return error;
76
+ }
77
+ // Optional parameters
78
+ const maxResults = this.getNumericParam(params, "maxresults", 100);
79
+ const pathPrefix = this.getStringParam(params, "pathprefix");
80
+ const searchContent = this.getBooleanParam(params, "searchcontent", false);
81
+ const modifiedAfterStr = this.getStringParam(params, "modifiedafter");
82
+ const modifiedBeforeStr = this.getStringParam(params, "modifiedbefore");
83
+ // Parse file types (comma-separated)
84
+ const fileTypesParam = this.getStringParam(params, "filetypes");
85
+ const fileTypes = fileTypesParam
86
+ ? fileTypesParam.split(',').map(ft => ft.trim()).filter(ft => ft.length > 0)
87
+ : undefined;
88
+ // Parse dates
89
+ let modifiedAfter;
90
+ let modifiedBefore;
91
+ if (modifiedAfterStr) {
92
+ const date = new Date(modifiedAfterStr);
93
+ if (!isNaN(date.getTime())) {
94
+ modifiedAfter = date;
95
+ }
96
+ else {
97
+ return this.createErrorResult(`Invalid ModifiedAfter date format: ${modifiedAfterStr}. Use ISO 8601 format (e.g., '2024-01-01')`, "INVALID_DATE_FORMAT");
98
+ }
99
+ }
100
+ if (modifiedBeforeStr) {
101
+ const date = new Date(modifiedBeforeStr);
102
+ if (!isNaN(date.getTime())) {
103
+ modifiedBefore = date;
104
+ }
105
+ else {
106
+ return this.createErrorResult(`Invalid ModifiedBefore date format: ${modifiedBeforeStr}. Use ISO 8601 format (e.g., '2024-12-31')`, "INVALID_DATE_FORMAT");
107
+ }
108
+ }
109
+ try {
110
+ // Build search options
111
+ const searchOptions = {
112
+ maxResults,
113
+ searchContent
114
+ };
115
+ if (fileTypes) {
116
+ searchOptions.fileTypes = fileTypes;
117
+ }
118
+ if (pathPrefix) {
119
+ searchOptions.pathPrefix = pathPrefix;
120
+ }
121
+ if (modifiedAfter) {
122
+ searchOptions.modifiedAfter = modifiedAfter;
123
+ }
124
+ if (modifiedBefore) {
125
+ searchOptions.modifiedBefore = modifiedBefore;
126
+ }
127
+ // Perform the search
128
+ const searchResults = await driver.SearchFiles(query, searchOptions);
129
+ // Format results for output
130
+ const formattedResults = searchResults.results.map((file) => ({
131
+ Path: file.path,
132
+ Name: file.name,
133
+ Size: file.size,
134
+ ContentType: file.contentType,
135
+ LastModified: file.lastModified.toISOString(),
136
+ Relevance: file.relevance,
137
+ Excerpt: file.excerpt,
138
+ MatchInFilename: file.matchInFilename,
139
+ CustomMetadata: file.customMetadata,
140
+ ProviderData: file.providerData
141
+ }));
142
+ // Create success result with detailed information
143
+ const resultData = {
144
+ SearchResults: formattedResults,
145
+ ResultCount: searchResults.results.length,
146
+ TotalMatches: searchResults.totalMatches,
147
+ HasMore: searchResults.hasMore,
148
+ NextPageToken: searchResults.nextPageToken,
149
+ Query: query,
150
+ SearchOptions: searchOptions
151
+ };
152
+ return {
153
+ Success: true,
154
+ ResultCode: "SUCCESS",
155
+ Message: `Found ${searchResults.results.length} file(s) matching query '${query}'`,
156
+ // Store detailed results in message as JSON for now (ActionResultSimple doesn't have Results property)
157
+ ...resultData
158
+ };
159
+ }
160
+ catch (error) {
161
+ // Handle specific error types
162
+ if (error instanceof storage_1.UnsupportedOperationError) {
163
+ return this.createErrorResult(`Storage provider does not support file search. Providers with search support: Google Drive, SharePoint, Dropbox, Box. Consider using a different provider or List Objects action with filtering.`, "SEARCH_NOT_SUPPORTED");
164
+ }
165
+ // Handle other errors
166
+ const errorMessage = error instanceof Error ? error.message : String(error);
167
+ return this.createErrorResult(`Search failed: ${errorMessage}`, "SEARCH_FAILED");
168
+ }
169
+ }
170
+ };
171
+ exports.SearchStorageFilesAction = SearchStorageFilesAction;
172
+ exports.SearchStorageFilesAction = SearchStorageFilesAction = __decorate([
173
+ (0, global_1.RegisterClass)(base_file_storage_action_1.BaseFileStorageAction, "Search Storage Files")
174
+ ], SearchStorageFilesAction);
175
+ /**
176
+ * Load function to ensure the class is registered and not tree-shaken
177
+ */
178
+ function LoadSearchStorageFilesAction() {
179
+ // This function call ensures the class decorator executes
180
+ global_2.MJGlobal.Instance.ClassFactory.GetRegistration(base_file_storage_action_1.BaseFileStorageAction, "Search Storage Files");
181
+ }
182
+ exports.LoadSearchStorageFilesAction = LoadSearchStorageFilesAction;
183
+ //# sourceMappingURL=search-storage-files.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-storage-files.action.js","sourceRoot":"","sources":["../../../src/custom/files/search-storage-files.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,mDAAkD;AAClD,qDAIiC;AACjC,yEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gDAAqB;IAErD,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,sBAAsB;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OA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,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC,iBAAiB,CACzB,kBAAkB,YAAY,EAAE,EAChC,eAAe,CAClB,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AApIY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAa,EAAC,gDAAqB,EAAE,sBAAsB,CAAC;GAChD,wBAAwB,CAoIpC;AAED;;GAEG;AACH,SAAgB,4BAA4B;IACxC,0DAA0D;IAC1D,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,CAAC,gDAAqB,EAAE,sBAAsB,CAAC,CAAC;AAClG,CAAC;AAHD,oEAGC"}
@@ -0,0 +1,55 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseAction } from "@memberjunction/actions";
3
+ /**
4
+ * Action that performs web search using the Google Custom Search JSON API
5
+ * and returns structured results.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Basic Google search
10
+ * await runAction({
11
+ * ActionName: 'Google Custom Search',
12
+ * Params: [{
13
+ * Name: 'Query',
14
+ * Value: 'latest trends in renewable energy'
15
+ * }]
16
+ * });
17
+ *
18
+ * // Search with additional options
19
+ * await runAction({
20
+ * ActionName: 'Google Custom Search',
21
+ * Params: [{
22
+ * Name: 'Query',
23
+ * Value: 'AI regulation whitepapers'
24
+ * }, {
25
+ * Name: 'MaxResults',
26
+ * Value: 5
27
+ * }, {
28
+ * Name: 'SafeSearch',
29
+ * Value: 'high'
30
+ * }, {
31
+ * Name: 'SiteSearch',
32
+ * Value: 'europa.eu'
33
+ * }]
34
+ * });
35
+ * ```
36
+ */
37
+ export declare class GoogleCustomSearchAction extends BaseAction {
38
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
39
+ private transformItem;
40
+ private extractFirstString;
41
+ private normalizeSafeSearch;
42
+ private normalizeSiteSearchFilter;
43
+ private normalizeLanguageRestriction;
44
+ private normalizeSearchType;
45
+ private clamp;
46
+ private getStringParam;
47
+ private getNumericParam;
48
+ private addOutputParam;
49
+ private createErrorResult;
50
+ }
51
+ /**
52
+ * Loader function to ensure the GoogleCustomSearchAction class is included in the bundle.
53
+ */
54
+ export declare function LoadGoogleCustomSearchAction(): void;
55
+ //# sourceMappingURL=google-custom-search.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-custom-search.action.d.ts","sourceRoot":"","sources":["../../../src/custom/web/google-custom-search.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA6BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBACa,wBAAyB,SAAQ,UAAU;cAEpC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6JvF,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,4BAA4B;IAiBpC,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;CAO5B;AAED;;GAEG;AACH,wBAAgB,4BAA4B,SAE3C"}