@promptbook/documents 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/documents`
|
|
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
|
@@ -28,7 +28,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
31
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-16';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1828,57 +1828,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1828
1828
|
return true;
|
|
1829
1829
|
}
|
|
1830
1830
|
|
|
1831
|
-
/**
|
|
1832
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1833
|
-
*
|
|
1834
|
-
* Note: There are two simmilar functions:
|
|
1835
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1836
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1837
|
-
*
|
|
1838
|
-
* @public exported from `@promptbook/utils`
|
|
1839
|
-
*/
|
|
1840
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1841
|
-
if (hostname === 'example.com' ||
|
|
1842
|
-
hostname === 'localhost' ||
|
|
1843
|
-
hostname.endsWith('.localhost') ||
|
|
1844
|
-
hostname.endsWith('.local') ||
|
|
1845
|
-
hostname.endsWith('.test') ||
|
|
1846
|
-
hostname === '127.0.0.1' ||
|
|
1847
|
-
hostname === '::1') {
|
|
1848
|
-
return true;
|
|
1849
|
-
}
|
|
1850
|
-
if (hostname.includes(':')) {
|
|
1851
|
-
// IPv6
|
|
1852
|
-
var ipParts = hostname.split(':');
|
|
1853
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1854
|
-
}
|
|
1855
|
-
else {
|
|
1856
|
-
// IPv4
|
|
1857
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1858
|
-
return (ipParts[0] === 10 ||
|
|
1859
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1860
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
/**
|
|
1865
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1866
|
-
*
|
|
1867
|
-
* Note: There are two simmilar functions:
|
|
1868
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1869
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1870
|
-
*
|
|
1871
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1872
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1873
|
-
* @public exported from `@promptbook/utils`
|
|
1874
|
-
*/
|
|
1875
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1876
|
-
if (typeof url === 'string') {
|
|
1877
|
-
url = new URL(url);
|
|
1878
|
-
}
|
|
1879
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
1831
|
/**
|
|
1883
1832
|
* Tests if given string is valid pipeline URL URL.
|
|
1884
1833
|
*
|
|
@@ -1892,16 +1841,19 @@ function isValidPipelineUrl(url) {
|
|
|
1892
1841
|
if (!isValidUrl(url)) {
|
|
1893
1842
|
return false;
|
|
1894
1843
|
}
|
|
1895
|
-
if (!url.startsWith('https://')) {
|
|
1844
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1896
1845
|
return false;
|
|
1897
1846
|
}
|
|
1898
1847
|
if (url.includes('#')) {
|
|
1899
1848
|
// TODO: [🐠]
|
|
1900
1849
|
return false;
|
|
1901
1850
|
}
|
|
1851
|
+
/*
|
|
1852
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1902
1853
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1903
1854
|
return false;
|
|
1904
1855
|
}
|
|
1856
|
+
*/
|
|
1905
1857
|
return true;
|
|
1906
1858
|
}
|
|
1907
1859
|
/**
|