@promptbook/core 0.52.0-15 → 0.52.0-16
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 +62 -38
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/core.index.d.ts +4 -2
- package/esm/typings/library/constructors/justTestFsImport.d.ts +4 -0
- package/package.json +2 -1
- package/umd/index.umd.js +67 -41
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/core.index.d.ts +4 -2
- package/umd/typings/library/constructors/justTestFsImport.d.ts +4 -0
package/esm/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
2
2
|
import { format } from 'prettier';
|
|
3
3
|
import parserHtml from 'prettier/parser-html';
|
|
4
|
-
import
|
|
4
|
+
import glob from 'glob-promise';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
@@ -448,7 +448,7 @@ function union() {
|
|
|
448
448
|
/**
|
|
449
449
|
* The version of the Promptbook library
|
|
450
450
|
*/
|
|
451
|
-
var PROMPTBOOK_VERSION = '0.52.0-
|
|
451
|
+
var PROMPTBOOK_VERSION = '0.52.0-15';
|
|
452
452
|
|
|
453
453
|
/**
|
|
454
454
|
* Parses the template and returns the list of all parameter names
|
|
@@ -3169,23 +3169,6 @@ var isRunningInNode = new Function("\n try {\n return this === global;
|
|
|
3169
3169
|
*/
|
|
3170
3170
|
new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
3171
3171
|
|
|
3172
|
-
/**
|
|
3173
|
-
* Returns the same value that is passed as argument.
|
|
3174
|
-
* No side effects.
|
|
3175
|
-
*
|
|
3176
|
-
* Note: It can be usefull for leveling indentation
|
|
3177
|
-
*
|
|
3178
|
-
* @param value any values
|
|
3179
|
-
* @returns the same values
|
|
3180
|
-
*/
|
|
3181
|
-
function just(value) {
|
|
3182
|
-
if (value === undefined) {
|
|
3183
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3184
|
-
return undefined;
|
|
3185
|
-
}
|
|
3186
|
-
return value;
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
3172
|
/**
|
|
3190
3173
|
* This error indicates that promptbook not found in the library
|
|
3191
3174
|
*/
|
|
@@ -3431,25 +3414,27 @@ function createPromptbookLibraryFromDirectory(path, options) {
|
|
|
3431
3414
|
}
|
|
3432
3415
|
var _a = (options || {}).isRecursive, isRecursive = _a === void 0 ? true : _a;
|
|
3433
3416
|
return createPromptbookLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3434
|
-
var justR_equire, readdir, dirents, fileNames;
|
|
3435
3417
|
return __generator(this, function (_a) {
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3418
|
+
/*
|
|
3419
|
+
const justR_equire = require; /* <- Note: [1] * /
|
|
3420
|
+
const readdir = justR_equire(just('fs/promises') /* <- Note: [2] * /).readdir as typeof readdirType;
|
|
3421
|
+
|
|
3422
|
+
// TODO: !!!! Implement recursive reading
|
|
3423
|
+
// TODO: !!!!! readAllFiles util
|
|
3424
|
+
|
|
3425
|
+
const dirents = await readdir(path, {
|
|
3426
|
+
withFileTypes: true /* Note: This is not working: recursive: isRecursive * /,
|
|
3427
|
+
});
|
|
3428
|
+
const fileNames = dirents.filter((dirent) => dirent.isFile()).map(({ name }) => join(name, path));
|
|
3429
|
+
|
|
3430
|
+
// TODO: !!! Implement
|
|
3431
|
+
|
|
3432
|
+
console.info('createPromptbookLibraryFromDirectory', { path, isRecursive, fileNames });
|
|
3433
|
+
throw new Error('Not implemented yet');
|
|
3434
|
+
|
|
3435
|
+
*/
|
|
3436
|
+
console.info('createPromptbookLibraryFromDirectory', { path: path, isRecursive: isRecursive });
|
|
3437
|
+
return [2 /*return*/, []];
|
|
3453
3438
|
});
|
|
3454
3439
|
}); });
|
|
3455
3440
|
}
|
|
@@ -3561,6 +3546,28 @@ function createPromptbookSublibrary(library, predicate) {
|
|
|
3561
3546
|
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
3562
3547
|
*/
|
|
3563
3548
|
|
|
3549
|
+
/**
|
|
3550
|
+
* Just testing imports and compatibility
|
|
3551
|
+
*/
|
|
3552
|
+
function justTestFsImport() {
|
|
3553
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3554
|
+
var files;
|
|
3555
|
+
return __generator(this, function (_a) {
|
|
3556
|
+
switch (_a.label) {
|
|
3557
|
+
case 0:
|
|
3558
|
+
if (!isRunningInNode()) {
|
|
3559
|
+
throw new Error('Function `testFiles` can only be run in Node.js environment because it reads the file system.');
|
|
3560
|
+
}
|
|
3561
|
+
return [4 /*yield*/, glob('/**/*')];
|
|
3562
|
+
case 1:
|
|
3563
|
+
files = _a.sent();
|
|
3564
|
+
console.info('testFiles', { files: files });
|
|
3565
|
+
return [2 /*return*/];
|
|
3566
|
+
}
|
|
3567
|
+
});
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3564
3571
|
/**
|
|
3565
3572
|
* Format either small or big number
|
|
3566
3573
|
*
|
|
@@ -3581,6 +3588,23 @@ function formatNumber(value) {
|
|
|
3581
3588
|
return value.toString();
|
|
3582
3589
|
}
|
|
3583
3590
|
|
|
3591
|
+
/**
|
|
3592
|
+
* Returns the same value that is passed as argument.
|
|
3593
|
+
* No side effects.
|
|
3594
|
+
*
|
|
3595
|
+
* Note: It can be usefull for leveling indentation
|
|
3596
|
+
*
|
|
3597
|
+
* @param value any values
|
|
3598
|
+
* @returns the same values
|
|
3599
|
+
*/
|
|
3600
|
+
function just(value) {
|
|
3601
|
+
if (value === undefined) {
|
|
3602
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3603
|
+
return undefined;
|
|
3604
|
+
}
|
|
3605
|
+
return value;
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3584
3608
|
/**
|
|
3585
3609
|
* Create a markdown table from a 2D array of strings
|
|
3586
3610
|
*
|
|
@@ -3861,5 +3885,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
3861
3885
|
* TODO: [🧠] Allow to filter out some parts of the report by options
|
|
3862
3886
|
*/
|
|
3863
3887
|
|
|
3864
|
-
export { CallbackInterfaceTools, ExecutionReportStringOptionsDefaults, ExecutionTypes, MultipleLlmExecutionTools, PROMPTBOOK_VERSION, SimplePromptInterfaceTools, SimplePromptbookLibrary, assertsExecutionSuccessful, checkExpectations, createPromptbookExecutor, createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, executionReportJsonToString, isPassingExpectations, prettifyPromptbookString, promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
3888
|
+
export { CallbackInterfaceTools, ExecutionReportStringOptionsDefaults, ExecutionTypes, MultipleLlmExecutionTools, PROMPTBOOK_VERSION, SimplePromptInterfaceTools, SimplePromptbookLibrary, assertsExecutionSuccessful, checkExpectations, createPromptbookExecutor, createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, executionReportJsonToString, isPassingExpectations, justTestFsImport, prettifyPromptbookString, promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
3865
3889
|
//# sourceMappingURL=index.es.js.map
|