@promptbook/legacy-documents 0.77.1 → 0.78.0-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
@@ -23,6 +23,10 @@
23
23
 
24
24
 
25
25
 
26
+ <blockquote style="color: #ff8811">
27
+ <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>.
28
+ </blockquote>
29
+
26
30
  ## 📦 Package `@promptbook/legacy-documents`
27
31
 
28
32
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
package/esm/index.es.js CHANGED
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.77.1';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -740,32 +740,12 @@ function isFileExisting(filename, fs) {
740
740
  */
741
741
 
742
742
  /**
743
- * Tests if given string is valid URL.
744
- *
745
- * Note: Dataurl are considered perfectly valid.
746
- * Note: There are two simmilar functions:
747
- * - `isValidUrl` which tests any URL
748
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
743
+ * @@@
749
744
  *
750
- * @public exported from `@promptbook/utils`
745
+ * @private for `FileCacheStorage`
751
746
  */
752
- function isValidUrl(url) {
753
- if (typeof url !== 'string') {
754
- return false;
755
- }
756
- try {
757
- if (url.startsWith('blob:')) {
758
- url = url.replace(/^blob:/, '');
759
- }
760
- var urlObject = new URL(url /* because fail is handled */);
761
- if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
762
- return false;
763
- }
764
- return true;
765
- }
766
- catch (error) {
767
- return false;
768
- }
747
+ function nameToSubfolderPath(name) {
748
+ return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
769
749
  }
770
750
 
771
751
  var defaultDiacriticsRemovalMap = [
@@ -1133,6 +1113,35 @@ function isValidFilePath(filename) {
1133
1113
  return false;
1134
1114
  }
1135
1115
 
1116
+ /**
1117
+ * Tests if given string is valid URL.
1118
+ *
1119
+ * Note: Dataurl are considered perfectly valid.
1120
+ * Note: There are two simmilar functions:
1121
+ * - `isValidUrl` which tests any URL
1122
+ * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
1123
+ *
1124
+ * @public exported from `@promptbook/utils`
1125
+ */
1126
+ function isValidUrl(url) {
1127
+ if (typeof url !== 'string') {
1128
+ return false;
1129
+ }
1130
+ try {
1131
+ if (url.startsWith('blob:')) {
1132
+ url = url.replace(/^blob:/, '');
1133
+ }
1134
+ var urlObject = new URL(url /* because fail is handled */);
1135
+ if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
1136
+ return false;
1137
+ }
1138
+ return true;
1139
+ }
1140
+ catch (error) {
1141
+ return false;
1142
+ }
1143
+ }
1144
+
1136
1145
  /**
1137
1146
  * @@@
1138
1147
  *
@@ -1157,15 +1166,6 @@ function titleToName(value) {
1157
1166
  return value;
1158
1167
  }
1159
1168
 
1160
- /**
1161
- * @@@
1162
- *
1163
- * @private for `FileCacheStorage`
1164
- */
1165
- function nameToSubfolderPath(name) {
1166
- return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
1167
- }
1168
-
1169
1169
  /**
1170
1170
  * Create a filename for intermediate cache for scrapers
1171
1171
  *
@@ -3840,9 +3840,9 @@ function preparePipeline(pipeline, tools, options) {
3840
3840
  * @param script from which to extract the variables
3841
3841
  * @returns the list of variable names
3842
3842
  * @throws {ParseError} if the script is invalid
3843
- * @public exported from `@promptbook/utils`
3843
+ * @public exported from `@promptbook/utils` <- Note: [👖] This is usable elsewhere than in Promptbook, so keeping in utils
3844
3844
  */
3845
- function extractVariables(script) {
3845
+ function extractVariablesFromScript(script) {
3846
3846
  var variables = new Set();
3847
3847
  script = "(()=>{".concat(script, "})()");
3848
3848
  try {
@@ -3889,7 +3889,7 @@ function extractVariables(script) {
3889
3889
  * @param task the task with used parameters
3890
3890
  * @returns the set of parameter names
3891
3891
  * @throws {ParseError} if the script is invalid
3892
- * @public exported from `@promptbook/utils`
3892
+ * @public exported from `@promptbook/core` <- Note: [👖] This utility is so tightly interconnected with the Promptbook that it is not exported as util but in core
3893
3893
  */
3894
3894
  function extractParameterNamesFromTask(task) {
3895
3895
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
@@ -3910,7 +3910,7 @@ function extractParameterNamesFromTask(task) {
3910
3910
  }
3911
3911
  if (taskType === 'SCRIPT_TASK') {
3912
3912
  try {
3913
- for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3913
+ for (var _g = __values(extractVariablesFromScript(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3914
3914
  var parameterName = _h.value;
3915
3915
  parameterNames.add(parameterName);
3916
3916
  }