@promptbook/cli 0.71.0-20 → 0.71.0-23

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/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('commander'), require('spacetrim'), require('colors'), require('waitasecond'), require('fs/promises'), require('path'), require('prettier'), require('prettier/parser-html'), require('papaparse'), require('crypto-js'), require('crypto-js/enc-hex'), require('mime-types'), require('dotenv'), require('crypto-js/sha256'), require('glob-promise'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('@azure/openai'), require('openai'), require('child_process'), require('@mozilla/readability'), require('jsdom'), require('showdown')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'commander', 'spacetrim', 'colors', 'waitasecond', 'fs/promises', 'path', 'prettier', 'prettier/parser-html', 'papaparse', 'crypto-js', 'crypto-js/enc-hex', 'mime-types', 'dotenv', 'crypto-js/sha256', 'glob-promise', 'socket.io-client', '@anthropic-ai/sdk', '@azure/openai', 'openai', 'child_process', '@mozilla/readability', 'jsdom', 'showdown'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.commander, global.spaceTrim, global.colors, global.waitasecond, global.promises, global.path, global.prettier, global.parserHtml, global.papaparse, global.cryptoJs, global.hexEncoder, global.mimeTypes, global.dotenv, global.sha256, global.glob, global.socket_ioClient, global.Anthropic, global.openai, global.OpenAI, global.child_process, global.readability, global.jsdom, global.showdown));
5
- })(this, (function (exports, commander, spaceTrim, colors, waitasecond, promises, path, prettier, parserHtml, papaparse, cryptoJs, hexEncoder, mimeTypes, dotenv, sha256, glob, socket_ioClient, Anthropic, openai, OpenAI, child_process, readability, jsdom, showdown) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('commander'), require('spacetrim'), require('colors'), require('waitasecond'), require('fs/promises'), require('path'), require('prettier'), require('prettier/parser-html'), require('papaparse'), require('crypto-js'), require('crypto-js/enc-hex'), require('mime-types'), require('child_process'), require('util'), require('dotenv'), require('crypto-js/sha256'), require('glob-promise'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('@azure/openai'), require('openai'), require('@mozilla/readability'), require('jsdom'), require('showdown')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'commander', 'spacetrim', 'colors', 'waitasecond', 'fs/promises', 'path', 'prettier', 'prettier/parser-html', 'papaparse', 'crypto-js', 'crypto-js/enc-hex', 'mime-types', 'child_process', 'util', 'dotenv', 'crypto-js/sha256', 'glob-promise', 'socket.io-client', '@anthropic-ai/sdk', '@azure/openai', 'openai', '@mozilla/readability', 'jsdom', 'showdown'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.commander, global.spaceTrim, global.colors, global.waitasecond, global.promises, global.path, global.prettier, global.parserHtml, global.papaparse, global.cryptoJs, global.hexEncoder, global.mimeTypes, global.child_process, global.util, global.dotenv, global.sha256, global.glob, global.socket_ioClient, global.Anthropic, global.openai, global.OpenAI, global.readability, global.jsdom, global.showdown));
5
+ })(this, (function (exports, commander, spaceTrim, colors, waitasecond, promises, path, prettier, parserHtml, papaparse, cryptoJs, hexEncoder, mimeTypes, child_process, util, dotenv, sha256, glob, socket_ioClient, Anthropic, openai, OpenAI, readability, jsdom, showdown) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -39,7 +39,7 @@
39
39
  /**
40
40
  * The version of the Promptbook library
41
41
  */
42
- var PROMPTBOOK_VERSION = '0.71.0-19';
42
+ var PROMPTBOOK_VERSION = '0.71.0-22';
43
43
  // TODO: [main] !!!! List here all the versions and annotate + put into script
44
44
 
45
45
  /*! *****************************************************************************
@@ -4913,7 +4913,6 @@
4913
4913
  * TODO: [®] DRY Register logic
4914
4914
  */
4915
4915
 
4916
- // TODO: !!!!!!last - Maybe delete this function
4917
4916
  /**
4918
4917
  * Creates a message with all registered scrapers
4919
4918
  *
@@ -5186,7 +5185,7 @@
5186
5185
  return __awaiter(this, void 0, void 0, function () {
5187
5186
  var sourceContent, name, _b, _c, rootDirname, _d,
5188
5187
  // <- TODO: process.cwd() if running in Node.js
5189
- isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType_1;
5188
+ isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
5190
5189
  return __generator(this, function (_e) {
5191
5190
  switch (_e.label) {
5192
5191
  case 0:
@@ -5208,19 +5207,14 @@
5208
5207
  filename: null,
5209
5208
  url: url,
5210
5209
  mimeType: mimeType,
5211
- asBlob: function () {
5212
- return __awaiter(this, void 0, void 0, function () {
5213
- var content;
5214
- return __generator(this, function (_a) {
5215
- switch (_a.label) {
5216
- case 0: return [4 /*yield*/, response_1.blob()];
5217
- case 1:
5218
- content = _a.sent();
5219
- return [2 /*return*/, content];
5220
- }
5221
- });
5222
- });
5223
- },
5210
+ /*
5211
+ TODO: [🥽]
5212
+ > async asBlob() {
5213
+ > // TODO: [👨🏻‍🤝‍👨🏻] This can be called multiple times BUT when called second time, response in already consumed
5214
+ > const content = await response.blob();
5215
+ > return content;
5216
+ > },
5217
+ */
5224
5218
  asJson: function () {
5225
5219
  return __awaiter(this, void 0, void 0, function () {
5226
5220
  var content;
@@ -5260,34 +5254,31 @@
5260
5254
  }
5261
5255
  filename_1 = path.join(rootDirname, sourceContent).split('\\').join('/');
5262
5256
  fileExtension = getFileExtension(filename_1);
5263
- mimeType_1 = extensionToMimeType(fileExtension || '');
5257
+ mimeType = extensionToMimeType(fileExtension || '');
5264
5258
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
5265
5259
  case 3:
5266
5260
  if (!(_e.sent())) {
5267
5261
  throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
5268
5262
  }
5269
- // TODO: !!!!!! Test security file - file is scoped to the project (maybe do this in `filesystemTools`)
5263
+ // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
5270
5264
  return [2 /*return*/, {
5271
5265
  source: name,
5272
5266
  filename: filename_1,
5273
5267
  url: null,
5274
- mimeType: mimeType_1,
5275
- asBlob: function () {
5276
- return __awaiter(this, void 0, void 0, function () {
5277
- var content;
5278
- return __generator(this, function (_a) {
5279
- switch (_a.label) {
5280
- case 0: return [4 /*yield*/, tools.fs.readFile(filename_1)];
5281
- case 1:
5282
- content = _a.sent();
5283
- return [2 /*return*/, new Blob([
5284
- content,
5285
- // <- TODO: !!!!!! Test that this is working
5286
- ], { type: mimeType_1 })];
5287
- }
5288
- });
5289
- });
5290
- },
5268
+ mimeType: mimeType,
5269
+ /*
5270
+ TODO: [🥽]
5271
+ > async asBlob() {
5272
+ > const content = await tools.fs!.readFile(filename);
5273
+ > return new Blob(
5274
+ > [
5275
+ > content,
5276
+ > // <- TODO: [🥽] This is NOT tested, test it
5277
+ > ],
5278
+ > { type: mimeType },
5279
+ > );
5280
+ > },
5281
+ */
5291
5282
  asJson: function () {
5292
5283
  return __awaiter(this, void 0, void 0, function () {
5293
5284
  var _a, _b;
@@ -5323,9 +5314,14 @@
5323
5314
  asJson: function () {
5324
5315
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
5325
5316
  },
5326
- asBlob: function () {
5327
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
5328
- },
5317
+ /*
5318
+ TODO: [🥽]
5319
+ > asBlob() {
5320
+ > throw new UnexpectedError(
5321
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
5322
+ > );
5323
+ > },
5324
+ */
5329
5325
  }];
5330
5326
  }
5331
5327
  });
@@ -5650,6 +5646,7 @@
5650
5646
  'KNOWLEDGE ./hejny-cv.md',
5651
5647
  'KNOWLEDGE ./hejny-cv.pdf',
5652
5648
  'KNOWLEDGE ./hejny-cv.docx',
5649
+ // <- TODO: [😿] Allow ONLY files scoped in the (sub)directory NOT ../ and test it
5653
5650
  ],
5654
5651
  /**
5655
5652
  * Parses the KNOWLEDGE command
@@ -8358,6 +8355,301 @@
8358
8355
  * TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
8359
8356
  */
8360
8357
 
8358
+ // Note: We want to use the `exec` as async function
8359
+ var exec$1 = util.promisify(child_process.exec);
8360
+ /**
8361
+ * @@@
8362
+ *
8363
+ * @private within the repository
8364
+ */
8365
+ function locateAppOnLinux(_a) {
8366
+ var appName = _a.appName, linuxWhich = _a.linuxWhich;
8367
+ return __awaiter(this, void 0, void 0, function () {
8368
+ var _b, stderr, stdout;
8369
+ return __generator(this, function (_c) {
8370
+ switch (_c.label) {
8371
+ case 0: return [4 /*yield*/, exec$1("which ".concat(linuxWhich))];
8372
+ case 1:
8373
+ _b = _c.sent(), stderr = _b.stderr, stdout = _b.stdout;
8374
+ if (!stderr && stdout) {
8375
+ return [2 /*return*/, stdout.trim()];
8376
+ }
8377
+ throw new Error("Can not locate app ".concat(appName, " on Linux.\n ").concat(stderr));
8378
+ }
8379
+ });
8380
+ });
8381
+ }
8382
+ /**
8383
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8384
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8385
+ */
8386
+
8387
+ /**
8388
+ * @@@
8389
+ *
8390
+ * @public exported from `@promptbook/node`
8391
+ */
8392
+ function $provideFilesystemForNode(options) {
8393
+ if (!$isRunningInNode()) {
8394
+ throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
8395
+ }
8396
+ var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
8397
+ TODO_USE(isVerbose);
8398
+ return {
8399
+ stat: promises.stat,
8400
+ access: promises.access,
8401
+ constants: promises.constants,
8402
+ readFile: promises.readFile,
8403
+ readdir: promises.readdir,
8404
+ };
8405
+ }
8406
+ /**
8407
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8408
+ */
8409
+
8410
+ /**
8411
+ * Checks if the file is executable
8412
+ *
8413
+ * @private within the repository
8414
+ */
8415
+ function isExecutable(path, fs) {
8416
+ return __awaiter(this, void 0, void 0, function () {
8417
+ return __generator(this, function (_a) {
8418
+ switch (_a.label) {
8419
+ case 0:
8420
+ _a.trys.push([0, 2, , 3]);
8421
+ return [4 /*yield*/, fs.access(path, fs.constants.X_OK)];
8422
+ case 1:
8423
+ _a.sent();
8424
+ return [2 /*return*/, true];
8425
+ case 2:
8426
+ _a.sent();
8427
+ return [2 /*return*/, false];
8428
+ case 3: return [2 /*return*/];
8429
+ }
8430
+ });
8431
+ });
8432
+ }
8433
+ /**
8434
+ * Note: Not [~🟢~] because it is not directly dependent on `fs
8435
+ * TODO: [🖇] What about symlinks?
8436
+ */
8437
+
8438
+ // Note: Module `userhome` has no types available, so it is imported using `require`
8439
+ // @see https://stackoverflow.com/questions/37000981/how-to-import-node-module-in-typescript-without-type-definitions
8440
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8441
+ var userhome = require('userhome');
8442
+ // Note: We want to use the `exec` as async function
8443
+ var exec = util.promisify(child_process.exec);
8444
+ /**
8445
+ * @@@
8446
+ *
8447
+ * @private within the repository
8448
+ */
8449
+ function locateAppOnMacOs(_a) {
8450
+ var appName = _a.appName, macOsName = _a.macOsName;
8451
+ return __awaiter(this, void 0, void 0, function () {
8452
+ var toExec, regPath, altPath, _b, stderr, stdout;
8453
+ return __generator(this, function (_c) {
8454
+ switch (_c.label) {
8455
+ case 0:
8456
+ toExec = "/Contents/MacOS/".concat(macOsName);
8457
+ regPath = "/Applications/".concat(macOsName, ".app") + toExec;
8458
+ altPath = userhome(regPath.slice(1));
8459
+ return [4 /*yield*/, isExecutable(regPath, $provideFilesystemForNode())];
8460
+ case 1:
8461
+ if (!_c.sent()) return [3 /*break*/, 2];
8462
+ return [2 /*return*/, regPath];
8463
+ case 2: return [4 /*yield*/, isExecutable(altPath, $provideFilesystemForNode())];
8464
+ case 3:
8465
+ if (_c.sent()) {
8466
+ return [2 /*return*/, altPath];
8467
+ }
8468
+ _c.label = 4;
8469
+ case 4: return [4 /*yield*/, exec("mdfind 'kMDItemDisplayName == \"".concat(macOsName, "\" && kMDItemKind == Application'"))];
8470
+ case 5:
8471
+ _b = _c.sent(), stderr = _b.stderr, stdout = _b.stdout;
8472
+ if (!stderr && stdout) {
8473
+ return [2 /*return*/, stdout.trim() + toExec];
8474
+ }
8475
+ throw new Error("Can not locate app ".concat(appName, " on macOS.\n ").concat(stderr));
8476
+ }
8477
+ });
8478
+ });
8479
+ }
8480
+ /**
8481
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8482
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8483
+ */
8484
+
8485
+ /**
8486
+ * @@@
8487
+ *
8488
+ * @private within the repository
8489
+ */
8490
+ function locateAppOnWindows(_a) {
8491
+ var appName = _a.appName, windowsSuffix = _a.windowsSuffix;
8492
+ return __awaiter(this, void 0, void 0, function () {
8493
+ var prefixes, prefixes_1, prefixes_1_1, prefix, path$1, e_1_1;
8494
+ var e_1, _b;
8495
+ return __generator(this, function (_c) {
8496
+ switch (_c.label) {
8497
+ case 0:
8498
+ prefixes = [
8499
+ process.env.LOCALAPPDATA,
8500
+ path.join(process.env.LOCALAPPDATA || '', 'Programs'),
8501
+ process.env.PROGRAMFILES,
8502
+ process.env['PROGRAMFILES(X86)'],
8503
+ ];
8504
+ _c.label = 1;
8505
+ case 1:
8506
+ _c.trys.push([1, 6, 7, 8]);
8507
+ prefixes_1 = __values(prefixes), prefixes_1_1 = prefixes_1.next();
8508
+ _c.label = 2;
8509
+ case 2:
8510
+ if (!!prefixes_1_1.done) return [3 /*break*/, 5];
8511
+ prefix = prefixes_1_1.value;
8512
+ path$1 = prefix + windowsSuffix;
8513
+ return [4 /*yield*/, isExecutable(path$1, $provideFilesystemForNode())];
8514
+ case 3:
8515
+ if (_c.sent()) {
8516
+ return [2 /*return*/, path$1];
8517
+ }
8518
+ _c.label = 4;
8519
+ case 4:
8520
+ prefixes_1_1 = prefixes_1.next();
8521
+ return [3 /*break*/, 2];
8522
+ case 5: return [3 /*break*/, 8];
8523
+ case 6:
8524
+ e_1_1 = _c.sent();
8525
+ e_1 = { error: e_1_1 };
8526
+ return [3 /*break*/, 8];
8527
+ case 7:
8528
+ try {
8529
+ if (prefixes_1_1 && !prefixes_1_1.done && (_b = prefixes_1.return)) _b.call(prefixes_1);
8530
+ }
8531
+ finally { if (e_1) throw e_1.error; }
8532
+ return [7 /*endfinally*/];
8533
+ case 8: throw new Error("Can not locate app ".concat(appName, " on Windows."));
8534
+ }
8535
+ });
8536
+ });
8537
+ }
8538
+ /**
8539
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8540
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8541
+ */
8542
+
8543
+ /**
8544
+ * Locates an application on the system
8545
+ *
8546
+ * @private within the repository
8547
+ */
8548
+ function locateApp(options) {
8549
+ if (!$isRunningInNode()) {
8550
+ throw new EnvironmentMismatchError('Locating apps works only in Node.js environment');
8551
+ }
8552
+ var appName = options.appName, linuxWhich = options.linuxWhich, windowsSuffix = options.windowsSuffix, macOsName = options.macOsName;
8553
+ if (process.platform === 'win32') {
8554
+ if (windowsSuffix) {
8555
+ return locateAppOnWindows({ appName: appName, windowsSuffix: windowsSuffix });
8556
+ }
8557
+ else {
8558
+ throw new Error("".concat(appName, " is not available on Windows."));
8559
+ }
8560
+ }
8561
+ else if (process.platform === 'darwin') {
8562
+ if (macOsName) {
8563
+ return locateAppOnMacOs({ appName: appName, macOsName: macOsName });
8564
+ }
8565
+ else {
8566
+ throw new Error("".concat(appName, " is not available on macOS."));
8567
+ }
8568
+ }
8569
+ else {
8570
+ if (linuxWhich) {
8571
+ return locateAppOnLinux({ appName: appName, linuxWhich: linuxWhich });
8572
+ }
8573
+ else {
8574
+ throw new Error("".concat(appName, " is not available on Linux."));
8575
+ }
8576
+ }
8577
+ }
8578
+ /**
8579
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8580
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8581
+ */
8582
+
8583
+ /**
8584
+ * @@@
8585
+ *
8586
+ * @private within the repository
8587
+ */
8588
+ function locateLibreoffice() {
8589
+ return locateApp({
8590
+ appName: 'Libreoffice',
8591
+ linuxWhich: 'libreoffice',
8592
+ windowsSuffix: '\\LibreOffice\\program\\soffice.exe',
8593
+ macOsName: 'LibreOffice',
8594
+ });
8595
+ }
8596
+ /**
8597
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/legacy-documents`
8598
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8599
+ */
8600
+
8601
+ /**
8602
+ * @@@
8603
+ *
8604
+ * @private within the repository
8605
+ */
8606
+ function locatePandoc() {
8607
+ return locateApp({
8608
+ appName: 'Pandoc',
8609
+ linuxWhich: 'pandoc',
8610
+ windowsSuffix: '\\Pandoc\\pandoc.exe',
8611
+ macOsName: 'Pandoc',
8612
+ });
8613
+ }
8614
+ /**
8615
+ * TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/documents`
8616
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8617
+ */
8618
+
8619
+ /**
8620
+ * @@@
8621
+ *
8622
+ * @public exported from `@promptbook/node`
8623
+ */
8624
+ function $provideExecutablesForNode(options) {
8625
+ return __awaiter(this, void 0, void 0, function () {
8626
+ var _a, _b, isAutoInstalled, _c, isVerbose;
8627
+ var _d;
8628
+ return __generator(this, function (_e) {
8629
+ switch (_e.label) {
8630
+ case 0:
8631
+ if (!$isRunningInNode()) {
8632
+ throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
8633
+ }
8634
+ _a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ? DEFAULT_IS_AUTO_INSTALLED : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
8635
+ TODO_USE(isAutoInstalled); // <- TODO: [🔱][🧠] Auto-install the executables
8636
+ TODO_USE(isVerbose);
8637
+ _d = {};
8638
+ return [4 /*yield*/, locatePandoc()];
8639
+ case 1:
8640
+ _d.pandocPath = _e.sent();
8641
+ return [4 /*yield*/, locateLibreoffice()];
8642
+ case 2: return [2 /*return*/, (_d.libreOfficePath = _e.sent(),
8643
+ _d)];
8644
+ }
8645
+ });
8646
+ });
8647
+ }
8648
+ /**
8649
+ * TODO: [🧠] Allow to override the executables without need to call `locatePandoc` / `locateLibreoffice` in case of provided
8650
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8651
+ */
8652
+
8361
8653
  /**
8362
8654
  * @@@
8363
8655
  *
@@ -8588,57 +8880,6 @@
8588
8880
  * TODO: [®] DRY Register logic
8589
8881
  */
8590
8882
 
8591
- /**
8592
- * @@@
8593
- *
8594
- * @public exported from `@promptbook/node`
8595
- */
8596
- function $provideExecutablesForNode(options) {
8597
- return __awaiter(this, void 0, void 0, function () {
8598
- var _a, _b, isAutoInstalled, _c, isVerbose;
8599
- return __generator(this, function (_d) {
8600
- if (!$isRunningInNode()) {
8601
- throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
8602
- }
8603
- _a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ? DEFAULT_IS_AUTO_INSTALLED : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
8604
- TODO_USE(isAutoInstalled);
8605
- TODO_USE(isVerbose);
8606
- return [2 /*return*/, {
8607
- // TODO: !!!!!! use `locate-app` library here
8608
- pandocPath: 'C:/Users/me/AppData/Local/Pandoc/pandoc.exe',
8609
- libreOfficePath: 'C:/Program Files/LibreOffice/program/swriter.exe',
8610
- }];
8611
- });
8612
- });
8613
- }
8614
- /**
8615
- * TODO: [🧠] THis should be maybe in different folder
8616
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8617
- */
8618
-
8619
- /**
8620
- * @@@
8621
- *
8622
- * @public exported from `@promptbook/node`
8623
- */
8624
- function $provideFilesystemForNode(options) {
8625
- if (!$isRunningInNode()) {
8626
- throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
8627
- }
8628
- var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
8629
- TODO_USE(isVerbose);
8630
- return {
8631
- stat: promises.stat,
8632
- access: promises.access,
8633
- constants: promises.constants,
8634
- readFile: promises.readFile,
8635
- readdir: promises.readdir,
8636
- };
8637
- }
8638
- /**
8639
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8640
- */
8641
-
8642
8883
  /**
8643
8884
  * @@@
8644
8885
  *
@@ -13158,9 +13399,14 @@
13158
13399
  asJson: function () {
13159
13400
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
13160
13401
  },
13161
- asBlob: function () {
13162
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
13163
- },
13402
+ /*
13403
+ TODO: [🥽]
13404
+ > asBlob() {
13405
+ > throw new UnexpectedError(
13406
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
13407
+ > );
13408
+ > },
13409
+ */
13164
13410
  };
