@promptbook/core 0.84.0-0 → 0.84.0-11
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 +1 -0
- package/esm/index.es.js +264 -98
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
- package/esm/typings/src/_packages/pdf.index.d.ts +6 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +8 -0
- package/esm/typings/src/constants.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +5 -0
- package/esm/typings/src/pipeline/prompt-notation.d.ts +31 -0
- package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
- package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +265 -97
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
30
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-10';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -180,22 +180,94 @@
|
|
|
180
180
|
*/
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
183
|
+
* Checks if value is valid email
|
|
184
184
|
*
|
|
185
185
|
* @public exported from `@promptbook/utils`
|
|
186
186
|
*/
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
function isValidEmail(email) {
|
|
188
|
+
if (typeof email !== 'string') {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
if (email.split('\n').length > 1) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
return /^.+@.+\..+$/.test(email);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Tests if given string is valid URL.
|
|
199
|
+
*
|
|
200
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
201
|
+
* @public exported from `@promptbook/utils`
|
|
202
|
+
*/
|
|
203
|
+
function isValidFilePath(filename) {
|
|
204
|
+
if (typeof filename !== 'string') {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
if (filename.split('\n').length > 1) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
if (filename.split(' ').length >
|
|
211
|
+
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
var filenameSlashes = filename.split('\\').join('/');
|
|
215
|
+
// Absolute Unix path: /hello.txt
|
|
216
|
+
if (/^(\/)/i.test(filenameSlashes)) {
|
|
217
|
+
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
190
218
|
return true;
|
|
191
219
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
220
|
+
// Absolute Windows path: /hello.txt
|
|
221
|
+
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
222
|
+
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
// Relative path: ./hello.txt
|
|
226
|
+
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
227
|
+
// console.log(filename, 'Relative path: ./hello.txt');
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
// Allow paths like foo/hello
|
|
231
|
+
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
232
|
+
// console.log(filename, 'Allow paths like foo/hello');
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
// Allow paths like hello.book
|
|
236
|
+
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
237
|
+
// console.log(filename, 'Allow paths like hello.book');
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* TODO: [🍏] Implement for MacOs
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Tests if given string is valid URL.
|
|
248
|
+
*
|
|
249
|
+
* Note: Dataurl are considered perfectly valid.
|
|
250
|
+
* Note: There are two simmilar functions:
|
|
251
|
+
* - `isValidUrl` which tests any URL
|
|
252
|
+
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
253
|
+
*
|
|
254
|
+
* @public exported from `@promptbook/utils`
|
|
255
|
+
*/
|
|
256
|
+
function isValidUrl(url) {
|
|
257
|
+
if (typeof url !== 'string') {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
if (url.startsWith('blob:')) {
|
|
262
|
+
url = url.replace(/^blob:/, '');
|
|
195
263
|
}
|
|
196
|
-
|
|
264
|
+
var urlObject = new URL(url /* because fail is handled */);
|
|
265
|
+
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
197
266
|
return false;
|
|
198
267
|
}
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
199
271
|
return false;
|
|
200
272
|
}
|
|
201
273
|
}
|
|
@@ -219,6 +291,27 @@
|
|
|
219
291
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
220
292
|
*/
|
|
221
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
296
|
+
*
|
|
297
|
+
* @public exported from `@promptbook/utils`
|
|
298
|
+
*/
|
|
299
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
300
|
+
try {
|
|
301
|
+
JSON.parse(value);
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
if (!(error instanceof Error)) {
|
|
306
|
+
throw error;
|
|
307
|
+
}
|
|
308
|
+
if (error.message.includes('Unexpected token')) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
222
315
|
/**
|
|
223
316
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
224
317
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
@@ -232,6 +325,15 @@
|
|
|
232
325
|
if (isValidJsonString(pipelineString)) {
|
|
233
326
|
throw new ParseError('Expected a book, but got a JSON string');
|
|
234
327
|
}
|
|
328
|
+
else if (isValidUrl(pipelineString)) {
|
|
329
|
+
throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
|
|
330
|
+
}
|
|
331
|
+
else if (isValidFilePath(pipelineString)) {
|
|
332
|
+
throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
|
|
333
|
+
}
|
|
334
|
+
else if (isValidEmail(pipelineString)) {
|
|
335
|
+
throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
|
|
336
|
+
}
|
|
235
337
|
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
236
338
|
return pipelineString;
|
|
237
339
|
}
|
|
@@ -528,7 +630,7 @@
|
|
|
528
630
|
*
|
|
529
631
|
* @public exported from `@promptbook/core`
|
|
530
632
|
*/
|
|
531
|
-
var ADMIN_EMAIL = '
|
|
633
|
+
var ADMIN_EMAIL = 'pavol@ptbk.io';
|
|
532
634
|
/**
|
|
533
635
|
* Name of the responsible person for the Promptbook on GitHub
|
|
534
636
|
*
|
|
@@ -1039,7 +1141,7 @@
|
|
|
1039
1141
|
*
|
|
1040
1142
|
* @private within the repository
|
|
1041
1143
|
*/
|
|
1042
|
-
var REPLACING_NONCE = '
|
|
1144
|
+
var REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
1043
1145
|
/**
|
|
1044
1146
|
* @@@
|
|
1045
1147
|
*
|
|
@@ -1185,35 +1287,6 @@
|
|
|
1185
1287
|
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1186
1288
|
}
|
|
1187
1289
|
|
|
1188
|
-
/**
|
|
1189
|
-
* Tests if given string is valid URL.
|
|
1190
|
-
*
|
|
1191
|
-
* Note: Dataurl are considered perfectly valid.
|
|
1192
|
-
* Note: There are two simmilar functions:
|
|
1193
|
-
* - `isValidUrl` which tests any URL
|
|
1194
|
-
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
1195
|
-
*
|
|
1196
|
-
* @public exported from `@promptbook/utils`
|
|
1197
|
-
*/
|
|
1198
|
-
function isValidUrl(url) {
|
|
1199
|
-
if (typeof url !== 'string') {
|
|
1200
|
-
return false;
|
|
1201
|
-
}
|
|
1202
|
-
try {
|
|
1203
|
-
if (url.startsWith('blob:')) {
|
|
1204
|
-
url = url.replace(/^blob:/, '');
|
|
1205
|
-
}
|
|
1206
|
-
var urlObject = new URL(url /* because fail is handled */);
|
|
1207
|
-
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
1208
|
-
return false;
|
|
1209
|
-
}
|
|
1210
|
-
return true;
|
|
1211
|
-
}
|
|
1212
|
-
catch (error) {
|
|
1213
|
-
return false;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
1290
|
/**
|
|
1218
1291
|
* Tests if given string is valid pipeline URL URL.
|
|
1219
1292
|
*
|
|
@@ -2086,7 +2159,7 @@
|
|
|
2086
2159
|
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
2087
2160
|
__extends(NotYetImplementedError, _super);
|
|
2088
2161
|
function NotYetImplementedError(message) {
|
|
2089
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on
|
|
2162
|
+
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on pavol@ptbk.io\n\n "); })) || this;
|
|
2090
2163
|
_this.name = 'NotYetImplementedError';
|
|
2091
2164
|
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
2092
2165
|
return _this;
|
|
@@ -2172,12 +2245,28 @@
|
|
|
2172
2245
|
/**
|
|
2173
2246
|
* Asserts that the execution of a Promptbook is successful
|
|
2174
2247
|
*
|
|
2248
|
+
* Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
|
|
2249
|
+
*
|
|
2175
2250
|
* @param executionResult - The partial result of the Promptbook execution
|
|
2176
2251
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
2177
2252
|
* @public exported from `@promptbook/core`
|
|
2178
2253
|
*/
|
|
2179
2254
|
function assertsExecutionSuccessful(executionResult) {
|
|
2180
|
-
var
|
|
2255
|
+
var e_1, _a;
|
|
2256
|
+
var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors, warnings = executionResult.warnings;
|
|
2257
|
+
try {
|
|
2258
|
+
for (var warnings_1 = __values(warnings), warnings_1_1 = warnings_1.next(); !warnings_1_1.done; warnings_1_1 = warnings_1.next()) {
|
|
2259
|
+
var warning = warnings_1_1.value;
|
|
2260
|
+
console.warn(warning.message);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2264
|
+
finally {
|
|
2265
|
+
try {
|
|
2266
|
+
if (warnings_1_1 && !warnings_1_1.done && (_a = warnings_1.return)) _a.call(warnings_1);
|
|
2267
|
+
}
|
|
2268
|
+
finally { if (e_1) throw e_1.error; }
|
|
2269
|
+
}
|
|
2181
2270
|
if (isSuccessful === true) {
|
|
2182
2271
|
return;
|
|
2183
2272
|
}
|
|
@@ -5717,55 +5806,6 @@
|
|
|
5717
5806
|
* TODO: [🖇] What about symlinks?
|
|
5718
5807
|
*/
|
|
5719
5808
|
|
|
5720
|
-
/**
|
|
5721
|
-
* Tests if given string is valid URL.
|
|
5722
|
-
*
|
|
5723
|
-
* Note: This does not check if the file exists only if the path is valid
|
|
5724
|
-
* @public exported from `@promptbook/utils`
|
|
5725
|
-
*/
|
|
5726
|
-
function isValidFilePath(filename) {
|
|
5727
|
-
if (typeof filename !== 'string') {
|
|
5728
|
-
return false;
|
|
5729
|
-
}
|
|
5730
|
-
if (filename.split('\n').length > 1) {
|
|
5731
|
-
return false;
|
|
5732
|
-
}
|
|
5733
|
-
if (filename.split(' ').length >
|
|
5734
|
-
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
5735
|
-
return false;
|
|
5736
|
-
}
|
|
5737
|
-
var filenameSlashes = filename.split('\\').join('/');
|
|
5738
|
-
// Absolute Unix path: /hello.txt
|
|
5739
|
-
if (/^(\/)/i.test(filenameSlashes)) {
|
|
5740
|
-
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
5741
|
-
return true;
|
|
5742
|
-
}
|
|
5743
|
-
// Absolute Windows path: /hello.txt
|
|
5744
|
-
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
5745
|
-
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
5746
|
-
return true;
|
|
5747
|
-
}
|
|
5748
|
-
// Relative path: ./hello.txt
|
|
5749
|
-
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
5750
|
-
// console.log(filename, 'Relative path: ./hello.txt');
|
|
5751
|
-
return true;
|
|
5752
|
-
}
|
|
5753
|
-
// Allow paths like foo/hello
|
|
5754
|
-
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
5755
|
-
// console.log(filename, 'Allow paths like foo/hello');
|
|
5756
|
-
return true;
|
|
5757
|
-
}
|
|
5758
|
-
// Allow paths like hello.book
|
|
5759
|
-
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
5760
|
-
// console.log(filename, 'Allow paths like hello.book');
|
|
5761
|
-
return true;
|
|
5762
|
-
}
|
|
5763
|
-
return false;
|
|
5764
|
-
}
|
|
5765
|
-
/**
|
|
5766
|
-
* TODO: [🍏] Implement for MacOs
|
|
5767
|
-
*/
|
|
5768
|
-
|
|
5769
5809
|
/**
|
|
5770
5810
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
5771
5811
|
*
|
|
@@ -11074,9 +11114,71 @@
|
|
|
11074
11114
|
* TODO: [🧠][🈴] Where is the best location for this file
|
|
11075
11115
|
*/
|
|
11076
11116
|
|
|
11117
|
+
/**
|
|
11118
|
+
* Tag function for notating a prompt as template literal
|
|
11119
|
+
*
|
|
11120
|
+
* Note: There are 3 similar functions:
|
|
11121
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
11122
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
11123
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
11124
|
+
*
|
|
11125
|
+
* @param strings
|
|
11126
|
+
* @param values
|
|
11127
|
+
* @returns the prompt string
|
|
11128
|
+
* @public exported from `@promptbook/utils`
|
|
11129
|
+
*/
|
|
11130
|
+
function prompt(strings) {
|
|
11131
|
+
var values = [];
|
|
11132
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
11133
|
+
values[_i - 1] = arguments[_i];
|
|
11134
|
+
}
|
|
11135
|
+
if (values.length === 0) {
|
|
11136
|
+
return spaceTrim__default["default"](strings.join(''));
|
|
11137
|
+
}
|
|
11138
|
+
var stringsWithHiddenParameters = strings.map(function (stringsItem) {
|
|
11139
|
+
// TODO: [0] DRY
|
|
11140
|
+
return stringsItem.split('{').join("".concat(REPLACING_NONCE, "beginbracket")).split('}').join("".concat(REPLACING_NONCE, "endbracket"));
|
|
11141
|
+
});
|
|
11142
|
+
var placeholderParameterNames = values.map(function (value, i) { return "".concat(REPLACING_NONCE).concat(i); });
|
|
11143
|
+
var parameters = Object.fromEntries(values.map(function (value, i) { return [placeholderParameterNames[i], value]; }));
|
|
11144
|
+
// Combine strings and values
|
|
11145
|
+
var pipelineString = stringsWithHiddenParameters.reduce(function (result, stringsItem, i) {
|
|
11146
|
+
return placeholderParameterNames[i] === undefined
|
|
11147
|
+
? "".concat(result).concat(stringsItem)
|
|
11148
|
+
: "".concat(result).concat(stringsItem, "{").concat(placeholderParameterNames[i], "}");
|
|
11149
|
+
}, '');
|
|
11150
|
+
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
11151
|
+
try {
|
|
11152
|
+
pipelineString = templateParameters(pipelineString, parameters);
|
|
11153
|
+
}
|
|
11154
|
+
catch (error) {
|
|
11155
|
+
if (!(error instanceof PipelineExecutionError)) {
|
|
11156
|
+
throw error;
|
|
11157
|
+
}
|
|
11158
|
+
console.error({ pipelineString: pipelineString, parameters: parameters, placeholderParameterNames: placeholderParameterNames, error: error });
|
|
11159
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n Internal error in prompt template literal\n \n ".concat(block(JSON.stringify({ strings: strings, values: values }, null, 4)), "}\n \n "); }));
|
|
11160
|
+
}
|
|
11161
|
+
// TODO: [0] DRY
|
|
11162
|
+
pipelineString = pipelineString
|
|
11163
|
+
.split("".concat(REPLACING_NONCE, "beginbracket"))
|
|
11164
|
+
.join('{')
|
|
11165
|
+
.split("".concat(REPLACING_NONCE, "endbracket"))
|
|
11166
|
+
.join('}');
|
|
11167
|
+
return pipelineString;
|
|
11168
|
+
}
|
|
11169
|
+
/**
|
|
11170
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
11171
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11172
|
+
*/
|
|
11173
|
+
|
|
11077
11174
|
/**
|
|
11078
11175
|
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
11079
11176
|
*
|
|
11177
|
+
* Note: There are 3 similar functions:
|
|
11178
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
11179
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
11180
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
11181
|
+
*
|
|
11080
11182
|
* @param strings @@@
|
|
11081
11183
|
* @param values @@@
|
|
11082
11184
|
* @returns the pipeline string
|
|
@@ -11087,11 +11189,7 @@
|
|
|
11087
11189
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
11088
11190
|
values[_i - 1] = arguments[_i];
|
|
11089
11191
|
}
|
|
11090
|
-
|
|
11091
|
-
throw new NotYetImplementedError("Only one string without interpolated value is supported for now in book`...` notation");
|
|
11092
|
-
}
|
|
11093
|
-
var pipelineString = strings[0];
|
|
11094
|
-
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
11192
|
+
var pipelineString = prompt.apply(void 0, __spreadArray([strings], __read(values), false));
|
|
11095
11193
|
if (!isValidPipelineString(pipelineString)) {
|
|
11096
11194
|
// TODO: Make the CustomError for this
|
|
11097
11195
|
throw new Error(spaceTrim__default["default"]("\n The string is not a valid pipeline string\n\n book`\n ".concat(pipelineString, "\n `\n ")));
|
|
@@ -11103,6 +11201,40 @@
|
|
|
11103
11201
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11104
11202
|
*/
|
|
11105
11203
|
|
|
11204
|
+
/**
|
|
11205
|
+
* Metadata of the scraper
|
|
11206
|
+
*
|
|
11207
|
+
* @private within the scraper directory
|
|
11208
|
+
*/
|
|
11209
|
+
var boilerplateScraperMetadata = $deepFreeze({
|
|
11210
|
+
title: 'Boilerplate scraper',
|
|
11211
|
+
packageName: '@promptbook/boilerplate',
|
|
11212
|
+
className: 'BoilerplateScraper',
|
|
11213
|
+
mimeTypes: [
|
|
11214
|
+
'@@@/@@@',
|
|
11215
|
+
// <- TODO: @@@ Add compatible mime types with Boilerplate scraper
|
|
11216
|
+
],
|
|
11217
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@@',
|
|
11218
|
+
isAvilableInBrowser: false,
|
|
11219
|
+
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
11220
|
+
requiredExecutables: [
|
|
11221
|
+
/* @@@ 'Pandoc' */
|
|
11222
|
+
],
|
|
11223
|
+
}); /* <- Note: [🤛] */
|
|
11224
|
+
/**
|
|
11225
|
+
* Registration of known scraper metadata
|
|
11226
|
+
*
|
|
11227
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
11228
|
+
*
|
|
11229
|
+
* @public exported from `@promptbook/core`
|
|
11230
|
+
* @public exported from `@promptbook/wizzard`
|
|
11231
|
+
* @public exported from `@promptbook/cli`
|
|
11232
|
+
*/
|
|
11233
|
+
var _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
|
|
11234
|
+
/**
|
|
11235
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11236
|
+
*/
|
|
11237
|
+
|
|
11106
11238
|
/**
|
|
11107
11239
|
* Metadata of the scraper
|
|
11108
11240
|
*
|
|
@@ -11194,6 +11326,40 @@
|
|
|
11194
11326
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11195
11327
|
*/
|
|
11196
11328
|
|
|
11329
|
+
/**
|
|
11330
|
+
* Metadata of the scraper
|
|
11331
|
+
*
|
|
11332
|
+
* @private within the scraper directory
|
|
11333
|
+
*/
|
|
11334
|
+
var markitdownScraperMetadata = $deepFreeze({
|
|
11335
|
+
title: 'Markitdown scraper',
|
|
11336
|
+
packageName: '@promptbook/markitdown',
|
|
11337
|
+
className: 'MarkitdownScraper',
|
|
11338
|
+
mimeTypes: [
|
|
11339
|
+
'application/pdf',
|
|
11340
|
+
// TODO: Make priority for scrapers and than allow all mime types here:
|
|
11341
|
+
// 'text/html',
|
|
11342
|
+
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
11343
|
+
],
|
|
11344
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
11345
|
+
isAvilableInBrowser: false,
|
|
11346
|
+
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
11347
|
+
requiredExecutables: [],
|
|
11348
|
+
}); /* <- Note: [🤛] */
|
|
11349
|
+
/**
|
|
11350
|
+
* Registration of known scraper metadata
|
|
11351
|
+
*
|
|
11352
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
11353
|
+
*
|
|
11354
|
+
* @public exported from `@promptbook/core`
|
|
11355
|
+
* @public exported from `@promptbook/wizzard`
|
|
11356
|
+
* @public exported from `@promptbook/cli`
|
|
11357
|
+
*/
|
|
11358
|
+
var _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
11359
|
+
/**
|
|
11360
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11361
|
+
*/
|
|
11362
|
+
|
|
11197
11363
|
/**
|
|
11198
11364
|
* Metadata of the scraper
|
|
11199
11365
|
*
|
|
@@ -11203,7 +11369,7 @@
|
|
|
11203
11369
|
title: 'Pdf scraper',
|
|
11204
11370
|
packageName: '@promptbook/pdf',
|
|
11205
11371
|
className: 'PdfScraper',
|
|
11206
|
-
mimeTypes: ['application/pdf'],
|
|
11372
|
+
mimeTypes: ['application/pdf-DISABLED'],
|
|
11207
11373
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
11208
11374
|
isAvilableInBrowser: false,
|
|
11209
11375
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
@@ -11410,10 +11576,12 @@
|
|
|
11410
11576
|
exports.ZERO_USAGE = ZERO_USAGE;
|
|
11411
11577
|
exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
|
|
11412
11578
|
exports._AzureOpenAiMetadataRegistration = _AzureOpenAiMetadataRegistration;
|
|
11579
|
+
exports._BoilerplateScraperMetadataRegistration = _BoilerplateScraperMetadataRegistration;
|
|
11413
11580
|
exports._DocumentScraperMetadataRegistration = _DocumentScraperMetadataRegistration;
|
|
11414
11581
|
exports._GoogleMetadataRegistration = _GoogleMetadataRegistration;
|
|
11415
11582
|
exports._LegacyDocumentScraperMetadataRegistration = _LegacyDocumentScraperMetadataRegistration;
|
|
11416
11583
|
exports._MarkdownScraperMetadataRegistration = _MarkdownScraperMetadataRegistration;
|
|
11584
|
+
exports._MarkitdownScraperMetadataRegistration = _MarkitdownScraperMetadataRegistration;
|
|
11417
11585
|
exports._OpenAiAssistantMetadataRegistration = _OpenAiAssistantMetadataRegistration;
|
|
11418
11586
|
exports._OpenAiMetadataRegistration = _OpenAiMetadataRegistration;
|
|
11419
11587
|
exports._PdfScraperMetadataRegistration = _PdfScraperMetadataRegistration;
|