@promptbook/website-crawler 0.89.0-8 → 0.89.0-9

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.
Files changed (25) hide show
  1. package/esm/index.es.js +27 -6
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/remote-client.index.d.ts +6 -6
  5. package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
  6. package/esm/typings/src/_packages/types.index.d.ts +10 -18
  7. package/esm/typings/src/errors/0-index.d.ts +3 -0
  8. package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
  9. package/esm/typings/src/llm-providers/_common/register/$provideEnvFilepath.d.ts +12 -0
  10. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
  11. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
  12. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +5 -3
  13. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
  14. package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
  15. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
  16. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
  17. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
  18. package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +2 -2
  19. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +43 -30
  20. package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
  21. package/package.json +2 -2
  22. package/umd/index.umd.js +27 -6
  23. package/umd/index.umd.js.map +1 -1
  24. package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
  25. package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
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.89.0-8';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-9';
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
@@ -2341,6 +2341,19 @@ class LimitReachedError extends Error {
2341
2341
  }
2342
2342
  }
2343
2343
 
2344
+ /**
2345
+ * Error thrown when a fetch request fails
2346
+ *
2347
+ * @public exported from `@promptbook/core`
2348
+ */
2349
+ class PromptbookFetchError extends Error {
2350
+ constructor(message) {
2351
+ super(message);
2352
+ this.name = 'PromptbookFetchError';
2353
+ Object.setPrototypeOf(this, PromptbookFetchError.prototype);
2354
+ }
2355
+ }
2356
+
2344
2357
  /**
2345
2358
  * Index of all custom errors
2346
2359
  *
@@ -2379,6 +2392,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
2379
2392
  URIError,
2380
2393
  AggregateError,
2381
2394
  AuthenticationError,
2395
+ PromptbookFetchError,
2382
2396
  /*
2383
2397
  Note: Not widely supported
2384
2398
  > InternalError,
@@ -3244,17 +3258,24 @@ function mimeTypeToExtension(value) {
3244
3258
  /**
3245
3259
  * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
3246
3260
  *
3247
- * @private as default `fetch` function used in Promptbook scrapers
3261
+ * @public exported from `@promptbook/core`
3248
3262
  */
3249
- const scraperFetch = async (url, init) => {
3263
+ const promptbookFetch = async (urlOrRequest, init) => {
3250
3264
  try {
3251
- return await fetch(url, init);
3265
+ return await fetch(urlOrRequest, init);
3252
3266
  }
3253
3267
  catch (error) {
3254
3268
  if (!(error instanceof Error)) {
3255
3269
  throw error;
3256
3270
  }
3257
- throw new KnowledgeScrapeError(spaceTrim$1((block) => `
3271
+ let url;
3272
+ if (typeof urlOrRequest === 'string') {
3273
+ url = urlOrRequest;
3274
+ }
3275
+ else if (urlOrRequest instanceof Request) {
3276
+ url = urlOrRequest.url;
3277
+ }
3278
+ throw new PromptbookFetchError(spaceTrim$1((block) => `
3258
3279
  Can not fetch "${url}"
3259
3280
 
3260
3281
  Fetch error:
@@ -3275,7 +3296,7 @@ const scraperFetch = async (url, init) => {
3275
3296
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3276
3297
  // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
3277
3298
  var _a;
3278
- const { fetch = scraperFetch } = tools;
3299
+ const { fetch = promptbookFetch } = tools;
3279
3300
  const { knowledgeSourceContent } = knowledgeSource;
3280
3301
  let { name } = knowledgeSource;
3281
3302
  const { rootDirname = null,