@promptbook/markdown-utils 0.85.0-8 → 0.85.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 +0 -4
- package/esm/index.es.js +6 -58
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +0 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +3 -3
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/package.json +2 -2
- package/umd/index.umd.js +6 -58
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
<blockquote style="color: #ff8811">
|
|
28
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
29
|
-
</blockquote>
|
|
30
|
-
|
|
31
27
|
## 📦 Package `@promptbook/markdown-utils`
|
|
32
28
|
|
|
33
29
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -25,7 +25,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-16';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1282,57 +1282,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1282
1282
|
return true;
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
|
-
/**
|
|
1286
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1287
|
-
*
|
|
1288
|
-
* Note: There are two simmilar functions:
|
|
1289
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1290
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1291
|
-
*
|
|
1292
|
-
* @public exported from `@promptbook/utils`
|
|
1293
|
-
*/
|
|
1294
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1295
|
-
if (hostname === 'example.com' ||
|
|
1296
|
-
hostname === 'localhost' ||
|
|
1297
|
-
hostname.endsWith('.localhost') ||
|
|
1298
|
-
hostname.endsWith('.local') ||
|
|
1299
|
-
hostname.endsWith('.test') ||
|
|
1300
|
-
hostname === '127.0.0.1' ||
|
|
1301
|
-
hostname === '::1') {
|
|
1302
|
-
return true;
|
|
1303
|
-
}
|
|
1304
|
-
if (hostname.includes(':')) {
|
|
1305
|
-
// IPv6
|
|
1306
|
-
var ipParts = hostname.split(':');
|
|
1307
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1308
|
-
}
|
|
1309
|
-
else {
|
|
1310
|
-
// IPv4
|
|
1311
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1312
|
-
return (ipParts[0] === 10 ||
|
|
1313
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1314
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
/**
|
|
1319
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1320
|
-
*
|
|
1321
|
-
* Note: There are two simmilar functions:
|
|
1322
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1323
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1324
|
-
*
|
|
1325
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1326
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1327
|
-
* @public exported from `@promptbook/utils`
|
|
1328
|
-
*/
|
|
1329
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1330
|
-
if (typeof url === 'string') {
|
|
1331
|
-
url = new URL(url);
|
|
1332
|
-
}
|
|
1333
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1285
|
/**
|
|
1337
1286
|
* Tests if given string is valid pipeline URL URL.
|
|
1338
1287
|
*
|
|
@@ -1346,16 +1295,19 @@ function isValidPipelineUrl(url) {
|
|
|
1346
1295
|
if (!isValidUrl(url)) {
|
|
1347
1296
|
return false;
|
|
1348
1297
|
}
|
|
1349
|
-
if (!url.startsWith('https://')) {
|
|
1298
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1350
1299
|
return false;
|
|
1351
1300
|
}
|
|
1352
1301
|
if (url.includes('#')) {
|
|
1353
1302
|
// TODO: [🐠]
|
|
1354
1303
|
return false;
|
|
1355
1304
|
}
|
|
1305
|
+
/*
|
|
1306
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1356
1307
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1357
1308
|
return false;
|
|
1358
1309
|
}
|
|
1310
|
+
*/
|
|
1359
1311
|
return true;
|
|
1360
1312
|
}
|
|
1361
1313
|
/**
|
|
@@ -2190,18 +2142,16 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2190
2142
|
*/
|
|
2191
2143
|
function createTask(options) {
|
|
2192
2144
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2193
|
-
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO:
|
|
2145
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2194
2146
|
var partialResultSubject = new BehaviorSubject({});
|
|
2195
2147
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2196
2148
|
partialResultSubject.next(newOngoingResult);
|
|
2197
2149
|
});
|
|
2198
2150
|
finalResultPromise
|
|
2199
2151
|
.catch(function (error) {
|
|
2200
|
-
// console.error('!!!!! Task failed:', error);
|
|
2201
2152
|
partialResultSubject.error(error);
|
|
2202
2153
|
})
|
|
2203
2154
|
.then(function (value) {
|
|
2204
|
-
// console.error('!!!!! Task finished:', value);
|
|
2205
2155
|
if (value) {
|
|
2206
2156
|
try {
|
|
2207
2157
|
assertsTaskSuccessful(value);
|
|
@@ -2223,9 +2173,7 @@ function createTask(options) {
|
|
|
2223
2173
|
return [4 /*yield*/, finalResultPromise];
|
|
2224
2174
|
case 1:
|
|
2225
2175
|
finalResult = _b.sent();
|
|
2226
|
-
console.error('!!!!! finalResult:', finalResult);
|
|
2227
2176
|
if (isCrashedOnError) {
|
|
2228
|
-
console.error('!!!!! isCrashedOnError:', finalResult);
|
|
2229
2177
|
assertsTaskSuccessful(finalResult);
|
|
2230
2178
|
}
|
|
2231
2179
|
return [2 /*return*/, finalResult];
|