13165
13411
  knowledge = this.markdownScraper.scrape(markdownSource);
13166
13412
  return [4 /*yield*/, cacheFilehandler.destroy()];
@@ -13326,9 +13572,14 @@
13326
13572
  asJson: function () {
13327
13573
  throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asJson`');
13328
13574
  },
13329
- asBlob: function () {
13330
- throw new UnexpectedError('Did not expect that `documentScraper` would need to get the content `asBlob`');
13331
- },
13575
+ /*
13576
+ TODO: [🥽]
13577
+ > asBlob() {
13578
+ > throw new UnexpectedError(
13579
+ > 'Did not expect that `documentScraper` would need to get the content `asBlob`',
13580
+ > );
13581
+ > },
13582
+ */
13332
13583
  };
13333
13584
  knowledge = this.documentScraper.scrape(markdownSource);
13334
13585
  return [4 /*yield*/, cacheFilehandler.destroy()];
@@ -13616,7 +13867,6 @@
13616
13867
  switch (_g.label) {
13617
13868
  case 0:
13618
13869
  _a = this.options, _b = _a.rootDirname, rootDirname = _b === void 0 ? process.cwd() : _b, _c = _a.cacheDirname, cacheDirname = _c === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _c, _d = _a.intermediateFilesStrategy, intermediateFilesStrategy = _d === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _d, _e = _a.isVerbose, isVerbose = _e === void 0 ? DEFAULT_IS_VERBOSE : _e;
13619
- // TODO: !!!!!! Does this work in browser? Make it work.
13620
13870
  if (source.url === null) {
13621
13871
  throw new KnowledgeScrapeError('Website scraper requires URL');
13622
13872
  }
@@ -13676,9 +13926,14 @@
13676
13926
  asJson: function () {
13677
13927
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
13678
13928
  },
13679
- asBlob: function () {
13680
- throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asBlob`');
13681
- },
13929
+ /*
13930
+ TODO: [🥽]
13931
+ > asBlob() {
13932
+ > throw new UnexpectedError(
13933
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
13934
+ > );
13935
+ > },
13936
+ */
13682
13937
  };
13683
13938
  knowledge = this.markdownScraper.scrape(markdownSource);
13684
13939
  return [4 /*yield*/, cacheFilehandler.destroy()];