@frogbotai/piece-text-helper 0.21.0 → 0.23.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.
- package/README.md +29 -0
- package/dist/index.d.ts +210 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -50
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# `@frogbotai/piece-text-helper`
|
|
2
|
+
|
|
3
|
+
Text conversion, search, formatting, and HTML extraction tools for FrogBot.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createTextHelper } from '@frogbotai/piece-text-helper';
|
|
9
|
+
|
|
10
|
+
export const textHelper = createTextHelper();
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
| Upstream action slug | Previous wrapper export | Native action | Notes |
|
|
16
|
+
| --------------------- | ----------------------- | ----------------------- | --------------------------------------------------------- |
|
|
17
|
+
| `concat` | `concat` | `concatText` | |
|
|
18
|
+
| `replace` | `replace` | `replaceText` | |
|
|
19
|
+
| `split` | `split` | `splitText` | |
|
|
20
|
+
| `find` | `find` | `findText` | |
|
|
21
|
+
| `markdown_to_html` | `markdownToHtml` | `convertMarkdownToHtml` | |
|
|
22
|
+
| `html_to_markdown` | `htmlToMarkdown` | `convertHtmlToMarkdown` | |
|
|
23
|
+
| `stripHtml` | `stripHtml` | `stripHtml` | |
|
|
24
|
+
| `slugify` | `slugify` | `slugifyText` | |
|
|
25
|
+
| `defaultValue` | `defaultValue` | `useDefaultValue` | Input `defaultString` is now the semantic `defaultValue`. |
|
|
26
|
+
| `json_to_ascii_table` | `jsonToAsciiTable` | `createTextTable` | Validates that input is a list of objects. |
|
|
27
|
+
| `extract_from_html` | `extractFromHtml` | `extractFromHtml` | |
|
|
28
|
+
|
|
29
|
+
The upstream piece registers no triggers.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,211 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { type PieceRunArgs } from 'frogbot/pieces';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
type RunArgs<T extends z.ZodType> = PieceRunArgs<z.output<T>, object, undefined>;
|
|
4
|
+
declare const concatTextInput: z.ZodObject<{
|
|
5
|
+
texts: z.ZodArray<z.ZodUnknown>;
|
|
6
|
+
separator: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const replaceTextInput: z.ZodObject<{
|
|
9
|
+
text: z.ZodString;
|
|
10
|
+
searchValue: z.ZodString;
|
|
11
|
+
replaceValue: z.ZodOptional<z.ZodString>;
|
|
12
|
+
replaceOnlyFirst: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
declare const splitTextInput: z.ZodObject<{
|
|
15
|
+
text: z.ZodString;
|
|
16
|
+
delimiter: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
declare const findTextInput: z.ZodObject<{
|
|
19
|
+
text: z.ZodString;
|
|
20
|
+
expression: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
declare const markdownToHtmlInput: z.ZodObject<{
|
|
23
|
+
markdown: z.ZodString;
|
|
24
|
+
flavor: z.ZodDefault<z.ZodEnum<{
|
|
25
|
+
vanilla: "vanilla";
|
|
26
|
+
original: "original";
|
|
27
|
+
github: "github";
|
|
28
|
+
}>>;
|
|
29
|
+
headerLevelStart: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
tables: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
noHeaderId: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
simpleLineBreaks: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
openLinksInNewWindow: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
declare const htmlInput: z.ZodObject<{
|
|
36
|
+
html: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
declare const textInput: z.ZodObject<{
|
|
39
|
+
text: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
declare const defaultValueInput: z.ZodObject<{
|
|
42
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnknown>]>>;
|
|
43
|
+
defaultValue: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
declare const createTextTableInput: z.ZodObject<{
|
|
46
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
declare const extractFromHtmlInput: z.ZodObject<{
|
|
49
|
+
html: z.ZodString;
|
|
50
|
+
target: z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
custom: "custom";
|
|
52
|
+
title: "title";
|
|
53
|
+
links: "links";
|
|
54
|
+
images: "images";
|
|
55
|
+
headings: "headings";
|
|
56
|
+
paragraphs: "paragraphs";
|
|
57
|
+
}>>;
|
|
58
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
59
|
+
extractionType: z.ZodDefault<z.ZodEnum<{
|
|
60
|
+
textContent: "textContent";
|
|
61
|
+
innerHtml: "innerHtml";
|
|
62
|
+
outerHtml: "outerHtml";
|
|
63
|
+
attribute: "attribute";
|
|
64
|
+
}>>;
|
|
65
|
+
attributeName: z.ZodOptional<z.ZodString>;
|
|
66
|
+
returnMultiple: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export declare const createTextHelper: import("frogbot/pieces").PieceFactory<{
|
|
69
|
+
readonly slug: "text-helper";
|
|
70
|
+
readonly label: "Text Helper";
|
|
71
|
+
readonly admin: {
|
|
72
|
+
readonly description: "Tools for text processing";
|
|
73
|
+
readonly group: "Core";
|
|
74
|
+
};
|
|
75
|
+
readonly actions: readonly [{
|
|
76
|
+
slug: string;
|
|
77
|
+
label: string;
|
|
78
|
+
description: string;
|
|
79
|
+
input: z.ZodObject<{
|
|
80
|
+
texts: z.ZodArray<z.ZodUnknown>;
|
|
81
|
+
separator: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
output: z.ZodString;
|
|
84
|
+
run({ input }: RunArgs<typeof concatTextInput>): Promise<string>;
|
|
85
|
+
}, {
|
|
86
|
+
slug: string;
|
|
87
|
+
label: string;
|
|
88
|
+
description: string;
|
|
89
|
+
input: z.ZodObject<{
|
|
90
|
+
text: z.ZodString;
|
|
91
|
+
searchValue: z.ZodString;
|
|
92
|
+
replaceValue: z.ZodOptional<z.ZodString>;
|
|
93
|
+
replaceOnlyFirst: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
output: z.ZodString;
|
|
96
|
+
run({ input }: RunArgs<typeof replaceTextInput>): Promise<string>;
|
|
97
|
+
}, {
|
|
98
|
+
slug: string;
|
|
99
|
+
label: string;
|
|
100
|
+
description: string;
|
|
101
|
+
input: z.ZodObject<{
|
|
102
|
+
text: z.ZodString;
|
|
103
|
+
delimiter: z.ZodString;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
output: z.ZodArray<z.ZodString>;
|
|
106
|
+
run({ input }: RunArgs<typeof splitTextInput>): Promise<string[]>;
|
|
107
|
+
}, {
|
|
108
|
+
slug: string;
|
|
109
|
+
label: string;
|
|
110
|
+
description: string;
|
|
111
|
+
input: z.ZodObject<{
|
|
112
|
+
text: z.ZodString;
|
|
113
|
+
expression: z.ZodString;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
output: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
116
|
+
run({ input }: RunArgs<typeof findTextInput>): Promise<string[] | null>;
|
|
117
|
+
}, {
|
|
118
|
+
slug: string;
|
|
119
|
+
label: string;
|
|
120
|
+
description: string;
|
|
121
|
+
input: z.ZodObject<{
|
|
122
|
+
markdown: z.ZodString;
|
|
123
|
+
flavor: z.ZodDefault<z.ZodEnum<{
|
|
124
|
+
vanilla: "vanilla";
|
|
125
|
+
original: "original";
|
|
126
|
+
github: "github";
|
|
127
|
+
}>>;
|
|
128
|
+
headerLevelStart: z.ZodDefault<z.ZodNumber>;
|
|
129
|
+
tables: z.ZodDefault<z.ZodBoolean>;
|
|
130
|
+
noHeaderId: z.ZodDefault<z.ZodBoolean>;
|
|
131
|
+
simpleLineBreaks: z.ZodDefault<z.ZodBoolean>;
|
|
132
|
+
openLinksInNewWindow: z.ZodDefault<z.ZodBoolean>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
output: z.ZodString;
|
|
135
|
+
run({ input }: RunArgs<typeof markdownToHtmlInput>): Promise<string>;
|
|
136
|
+
}, {
|
|
137
|
+
slug: string;
|
|
138
|
+
label: string;
|
|
139
|
+
description: string;
|
|
140
|
+
input: z.ZodObject<{
|
|
141
|
+
html: z.ZodString;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
output: z.ZodString;
|
|
144
|
+
run({ input }: RunArgs<typeof htmlInput>): Promise<string>;
|
|
145
|
+
}, {
|
|
146
|
+
slug: string;
|
|
147
|
+
label: string;
|
|
148
|
+
description: string;
|
|
149
|
+
input: z.ZodObject<{
|
|
150
|
+
html: z.ZodString;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
output: z.ZodString;
|
|
153
|
+
run({ input }: RunArgs<typeof htmlInput>): Promise<string>;
|
|
154
|
+
}, {
|
|
155
|
+
slug: string;
|
|
156
|
+
label: string;
|
|
157
|
+
description: string;
|
|
158
|
+
input: z.ZodObject<{
|
|
159
|
+
text: z.ZodString;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
output: z.ZodString;
|
|
162
|
+
run({ input }: RunArgs<typeof textInput>): Promise<string>;
|
|
163
|
+
}, {
|
|
164
|
+
slug: string;
|
|
165
|
+
label: string;
|
|
166
|
+
description: string;
|
|
167
|
+
input: z.ZodObject<{
|
|
168
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnknown>]>>;
|
|
169
|
+
defaultValue: z.ZodString;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
output: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnknown>]>;
|
|
172
|
+
run({ input }: RunArgs<typeof defaultValueInput>): Promise<string | unknown[]>;
|
|
173
|
+
}, {
|
|
174
|
+
slug: string;
|
|
175
|
+
label: string;
|
|
176
|
+
description: string;
|
|
177
|
+
input: z.ZodObject<{
|
|
178
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
output: z.ZodString;
|
|
181
|
+
run({ input }: RunArgs<typeof createTextTableInput>): Promise<string>;
|
|
182
|
+
}, {
|
|
183
|
+
slug: string;
|
|
184
|
+
label: string;
|
|
185
|
+
description: string;
|
|
186
|
+
input: z.ZodObject<{
|
|
187
|
+
html: z.ZodString;
|
|
188
|
+
target: z.ZodDefault<z.ZodEnum<{
|
|
189
|
+
custom: "custom";
|
|
190
|
+
title: "title";
|
|
191
|
+
links: "links";
|
|
192
|
+
images: "images";
|
|
193
|
+
headings: "headings";
|
|
194
|
+
paragraphs: "paragraphs";
|
|
195
|
+
}>>;
|
|
196
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
197
|
+
extractionType: z.ZodDefault<z.ZodEnum<{
|
|
198
|
+
textContent: "textContent";
|
|
199
|
+
innerHtml: "innerHtml";
|
|
200
|
+
outerHtml: "outerHtml";
|
|
201
|
+
attribute: "attribute";
|
|
202
|
+
}>>;
|
|
203
|
+
attributeName: z.ZodOptional<z.ZodString>;
|
|
204
|
+
returnMultiple: z.ZodDefault<z.ZodBoolean>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
output: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>;
|
|
207
|
+
run({ input }: RunArgs<typeof extractFromHtmlInput>): Promise<string | string[] | null>;
|
|
208
|
+
}];
|
|
209
|
+
}>;
|
|
210
|
+
export {};
|
|
28
211
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAIjF,QAAA,MAAM,eAAe;;;iBAMnB,CAAC;AAaH,QAAA,MAAM,gBAAgB;;;;;iBAUpB,CAAC;AAeH,QAAA,MAAM,cAAc;;;iBAGlB,CAAC;AAaH,QAAA,MAAM,aAAa;;;iBAGjB,CAAC;AAgBH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;iBAcvB,CAAC;AAwBH,QAAA,MAAM,SAAS;;iBAAiE,CAAC;AA4BjF,QAAA,MAAM,SAAS;;iBAAyD,CAAC;AAazE,QAAA,MAAM,iBAAi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|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
}
|
|
1
|
+
import { definePiece } from 'frogbot/pieces';
|
|
2
|
+
import { JSDOM, VirtualConsole } from 'jsdom';
|
|
3
|
+
import Showdown from 'showdown';
|
|
4
|
+
import slugify from 'slugify';
|
|
5
|
+
import { stripHtml as removeHtml } from 'string-strip-html';
|
|
6
|
+
import TurndownService from 'turndown';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
const textOutput = z.string();
|
|
9
|
+
const concatTextInput = z.object({
|
|
10
|
+
texts: z.array(z.unknown()).meta({ label: 'Texts' }),
|
|
11
|
+
separator: z.string().optional().meta({
|
|
12
|
+
label: 'Separator',
|
|
13
|
+
description: 'The text that separates the texts you want to concatenate',
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
const concatText = {
|
|
17
|
+
slug: 'concatText',
|
|
18
|
+
label: 'Concatenate Text',
|
|
19
|
+
description: 'Concatenate two or more texts.',
|
|
20
|
+
input: concatTextInput,
|
|
21
|
+
output: textOutput,
|
|
22
|
+
async run({ input }) {
|
|
23
|
+
return input.texts.join(input.separator ?? '');
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const replaceTextInput = z.object({
|
|
27
|
+
text: z.string().meta({ label: 'Text' }),
|
|
28
|
+
searchValue: z
|
|
29
|
+
.string()
|
|
30
|
+
.meta({ label: 'Search Value', description: 'Plain text or a regex expression.' }),
|
|
31
|
+
replaceValue: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.meta({ label: 'Replace Value', description: 'Leave empty to delete matches.' }),
|
|
35
|
+
replaceOnlyFirst: z.boolean().default(false).meta({ label: 'Replace Only First Match' }),
|
|
36
|
+
});
|
|
37
|
+
const replaceText = {
|
|
38
|
+
slug: 'replaceText',
|
|
39
|
+
label: 'Replace Text',
|
|
40
|
+
description: 'Replace matches of a word, character, phrase, or regular expression.',
|
|
41
|
+
input: replaceTextInput,
|
|
42
|
+
output: textOutput,
|
|
43
|
+
async run({ input }) {
|
|
44
|
+
const expression = new RegExp(input.searchValue, input.replaceOnlyFirst ? undefined : 'g');
|
|
45
|
+
return input.text.replace(expression, input.replaceValue ?? '');
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const splitTextInput = z.object({
|
|
49
|
+
text: z.string().meta({ label: 'Text' }),
|
|
50
|
+
delimiter: z.string().meta({ label: 'Delimiter' }),
|
|
51
|
+
});
|
|
52
|
+
const splitText = {
|
|
53
|
+
slug: 'splitText',
|
|
54
|
+
label: 'Split Text',
|
|
55
|
+
description: 'Split text by a delimiter.',
|
|
56
|
+
input: splitTextInput,
|
|
57
|
+
output: z.array(z.string()),
|
|
58
|
+
async run({ input }) {
|
|
59
|
+
return input.text.split(input.delimiter);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const findTextInput = z.object({
|
|
63
|
+
text: z.string().meta({ label: 'Text' }),
|
|
64
|
+
expression: z.string().meta({ label: 'Expression', description: 'Regex or text to search for.' }),
|
|
65
|
+
});
|
|
66
|
+
const findText = {
|
|
67
|
+
slug: 'findText',
|
|
68
|
+
label: 'Find Text',
|
|
69
|
+
description: 'Find a substring using text or a regular expression.',
|
|
70
|
+
input: findTextInput,
|
|
71
|
+
output: z.array(z.string()).nullable(),
|
|
72
|
+
async run({ input }) {
|
|
73
|
+
const match = input.text.match(new RegExp(input.expression));
|
|
74
|
+
return match ? Array.from(match) : null;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
const markdownFlavor = z.enum(['vanilla', 'original', 'github']);
|
|
78
|
+
const markdownToHtmlInput = z.object({
|
|
79
|
+
markdown: z.string().meta({ label: 'Markdown Content' }),
|
|
80
|
+
flavor: markdownFlavor.default('github').meta({ label: 'Flavor of Markdown' }),
|
|
81
|
+
headerLevelStart: z
|
|
82
|
+
.number()
|
|
83
|
+
.int()
|
|
84
|
+
.min(1)
|
|
85
|
+
.max(6)
|
|
86
|
+
.default(1)
|
|
87
|
+
.meta({ label: 'Minimum Header Level' }),
|
|
88
|
+
tables: z.boolean().default(true).meta({ label: 'Support Tables' }),
|
|
89
|
+
noHeaderId: z.boolean().default(false).meta({ label: 'No Header ID' }),
|
|
90
|
+
simpleLineBreaks: z.boolean().default(false).meta({ label: 'Simple Line Breaks' }),
|
|
91
|
+
openLinksInNewWindow: z.boolean().default(false).meta({ label: 'Open Links in New Window' }),
|
|
92
|
+
});
|
|
93
|
+
const convertMarkdownToHtml = {
|
|
94
|
+
slug: 'convertMarkdownToHtml',
|
|
95
|
+
label: 'Convert Markdown to HTML',
|
|
96
|
+
description: 'Convert Markdown to HTML.',
|
|
97
|
+
input: markdownToHtmlInput,
|
|
98
|
+
output: textOutput,
|
|
99
|
+
async run({ input }) {
|
|
100
|
+
const converter = new Showdown.Converter({
|
|
101
|
+
headerLevelStart: input.headerLevelStart,
|
|
102
|
+
omitExtraWLInCodeBlocks: true,
|
|
103
|
+
noHeaderId: input.noHeaderId,
|
|
104
|
+
tables: input.tables,
|
|
105
|
+
simpleLineBreaks: input.simpleLineBreaks,
|
|
106
|
+
openLinksInNewWindow: input.openLinksInNewWindow,
|
|
107
|
+
});
|
|
108
|
+
converter.setFlavor(input.flavor);
|
|
109
|
+
return converter.makeHtml(input.markdown);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
const htmlInput = z.object({ html: z.string().meta({ label: 'HTML Content' }) });
|
|
113
|
+
const convertHtmlToMarkdown = {
|
|
114
|
+
slug: 'convertHtmlToMarkdown',
|
|
115
|
+
label: 'Convert HTML to Markdown',
|
|
116
|
+
description: 'Convert HTML to Markdown.',
|
|
117
|
+
input: htmlInput,
|
|
118
|
+
output: textOutput,
|
|
119
|
+
async run({ input }) {
|
|
120
|
+
const service = new TurndownService();
|
|
121
|
+
service.remove('script');
|
|
122
|
+
return service.turndown(input.html);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const stripHtml = {
|
|
126
|
+
slug: 'stripHtml',
|
|
127
|
+
label: 'Strip HTML',
|
|
128
|
+
description: 'Remove HTML tags and return plain text.',
|
|
129
|
+
input: htmlInput,
|
|
130
|
+
output: textOutput,
|
|
131
|
+
async run({ input }) {
|
|
132
|
+
return removeHtml(input.html).result;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
const textInput = z.object({ text: z.string().meta({ label: 'Text' }) });
|
|
136
|
+
const slugifyText = {
|
|
137
|
+
slug: 'slugifyText',
|
|
138
|
+
label: 'Slugify Text',
|
|
139
|
+
description: 'Convert text to a URL-friendly slug.',
|
|
140
|
+
input: textInput,
|
|
141
|
+
output: textOutput,
|
|
142
|
+
async run({ input }) {
|
|
143
|
+
return slugify(input.text);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
const defaultValueInput = z.object({
|
|
147
|
+
value: z
|
|
148
|
+
.union([z.string(), z.array(z.unknown())])
|
|
149
|
+
.optional()
|
|
150
|
+
.meta({ label: 'Value' }),
|
|
151
|
+
defaultValue: z.string().meta({ label: 'Default Value' }),
|
|
152
|
+
});
|
|
153
|
+
const useDefaultValue = {
|
|
154
|
+
slug: 'useDefaultValue',
|
|
155
|
+
label: 'Use Default Value',
|
|
156
|
+
description: 'Return a default value when the input is empty.',
|
|
157
|
+
input: defaultValueInput,
|
|
158
|
+
output: z.union([z.string(), z.array(z.unknown())]),
|
|
159
|
+
async run({ input }) {
|
|
160
|
+
if (input.value === undefined || input.value === '' || input.value.length === 0) {
|
|
161
|
+
return input.defaultValue;
|
|
162
|
+
}
|
|
163
|
+
return input.value;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const tableRow = z.record(z.string(), z.unknown());
|
|
167
|
+
const createTextTableInput = z.object({ data: z.array(tableRow).meta({ label: 'List' }) });
|
|
168
|
+
const createTextTable = {
|
|
169
|
+
slug: 'createTextTable',
|
|
170
|
+
label: 'Create Text Table',
|
|
171
|
+
description: 'Convert a list of objects to an ASCII text table.',
|
|
172
|
+
input: createTextTableInput,
|
|
173
|
+
output: textOutput,
|
|
174
|
+
async run({ input }) {
|
|
175
|
+
if (input.data.length === 0)
|
|
176
|
+
return '';
|
|
177
|
+
const keys = Array.from(new Set(input.data.flatMap((row) => Object.keys(row))));
|
|
178
|
+
const widths = keys.map((key) => Math.max(key.length, ...input.data.map((row) => String(row[key] ?? '').length)));
|
|
179
|
+
const separator = `+${widths.map((width) => '-'.repeat(width + 2)).join('+')}+`;
|
|
180
|
+
const header = `|${keys.map((key, index) => ` ${key.padEnd(widths[index])} `).join('|')}|`;
|
|
181
|
+
const rows = input.data.map((row) => `|${keys.map((key, index) => ` ${String(row[key] ?? '').padEnd(widths[index])} `).join('|')}|`);
|
|
182
|
+
return [separator, header, separator, ...rows, separator].join('\n');
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
const extractionTarget = z.enum(['title', 'links', 'images', 'headings', 'paragraphs', 'custom']);
|
|
186
|
+
const extractionType = z.enum(['textContent', 'innerHtml', 'outerHtml', 'attribute']);
|
|
187
|
+
const extractFromHtmlInput = z.object({
|
|
188
|
+
html: z.string().meta({ label: 'HTML Content' }),
|
|
189
|
+
target: extractionTarget.default('title').meta({ label: 'Extraction Target' }),
|
|
190
|
+
selector: z.string().optional().meta({ label: 'Custom CSS Selector' }),
|
|
191
|
+
extractionType: extractionType.default('textContent').meta({ label: 'Extraction Type' }),
|
|
192
|
+
attributeName: z.string().optional().meta({ label: 'Attribute Name' }),
|
|
193
|
+
returnMultiple: z.boolean().default(false).meta({ label: 'Return Multiple Elements' }),
|
|
194
|
+
});
|
|
195
|
+
const extractFromHtml = {
|
|
196
|
+
slug: 'extractFromHtml',
|
|
197
|
+
label: 'Extract from HTML',
|
|
198
|
+
description: 'Extract specific elements or data from an HTML document.',
|
|
199
|
+
input: extractFromHtmlInput,
|
|
200
|
+
output: z.union([z.string(), z.array(z.string()), z.null()]),
|
|
201
|
+
async run({ input }) {
|
|
202
|
+
const selectors = {
|
|
203
|
+
title: 'title',
|
|
204
|
+
links: 'a[href]',
|
|
205
|
+
images: 'img[src]',
|
|
206
|
+
headings: 'h1, h2, h3',
|
|
207
|
+
paragraphs: 'p',
|
|
208
|
+
};
|
|
209
|
+
if (input.target === 'custom' && !input.selector) {
|
|
210
|
+
throw new Error('You must provide a "Custom CSS Selector" when the target is set to Custom.');
|
|
211
|
+
}
|
|
212
|
+
if (input.extractionType === 'attribute' && !input.attributeName) {
|
|
213
|
+
throw new Error('You must provide an "Attribute Name" when the extraction type is Attribute.');
|
|
214
|
+
}
|
|
215
|
+
const selector = input.target === 'custom' ? input.selector : selectors[input.target];
|
|
216
|
+
const dom = new JSDOM(input.html, {
|
|
217
|
+
includeNodeLocations: false,
|
|
218
|
+
virtualConsole: new VirtualConsole(),
|
|
219
|
+
});
|
|
220
|
+
try {
|
|
221
|
+
let elements;
|
|
222
|
+
try {
|
|
223
|
+
elements = dom.window.document.querySelectorAll(selector);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
throw new Error(`Invalid CSS selector: "${selector}". Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
227
|
+
}
|
|
228
|
+
const extract = (element) => {
|
|
229
|
+
if (input.extractionType === 'innerHtml')
|
|
230
|
+
return element.innerHTML;
|
|
231
|
+
if (input.extractionType === 'outerHtml')
|
|
232
|
+
return element.outerHTML;
|
|
233
|
+
if (input.extractionType === 'attribute') {
|
|
234
|
+
return element.getAttribute(input.attributeName) ?? '';
|
|
235
|
+
}
|
|
236
|
+
return element.textContent?.trim() ?? '';
|
|
237
|
+
};
|
|
238
|
+
if (input.returnMultiple)
|
|
239
|
+
return Array.from(elements, extract);
|
|
240
|
+
return elements[0] ? extract(elements[0]) : null;
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
dom.window.close();
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
export const createTextHelper = definePiece({
|
|
248
|
+
slug: 'text-helper',
|
|
249
|
+
label: 'Text Helper',
|
|
250
|
+
admin: { description: 'Tools for text processing', group: 'Core' },
|
|
251
|
+
actions: [
|
|
252
|
+
concatText,
|
|
253
|
+
replaceText,
|
|
254
|
+
splitText,
|
|
255
|
+
findText,
|
|
256
|
+
convertMarkdownToHtml,
|
|
257
|
+
convertHtmlToMarkdown,
|
|
258
|
+
stripHtml,
|
|
259
|
+
slugifyText,
|
|
260
|
+
useDefaultValue,
|
|
261
|
+
createTextTable,
|
|
262
|
+
extractFromHtml,
|
|
263
|
+
],
|
|
264
|
+
});
|
|
51
265
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAA2B,MAAM,gBAAgB,CAAC;AAElF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;IACN,kBAAkB;IAClB,kBAAkB;IAClB,WAAW;IACX,SAAS;IACT,cAAc;IACd,qBAAqB;IACrB,mBAAmB;CACX,CAAC;AACX,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAW,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,MAA2B;IAC1D,MAAM,KAAK,GAAG,uBAAuB,CAAC;QACpC,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,aAAa;QACtB,cAAc,EAAE,MAAM;QACtB,cAAc,EAAE,iBAAiB;QACjC,MAAM,EAAE,gBAAgB;QACxB,MAAM;KACP,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC1B,iDAAiD;QACjD,MAAM,EAA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G,WAAW,CAAC;IAC1C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,EAAE;IAClE,OAAO,EAAE;QACP,UAAU;QACV,WAAW;QACX,SAAS;QACT,QAAQ;QACR,qBAAqB;QACrB,qBAAqB;QACrB,SAAS;QACT,WAAW;QACX,eAAe;QACf,eAAe;QACf,eAAe;KAChB;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frogbotai/piece-text-helper",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"description": "text-helper tools for FrogBot.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Colby Gilbert",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/frogbotai/frogbot.git",
|
|
10
|
-
"directory": "packages/pieces/piece-text-helper"
|
|
11
|
-
},
|
|
12
7
|
"type": "module",
|
|
13
8
|
"main": "./dist/index.js",
|
|
14
9
|
"types": "./dist/index.d.ts",
|
|
@@ -24,14 +19,22 @@
|
|
|
24
19
|
],
|
|
25
20
|
"sideEffects": false,
|
|
26
21
|
"dependencies": {
|
|
27
|
-
"
|
|
22
|
+
"jsdom": "^24.0.0",
|
|
23
|
+
"showdown": "2.1.0",
|
|
24
|
+
"slugify": "1.6.6",
|
|
25
|
+
"string-strip-html": "8.5.0",
|
|
26
|
+
"turndown": "7.2.0",
|
|
27
|
+
"zod": "^4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"frogbot": "0.
|
|
30
|
+
"frogbot": "0.23.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@types/jsdom": "^21.1.6",
|
|
34
|
+
"@types/showdown": "2.0.6",
|
|
35
|
+
"@types/turndown": "^5.0.6",
|
|
33
36
|
"typescript": "5.6.2",
|
|
34
|
-
"frogbot": "0.
|
|
37
|
+
"frogbot": "0.23.0"
|
|
35
38
|
},
|
|
36
39
|
"publishConfig": {
|
|
37
40
|
"access": "public"
|