@promptbook/core 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/core`
|
|
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
|
@@ -27,7 +27,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
30
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-16';
|
|
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
|
|
@@ -1262,57 +1262,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1262
1262
|
return true;
|
|
1263
1263
|
}
|
|
1264
1264
|
|
|
1265
|
-
/**
|
|
1266
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1267
|
-
*
|
|
1268
|
-
* Note: There are two simmilar functions:
|
|
1269
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1270
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1271
|
-
*
|
|
1272
|
-
* @public exported from `@promptbook/utils`
|
|
1273
|
-
*/
|
|
1274
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1275
|
-
if (hostname === 'example.com' ||
|
|
1276
|
-
hostname === 'localhost' ||
|
|
1277
|
-
hostname.endsWith('.localhost') ||
|
|
1278
|
-
hostname.endsWith('.local') ||
|
|
1279
|
-
hostname.endsWith('.test') ||
|
|
1280
|
-
hostname === '127.0.0.1' ||
|
|
1281
|
-
hostname === '::1') {
|
|
1282
|
-
return true;
|
|
1283
|
-
}
|
|
1284
|
-
if (hostname.includes(':')) {
|
|
1285
|
-
// IPv6
|
|
1286
|
-
var ipParts = hostname.split(':');
|
|
1287
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1288
|
-
}
|
|
1289
|
-
else {
|
|
1290
|
-
// IPv4
|
|
1291
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1292
|
-
return (ipParts[0] === 10 ||
|
|
1293
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1294
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
/**
|
|
1299
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1300
|
-
*
|
|
1301
|
-
* Note: There are two simmilar functions:
|
|
1302
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1303
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1304
|
-
*
|
|
1305
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1306
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1307
|
-
* @public exported from `@promptbook/utils`
|
|
1308
|
-
*/
|
|
1309
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1310
|
-
if (typeof url === 'string') {
|
|
1311
|
-
url = new URL(url);
|
|
1312
|
-
}
|
|
1313
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
1265
|
/**
|
|
1317
1266
|
* Tests if given string is valid pipeline URL URL.
|
|
1318
1267
|
*
|
|
@@ -1326,16 +1275,19 @@ function isValidPipelineUrl(url) {
|
|
|
1326
1275
|
if (!isValidUrl(url)) {
|
|
1327
1276
|
return false;
|
|
1328
1277
|
}
|
|
1329
|
-
if (!url.startsWith('https://')) {
|
|
1278
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1330
1279
|
return false;
|
|
1331
1280
|
}
|
|
1332
1281
|
if (url.includes('#')) {
|
|
1333
1282
|
// TODO: [🐠]
|
|
1334
1283
|
return false;
|
|
1335
1284
|
}
|
|
1285
|
+
/*
|
|
1286
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1336
1287
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1337
1288
|
return false;
|
|
1338
1289
|
}
|
|
1290
|
+
*/
|
|
1339
1291
|
return true;
|
|
1340
1292
|
}
|
|
1341
1293
|
/**
|
|
@@ -2374,18 +2326,16 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2374
2326
|
*/
|
|
2375
2327
|
function createTask(options) {
|
|
2376
2328
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2377
|
-
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO:
|
|
2329
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2378
2330
|
var partialResultSubject = new BehaviorSubject({});
|
|
2379
2331
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2380
2332
|
partialResultSubject.next(newOngoingResult);
|
|
2381
2333
|
});
|
|
2382
2334
|
finalResultPromise
|
|
2383
2335
|
.catch(function (error) {
|
|
2384
|
-
// console.error('!!!!! Task failed:', error);
|
|
2385
2336
|
partialResultSubject.error(error);
|
|
2386
2337
|
})
|
|
2387
2338
|
.then(function (value) {
|
|
2388
|
-
// console.error('!!!!! Task finished:', value);
|
|
2389
2339
|
if (value) {
|
|
2390
2340
|
try {
|
|
2391
2341
|
assertsTaskSuccessful(value);
|
|
@@ -2407,9 +2357,7 @@ function createTask(options) {
|
|
|
2407
2357
|
return [4 /*yield*/, finalResultPromise];
|
|
2408
2358
|
case 1:
|
|
2409
2359
|
finalResult = _b.sent();
|
|
2410
|
-
console.error('!!!!! finalResult:', finalResult);
|
|
2411
2360
|
if (isCrashedOnError) {
|
|
2412
|
-
console.error('!!!!! isCrashedOnError:', finalResult);
|
|
2413
2361
|
assertsTaskSuccessful(finalResult);
|
|
2414
2362
|
}
|
|
2415
2363
|
return [2 /*return*/, finalResult];
|