@promptbook/website-crawler 0.92.0-23 → 0.92.0-24

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/esm/index.es.js CHANGED
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-24';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -133,11 +133,20 @@ const DEFAULT_BOOK_TITLE = `✨ Untitled Book`;
133
133
  */
134
134
  const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
135
135
  /**
136
- * @@@
136
+ * Threshold value that determines when a dataset is considered "big"
137
+ * and may require special handling or optimizations
138
+ *
139
+ * For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
137
140
  *
138
141
  * @public exported from `@promptbook/core`
139
142
  */
140
143
  const BIG_DATASET_TRESHOLD = 50;
144
+ /**
145
+ * Placeholder text used to represent a placeholder value of failed operation
146
+ *
147
+ * @public exported from `@promptbook/core`
148
+ */
149
+ const FAILED_VALUE_PLACEHOLDER = '!?';
141
150
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
142
151
  /**
143
152
  * The maximum number of iterations for a loops
@@ -345,7 +354,8 @@ class UnexpectedError extends Error {
345
354
  }
346
355
 
347
356
  /**
348
- * @@@
357
+ * Safely retrieves the global scope object (window in browser, global in Node.js)
358
+ * regardless of the JavaScript environment in which the code is running
349
359
  *
350
360
  * Note: `$` is used to indicate that this function is not a pure function - it access global scope
351
361
  *
@@ -2092,7 +2102,7 @@ class SimplePipelineCollection {
2092
2102
  /**
2093
2103
  * Constructs a pipeline collection from pipelines
2094
2104
  *
2095
- * @param pipelines @@@
2105
+ * @param pipelines Array of pipeline JSON objects to include in the collection
2096
2106
  *
2097
2107
  * Note: During the construction logic of all pipelines are validated
2098
2108
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
@@ -4193,6 +4203,15 @@ const CsvFormatParser = {
4193
4203
  mappedData.push(mappedRow);
4194
4204
  if (onProgress) {
4195
4205
  // Note: Report the CSV with all rows mapped so far
4206
+ /*
4207
+ !!!!
4208
+ // Report progress with updated value
4209
+ const progressData = mappedData.map((row, i) =>
4210
+ i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
4211
+ );
4212
+
4213
+
4214
+ */
4196
4215
  await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
4197
4216
  }
4198
4217
  }
@@ -5201,7 +5220,7 @@ async function executeFormatSubvalues(options) {
5201
5220
  `));
5202
5221
  if (length > BIG_DATASET_TRESHOLD) {
5203
5222
  console.error(highLevelError);
5204
- return '~';
5223
+ return FAILED_VALUE_PLACEHOLDER;
5205
5224
  }
5206
5225
  throw highLevelError;
5207
5226
  }
@@ -5232,7 +5251,7 @@ async function executeFormatSubvalues(options) {
5232
5251
  ${block(pipelineIdentification)}
5233
5252
  Subparameter index: ${index}
5234
5253
  `));
5235
- return '~';
5254
+ return FAILED_VALUE_PLACEHOLDER;
5236
5255
  }
5237
5256
  throw error;
5238
5257
  }