@promptbook/website-crawler 0.112.0-115 → 0.112.0-117
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/esm/index.es.js +12 -13
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +2 -0
- package/esm/src/_packages/node.index.d.ts +10 -0
- package/esm/src/book-3.0/CliAgent.d.ts +8 -15
- package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/umd/index.umd.js +16 -13
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +2 -0
- package/umd/src/_packages/node.index.d.ts +10 -0
- package/umd/src/book-3.0/CliAgent.d.ts +8 -15
- package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
- package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import { Readability } from '@mozilla/readability';
|
|
3
3
|
import { JSDOM } from 'jsdom';
|
|
4
|
-
import
|
|
4
|
+
import CryptoJS from 'crypto-js';
|
|
5
5
|
import { Subject } from 'rxjs';
|
|
6
6
|
import { forTime } from 'waitasecond';
|
|
7
7
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
8
8
|
import sha256 from 'crypto-js/sha256';
|
|
9
9
|
import { basename, join, dirname, isAbsolute } from 'path';
|
|
10
|
-
import { SHA256 } from 'crypto-js';
|
|
11
10
|
import { lookup, extension } from 'mime-types';
|
|
12
|
-
import
|
|
11
|
+
import papaparse from 'papaparse';
|
|
13
12
|
import { mkdir, rm } from 'fs/promises';
|
|
14
|
-
import
|
|
13
|
+
import showdown from 'showdown';
|
|
15
14
|
|
|
16
15
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
17
16
|
/**
|
|
@@ -27,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
27
26
|
* @generated
|
|
28
27
|
* @see https://github.com/webgptorg/promptbook
|
|
29
28
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
|
|
31
30
|
/**
|
|
32
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3339,7 +3338,7 @@ class MissingToolsError extends Error {
|
|
|
3339
3338
|
* @private internal helper function
|
|
3340
3339
|
*/
|
|
3341
3340
|
function $randomToken(randomness) {
|
|
3342
|
-
return
|
|
3341
|
+
return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
|
|
3343
3342
|
}
|
|
3344
3343
|
// TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
3345
3344
|
// TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
@@ -5104,7 +5103,7 @@ function normalizeToKebabCase(text) {
|
|
|
5104
5103
|
* @public exported from `@promptbook/editable`
|
|
5105
5104
|
*/
|
|
5106
5105
|
function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
5107
|
-
const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
5106
|
+
const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
5108
5107
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
5109
5108
|
.toString( /* hex */)
|
|
5110
5109
|
.substring(0, 20);
|
|
@@ -6098,7 +6097,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
|
|
|
6098
6097
|
console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
|
|
6099
6098
|
value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
6100
6099
|
}
|
|
6101
|
-
const csv = parse(value, settings);
|
|
6100
|
+
const csv = papaparse.parse(value, settings);
|
|
6102
6101
|
return csv;
|
|
6103
6102
|
}
|
|
6104
6103
|
|
|
@@ -6183,10 +6182,10 @@ const CsvFormatParser = {
|
|
|
6183
6182
|
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
6184
6183
|
);
|
|
6185
6184
|
*/
|
|
6186
|
-
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
6185
|
+
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
6187
6186
|
}
|
|
6188
6187
|
}
|
|
6189
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
6188
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
6190
6189
|
},
|
|
6191
6190
|
},
|
|
6192
6191
|
{
|
|
@@ -6214,7 +6213,7 @@ const CsvFormatParser = {
|
|
|
6214
6213
|
return /* not await */ mapCallback({ [key]: value }, index, array.length);
|
|
6215
6214
|
}));
|
|
6216
6215
|
}));
|
|
6217
|
-
return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
6216
|
+
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
6218
6217
|
},
|
|
6219
6218
|
},
|
|
6220
6219
|
],
|
|
@@ -8412,7 +8411,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
8412
8411
|
const { filename: sourceFilename, url } = source;
|
|
8413
8412
|
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
8414
8413
|
// TODO: [👬] DRY
|
|
8415
|
-
const hash = SHA256(
|
|
8414
|
+
const hash = CryptoJS.SHA256(
|
|
8416
8415
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
8417
8416
|
hexEncoder.parse(sourceFilename || url || 'untitled'))
|
|
8418
8417
|
.toString( /* hex */)
|
|
@@ -8476,7 +8475,7 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
8476
8475
|
* @private utility of `WebsiteScraper`
|
|
8477
8476
|
*/
|
|
8478
8477
|
function createShowdownConverter() {
|
|
8479
|
-
return new Converter({
|
|
8478
|
+
return new showdown.Converter({
|
|
8480
8479
|
flavor: 'github',
|
|
8481
8480
|
/*
|
|
8482
8481
|
> import showdownHighlight from 'showdown-highlight';
|