@taskmagic/apps-textcortex-ai 0.0.1
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 +7 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +47 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-code.d.ts +8 -0
- package/src/lib/actions/create-code.js +120 -0
- package/src/lib/actions/create-code.js.map +1 -0
- package/src/lib/actions/create-email.d.ts +17 -0
- package/src/lib/actions/create-email.js +233 -0
- package/src/lib/actions/create-email.js.map +1 -0
- package/src/lib/actions/create-paraphrase.d.ts +12 -0
- package/src/lib/actions/create-paraphrase.js +191 -0
- package/src/lib/actions/create-paraphrase.js.map +1 -0
- package/src/lib/actions/create-product-description.d.ts +14 -0
- package/src/lib/actions/create-product-description.js +198 -0
- package/src/lib/actions/create-product-description.js.map +1 -0
- package/src/lib/actions/create-social-caption.d.ts +12 -0
- package/src/lib/actions/create-social-caption.js +184 -0
- package/src/lib/actions/create-social-caption.js.map +1 -0
- package/src/lib/actions/create-summary.d.ts +12 -0
- package/src/lib/actions/create-summary.js +191 -0
- package/src/lib/actions/create-summary.js.map +1 -0
- package/src/lib/actions/create-translation.d.ts +6 -0
- package/src/lib/actions/create-translation.js +113 -0
- package/src/lib/actions/create-translation.js.map +1 -0
- package/src/lib/actions/send-prompt.d.ts +10 -0
- package/src/lib/actions/send-prompt.js +162 -0
- package/src/lib/actions/send-prompt.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +66 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +12 -0
- package/src/lib/common/client.js +26 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/common.d.ts +58 -0
- package/src/lib/common/common.js +231 -0
- package/src/lib/common/common.js.map +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createSummary: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
text: import("@taskmagic/pieces-framework").LongTextProperty<false>;
|
|
3
|
+
file_id: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
mode: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
model: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
formality: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
source_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
target_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
max_tokens: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
10
|
+
temperature: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
11
|
+
n: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.createSummary = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'create_summary',
|
|
13
|
+
displayName: 'Create Summary',
|
|
14
|
+
description: 'Summarize input text to concise form.',
|
|
15
|
+
props: {
|
|
16
|
+
text: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Text to Summarize',
|
|
18
|
+
description: 'The text to summarize',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
21
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'File ID',
|
|
23
|
+
description: 'ID of the file to summarize',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
mode: pieces_framework_1.Property.StaticDropdown({
|
|
27
|
+
displayName: 'Mode',
|
|
28
|
+
description: 'Summarization mode',
|
|
29
|
+
required: false,
|
|
30
|
+
defaultValue: 'default',
|
|
31
|
+
options: {
|
|
32
|
+
options: [
|
|
33
|
+
{ label: 'Default', value: 'default' },
|
|
34
|
+
{ label: 'Embeddings', value: 'embeddings' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
39
|
+
displayName: 'Model',
|
|
40
|
+
description: 'The language model to use',
|
|
41
|
+
required: false,
|
|
42
|
+
defaultValue: 'gemini-2-0-flash',
|
|
43
|
+
options: {
|
|
44
|
+
options: common_1.AI_MODELS,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
48
|
+
displayName: 'Formality',
|
|
49
|
+
description: 'The formality of the generated text',
|
|
50
|
+
required: false,
|
|
51
|
+
defaultValue: 'default',
|
|
52
|
+
options: {
|
|
53
|
+
options: common_1.FORMALITY_LEVELS,
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
57
|
+
displayName: 'Source Language',
|
|
58
|
+
description: 'The language of the source text',
|
|
59
|
+
required: false,
|
|
60
|
+
defaultValue: 'en',
|
|
61
|
+
options: {
|
|
62
|
+
options: [
|
|
63
|
+
{ label: 'English (Default)', value: 'en' },
|
|
64
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
65
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
70
|
+
displayName: 'Target Language',
|
|
71
|
+
description: 'The language for the summary',
|
|
72
|
+
required: false,
|
|
73
|
+
defaultValue: 'en',
|
|
74
|
+
options: {
|
|
75
|
+
options: [
|
|
76
|
+
{ label: 'English (American)', value: 'en' },
|
|
77
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
78
|
+
{ label: 'Spanish', value: 'es' },
|
|
79
|
+
{ label: 'French', value: 'fr' },
|
|
80
|
+
{ label: 'German', value: 'de' },
|
|
81
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
82
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
83
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
max_tokens: pieces_framework_1.Property.Number({
|
|
88
|
+
displayName: 'Max Tokens',
|
|
89
|
+
description: 'Maximum length of summary (1-4096 tokens)',
|
|
90
|
+
required: false,
|
|
91
|
+
defaultValue: 2048,
|
|
92
|
+
}),
|
|
93
|
+
temperature: pieces_framework_1.Property.Number({
|
|
94
|
+
displayName: 'Temperature',
|
|
95
|
+
description: 'Controls creativity (0.0-2.0). Higher values = more creative, lower = more focused.',
|
|
96
|
+
required: false,
|
|
97
|
+
}),
|
|
98
|
+
n: pieces_framework_1.Property.Number({
|
|
99
|
+
displayName: 'Number of Outputs',
|
|
100
|
+
description: 'How many summaries to generate (1-5)',
|
|
101
|
+
required: false,
|
|
102
|
+
defaultValue: 1,
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
run(context) {
|
|
106
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
|
+
try {
|
|
109
|
+
if (!context.propsValue.text && !context.propsValue.file_id) {
|
|
110
|
+
throw new Error('Please provide either "Text to Summarize" or "File ID" to create a summary.');
|
|
111
|
+
}
|
|
112
|
+
const requestBody = {};
|
|
113
|
+
if (context.propsValue.text) {
|
|
114
|
+
requestBody.text = context.propsValue.text;
|
|
115
|
+
}
|
|
116
|
+
if (context.propsValue.file_id) {
|
|
117
|
+
requestBody.file_id = context.propsValue.file_id;
|
|
118
|
+
}
|
|
119
|
+
if (context.propsValue.mode && context.propsValue.mode !== 'default') {
|
|
120
|
+
requestBody.mode = context.propsValue.mode;
|
|
121
|
+
}
|
|
122
|
+
if (context.propsValue.model && context.propsValue.model !== 'gemini-2-0-flash') {
|
|
123
|
+
requestBody.model = context.propsValue.model;
|
|
124
|
+
}
|
|
125
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
126
|
+
requestBody.formality = context.propsValue.formality;
|
|
127
|
+
}
|
|
128
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
129
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
130
|
+
}
|
|
131
|
+
if (context.propsValue.target_lang && context.propsValue.target_lang !== 'en') {
|
|
132
|
+
requestBody.target_lang = context.propsValue.target_lang;
|
|
133
|
+
}
|
|
134
|
+
if (context.propsValue.max_tokens && context.propsValue.max_tokens !== 2048) {
|
|
135
|
+
requestBody.max_tokens = context.propsValue.max_tokens;
|
|
136
|
+
}
|
|
137
|
+
if (context.propsValue.temperature !== undefined) {
|
|
138
|
+
requestBody.temperature = context.propsValue.temperature;
|
|
139
|
+
}
|
|
140
|
+
if (context.propsValue.n && context.propsValue.n !== 1) {
|
|
141
|
+
requestBody.n = context.propsValue.n;
|
|
142
|
+
}
|
|
143
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
144
|
+
auth: context.auth,
|
|
145
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
146
|
+
resourceUri: common_1.API_ENDPOINTS.SUMMARIZATIONS,
|
|
147
|
+
body: requestBody,
|
|
148
|
+
});
|
|
149
|
+
const outputs = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.outputs) || [];
|
|
150
|
+
const generatedSummary = outputs.length > 0 ? outputs[0].text : response.body.text || response.body;
|
|
151
|
+
return {
|
|
152
|
+
success: true,
|
|
153
|
+
summary: generatedSummary,
|
|
154
|
+
outputs: outputs,
|
|
155
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
156
|
+
metadata: {
|
|
157
|
+
original_text_length: context.propsValue.text ? context.propsValue.text.length : 0,
|
|
158
|
+
mode: context.propsValue.mode || 'default',
|
|
159
|
+
model: context.propsValue.model || 'gemini-2-0-flash',
|
|
160
|
+
formality: context.propsValue.formality || 'default',
|
|
161
|
+
file_id: context.propsValue.file_id,
|
|
162
|
+
parameters: {
|
|
163
|
+
max_tokens: context.propsValue.max_tokens || 2048,
|
|
164
|
+
temperature: context.propsValue.temperature,
|
|
165
|
+
n: context.propsValue.n || 1,
|
|
166
|
+
source_lang: context.propsValue.source_lang || 'en',
|
|
167
|
+
target_lang: context.propsValue.target_lang || 'en',
|
|
168
|
+
},
|
|
169
|
+
timestamp: new Date().toISOString(),
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
175
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
176
|
+
}
|
|
177
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
178
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
179
|
+
}
|
|
180
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
181
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
182
|
+
}
|
|
183
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
184
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
185
|
+
}
|
|
186
|
+
throw new Error(`Summary generation failed: ${error.message || 'Unknown error'}`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=create-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-summary.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/create-summary.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,yCAAgD;AAChD,6CAAoD;AACpD,6CAAyF;AAE5E,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,SAAS;YACvB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACtC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;iBAC7C;aACF;SACF,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC7B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE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AC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const createTranslation: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
text: import("@taskmagic/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
target_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
source_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
formality: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTranslation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.createTranslation = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'create_translation',
|
|
13
|
+
displayName: 'Create Translation',
|
|
14
|
+
description: 'Translate input text into a target language.',
|
|
15
|
+
props: {
|
|
16
|
+
text: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Text to Translate',
|
|
18
|
+
description: 'The text to translate',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Target Language',
|
|
23
|
+
description: 'The language to translate to',
|
|
24
|
+
required: true,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'English (American)', value: 'en' },
|
|
28
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
29
|
+
{ label: 'Spanish', value: 'es' },
|
|
30
|
+
{ label: 'French', value: 'fr' },
|
|
31
|
+
{ label: 'German', value: 'de' },
|
|
32
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
33
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
34
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
39
|
+
displayName: 'Source Language',
|
|
40
|
+
description: 'The language of the text to translate',
|
|
41
|
+
required: false,
|
|
42
|
+
defaultValue: 'en',
|
|
43
|
+
options: {
|
|
44
|
+
options: [
|
|
45
|
+
{ label: 'English (Default)', value: 'en' },
|
|
46
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
47
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
52
|
+
displayName: 'Formality',
|
|
53
|
+
description: 'The formality of the generated text',
|
|
54
|
+
required: false,
|
|
55
|
+
defaultValue: 'default',
|
|
56
|
+
options: {
|
|
57
|
+
options: common_1.FORMALITY_LEVELS,
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
run(context) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
|
+
try {
|
|
65
|
+
const requestBody = {
|
|
66
|
+
text: context.propsValue.text,
|
|
67
|
+
target_lang: context.propsValue.target_lang,
|
|
68
|
+
};
|
|
69
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
70
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
71
|
+
}
|
|
72
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
73
|
+
requestBody.formality = context.propsValue.formality;
|
|
74
|
+
}
|
|
75
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
76
|
+
auth: context.auth,
|
|
77
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
78
|
+
resourceUri: common_1.API_ENDPOINTS.TRANSLATIONS,
|
|
79
|
+
body: requestBody,
|
|
80
|
+
});
|
|
81
|
+
const translatedText = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.text) || response.body.text || response.body;
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
original_text: context.propsValue.text,
|
|
85
|
+
translated_text: translatedText,
|
|
86
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
87
|
+
metadata: {
|
|
88
|
+
source_language: context.propsValue.source_lang || 'en',
|
|
89
|
+
target_language: context.propsValue.target_lang,
|
|
90
|
+
formality: context.propsValue.formality || 'default',
|
|
91
|
+
timestamp: new Date().toISOString(),
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
97
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
98
|
+
}
|
|
99
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
100
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
101
|
+
}
|
|
102
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
103
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
104
|
+
}
|
|
105
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
106
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
107
|
+
}
|
|
108
|
+
throw new Error(`Translation failed: ${error.message || 'Unknown error'}`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=create-translation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-translation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/create-translation.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,yCAAgD;AAChD,6CAAoD;AACpD,6CAA8E;AAEjE,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC5C,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE;oBAC9C,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE;oBACjC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;oBAChC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;oBAChC,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE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E,CAAC;gBACD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACnC,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;gBACrG,CAAC;gBACD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACnC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;gBAC1E,CAAC;gBACD,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,CAAC,SAAS,CAAC,MAAI,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,CAAC,SAAS,CAAC,CAAA,EAAE,CAAC;oBAC7E,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;gBAChF,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const sendPrompt: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
text: import("@taskmagic/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
model: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
formality: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
source_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
target_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
max_tokens: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
8
|
+
temperature: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
9
|
+
n: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendPrompt = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.sendPrompt = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'send_prompt',
|
|
13
|
+
displayName: 'Send Prompt',
|
|
14
|
+
description: 'Send a custom prompt to TextCortex AI and generate a completion.',
|
|
15
|
+
props: {
|
|
16
|
+
text: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Text to Complete',
|
|
18
|
+
description: 'Enter the beginning of your text and AI will complete it (e.g., "The benefits of renewable energy are")',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Model',
|
|
23
|
+
description: 'The language model to use',
|
|
24
|
+
required: false,
|
|
25
|
+
defaultValue: 'gemini-2-0-flash',
|
|
26
|
+
options: {
|
|
27
|
+
options: common_1.AI_MODELS,
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
31
|
+
displayName: 'Formality',
|
|
32
|
+
description: 'The formality of the generated text',
|
|
33
|
+
required: false,
|
|
34
|
+
defaultValue: 'default',
|
|
35
|
+
options: {
|
|
36
|
+
options: common_1.FORMALITY_LEVELS,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
40
|
+
displayName: 'Source Language',
|
|
41
|
+
description: 'The language of the source text',
|
|
42
|
+
required: false,
|
|
43
|
+
defaultValue: 'en',
|
|
44
|
+
options: {
|
|
45
|
+
options: [
|
|
46
|
+
{ label: 'English (Default)', value: 'en' },
|
|
47
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
48
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
53
|
+
displayName: 'Target Language',
|
|
54
|
+
description: 'The language for the generated text',
|
|
55
|
+
required: false,
|
|
56
|
+
defaultValue: 'en',
|
|
57
|
+
options: {
|
|
58
|
+
options: [
|
|
59
|
+
{ label: 'English (American)', value: 'en' },
|
|
60
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
61
|
+
{ label: 'Spanish', value: 'es' },
|
|
62
|
+
{ label: 'French', value: 'fr' },
|
|
63
|
+
{ label: 'German', value: 'de' },
|
|
64
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
65
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
66
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
max_tokens: pieces_framework_1.Property.Number({
|
|
71
|
+
displayName: 'Max Tokens',
|
|
72
|
+
description: 'Maximum length of generated text (1-4096 tokens)',
|
|
73
|
+
required: false,
|
|
74
|
+
defaultValue: 2048,
|
|
75
|
+
}),
|
|
76
|
+
temperature: pieces_framework_1.Property.Number({
|
|
77
|
+
displayName: 'Temperature',
|
|
78
|
+
description: 'Controls creativity (0.0-2.0). Higher values = more creative, lower = more focused.',
|
|
79
|
+
required: false,
|
|
80
|
+
}),
|
|
81
|
+
n: pieces_framework_1.Property.Number({
|
|
82
|
+
displayName: 'Number of Outputs',
|
|
83
|
+
description: 'How many completions to generate (1-5)',
|
|
84
|
+
required: false,
|
|
85
|
+
defaultValue: 1,
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
88
|
+
run(context) {
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
91
|
+
try {
|
|
92
|
+
const requestBody = {
|
|
93
|
+
text: context.propsValue.text,
|
|
94
|
+
};
|
|
95
|
+
if (context.propsValue.model && context.propsValue.model !== 'gemini-2-0-flash') {
|
|
96
|
+
requestBody.model = context.propsValue.model;
|
|
97
|
+
}
|
|
98
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
99
|
+
requestBody.formality = context.propsValue.formality;
|
|
100
|
+
}
|
|
101
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
102
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
103
|
+
}
|
|
104
|
+
if (context.propsValue.target_lang && context.propsValue.target_lang !== 'en') {
|
|
105
|
+
requestBody.target_lang = context.propsValue.target_lang;
|
|
106
|
+
}
|
|
107
|
+
if (context.propsValue.max_tokens && context.propsValue.max_tokens !== 2048) {
|
|
108
|
+
requestBody.max_tokens = context.propsValue.max_tokens;
|
|
109
|
+
}
|
|
110
|
+
if (context.propsValue.temperature !== undefined) {
|
|
111
|
+
requestBody.temperature = context.propsValue.temperature;
|
|
112
|
+
}
|
|
113
|
+
if (context.propsValue.n && context.propsValue.n !== 1) {
|
|
114
|
+
requestBody.n = context.propsValue.n;
|
|
115
|
+
}
|
|
116
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
117
|
+
auth: context.auth,
|
|
118
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
119
|
+
resourceUri: common_1.API_ENDPOINTS.COMPLETIONS,
|
|
120
|
+
body: requestBody,
|
|
121
|
+
});
|
|
122
|
+
const outputs = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.outputs) || [];
|
|
123
|
+
const generatedText = outputs.length > 0 ? outputs[0].text : response.body.text || response.body;
|
|
124
|
+
return {
|
|
125
|
+
success: true,
|
|
126
|
+
text: generatedText,
|
|
127
|
+
outputs: outputs,
|
|
128
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
129
|
+
metadata: {
|
|
130
|
+
prompt: context.propsValue.text,
|
|
131
|
+
model: context.propsValue.model || 'gemini-2-0-flash',
|
|
132
|
+
formality: context.propsValue.formality || 'default',
|
|
133
|
+
parameters: {
|
|
134
|
+
max_tokens: context.propsValue.max_tokens || 2048,
|
|
135
|
+
temperature: context.propsValue.temperature,
|
|
136
|
+
n: context.propsValue.n || 1,
|
|
137
|
+
source_lang: context.propsValue.source_lang || 'en',
|
|
138
|
+
target_lang: context.propsValue.target_lang || 'en',
|
|
139
|
+
},
|
|
140
|
+
timestamp: new Date().toISOString(),
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
146
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
147
|
+
}
|
|
148
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
149
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
150
|
+
}
|
|
151
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
152
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
153
|
+
}
|
|
154
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
155
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
156
|
+
}
|
|
157
|
+
throw new Error(`Text generation failed: ${error.message || 'Unknown error'}`);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=send-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-prompt.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/send-prompt.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,yCAAgD;AAChD,6CAAoD;AACpD,6CAAyF;AAE5E,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,yGAAyG;YACtH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC7B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,kBAAkB;YAChC,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAS;aACnB;SACF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACjC,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,SAAS;YACvB,OAAO,EAAE;gBACP,OAAO,EAAE,yBAAgB;aAC1B;SACF,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC3C,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE;oBACvC,GAAG,kBAAS,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ic/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textcortexAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
exports.textcortexAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'API Key',
|
|
9
|
+
description: `To get your TextCortex API key:
|
|
10
|
+
1. Sign up for free at https://textcortex.com
|
|
11
|
+
2. Go to your account settings
|
|
12
|
+
3. Navigate to the API Key section
|
|
13
|
+
4. Generate and copy your API key
|
|
14
|
+
|
|
15
|
+
Your API key should start with 'gAAAAAB...'`,
|
|
16
|
+
required: true,
|
|
17
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
+
var _b, _c, _d, _e;
|
|
19
|
+
try {
|
|
20
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
21
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
22
|
+
url: 'https://api.textcortex.com/v1/texts/completions',
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
authentication: {
|
|
27
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
28
|
+
token: auth,
|
|
29
|
+
},
|
|
30
|
+
body: {
|
|
31
|
+
text: 'test',
|
|
32
|
+
max_tokens: 1,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return { valid: true };
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
39
|
+
return {
|
|
40
|
+
valid: false,
|
|
41
|
+
error: 'Invalid API key. Please check your TextCortex API key and try again.',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (((_c = e.response) === null || _c === void 0 ? void 0 : _c.status) === 429) {
|
|
45
|
+
return {
|
|
46
|
+
valid: false,
|
|
47
|
+
error: 'Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (((_d = e.response) === null || _d === void 0 ? void 0 : _d.status) === 400) {
|
|
51
|
+
return { valid: true };
|
|
52
|
+
}
|
|
53
|
+
if ((_e = e.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('network')) {
|
|
54
|
+
return {
|
|
55
|
+
valid: false,
|
|
56
|
+
error: 'Network error. Please check your internet connection and try again.',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
valid: false,
|
|
61
|
+
error: 'Authentication failed. Please verify your API key is correct.',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,kEAAwD;AACxD,4DAAsF;AAEzE,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;;4CAM6B;IAC1C,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,iDAAiD;gBACtD,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;iBACnC;gBACD,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI;iBACZ;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,UAAU,EAAE,CAAC;iBACd;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,IAAI,CAAA,MAAA,CAAC,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBAC/B,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,sEAAsE;iBAC9E,CAAC;YACJ,CAAC;YACD,IAAI,CAAA,MAAA,CAAC,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBAC/B,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,iFAAiF;iBACzF,CAAC;YACJ,CAAC;YACD,IAAI,CAAA,MAAA,CAAC,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBAC/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YACD,IAAI,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACjD,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,qEAAqE;iBAC7E,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,+DAA+D;aACvE,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpMethod } from '@taskmagic/pieces-common';
|
|
2
|
+
import { PiecePropValueSchema } from '@taskmagic/pieces-framework';
|
|
3
|
+
import { textcortexAuth } from './auth';
|
|
4
|
+
export declare const textcortexCommon: {
|
|
5
|
+
apiCall({ auth, method, resourceUri, body, headers, }: {
|
|
6
|
+
auth: PiecePropValueSchema<typeof textcortexAuth>;
|
|
7
|
+
method: HttpMethod;
|
|
8
|
+
resourceUri: string;
|
|
9
|
+
body?: any;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
}): Promise<import("@taskmagic/pieces-common").HttpResponse<any>>;
|
|
12
|
+
};
|