@promptbook/markitdown 0.89.0-7 → 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 -16
  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 +63 -21
  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
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-7';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-9';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2213,6 +2213,19 @@ class NotYetImplementedError extends Error {
2213
2213
  }
2214
2214
  }
2215
2215
 
2216
+ /**
2217
+ * Error thrown when a fetch request fails
2218
+ *
2219
+ * @public exported from `@promptbook/core`
2220
+ */
2221
+ class PromptbookFetchError extends Error {
2222
+ constructor(message) {
2223
+ super(message);
2224
+ this.name = 'PromptbookFetchError';
2225
+ Object.setPrototypeOf(this, PromptbookFetchError.prototype);
2226
+ }
2227
+ }
2228
+
2216
2229
  /**
2217
2230
  * Index of all custom errors
2218
2231
  *
@@ -2251,6 +2264,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
2251
2264
  URIError,
2252
2265
  AggregateError,
2253
2266
  AuthenticationError,
2267
+ PromptbookFetchError,
2254
2268
  /*
2255
2269
  Note: Not widely supported
2256
2270
  > InternalError,
@@ -3230,17 +3244,24 @@ function mimeTypeToExtension(value) {
3230
3244
  /**
3231
3245
  * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
3232
3246
  *
3233
- * @private as default `fetch` function used in Promptbook scrapers
3247
+ * @public exported from `@promptbook/core`
3234
3248
  */
3235
- const scraperFetch = async (url, init) => {
3249
+ const promptbookFetch = async (urlOrRequest, init) => {
3236
3250
  try {
3237
- return await fetch(url, init);
3251
+ return await fetch(urlOrRequest, init);
3238
3252
  }
3239
3253
  catch (error) {
3240
3254
  if (!(error instanceof Error)) {
3241
3255
  throw error;
3242
3256
  }
3243
- throw new KnowledgeScrapeError(spaceTrim((block) => `
3257
+ let url;
3258
+ if (typeof urlOrRequest === 'string') {
3259
+ url = urlOrRequest;
3260
+ }
3261
+ else if (urlOrRequest instanceof Request) {
3262
+ url = urlOrRequest.url;
3263
+ }
3264
+ throw new PromptbookFetchError(spaceTrim((block) => `
3244
3265
  Can not fetch "${url}"
3245
3266
 
3246
3267
  Fetch error:
@@ -3261,7 +3282,7 @@ const scraperFetch = async (url, init) => {
3261
3282
  async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3262
3283
  // console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
3263
3284
  var _a;
3264
- const { fetch = scraperFetch } = tools;
3285
+ const { fetch = promptbookFetch } = tools;
3265
3286
  const { knowledgeSourceContent } = knowledgeSource;
3266
3287
  let { name } = knowledgeSource;
3267
3288
  const { rootDirname = null,