@memberjunction/core-actions 2.53.0 → 2.55.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 (118) hide show
  1. package/dist/custom/ai/execute-ai-prompt.action.d.ts +94 -0
  2. package/dist/custom/ai/execute-ai-prompt.action.d.ts.map +1 -0
  3. package/dist/custom/ai/execute-ai-prompt.action.js +274 -0
  4. package/dist/custom/ai/execute-ai-prompt.action.js.map +1 -0
  5. package/dist/custom/communication/slack-webhook.action.d.ts +101 -0
  6. package/dist/custom/communication/slack-webhook.action.d.ts.map +1 -0
  7. package/dist/custom/communication/slack-webhook.action.js +269 -0
  8. package/dist/custom/communication/slack-webhook.action.js.map +1 -0
  9. package/dist/custom/communication/teams-webhook.action.d.ts +96 -0
  10. package/dist/custom/communication/teams-webhook.action.d.ts.map +1 -0
  11. package/dist/custom/communication/teams-webhook.action.js +275 -0
  12. package/dist/custom/communication/teams-webhook.action.js.map +1 -0
  13. package/dist/custom/data/aggregate-data.action.d.ts +91 -0
  14. package/dist/custom/data/aggregate-data.action.d.ts.map +1 -0
  15. package/dist/custom/data/aggregate-data.action.js +333 -0
  16. package/dist/custom/data/aggregate-data.action.js.map +1 -0
  17. package/dist/custom/data/csv-parser.action.d.ts +68 -0
  18. package/dist/custom/data/csv-parser.action.d.ts.map +1 -0
  19. package/dist/custom/data/csv-parser.action.js +184 -0
  20. package/dist/custom/data/csv-parser.action.js.map +1 -0
  21. package/dist/custom/data/data-mapper.action.d.ts +89 -0
  22. package/dist/custom/data/data-mapper.action.d.ts.map +1 -0
  23. package/dist/custom/data/data-mapper.action.js +325 -0
  24. package/dist/custom/data/data-mapper.action.js.map +1 -0
  25. package/dist/custom/data/json-transform.action.d.ts +57 -0
  26. package/dist/custom/data/json-transform.action.d.ts.map +1 -0
  27. package/dist/custom/data/json-transform.action.js +205 -0
  28. package/dist/custom/data/json-transform.action.js.map +1 -0
  29. package/dist/custom/data/xml-parser.action.d.ts +85 -0
  30. package/dist/custom/data/xml-parser.action.d.ts.map +1 -0
  31. package/dist/custom/data/xml-parser.action.js +326 -0
  32. package/dist/custom/data/xml-parser.action.js.map +1 -0
  33. package/dist/custom/files/excel-reader.action.d.ts +86 -0
  34. package/dist/custom/files/excel-reader.action.d.ts.map +1 -0
  35. package/dist/custom/files/excel-reader.action.js +348 -0
  36. package/dist/custom/files/excel-reader.action.js.map +1 -0
  37. package/dist/custom/files/excel-writer.action.d.ts +79 -0
  38. package/dist/custom/files/excel-writer.action.d.ts.map +1 -0
  39. package/dist/custom/files/excel-writer.action.js +325 -0
  40. package/dist/custom/files/excel-writer.action.js.map +1 -0
  41. package/dist/custom/files/file-compress.action.d.ts +90 -0
  42. package/dist/custom/files/file-compress.action.d.ts.map +1 -0
  43. package/dist/custom/files/file-compress.action.js +346 -0
  44. package/dist/custom/files/file-compress.action.js.map +1 -0
  45. package/dist/custom/files/pdf-extractor.action.d.ts +86 -0
  46. package/dist/custom/files/pdf-extractor.action.d.ts.map +1 -0
  47. package/dist/custom/files/pdf-extractor.action.js +247 -0
  48. package/dist/custom/files/pdf-extractor.action.js.map +1 -0
  49. package/dist/custom/files/pdf-generator.action.d.ts +70 -0
  50. package/dist/custom/files/pdf-generator.action.d.ts.map +1 -0
  51. package/dist/custom/files/pdf-generator.action.js +286 -0
  52. package/dist/custom/files/pdf-generator.action.js.map +1 -0
  53. package/dist/custom/integration/api-rate-limiter.action.d.ts +88 -0
  54. package/dist/custom/integration/api-rate-limiter.action.d.ts.map +1 -0
  55. package/dist/custom/integration/api-rate-limiter.action.js +363 -0
  56. package/dist/custom/integration/api-rate-limiter.action.js.map +1 -0
  57. package/dist/custom/integration/graphql-query.action.d.ts +92 -0
  58. package/dist/custom/integration/graphql-query.action.d.ts.map +1 -0
  59. package/dist/custom/integration/graphql-query.action.js +251 -0
  60. package/dist/custom/integration/graphql-query.action.js.map +1 -0
  61. package/dist/custom/integration/http-request.action.d.ts +96 -0
  62. package/dist/custom/integration/http-request.action.d.ts.map +1 -0
  63. package/dist/custom/integration/http-request.action.js +316 -0
  64. package/dist/custom/integration/http-request.action.js.map +1 -0
  65. package/dist/custom/integration/oauth-flow.action.d.ts +130 -0
  66. package/dist/custom/integration/oauth-flow.action.d.ts.map +1 -0
  67. package/dist/custom/integration/oauth-flow.action.js +624 -0
  68. package/dist/custom/integration/oauth-flow.action.js.map +1 -0
  69. package/dist/custom/security/password-strength.action.d.ts +129 -0
  70. package/dist/custom/security/password-strength.action.d.ts.map +1 -0
  71. package/dist/custom/security/password-strength.action.js +463 -0
  72. package/dist/custom/security/password-strength.action.js.map +1 -0
  73. package/dist/custom/utilities/base-file-handler.d.ts +54 -0
  74. package/dist/custom/utilities/base-file-handler.d.ts.map +1 -0
  75. package/dist/custom/utilities/base-file-handler.js +167 -0
  76. package/dist/custom/utilities/base-file-handler.js.map +1 -0
  77. package/dist/custom/utilities/index.d.ts +3 -0
  78. package/dist/custom/utilities/index.d.ts.map +1 -0
  79. package/dist/custom/utilities/index.js +19 -0
  80. package/dist/custom/utilities/index.js.map +1 -0
  81. package/dist/custom/utilities/json-param-helper.d.ts +33 -0
  82. package/dist/custom/utilities/json-param-helper.d.ts.map +1 -0
  83. package/dist/custom/utilities/json-param-helper.js +66 -0
  84. package/dist/custom/utilities/json-param-helper.js.map +1 -0
  85. package/dist/custom/web/duckduckgo-rate-limiter.d.ts +72 -0
  86. package/dist/custom/web/duckduckgo-rate-limiter.d.ts.map +1 -0
  87. package/dist/custom/web/duckduckgo-rate-limiter.js +175 -0
  88. package/dist/custom/web/duckduckgo-rate-limiter.js.map +1 -0
  89. package/dist/custom/web/web-search.action.d.ts +1 -0
  90. package/dist/custom/web/web-search.action.d.ts.map +1 -1
  91. package/dist/custom/web/web-search.action.js +48 -20
  92. package/dist/custom/web/web-search.action.js.map +1 -1
  93. package/dist/custom/workflow/conditional.action.d.ts +94 -0
  94. package/dist/custom/workflow/conditional.action.d.ts.map +1 -0
  95. package/dist/custom/workflow/conditional.action.js +274 -0
  96. package/dist/custom/workflow/conditional.action.js.map +1 -0
  97. package/dist/custom/workflow/delay.action.d.ts +76 -0
  98. package/dist/custom/workflow/delay.action.d.ts.map +1 -0
  99. package/dist/custom/workflow/delay.action.js +187 -0
  100. package/dist/custom/workflow/delay.action.js.map +1 -0
  101. package/dist/custom/workflow/loop.action.d.ts +112 -0
  102. package/dist/custom/workflow/loop.action.d.ts.map +1 -0
  103. package/dist/custom/workflow/loop.action.js +380 -0
  104. package/dist/custom/workflow/loop.action.js.map +1 -0
  105. package/dist/custom/workflow/parallel-execute.action.d.ts +105 -0
  106. package/dist/custom/workflow/parallel-execute.action.d.ts.map +1 -0
  107. package/dist/custom/workflow/parallel-execute.action.js +457 -0
  108. package/dist/custom/workflow/parallel-execute.action.js.map +1 -0
  109. package/dist/custom/workflow/retry.action.d.ts +90 -0
  110. package/dist/custom/workflow/retry.action.d.ts.map +1 -0
  111. package/dist/custom/workflow/retry.action.js +378 -0
  112. package/dist/custom/workflow/retry.action.js.map +1 -0
  113. package/dist/index.d.ts +23 -0
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +75 -0
  116. package/dist/index.js.map +1 -1
  117. package/package.json +25 -10
  118. package/readme.md +11270 -101
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.LoadXMLParserAction = exports.XMLParserAction = void 0;
33
+ const global_1 = require("@memberjunction/global");
34
+ const base_file_handler_1 = require("../utilities/base-file-handler");
35
+ const xml2js = __importStar(require("xml2js"));
36
+ const xpath = __importStar(require("xpath"));
37
+ const xmldom_1 = require("@xmldom/xmldom");
38
+ const json_param_helper_1 = require("../utilities/json-param-helper");
39
+ /**
40
+ * Action that parses XML data and extracts content using XPath expressions
41
+ * Supports namespaces, various return types, and multiple input sources
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // Parse XML and extract with XPath
46
+ * await runAction({
47
+ * ActionName: 'XML Parser',
48
+ * Params: [{
49
+ * Name: 'XMLData',
50
+ * Value: '<users><user id="1"><name>John</name></user><user id="2"><name>Jane</name></user></users>'
51
+ * }, {
52
+ * Name: 'XPathExpression',
53
+ * Value: '//user[@id="1"]/name/text()'
54
+ * }]
55
+ * });
56
+ *
57
+ * // Parse XML with namespaces
58
+ * await runAction({
59
+ * ActionName: 'XML Parser',
60
+ * Params: [{
61
+ * Name: 'XMLData',
62
+ * Value: '<ns:root xmlns:ns="http://example.com"><ns:value>Test</ns:value></ns:root>'
63
+ * }, {
64
+ * Name: 'XPathExpression',
65
+ * Value: '//ns:value/text()'
66
+ * }, {
67
+ * Name: 'NamespaceMap',
68
+ * Value: { ns: 'http://example.com' }
69
+ * }]
70
+ * });
71
+ *
72
+ * // Convert entire XML to JSON
73
+ * await runAction({
74
+ * ActionName: 'XML Parser',
75
+ * Params: [{
76
+ * Name: 'XMLData',
77
+ * Value: '<root><item>Value 1</item><item>Value 2</item></root>'
78
+ * }]
79
+ * });
80
+ * ```
81
+ */
82
+ let XMLParserAction = class XMLParserAction extends base_file_handler_1.BaseFileHandlerAction {
83
+ /**
84
+ * Parses XML and extracts data using XPath expressions
85
+ *
86
+ * @param params - The action parameters containing:
87
+ * - XMLData: String containing XML data (direct input)
88
+ * - FileID: UUID of MJ Storage file (alternative)
89
+ * - FileURL: URL of XML file (alternative)
90
+ * - XPathExpression: XPath query to extract data (optional - if not provided, converts entire XML to JSON)
91
+ * - NamespaceMap: Object mapping namespace prefixes to URIs
92
+ * - ReturnType: "string" | "number" | "boolean" | "node" | "nodes" | "json" (default: "string")
93
+ * - PreserveAttributes: Boolean - include attributes in JSON conversion (default: true)
94
+ * - ExplicitArray: Boolean - always put child nodes in array (default: false)
95
+ * - IgnoreAttributes: Boolean - ignore attributes in conversion (default: false)
96
+ *
97
+ * @returns Extracted data based on XPath or full JSON conversion
98
+ */
99
+ async InternalRunAction(params) {
100
+ try {
101
+ // Get file content from various sources
102
+ const fileContent = await this.getFileContent(params, 'xmldata');
103
+ // Get parameters
104
+ const xpathExpression = this.getParamValue(params, 'xpathexpression');
105
+ const namespaceMap = json_param_helper_1.JSONParamHelper.getJSONParam(params, 'namespacemap') || {};
106
+ const returnType = (this.getParamValue(params, 'returntype') || 'string').toLowerCase();
107
+ const preserveAttributes = this.getBooleanParam(params, 'preserveattributes', true);
108
+ const explicitArray = this.getBooleanParam(params, 'explicitarray', false);
109
+ const ignoreAttributes = this.getBooleanParam(params, 'ignoreattributes', false);
110
+ // Convert Buffer to string if necessary
111
+ const xmlString = typeof fileContent.content === 'string'
112
+ ? fileContent.content
113
+ : fileContent.content.toString();
114
+ // Validate XML
115
+ if (!xmlString.trim()) {
116
+ return {
117
+ Success: false,
118
+ Message: "XML data is empty",
119
+ ResultCode: "EMPTY_DATA"
120
+ };
121
+ }
122
+ let result;
123
+ if (xpathExpression) {
124
+ // Use XPath to extract specific data
125
+ result = await this.extractWithXPath(xmlString, xpathExpression, namespaceMap, returnType);
126
+ }
127
+ else {
128
+ // Convert entire XML to JSON
129
+ result = await this.convertToJSON(xmlString, {
130
+ preserveAttributes,
131
+ explicitArray,
132
+ ignoreAttributes
133
+ });
134
+ }
135
+ // Prepare output
136
+ const output = {
137
+ result: result,
138
+ source: fileContent.source,
139
+ fileName: fileContent.fileName,
140
+ extractionMethod: xpathExpression ? 'xpath' : 'full-conversion'
141
+ };
142
+ if (xpathExpression) {
143
+ output['xpath'] = xpathExpression;
144
+ output['returnType'] = returnType;
145
+ if (Object.keys(namespaceMap).length > 0) {
146
+ output['namespaces'] = namespaceMap;
147
+ }
148
+ }
149
+ return {
150
+ Success: true,
151
+ ResultCode: "SUCCESS",
152
+ Message: JSON.stringify(output, null, 2)
153
+ };
154
+ }
155
+ catch (error) {
156
+ return {
157
+ Success: false,
158
+ Message: `Failed to parse XML: ${error instanceof Error ? error.message : String(error)}`,
159
+ ResultCode: "FAILED"
160
+ };
161
+ }
162
+ }
163
+ /**
164
+ * Extract data using XPath
165
+ */
166
+ async extractWithXPath(xmlString, xpathExpression, namespaceMap, returnType) {
167
+ try {
168
+ const doc = new xmldom_1.DOMParser().parseFromString(xmlString, 'text/xml');
169
+ // Check for parsing errors
170
+ const parseError = doc.getElementsByTagName('parsererror');
171
+ if (parseError.length > 0) {
172
+ throw new Error('XML parsing error: ' + parseError[0].textContent);
173
+ }
174
+ let nodes;
175
+ if (Object.keys(namespaceMap).length > 0) {
176
+ // Use namespace resolver
177
+ const select = xpath.useNamespaces(namespaceMap);
178
+ nodes = select(xpathExpression, doc);
179
+ }
180
+ else {
181
+ // No namespaces
182
+ nodes = xpath.select(xpathExpression, doc);
183
+ }
184
+ // Process results based on return type
185
+ switch (returnType) {
186
+ case 'string':
187
+ if (Array.isArray(nodes)) {
188
+ return nodes.map(n => this.nodeToString(n));
189
+ }
190
+ return this.nodeToString(nodes);
191
+ case 'number':
192
+ const numResult = Array.isArray(nodes) ? nodes[0] : nodes;
193
+ return Number(this.nodeToString(numResult));
194
+ case 'boolean':
195
+ return Boolean(nodes && (Array.isArray(nodes) ? nodes.length > 0 : true));
196
+ case 'node':
197
+ if (Array.isArray(nodes) && nodes.length > 0) {
198
+ return this.nodeToJSON(nodes[0]);
199
+ }
200
+ return nodes ? this.nodeToJSON(nodes) : null;
201
+ case 'nodes':
202
+ if (Array.isArray(nodes)) {
203
+ return nodes.map(n => this.nodeToJSON(n));
204
+ }
205
+ return nodes ? [this.nodeToJSON(nodes)] : [];
206
+ case 'json':
207
+ default:
208
+ if (Array.isArray(nodes)) {
209
+ return nodes.map(n => this.nodeToJSON(n));
210
+ }
211
+ return nodes ? this.nodeToJSON(nodes) : null;
212
+ }
213
+ }
214
+ catch (error) {
215
+ throw new Error(`XPath extraction failed: ${error instanceof Error ? error.message : String(error)}`);
216
+ }
217
+ }
218
+ /**
219
+ * Convert node to string
220
+ */
221
+ nodeToString(node) {
222
+ if (!node)
223
+ return '';
224
+ if (typeof node === 'string')
225
+ return node;
226
+ if (node.nodeValue !== undefined)
227
+ return node.nodeValue;
228
+ if (node.textContent !== undefined)
229
+ return node.textContent;
230
+ if (node.data !== undefined)
231
+ return node.data;
232
+ return node.toString();
233
+ }
234
+ /**
235
+ * Convert node to JSON representation
236
+ */
237
+ nodeToJSON(node) {
238
+ if (!node)
239
+ return null;
240
+ // Text node
241
+ if (node.nodeType === 3) {
242
+ return node.nodeValue;
243
+ }
244
+ // Attribute node
245
+ if (node.nodeType === 2) {
246
+ return node.nodeValue;
247
+ }
248
+ // Element node
249
+ if (node.nodeType === 1) {
250
+ const result = {};
251
+ // Add attributes
252
+ if (node.attributes && node.attributes.length > 0) {
253
+ result['@attributes'] = {};
254
+ for (let i = 0; i < node.attributes.length; i++) {
255
+ const attr = node.attributes[i];
256
+ result['@attributes'][attr.nodeName] = attr.nodeValue;
257
+ }
258
+ }
259
+ // Add child nodes
260
+ if (node.childNodes && node.childNodes.length > 0) {
261
+ for (let i = 0; i < node.childNodes.length; i++) {
262
+ const child = node.childNodes[i];
263
+ if (child.nodeType === 1) { // Element
264
+ const childName = child.nodeName;
265
+ const childValue = this.nodeToJSON(child);
266
+ if (result[childName]) {
267
+ // Convert to array if multiple children with same name
268
+ if (!Array.isArray(result[childName])) {
269
+ result[childName] = [result[childName]];
270
+ }
271
+ result[childName].push(childValue);
272
+ }
273
+ else {
274
+ result[childName] = childValue;
275
+ }
276
+ }
277
+ else if (child.nodeType === 3 && child.nodeValue.trim()) { // Text
278
+ result['@text'] = child.nodeValue;
279
+ }
280
+ }
281
+ }
282
+ // If only text content, return it directly
283
+ if (Object.keys(result).length === 1 && result['@text']) {
284
+ return result['@text'];
285
+ }
286
+ return result;
287
+ }
288
+ return null;
289
+ }
290
+ /**
291
+ * Convert entire XML to JSON using xml2js
292
+ */
293
+ async convertToJSON(xmlString, options) {
294
+ const parser = new xml2js.Parser({
295
+ explicitArray: options.explicitArray,
296
+ ignoreAttrs: options.ignoreAttributes,
297
+ preserveChildrenOrder: true,
298
+ explicitCharkey: true,
299
+ trim: true,
300
+ normalize: true,
301
+ normalizeTags: false
302
+ });
303
+ return new Promise((resolve, reject) => {
304
+ parser.parseString(xmlString, (err, result) => {
305
+ if (err) {
306
+ reject(err);
307
+ }
308
+ else {
309
+ resolve(result);
310
+ }
311
+ });
312
+ });
313
+ }
314
+ };
315
+ exports.XMLParserAction = XMLParserAction;
316
+ exports.XMLParserAction = XMLParserAction = __decorate([
317
+ (0, global_1.RegisterClass)(base_file_handler_1.BaseFileHandlerAction, "XML Parser")
318
+ ], XMLParserAction);
319
+ /**
320
+ * Loader function to ensure the XMLParserAction class is included in the bundle
321
+ */
322
+ function LoadXMLParserAction() {
323
+ // Stub function to prevent tree shaking
324
+ }
325
+ exports.LoadXMLParserAction = LoadXMLParserAction;
326
+ //# sourceMappingURL=xml-parser.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-parser.action.js","sourceRoot":"","sources":["../../../src/custom/data/xml-parser.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAuD;AACvD,sEAAuE;AACvE,+CAAiC;AACjC,6CAA+B;AAC/B,2CAA2C;AAC3C,sEAAiE;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,yCAAqB;IAEtD;;;;;;;;;;;;;;;OAeG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,wCAAwC;YACxC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAEjE,iBAAiB;YACjB,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACtE,MAAM,YAAY,GAAG,mCAAe,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC;YAChF,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;YACxF,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;YACpF,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;YAC3E,MAAM,gBAAgB,GAAG,IAA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,aAAa,EAAE,KAAK;SACvB,CAAC,CAAC;QAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBAC1C,IAAI,GAAG,EAAE,CAAC;oBACN,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAjQY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAa,EAAC,yCAAqB,EAAE,YAAY,CAAC;GACtC,eAAe,CAiQ3B;AAED;;GAEG;AACH,SAAgB,mBAAmB;IAC/B,wCAAwC;AAC5C,CAAC;AAFD,kDAEC"}
@@ -0,0 +1,86 @@
1
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
2
+ import { BaseFileHandlerAction } from "../utilities/base-file-handler";
3
+ /**
4
+ * Action that reads Excel files and converts them to JSON format
5
+ * Supports multiple sheets, ranges, and various data types
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Read entire Excel file
10
+ * await runAction({
11
+ * ActionName: 'Excel Reader',
12
+ * Params: [{
13
+ * Name: 'FileURL',
14
+ * Value: 'https://example.com/data.xlsx'
15
+ * }]
16
+ * });
17
+ *
18
+ * // Read specific sheet with headers
19
+ * await runAction({
20
+ * ActionName: 'Excel Reader',
21
+ * Params: [{
22
+ * Name: 'FileID',
23
+ * Value: 'uuid-of-excel-file'
24
+ * }, {
25
+ * Name: 'SheetName',
26
+ * Value: 'Sales Data'
27
+ * }, {
28
+ * Name: 'HasHeaders',
29
+ * Value: true
30
+ * }]
31
+ * });
32
+ *
33
+ * // Read specific range
34
+ * await runAction({
35
+ * ActionName: 'Excel Reader',
36
+ * Params: [{
37
+ * Name: 'ExcelData',
38
+ * Value: base64ExcelData
39
+ * }, {
40
+ * Name: 'Range',
41
+ * Value: 'A1:D10'
42
+ * }]
43
+ * });
44
+ * ```
45
+ */
46
+ export declare class ExcelReaderAction extends BaseFileHandlerAction {
47
+ /**
48
+ * Reads Excel files and converts to JSON
49
+ *
50
+ * @param params - The action parameters containing:
51
+ * - FileID: UUID of MJ Storage file (optional)
52
+ * - FileURL: URL of Excel file (optional)
53
+ * - ExcelData: Base64 encoded Excel data (optional)
54
+ * - SheetName: Specific sheet name to read (optional, default: first sheet)
55
+ * - SheetIndex: Sheet index (0-based, alternative to SheetName)
56
+ * - Range: A1 notation range like 'A1:D10' (optional)
57
+ * - HasHeaders: Boolean - first row contains headers (default: true)
58
+ * - DateFormat: How to format dates - 'ISO' | 'Excel' | 'Local' (default: 'ISO')
59
+ * - EmptyCellValue: Value to use for empty cells (default: null)
60
+ * - IncludeHidden: Include hidden rows/columns (default: false)
61
+ *
62
+ * @returns Array of objects (if headers) or array of arrays
63
+ */
64
+ protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
65
+ /**
66
+ * Check if string is base64 encoded
67
+ */
68
+ private isBase64;
69
+ /**
70
+ * Extract data from worksheet
71
+ */
72
+ private extractSheetData;
73
+ /**
74
+ * Get cell value with proper type handling
75
+ */
76
+ private getCellValue;
77
+ /**
78
+ * Convert column letter to number (A=1, B=2, etc.)
79
+ */
80
+ private columnToNumber;
81
+ }
82
+ /**
83
+ * Loader function to ensure the ExcelReaderAction class is included in the bundle
84
+ */
85
+ export declare function LoadExcelReaderAction(): void;
86
+ //# sourceMappingURL=excel-reader.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excel-reader.action.d.ts","sourceRoot":"","sources":["../../../src/custom/files/excel-reader.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,iBAAkB,SAAQ,qBAAqB;IAExD;;;;;;;;;;;;;;;;OAgBG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6GvF;;OAEG;IACH,OAAO,CAAC,QAAQ;IAQhB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiFxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgDpB;;OAEG;IACH,OAAO,CAAC,cAAc;CAOzB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,SAEpC"}