@memberjunction/actions-bizapps-formbuilders 6.2.0-edge.0 → 6.2.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +91 -0
- package/dist/providers/typeform/actions/get-file-content.action.js +10 -10
- package/dist/shared/file-content-processor.d.ts +15 -9
- package/dist/shared/file-content-processor.d.ts.map +1 -1
- package/dist/shared/file-content-processor.js +43 -31
- package/dist/shared/file-content-processor.js.map +1 -1
- package/package.json +7 -7
- package/src/providers/typeform/actions/get-file-content.action.ts +10 -10
- package/src/shared/file-content-processor.ts +63 -44
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @memberjunction/actions-bizapps-formbuilders@6.2.0-edge.
|
|
2
|
+
> @memberjunction/actions-bizapps-formbuilders@6.2.0-edge.2 build /home/runner/work/MJ/MJ/packages/Actions/BizApps/FormBuilders
|
|
3
3
|
> tsc && tsc-alias -f
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @memberjunction/actions-bizapps-formbuilders
|
|
2
2
|
|
|
3
|
+
## 6.2.0-edge.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e97d95c]
|
|
8
|
+
- Updated dependencies [2552b1e]
|
|
9
|
+
- Updated dependencies [21f9e15]
|
|
10
|
+
- Updated dependencies [4248fb3]
|
|
11
|
+
- Updated dependencies [0adaf76]
|
|
12
|
+
- Updated dependencies [ef43cf3]
|
|
13
|
+
- Updated dependencies [b44c7cf]
|
|
14
|
+
- Updated dependencies [705ab4e]
|
|
15
|
+
- Updated dependencies [7e57b48]
|
|
16
|
+
- Updated dependencies [7e57b48]
|
|
17
|
+
- Updated dependencies [5986939]
|
|
18
|
+
- Updated dependencies [200e634]
|
|
19
|
+
- Updated dependencies [4d647e6]
|
|
20
|
+
- Updated dependencies [c35f7e5]
|
|
21
|
+
- Updated dependencies [369e229]
|
|
22
|
+
- Updated dependencies [d13cf6b]
|
|
23
|
+
- Updated dependencies [2854a2e]
|
|
24
|
+
- @memberjunction/core@6.2.0-edge.2
|
|
25
|
+
- @memberjunction/core-entities@6.2.0-edge.2
|
|
26
|
+
- @memberjunction/actions@6.2.0-edge.2
|
|
27
|
+
- @memberjunction/global@6.2.0-edge.2
|
|
28
|
+
- @memberjunction/actions-base@6.2.0-edge.2
|
|
29
|
+
- @memberjunction/network-utils@6.2.0-edge.2
|
|
30
|
+
|
|
31
|
+
## 6.2.0-edge.1
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 80905a1: Rename public class members and exported functions to PascalCase, per MJ's naming convention,
|
|
36
|
+
**without breaking a single consumer**.
|
|
37
|
+
|
|
38
|
+
Every renamed symbol keeps its old name beside the new one as a `@deprecated` stub that forwards to
|
|
39
|
+
it — a delegating method or function, a getter/setter pair for a property, and for Angular a
|
|
40
|
+
readable accessor pair for an `@Input` and a second `@Output` sharing the same `EventEmitter`, so a
|
|
41
|
+
template still binding the old name keeps receiving events. Old names still compile, still resolve,
|
|
42
|
+
and still behave identically; the deprecation tag rides through to the published `.d.ts`, so editors
|
|
43
|
+
point callers at the replacement. Where a package re-exports through an explicit `export { … }`
|
|
44
|
+
list, the new name is added alongside the old, so the correct name is actually on the public surface
|
|
45
|
+
rather than merely declared.
|
|
46
|
+
|
|
47
|
+
The rename is deliberately refused wherever a mechanical stub would not be equivalent, because
|
|
48
|
+
several of those shapes change a type contract while still compiling in the package that declares
|
|
49
|
+
them:
|
|
50
|
+
- an **optional** property or parameter property — TypeScript has no optional accessor, so a stub
|
|
51
|
+
would promote `foo?` to a required member and break every object literal that omits it;
|
|
52
|
+
- a class that is a **data shape** (no methods, or `@ObjectType`/`@InputType`) — object literals are
|
|
53
|
+
assigned to it, and an accessor stub changes what they must supply;
|
|
54
|
+
- a property whose **subclass redeclares it**, since TypeScript forbids a property overriding an
|
|
55
|
+
accessor (TS2610);
|
|
56
|
+
- a name whose PascalCase form is **already bound** in that file or class;
|
|
57
|
+
- decorated members, `get`/`set` pairs behind a decorator, generators, destructured parameters,
|
|
58
|
+
overload sets and abstract members.
|
|
59
|
+
|
|
60
|
+
**One wire-visible consequence, for version skew only.** `BaseInfo.toJSON` walks `_`-prefixed
|
|
61
|
+
backing fields and emits them through their public getter, preferring the PascalCase one. Renaming
|
|
62
|
+
the 23 field aliases in `MJCore/src/generic` therefore changes what `AllMetadata` carries:
|
|
63
|
+
`EntityInfo.spCreate` and friends now serialize as `SpCreate`. A same-version client is unaffected —
|
|
64
|
+
`copyInitData` accepts a value through a settable accessor, so either spelling lands on the right
|
|
65
|
+
field. An OLDER client against a newer server has no such path in its `copyInitData` and drops those
|
|
66
|
+
fields silently. Same-version deployments, which is the supported configuration, see no change.
|
|
67
|
+
|
|
68
|
+
Each package was verified against its own pre-change baseline rather than against zero, because
|
|
69
|
+
several packages in this repo do not typecheck cleanly to begin with. Angular packages were verified
|
|
70
|
+
with `ngc`, not `tsc`: a plain typecheck does not compile templates, and an earlier write-only
|
|
71
|
+
`@Input` alias passed `tsc` while breaking six template reads.
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [a50948e]
|
|
74
|
+
- Updated dependencies [0eeb89d]
|
|
75
|
+
- Updated dependencies [a3539d2]
|
|
76
|
+
- Updated dependencies [41274aa]
|
|
77
|
+
- Updated dependencies [67f6c85]
|
|
78
|
+
- Updated dependencies [eb3a8d3]
|
|
79
|
+
- Updated dependencies [e1dd673]
|
|
80
|
+
- Updated dependencies [520bd09]
|
|
81
|
+
- Updated dependencies [520bd09]
|
|
82
|
+
- Updated dependencies [307da67]
|
|
83
|
+
- Updated dependencies [a7da50b]
|
|
84
|
+
- Updated dependencies [17cc774]
|
|
85
|
+
- Updated dependencies [80905a1]
|
|
86
|
+
- Updated dependencies [6b08ebf]
|
|
87
|
+
- @memberjunction/core-entities@6.2.0-edge.1
|
|
88
|
+
- @memberjunction/core@6.2.0-edge.1
|
|
89
|
+
- @memberjunction/actions-base@6.2.0-edge.1
|
|
90
|
+
- @memberjunction/actions@6.2.0-edge.1
|
|
91
|
+
- @memberjunction/global@6.2.0-edge.1
|
|
92
|
+
- @memberjunction/network-utils@6.2.0-edge.1
|
|
93
|
+
|
|
3
94
|
## 6.2.0-edge.0
|
|
4
95
|
|
|
5
96
|
### Patch Changes
|
|
@@ -98,11 +98,11 @@ let GetTypeformFileContentAction = class GetTypeformFileContentAction extends Ty
|
|
|
98
98
|
const filename = FileContentProcessor.extractFilename(fileUrl, response.Headers['content-disposition']);
|
|
99
99
|
// Process file content using the helper
|
|
100
100
|
const processResult = await FileContentProcessor.processContent(Buffer.from(response.Data), contentType, {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
Format: format,
|
|
102
|
+
IncludeWarnings: true,
|
|
103
|
+
MaxFileSize: 50 * 1024 * 1024 // 50MB limit
|
|
104
104
|
});
|
|
105
|
-
if (!processResult.
|
|
105
|
+
if (!processResult.Success) {
|
|
106
106
|
return {
|
|
107
107
|
Success: false,
|
|
108
108
|
ResultCode: 'PROCESSING_ERROR',
|
|
@@ -113,17 +113,17 @@ let GetTypeformFileContentAction = class GetTypeformFileContentAction extends Ty
|
|
|
113
113
|
{
|
|
114
114
|
Name: 'Content',
|
|
115
115
|
Type: 'Output',
|
|
116
|
-
Value: processResult.
|
|
116
|
+
Value: processResult.Content
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
Name: 'ContentType',
|
|
120
120
|
Type: 'Output',
|
|
121
|
-
Value: processResult.
|
|
121
|
+
Value: processResult.ContentType
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
Name: 'ContentFormat',
|
|
125
125
|
Type: 'Output',
|
|
126
|
-
Value: processResult.
|
|
126
|
+
Value: processResult.Format
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
Name: 'Size',
|
|
@@ -138,15 +138,15 @@ let GetTypeformFileContentAction = class GetTypeformFileContentAction extends Ty
|
|
|
138
138
|
{
|
|
139
139
|
Name: 'ExtractionMethod',
|
|
140
140
|
Type: 'Output',
|
|
141
|
-
Value: processResult.
|
|
141
|
+
Value: processResult.ExtractionMethod
|
|
142
142
|
}
|
|
143
143
|
];
|
|
144
144
|
// Add warning if present
|
|
145
|
-
if (processResult.
|
|
145
|
+
if (processResult.Warning) {
|
|
146
146
|
outputParams.push({
|
|
147
147
|
Name: 'Warning',
|
|
148
148
|
Type: 'Output',
|
|
149
|
-
Value: processResult.
|
|
149
|
+
Value: processResult.Warning
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
for (const outputParam of outputParams) {
|
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface FileContentProcessorOptions {
|
|
5
5
|
/** Requested output format: 'auto' (smart detection), 'text', 'base64', 'raw' */
|
|
6
|
-
|
|
6
|
+
Format?: 'auto' | 'text' | 'base64' | 'raw';
|
|
7
7
|
/** Maximum file size to process (in bytes) */
|
|
8
|
-
|
|
8
|
+
MaxFileSize?: number;
|
|
9
9
|
/** Whether to include extraction warnings */
|
|
10
|
-
|
|
10
|
+
IncludeWarnings?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Result of file content processing
|
|
14
14
|
*/
|
|
15
15
|
export interface FileContentProcessorResult {
|
|
16
16
|
/** Processed content */
|
|
17
|
-
|
|
17
|
+
Content: string;
|
|
18
18
|
/** Detected/processed format */
|
|
19
|
-
|
|
19
|
+
Format: string;
|
|
20
20
|
/** Original content type */
|
|
21
|
-
|
|
21
|
+
ContentType: string;
|
|
22
22
|
/** File size in bytes */
|
|
23
23
|
size: number;
|
|
24
24
|
/** Extraction method used */
|
|
25
|
-
|
|
25
|
+
ExtractionMethod: string;
|
|
26
26
|
/** Optional warning message */
|
|
27
|
-
|
|
27
|
+
Warning?: string;
|
|
28
28
|
/** Processing success status */
|
|
29
|
-
|
|
29
|
+
Success: boolean;
|
|
30
30
|
/** Error message if processing failed */
|
|
31
31
|
error?: string;
|
|
32
32
|
}
|
|
@@ -39,6 +39,8 @@ export declare class FileContentProcessor {
|
|
|
39
39
|
/**
|
|
40
40
|
* Process file content based on content type and requested format
|
|
41
41
|
*/
|
|
42
|
+
static ProcessContent(buffer: Buffer, contentType: string, options?: FileContentProcessorOptions): Promise<FileContentProcessorResult>;
|
|
43
|
+
/** @deprecated Use {@link ProcessContent}. */
|
|
42
44
|
static processContent(buffer: Buffer, contentType: string, options?: FileContentProcessorOptions): Promise<FileContentProcessorResult>;
|
|
43
45
|
/**
|
|
44
46
|
* Intelligent content extraction based on file type
|
|
@@ -67,10 +69,14 @@ export declare class FileContentProcessor {
|
|
|
67
69
|
/**
|
|
68
70
|
* Extract filename from URL or Content-Disposition header
|
|
69
71
|
*/
|
|
72
|
+
static ExtractFilename(fileUrl: string, contentDisposition?: string): string;
|
|
73
|
+
/** @deprecated Use {@link ExtractFilename}. */
|
|
70
74
|
static extractFilename(fileUrl: string, contentDisposition?: string): string;
|
|
71
75
|
/**
|
|
72
76
|
* Get content format description for easy processing
|
|
73
77
|
*/
|
|
78
|
+
static GetContentFormat(contentType: string): string;
|
|
79
|
+
/** @deprecated Use {@link GetContentFormat}. */
|
|
74
80
|
static getContentFormat(contentType: string): string;
|
|
75
81
|
}
|
|
76
82
|
//# sourceMappingURL=file-content-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-content-processor.d.ts","sourceRoot":"","sources":["../../src/shared/file-content-processor.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC5C,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAoB;IAEjE;;OAEG;WACU,cAAc,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,0BAA0B,CAAC;IAgEtC;;OAEG;mBACkB,qBAAqB;IA0G1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAc3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,KAAK;IAIpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IAMtB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM;IAMrB;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IAuB5E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"file-content-processor.d.ts","sourceRoot":"","sources":["../../src/shared/file-content-processor.ts"],"names":[],"mappings":"AAKA;;G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;IAMtB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM;IAMrB;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IAuB5E,+CAA+C;IAC/C,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IAI5E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAkBpD,gDAAgD;IAChD,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;CAGvD"}
|
|
@@ -11,41 +11,41 @@ export class FileContentProcessor {
|
|
|
11
11
|
/**
|
|
12
12
|
* Process file content based on content type and requested format
|
|
13
13
|
*/
|
|
14
|
-
static async
|
|
14
|
+
static async ProcessContent(buffer, contentType, options = {}) {
|
|
15
15
|
try {
|
|
16
|
-
const { format = 'auto', maxFileSize = this.DEFAULT_MAX_FILE_SIZE, includeWarnings = true } = options;
|
|
16
|
+
const { Format: format = 'auto', MaxFileSize: maxFileSize = this.DEFAULT_MAX_FILE_SIZE, IncludeWarnings: includeWarnings = true } = options;
|
|
17
17
|
// Check file size
|
|
18
18
|
if (buffer.length > maxFileSize) {
|
|
19
19
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
contentType,
|
|
20
|
+
Content: '',
|
|
21
|
+
Format: 'error',
|
|
22
|
+
ContentType: contentType,
|
|
23
23
|
size: buffer.length,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
ExtractionMethod: 'none',
|
|
25
|
+
Warning: `File too large (${buffer.length} bytes). Maximum allowed: ${maxFileSize} bytes.`,
|
|
26
|
+
Success: false,
|
|
27
27
|
error: 'File size exceeds limit'
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
// Process based on requested format
|
|
31
31
|
if (format === 'raw') {
|
|
32
32
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
contentType,
|
|
33
|
+
Content: buffer.toString('base64'),
|
|
34
|
+
Format: 'raw',
|
|
35
|
+
ContentType: contentType,
|
|
36
36
|
size: buffer.length,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
ExtractionMethod: 'none',
|
|
38
|
+
Success: true
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
if (format === 'base64') {
|
|
42
42
|
return {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
contentType,
|
|
43
|
+
Content: buffer.toString('base64'),
|
|
44
|
+
Format: 'base64',
|
|
45
|
+
ContentType: contentType,
|
|
46
46
|
size: buffer.length,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
ExtractionMethod: 'none',
|
|
48
|
+
Success: true
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
// Auto or text format - intelligent processing
|
|
@@ -55,16 +55,20 @@ export class FileContentProcessor {
|
|
|
55
55
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
56
56
|
LogStatus(`File content processing failed: ${errorMessage}`);
|
|
57
57
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
contentType,
|
|
58
|
+
Content: '',
|
|
59
|
+
Format: 'error',
|
|
60
|
+
ContentType: contentType,
|
|
61
61
|
size: buffer.length,
|
|
62
|
-
|
|
62
|
+
ExtractionMethod: 'none',
|
|
63
63
|
error: errorMessage,
|
|
64
|
-
|
|
64
|
+
Success: false
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
/** @deprecated Use {@link ProcessContent}. */
|
|
69
|
+
static async processContent(buffer, contentType, options = {}) {
|
|
70
|
+
return this.ProcessContent(buffer, contentType, options);
|
|
71
|
+
}
|
|
68
72
|
/**
|
|
69
73
|
* Intelligent content extraction based on file type
|
|
70
74
|
*/
|
|
@@ -157,13 +161,13 @@ export class FileContentProcessor {
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
return {
|
|
160
|
-
content,
|
|
161
|
-
format,
|
|
162
|
-
contentType,
|
|
164
|
+
Content: content,
|
|
165
|
+
Format: format,
|
|
166
|
+
ContentType: contentType,
|
|
163
167
|
size: buffer.length,
|
|
164
|
-
extractionMethod,
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
ExtractionMethod: extractionMethod,
|
|
169
|
+
Warning: includeWarnings ? warning : undefined,
|
|
170
|
+
Success: true
|
|
167
171
|
};
|
|
168
172
|
}
|
|
169
173
|
/**
|
|
@@ -213,7 +217,7 @@ export class FileContentProcessor {
|
|
|
213
217
|
/**
|
|
214
218
|
* Extract filename from URL or Content-Disposition header
|
|
215
219
|
*/
|
|
216
|
-
static
|
|
220
|
+
static ExtractFilename(fileUrl, contentDisposition) {
|
|
217
221
|
// Try to extract from Content-Disposition header first
|
|
218
222
|
if (contentDisposition) {
|
|
219
223
|
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
|
@@ -233,10 +237,14 @@ export class FileContentProcessor {
|
|
|
233
237
|
const cleanFilename = filename.split('?')[0];
|
|
234
238
|
return cleanFilename || 'download';
|
|
235
239
|
}
|
|
240
|
+
/** @deprecated Use {@link ExtractFilename}. */
|
|
241
|
+
static extractFilename(fileUrl, contentDisposition) {
|
|
242
|
+
return this.ExtractFilename(fileUrl, contentDisposition);
|
|
243
|
+
}
|
|
236
244
|
/**
|
|
237
245
|
* Get content format description for easy processing
|
|
238
246
|
*/
|
|
239
|
-
static
|
|
247
|
+
static GetContentFormat(contentType) {
|
|
240
248
|
const normalizedContentType = contentType.toLowerCase();
|
|
241
249
|
if (this.isImage(normalizedContentType)) {
|
|
242
250
|
return 'image';
|
|
@@ -257,5 +265,9 @@ export class FileContentProcessor {
|
|
|
257
265
|
return 'binary';
|
|
258
266
|
}
|
|
259
267
|
}
|
|
268
|
+
/** @deprecated Use {@link GetContentFormat}. */
|
|
269
|
+
static getContentFormat(contentType) {
|
|
270
|
+
return this.GetContentFormat(contentType);
|
|
271
|
+
}
|
|
260
272
|
}
|
|
261
273
|
//# sourceMappingURL=file-content-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-content-processor.js","sourceRoot":"","sources":["../../src/shared/file-content-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,OAAO,MAAM,SAAS,CAAC;AAoC9B;;;GAGG;AACH,MAAM,OAAO,oBAAoB;aACL,0BAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAC,OAAO;IAEzE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc,CACvB,MAAc,EACd,WAAmB,EACnB,UAAuC,EAAE;QAEzC,IAAI,CAAC;YACD,MAAM,EACF,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"file-content-processor.js","sourceRoot":"","sources":["../../src/shared/file-content-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,OAAO,MAAM,SAAS,CAAC;AAoC9B;;;GAGG;AACH,MAAM,OAAO,oBAAoB;aACL,0BAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAC,OAAO;IAEzE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc,CACvB,MAAc,EACd,WAAmB,EACnB,UAAuC,EAAE;QAEzC,IAAI,CAAC;YACD,MAAM,EACF,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC,qBAAqB,EACrD,eAAe,EAAE,eAAe,GAAG,IAAI,EAC1C,GAAG,O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CAAC;QACnB,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAClD,OAAO,MAAM,CAAC;QAClB,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC3C,OAAO,KAAK,CAAC;QACjB,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC7C,OAAO,aAAa,CAAC;QACzB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC5C,OAAO,UAAU,CAAC;QACtB,CAAC;aAAM,CAAC;YACJ,OAAO,QAAQ,CAAC;QACpB,CAAC;IACL,CAAC;IAED,gDAAgD;IAChD,MAAM,CAAC,gBAAgB,CAAC,WAAmB;QACvC,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/actions-bizapps-formbuilders",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.2.0-edge.
|
|
4
|
+
"version": "6.2.0-edge.2",
|
|
5
5
|
"description": "Form builder and survey platform integration actions for MemberJunction",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"author": "MemberJunction",
|
|
19
19
|
"license": "BUSL-1.1",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@memberjunction/actions": "6.2.0-edge.
|
|
22
|
-
"@memberjunction/actions-base": "6.2.0-edge.
|
|
23
|
-
"@memberjunction/core": "6.2.0-edge.
|
|
24
|
-
"@memberjunction/core-entities": "6.2.0-edge.
|
|
25
|
-
"@memberjunction/global": "6.2.0-edge.
|
|
26
|
-
"@memberjunction/network-utils": "6.2.0-edge.
|
|
21
|
+
"@memberjunction/actions": "6.2.0-edge.2",
|
|
22
|
+
"@memberjunction/actions-base": "6.2.0-edge.2",
|
|
23
|
+
"@memberjunction/core": "6.2.0-edge.2",
|
|
24
|
+
"@memberjunction/core-entities": "6.2.0-edge.2",
|
|
25
|
+
"@memberjunction/global": "6.2.0-edge.2",
|
|
26
|
+
"@memberjunction/network-utils": "6.2.0-edge.2",
|
|
27
27
|
"exceljs": "^4.4.0",
|
|
28
28
|
"mammoth": "^1.11.0",
|
|
29
29
|
"pdf-parse": "^1.1.1"
|
|
@@ -109,13 +109,13 @@ export class GetTypeformFileContentAction extends TypeformBaseAction {
|
|
|
109
109
|
Buffer.from(response.Data),
|
|
110
110
|
contentType,
|
|
111
111
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
Format: format as any,
|
|
113
|
+
IncludeWarnings: true,
|
|
114
|
+
MaxFileSize: 50 * 1024 * 1024 // 50MB limit
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
-
if (!processResult.
|
|
118
|
+
if (!processResult.Success) {
|
|
119
119
|
return {
|
|
120
120
|
Success: false,
|
|
121
121
|
ResultCode: 'PROCESSING_ERROR',
|
|
@@ -127,17 +127,17 @@ export class GetTypeformFileContentAction extends TypeformBaseAction {
|
|
|
127
127
|
{
|
|
128
128
|
Name: 'Content',
|
|
129
129
|
Type: 'Output',
|
|
130
|
-
Value: processResult.
|
|
130
|
+
Value: processResult.Content
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
Name: 'ContentType',
|
|
134
134
|
Type: 'Output',
|
|
135
|
-
Value: processResult.
|
|
135
|
+
Value: processResult.ContentType
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
Name: 'ContentFormat',
|
|
139
139
|
Type: 'Output',
|
|
140
|
-
Value: processResult.
|
|
140
|
+
Value: processResult.Format
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
Name: 'Size',
|
|
@@ -152,16 +152,16 @@ export class GetTypeformFileContentAction extends TypeformBaseAction {
|
|
|
152
152
|
{
|
|
153
153
|
Name: 'ExtractionMethod',
|
|
154
154
|
Type: 'Output',
|
|
155
|
-
Value: processResult.
|
|
155
|
+
Value: processResult.ExtractionMethod
|
|
156
156
|
}
|
|
157
157
|
];
|
|
158
158
|
|
|
159
159
|
// Add warning if present
|
|
160
|
-
if (processResult.
|
|
160
|
+
if (processResult.Warning) {
|
|
161
161
|
outputParams.push({
|
|
162
162
|
Name: 'Warning',
|
|
163
163
|
Type: 'Output',
|
|
164
|
-
Value: processResult.
|
|
164
|
+
Value: processResult.Warning
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -8,11 +8,11 @@ import mammoth from 'mammoth';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface FileContentProcessorOptions {
|
|
10
10
|
/** Requested output format: 'auto' (smart detection), 'text', 'base64', 'raw' */
|
|
11
|
-
|
|
11
|
+
Format?: 'auto' | 'text' | 'base64' | 'raw';
|
|
12
12
|
/** Maximum file size to process (in bytes) */
|
|
13
|
-
|
|
13
|
+
MaxFileSize?: number;
|
|
14
14
|
/** Whether to include extraction warnings */
|
|
15
|
-
|
|
15
|
+
IncludeWarnings?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -20,21 +20,21 @@ export interface FileContentProcessorOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
export interface FileContentProcessorResult {
|
|
22
22
|
/** Processed content */
|
|
23
|
-
|
|
23
|
+
Content: string;
|
|
24
24
|
/** Detected/processed format */
|
|
25
|
-
|
|
25
|
+
Format: string;
|
|
26
26
|
/** Original content type */
|
|
27
|
-
|
|
27
|
+
ContentType: string;
|
|
28
28
|
/** File size in bytes */
|
|
29
|
-
size: number;
|
|
29
|
+
size: number; // case-violation-ok-legacy-back-compat: the old name is also read off a value typed `any`, where a rename would compile and silently return undefined
|
|
30
30
|
/** Extraction method used */
|
|
31
|
-
|
|
31
|
+
ExtractionMethod: string;
|
|
32
32
|
/** Optional warning message */
|
|
33
|
-
|
|
33
|
+
Warning?: string;
|
|
34
34
|
/** Processing success status */
|
|
35
|
-
|
|
35
|
+
Success: boolean;
|
|
36
36
|
/** Error message if processing failed */
|
|
37
|
-
error?: string;
|
|
37
|
+
error?: string; // case-violation-ok-legacy-back-compat: optional, and the old name is also read off a value the checker cannot type; renaming it stays assignable and silently yields undefined
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -47,28 +47,28 @@ export class FileContentProcessor {
|
|
|
47
47
|
/**
|
|
48
48
|
* Process file content based on content type and requested format
|
|
49
49
|
*/
|
|
50
|
-
static async
|
|
50
|
+
static async ProcessContent(
|
|
51
51
|
buffer: Buffer,
|
|
52
52
|
contentType: string,
|
|
53
53
|
options: FileContentProcessorOptions = {}
|
|
54
54
|
): Promise<FileContentProcessorResult> {
|
|
55
55
|
try {
|
|
56
56
|
const {
|
|
57
|
-
format = 'auto',
|
|
58
|
-
maxFileSize = this.DEFAULT_MAX_FILE_SIZE,
|
|
59
|
-
includeWarnings = true
|
|
57
|
+
Format: format = 'auto',
|
|
58
|
+
MaxFileSize: maxFileSize = this.DEFAULT_MAX_FILE_SIZE,
|
|
59
|
+
IncludeWarnings: includeWarnings = true
|
|
60
60
|
} = options;
|
|
61
61
|
|
|
62
62
|
// Check file size
|
|
63
63
|
if (buffer.length > maxFileSize) {
|
|
64
64
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
contentType,
|
|
65
|
+
Content: '',
|
|
66
|
+
Format: 'error',
|
|
67
|
+
ContentType: contentType,
|
|
68
68
|
size: buffer.length,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
ExtractionMethod: 'none',
|
|
70
|
+
Warning: `File too large (${buffer.length} bytes). Maximum allowed: ${maxFileSize} bytes.`,
|
|
71
|
+
Success: false,
|
|
72
72
|
error: 'File size exceeds limit'
|
|
73
73
|
};
|
|
74
74
|
}
|
|
@@ -76,23 +76,23 @@ export class FileContentProcessor {
|
|
|
76
76
|
// Process based on requested format
|
|
77
77
|
if (format === 'raw') {
|
|
78
78
|
return {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
contentType,
|
|
79
|
+
Content: buffer.toString('base64'),
|
|
80
|
+
Format: 'raw',
|
|
81
|
+
ContentType: contentType,
|
|
82
82
|
size: buffer.length,
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
ExtractionMethod: 'none',
|
|
84
|
+
Success: true
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (format === 'base64') {
|
|
89
89
|
return {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
contentType,
|
|
90
|
+
Content: buffer.toString('base64'),
|
|
91
|
+
Format: 'base64',
|
|
92
|
+
ContentType: contentType,
|
|
93
93
|
size: buffer.length,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
ExtractionMethod: 'none',
|
|
95
|
+
Success: true
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -104,17 +104,26 @@ export class FileContentProcessor {
|
|
|
104
104
|
LogStatus(`File content processing failed: ${errorMessage}`);
|
|
105
105
|
|
|
106
106
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
contentType,
|
|
107
|
+
Content: '',
|
|
108
|
+
Format: 'error',
|
|
109
|
+
ContentType: contentType,
|
|
110
110
|
size: buffer.length,
|
|
111
|
-
|
|
111
|
+
ExtractionMethod: 'none',
|
|
112
112
|
error: errorMessage,
|
|
113
|
-
|
|
113
|
+
Success: false
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/** @deprecated Use {@link ProcessContent}. */
|
|
119
|
+
static async processContent(
|
|
120
|
+
buffer: Buffer,
|
|
121
|
+
contentType: string,
|
|
122
|
+
options: FileContentProcessorOptions = {}
|
|
123
|
+
): Promise<FileContentProcessorResult> {
|
|
124
|
+
return this.ProcessContent(buffer, contentType, options);
|
|
125
|
+
}
|
|
126
|
+
|
|
118
127
|
/**
|
|
119
128
|
* Intelligent content extraction based on file type
|
|
120
129
|
*/
|
|
@@ -214,13 +223,13 @@ export class FileContentProcessor {
|
|
|
214
223
|
}
|
|
215
224
|
|
|
216
225
|
return {
|
|
217
|
-
content,
|
|
218
|
-
format,
|
|
219
|
-
contentType,
|
|
226
|
+
Content: content,
|
|
227
|
+
Format: format,
|
|
228
|
+
ContentType: contentType,
|
|
220
229
|
size: buffer.length,
|
|
221
|
-
extractionMethod,
|
|
222
|
-
|
|
223
|
-
|
|
230
|
+
ExtractionMethod: extractionMethod,
|
|
231
|
+
Warning: includeWarnings ? warning : undefined,
|
|
232
|
+
Success: true
|
|
224
233
|
};
|
|
225
234
|
}
|
|
226
235
|
|
|
@@ -276,7 +285,7 @@ export class FileContentProcessor {
|
|
|
276
285
|
/**
|
|
277
286
|
* Extract filename from URL or Content-Disposition header
|
|
278
287
|
*/
|
|
279
|
-
static
|
|
288
|
+
static ExtractFilename(fileUrl: string, contentDisposition?: string): string {
|
|
280
289
|
// Try to extract from Content-Disposition header first
|
|
281
290
|
if (contentDisposition) {
|
|
282
291
|
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
|
@@ -299,10 +308,15 @@ export class FileContentProcessor {
|
|
|
299
308
|
return cleanFilename || 'download';
|
|
300
309
|
}
|
|
301
310
|
|
|
311
|
+
/** @deprecated Use {@link ExtractFilename}. */
|
|
312
|
+
static extractFilename(fileUrl: string, contentDisposition?: string): string {
|
|
313
|
+
return this.ExtractFilename(fileUrl, contentDisposition);
|
|
314
|
+
}
|
|
315
|
+
|
|
302
316
|
/**
|
|
303
317
|
* Get content format description for easy processing
|
|
304
318
|
*/
|
|
305
|
-
static
|
|
319
|
+
static GetContentFormat(contentType: string): string {
|
|
306
320
|
const normalizedContentType = contentType.toLowerCase();
|
|
307
321
|
|
|
308
322
|
if (this.isImage(normalizedContentType)) {
|
|
@@ -319,4 +333,9 @@ export class FileContentProcessor {
|
|
|
319
333
|
return 'binary';
|
|
320
334
|
}
|
|
321
335
|
}
|
|
336
|
+
|
|
337
|
+
/** @deprecated Use {@link GetContentFormat}. */
|
|
338
|
+
static getContentFormat(contentType: string): string {
|
|
339
|
+
return this.GetContentFormat(contentType);
|
|
340
|
+
}
|
|
322
341
|
}
|