@promptbook/pdf 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 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/pdf`
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
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.85.0-7';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-16';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1651,57 +1651,6 @@ function isValidPromptbookVersion(version) {
1651
1651
  return true;
1652
1652
  }
1653
1653
 
1654
- /**
1655
- * Checks if an URL is reserved for private networks or localhost.
1656
- *
1657
- * Note: There are two simmilar functions:
1658
- * - `isUrlOnPrivateNetwork` which tests full URL
1659
- * - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
1660
- *
1661
- * @public exported from `@promptbook/utils`
1662
- */
1663
- function isHostnameOnPrivateNetwork(hostname) {
1664
- if (hostname === 'example.com' ||
1665
- hostname === 'localhost' ||
1666
- hostname.endsWith('.localhost') ||
1667
- hostname.endsWith('.local') ||
1668
- hostname.endsWith('.test') ||
1669
- hostname === '127.0.0.1' ||
1670
- hostname === '::1') {
1671
- return true;
1672
- }
1673
- if (hostname.includes(':')) {
1674
- // IPv6
1675
- var ipParts = hostname.split(':');
1676
- return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
1677
- }
1678
- else {
1679
- // IPv4
1680
- var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
1681
- return (ipParts[0] === 10 ||
1682
- (ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
1683
- (ipParts[0] === 192 && ipParts[1] === 168));
1684
- }
1685
- }
1686
-
1687
- /**
1688
- * Checks if an IP address or hostname is reserved for private networks or localhost.
1689
- *
1690
- * Note: There are two simmilar functions:
1691
- * - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
1692
- * - `isHostnameOnPrivateNetwork` which tests just hostname
1693
- *
1694
- * @param {string} ipAddress - The IP address to check.
1695
- * @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
1696
- * @public exported from `@promptbook/utils`
1697
- */
1698
- function isUrlOnPrivateNetwork(url) {
1699
- if (typeof url === 'string') {
1700
- url = new URL(url);
1701
- }
1702
- return isHostnameOnPrivateNetwork(url.hostname);
1703
- }
1704
-
1705
1654
  /**
1706
1655
  * Tests if given string is valid pipeline URL URL.
1707
1656
  *
@@ -1715,16 +1664,19 @@ function isValidPipelineUrl(url) {
1715
1664
  if (!isValidUrl(url)) {
1716
1665
  return false;
1717
1666
  }
1718
- if (!url.startsWith('https://')) {
1667
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
1719
1668
  return false;
1720
1669
  }
1721
1670
  if (url.includes('#')) {
1722
1671
  // TODO: [🐠]
1723
1672
  return false;
1724
1673
  }
1674
+ /*
1675
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
1725
1676
  if (isUrlOnPrivateNetwork(url)) {
1726
1677
  return false;
1727
1678
  }
1679
+ */
1728
1680
  return true;
1729
1681
  }
1730
1682
  /**
@@ -2527,18 +2479,16 @@ function assertsTaskSuccessful(executionResult) {
2527
2479
  */
2528
2480
  function createTask(options) {
2529
2481
  var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
2530
- var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: !!! To global config + Use Base58 to avoid simmilar char conflicts */));
2482
+ var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
2531
2483
  var partialResultSubject = new BehaviorSubject({});
2532
2484
  var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2533
2485
  partialResultSubject.next(newOngoingResult);
2534
2486
  });
2535
2487
  finalResultPromise
2536
2488
  .catch(function (error) {
2537
- // console.error('!!!!! Task failed:', error);
2538
2489
  partialResultSubject.error(error);
2539
2490
  })
2540
2491
  .then(function (value) {
2541
- // console.error('!!!!! Task finished:', value);
2542
2492
  if (value) {
2543
2493
  try {
2544
2494
  assertsTaskSuccessful(value);
@@ -2560,9 +2510,7 @@ function createTask(options) {
2560
2510
  return [4 /*yield*/, finalResultPromise];
2561
2511
  case 1:
2562
2512
  finalResult = _b.sent();
2563
- console.error('!!!!! finalResult:', finalResult);
2564
2513
  if (isCrashedOnError) {
2565
- console.error('!!!!! isCrashedOnError:', finalResult);
2566
2514
  assertsTaskSuccessful(finalResult);
2567
2515
  }
2568
2516
  return [2 /*return*/, finalResult];