@promptbook/website-crawler 0.78.0-0 → 0.78.2
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 +0 -4
- package/esm/index.es.js +195 -153
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +14 -0
- package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +6 -0
- package/esm/typings/src/execution/execution-report/ExecutionReportString.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +195 -153
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -23,10 +23,6 @@
|
|
|
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
|
-
|
|
30
26
|
## 📦 Package `@promptbook/website-crawler`
|
|
31
27
|
|
|
32
28
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -24,7 +24,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
24
24
|
*
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.78.1';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -204,164 +204,25 @@ function just(value) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* Name for the Promptbook
|
|
208
|
+
*
|
|
209
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
208
210
|
*
|
|
209
211
|
* @public exported from `@promptbook/core`
|
|
210
212
|
*/
|
|
211
|
-
var
|
|
212
|
-
__extends(UnexpectedError, _super);
|
|
213
|
-
function UnexpectedError(message) {
|
|
214
|
-
var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
|
|
215
|
-
_this.name = 'UnexpectedError';
|
|
216
|
-
Object.setPrototypeOf(_this, UnexpectedError.prototype);
|
|
217
|
-
return _this;
|
|
218
|
-
}
|
|
219
|
-
return UnexpectedError;
|
|
220
|
-
}(Error));
|
|
221
|
-
|
|
213
|
+
var NAME = "Promptbook";
|
|
222
214
|
/**
|
|
223
|
-
*
|
|
224
|
-
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
225
|
-
*
|
|
226
|
-
* - Almost all primitives are serializable BUT:
|
|
227
|
-
* - `undefined` is not serializable
|
|
228
|
-
* - `NaN` is not serializable
|
|
229
|
-
* - Objects and arrays are serializable if all their properties are serializable
|
|
230
|
-
* - Functions are not serializable
|
|
231
|
-
* - Circular references are not serializable
|
|
232
|
-
* - `Date` objects are not serializable
|
|
233
|
-
* - `Map` and `Set` objects are not serializable
|
|
234
|
-
* - `RegExp` objects are not serializable
|
|
235
|
-
* - `Error` objects are not serializable
|
|
236
|
-
* - `Symbol` objects are not serializable
|
|
237
|
-
* - And much more...
|
|
215
|
+
* Email of the responsible person
|
|
238
216
|
*
|
|
239
|
-
* @
|
|
240
|
-
* @public exported from `@promptbook/utils`
|
|
241
|
-
*/
|
|
242
|
-
function checkSerializableAsJson(name, value) {
|
|
243
|
-
var e_1, _a;
|
|
244
|
-
if (value === undefined) {
|
|
245
|
-
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
246
|
-
}
|
|
247
|
-
else if (value === null) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
else if (typeof value === 'boolean') {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
else if (typeof value === 'number' && !isNaN(value)) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
else if (typeof value === 'string') {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
else if (typeof value === 'symbol') {
|
|
260
|
-
throw new UnexpectedError("".concat(name, " is symbol"));
|
|
261
|
-
}
|
|
262
|
-
else if (typeof value === 'function') {
|
|
263
|
-
throw new UnexpectedError("".concat(name, " is function"));
|
|
264
|
-
}
|
|
265
|
-
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
266
|
-
for (var i = 0; i < value.length; i++) {
|
|
267
|
-
checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
else if (typeof value === 'object') {
|
|
271
|
-
if (value instanceof Date) {
|
|
272
|
-
throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
|
|
273
|
-
}
|
|
274
|
-
else if (value instanceof Map) {
|
|
275
|
-
throw new UnexpectedError("".concat(name, " is Map"));
|
|
276
|
-
}
|
|
277
|
-
else if (value instanceof Set) {
|
|
278
|
-
throw new UnexpectedError("".concat(name, " is Set"));
|
|
279
|
-
}
|
|
280
|
-
else if (value instanceof RegExp) {
|
|
281
|
-
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
282
|
-
}
|
|
283
|
-
else if (value instanceof Error) {
|
|
284
|
-
throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
try {
|
|
288
|
-
for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
289
|
-
var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
|
|
290
|
-
if (subValue === undefined) {
|
|
291
|
-
// Note: undefined in object is serializable - it is just omited
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
298
|
-
finally {
|
|
299
|
-
try {
|
|
300
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
301
|
-
}
|
|
302
|
-
finally { if (e_1) throw e_1.error; }
|
|
303
|
-
}
|
|
304
|
-
try {
|
|
305
|
-
JSON.stringify(value); // <- TODO: [0]
|
|
306
|
-
}
|
|
307
|
-
catch (error) {
|
|
308
|
-
if (!(error instanceof Error)) {
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
311
|
-
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
|
|
312
|
-
}
|
|
313
|
-
/*
|
|
314
|
-
TODO: [0] Is there some more elegant way to check circular references?
|
|
315
|
-
const seen = new Set();
|
|
316
|
-
const stack = [{ value }];
|
|
317
|
-
while (stack.length > 0) {
|
|
318
|
-
const { value } = stack.pop()!;
|
|
319
|
-
if (typeof value === 'object' && value !== null) {
|
|
320
|
-
if (seen.has(value)) {
|
|
321
|
-
throw new UnexpectedError(`${name} has circular reference`);
|
|
322
|
-
}
|
|
323
|
-
seen.add(value);
|
|
324
|
-
if (Array.isArray(value)) {
|
|
325
|
-
stack.push(...value.map((value) => ({ value })));
|
|
326
|
-
} else {
|
|
327
|
-
stack.push(...Object.values(value).map((value) => ({ value })));
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
*/
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
throw new UnexpectedError("".concat(name, " is unknown"));
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
341
|
-
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
342
|
-
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
217
|
+
* @public exported from `@promptbook/core`
|
|
343
218
|
*/
|
|
344
|
-
|
|
219
|
+
var ADMIN_EMAIL = 'me@pavolhejny.com';
|
|
345
220
|
/**
|
|
346
|
-
*
|
|
347
|
-
* @@@
|
|
348
|
-
*
|
|
349
|
-
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
221
|
+
* Name of the responsible person for the Promptbook on GitHub
|
|
350
222
|
*
|
|
351
|
-
* @
|
|
352
|
-
* @param objectValue - Object to be deeply frozen
|
|
353
|
-
* @returns The same object as the input, but deeply frozen
|
|
354
|
-
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
355
|
-
*/
|
|
356
|
-
function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
357
|
-
checkSerializableAsJson(name, objectValue);
|
|
358
|
-
return $deepFreeze(objectValue);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
362
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
223
|
+
* @public exported from `@promptbook/core`
|
|
363
224
|
*/
|
|
364
|
-
|
|
225
|
+
var ADMIN_GITHUB_NAME = 'hejny';
|
|
365
226
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
366
227
|
/**
|
|
367
228
|
* The maximum number of iterations for a loops
|
|
@@ -413,7 +274,8 @@ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
|
413
274
|
*
|
|
414
275
|
* @public exported from `@promptbook/core`
|
|
415
276
|
*/
|
|
416
|
-
var RESERVED_PARAMETER_NAMES =
|
|
277
|
+
var RESERVED_PARAMETER_NAMES =
|
|
278
|
+
/* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
|
|
417
279
|
'content',
|
|
418
280
|
'context',
|
|
419
281
|
'knowledge',
|
|
@@ -423,7 +285,7 @@ var RESERVED_PARAMETER_NAMES = $asDeeplyFrozenSerializableJson('RESERVED_PARAMET
|
|
|
423
285
|
// <- TODO: list here all command names
|
|
424
286
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
425
287
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
426
|
-
]
|
|
288
|
+
];
|
|
427
289
|
/**
|
|
428
290
|
* @@@
|
|
429
291
|
*
|
|
@@ -491,6 +353,40 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
491
353
|
return NotYetImplementedError;
|
|
492
354
|
}(Error));
|
|
493
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Make error report URL for the given error
|
|
358
|
+
*
|
|
359
|
+
* @private !!!!!!
|
|
360
|
+
*/
|
|
361
|
+
function getErrorReportUrl(error) {
|
|
362
|
+
var report = {
|
|
363
|
+
title: "\uD83D\uDC1C Error report from ".concat(NAME),
|
|
364
|
+
body: spaceTrim$1(function (block) { return "\n\n\n `".concat(error.name || 'Error', "` has occurred in the [").concat(NAME, "], please look into it @").concat(ADMIN_GITHUB_NAME, ".\n\n ```\n ").concat(block(error.message || '(no error message)'), "\n ```\n\n\n ## More info:\n\n - **Promptbook engine version:** ").concat(PROMPTBOOK_ENGINE_VERSION, "\n - **Book language version:** ").concat(BOOK_LANGUAGE_VERSION, "\n - **Time:** ").concat(new Date().toISOString(), "\n\n <details>\n <summary>Stack trace:</summary>\n\n ## Stack trace:\n\n ```stacktrace\n ").concat(block(error.stack || '(empty)'), "\n ```\n </details>\n\n "); }),
|
|
365
|
+
};
|
|
366
|
+
var reportUrl = new URL("https://github.com/webgptorg/promptbook/issues/new");
|
|
367
|
+
reportUrl.searchParams.set('labels', 'bug');
|
|
368
|
+
reportUrl.searchParams.set('assignees', ADMIN_GITHUB_NAME);
|
|
369
|
+
reportUrl.searchParams.set('title', report.title);
|
|
370
|
+
reportUrl.searchParams.set('body', report.body);
|
|
371
|
+
return reportUrl;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
376
|
+
*
|
|
377
|
+
* @public exported from `@promptbook/core`
|
|
378
|
+
*/
|
|
379
|
+
var UnexpectedError = /** @class */ (function (_super) {
|
|
380
|
+
__extends(UnexpectedError, _super);
|
|
381
|
+
function UnexpectedError(message) {
|
|
382
|
+
var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n ").concat(block(getErrorReportUrl(new Error(message)).href), "\n\n Or contact us on ").concat(ADMIN_EMAIL, "\n\n "); })) || this;
|
|
383
|
+
_this.name = 'UnexpectedError';
|
|
384
|
+
Object.setPrototypeOf(_this, UnexpectedError.prototype);
|
|
385
|
+
return _this;
|
|
386
|
+
}
|
|
387
|
+
return UnexpectedError;
|
|
388
|
+
}(Error));
|
|
389
|
+
|
|
494
390
|
/**
|
|
495
391
|
* @@@
|
|
496
392
|
*
|
|
@@ -1936,6 +1832,149 @@ function extractParameterNames(template) {
|
|
|
1936
1832
|
return parameterNames;
|
|
1937
1833
|
}
|
|
1938
1834
|
|
|
1835
|
+
/**
|
|
1836
|
+
* Checks if the value is [🚉] serializable as JSON
|
|
1837
|
+
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
1838
|
+
*
|
|
1839
|
+
* - Almost all primitives are serializable BUT:
|
|
1840
|
+
* - `undefined` is not serializable
|
|
1841
|
+
* - `NaN` is not serializable
|
|
1842
|
+
* - Objects and arrays are serializable if all their properties are serializable
|
|
1843
|
+
* - Functions are not serializable
|
|
1844
|
+
* - Circular references are not serializable
|
|
1845
|
+
* - `Date` objects are not serializable
|
|
1846
|
+
* - `Map` and `Set` objects are not serializable
|
|
1847
|
+
* - `RegExp` objects are not serializable
|
|
1848
|
+
* - `Error` objects are not serializable
|
|
1849
|
+
* - `Symbol` objects are not serializable
|
|
1850
|
+
* - And much more...
|
|
1851
|
+
*
|
|
1852
|
+
* @throws UnexpectedError if the value is not serializable as JSON
|
|
1853
|
+
* @public exported from `@promptbook/utils`
|
|
1854
|
+
*/
|
|
1855
|
+
function checkSerializableAsJson(name, value) {
|
|
1856
|
+
var e_1, _a;
|
|
1857
|
+
if (value === undefined) {
|
|
1858
|
+
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
1859
|
+
}
|
|
1860
|
+
else if (value === null) {
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
else if (typeof value === 'boolean') {
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
else if (typeof value === 'number' && !isNaN(value)) {
|
|
1867
|
+
return;
|
|
1868
|
+
}
|
|
1869
|
+
else if (typeof value === 'string') {
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1872
|
+
else if (typeof value === 'symbol') {
|
|
1873
|
+
throw new UnexpectedError("".concat(name, " is symbol"));
|
|
1874
|
+
}
|
|
1875
|
+
else if (typeof value === 'function') {
|
|
1876
|
+
throw new UnexpectedError("".concat(name, " is function"));
|
|
1877
|
+
}
|
|
1878
|
+
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
1879
|
+
for (var i = 0; i < value.length; i++) {
|
|
1880
|
+
checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
else if (typeof value === 'object') {
|
|
1884
|
+
if (value instanceof Date) {
|
|
1885
|
+
throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
|
|
1886
|
+
}
|
|
1887
|
+
else if (value instanceof Map) {
|
|
1888
|
+
throw new UnexpectedError("".concat(name, " is Map"));
|
|
1889
|
+
}
|
|
1890
|
+
else if (value instanceof Set) {
|
|
1891
|
+
throw new UnexpectedError("".concat(name, " is Set"));
|
|
1892
|
+
}
|
|
1893
|
+
else if (value instanceof RegExp) {
|
|
1894
|
+
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
1895
|
+
}
|
|
1896
|
+
else if (value instanceof Error) {
|
|
1897
|
+
throw new UnexpectedError(spaceTrim$1("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
|
|
1898
|
+
}
|
|
1899
|
+
else {
|
|
1900
|
+
try {
|
|
1901
|
+
for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1902
|
+
var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
|
|
1903
|
+
if (subValue === undefined) {
|
|
1904
|
+
// Note: undefined in object is serializable - it is just omited
|
|
1905
|
+
continue;
|
|
1906
|
+
}
|
|
1907
|
+
checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1911
|
+
finally {
|
|
1912
|
+
try {
|
|
1913
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1914
|
+
}
|
|
1915
|
+
finally { if (e_1) throw e_1.error; }
|
|
1916
|
+
}
|
|
1917
|
+
try {
|
|
1918
|
+
JSON.stringify(value); // <- TODO: [0]
|
|
1919
|
+
}
|
|
1920
|
+
catch (error) {
|
|
1921
|
+
if (!(error instanceof Error)) {
|
|
1922
|
+
throw error;
|
|
1923
|
+
}
|
|
1924
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
|
|
1925
|
+
}
|
|
1926
|
+
/*
|
|
1927
|
+
TODO: [0] Is there some more elegant way to check circular references?
|
|
1928
|
+
const seen = new Set();
|
|
1929
|
+
const stack = [{ value }];
|
|
1930
|
+
while (stack.length > 0) {
|
|
1931
|
+
const { value } = stack.pop()!;
|
|
1932
|
+
if (typeof value === 'object' && value !== null) {
|
|
1933
|
+
if (seen.has(value)) {
|
|
1934
|
+
throw new UnexpectedError(`${name} has circular reference`);
|
|
1935
|
+
}
|
|
1936
|
+
seen.add(value);
|
|
1937
|
+
if (Array.isArray(value)) {
|
|
1938
|
+
stack.push(...value.map((value) => ({ value })));
|
|
1939
|
+
} else {
|
|
1940
|
+
stack.push(...Object.values(value).map((value) => ({ value })));
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
*/
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
else {
|
|
1949
|
+
throw new UnexpectedError("".concat(name, " is unknown"));
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
1954
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
1955
|
+
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
1956
|
+
*/
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* @@@
|
|
1960
|
+
* @@@
|
|
1961
|
+
*
|
|
1962
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1963
|
+
*
|
|
1964
|
+
* @param name - Name of the object for debugging purposes
|
|
1965
|
+
* @param objectValue - Object to be deeply frozen
|
|
1966
|
+
* @returns The same object as the input, but deeply frozen
|
|
1967
|
+
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
1968
|
+
*/
|
|
1969
|
+
function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
1970
|
+
checkSerializableAsJson(name, objectValue);
|
|
1971
|
+
return $deepFreeze(objectValue);
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
1975
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1976
|
+
*/
|
|
1977
|
+
|
|
1939
1978
|
/**
|
|
1940
1979
|
* Unprepare just strips the preparation data of the pipeline
|
|
1941
1980
|
*
|
|
@@ -3701,6 +3740,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3701
3740
|
*/
|
|
3702
3741
|
function extractVariablesFromScript(script) {
|
|
3703
3742
|
var variables = new Set();
|
|
3743
|
+
var originalScript = script;
|
|
3704
3744
|
script = "(()=>{".concat(script, "})()");
|
|
3705
3745
|
try {
|
|
3706
3746
|
for (var i = 0; i < 100 /* <- TODO: This limit to configuration */; i++)
|
|
@@ -3732,7 +3772,9 @@ function extractVariablesFromScript(script) {
|
|
|
3732
3772
|
if (!(error instanceof Error)) {
|
|
3733
3773
|
throw error;
|
|
3734
3774
|
}
|
|
3735
|
-
throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.toString()), "}\n
|
|
3775
|
+
throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.toString()), "}\n\n\n Found variables:\n\n ").concat(Array.from(variables)
|
|
3776
|
+
.map(function (variableName, i) { return "".concat(i + 1, ") ").concat(variableName); })
|
|
3777
|
+
.join('\n'), "\n\n\n The script:\n\n ```javascript\n ").concat(block(originalScript), "\n ```\n "); }));
|
|
3736
3778
|
}
|
|
3737
3779
|
return variables;
|
|
3738
3780
|
}
|