@promptbook/pdf 0.85.0-9 → 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-
|
|
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
|
/**
|