@promptbook/pdf 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.
- package/esm/index.es.js +27 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -6
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +10 -18
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
- package/esm/typings/src/llm-providers/_common/register/$provideEnvFilepath.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +43 -30
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/package.json +2 -2
- package/umd/index.umd.js +27 -6
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
- 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-
|
|
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
|
|
@@ -2226,6 +2226,19 @@ class NotYetImplementedError extends Error {
|
|
|
2226
2226
|
}
|
|
2227
2227
|
}
|
|
2228
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* Error thrown when a fetch request fails
|
|
2231
|
+
*
|
|
2232
|
+
* @public exported from `@promptbook/core`
|
|
2233
|
+
*/
|
|
2234
|
+
class PromptbookFetchError extends Error {
|
|
2235
|
+
constructor(message) {
|
|
2236
|
+
super(message);
|
|
2237
|
+
this.name = 'PromptbookFetchError';
|
|
2238
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2229
2242
|
/**
|
|
2230
2243
|
* Index of all custom errors
|
|
2231
2244
|
*
|
|
@@ -2264,6 +2277,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
|
|
|
2264
2277
|
URIError,
|
|
2265
2278
|
AggregateError,
|
|
2266
2279
|
AuthenticationError,
|
|
2280
|
+
PromptbookFetchError,
|
|
2267
2281
|
/*
|
|
2268
2282
|
Note: Not widely supported
|
|
2269
2283
|
> InternalError,
|
|
@@ -3243,17 +3257,24 @@ function mimeTypeToExtension(value) {
|
|
|
3243
3257
|
/**
|
|
3244
3258
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3245
3259
|
*
|
|
3246
|
-
* @
|
|
3260
|
+
* @public exported from `@promptbook/core`
|
|
3247
3261
|
*/
|
|
3248
|
-
const
|
|
3262
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3249
3263
|
try {
|
|
3250
|
-
return await fetch(
|
|
3264
|
+
return await fetch(urlOrRequest, init);
|
|
3251
3265
|
}
|
|
3252
3266
|
catch (error) {
|
|
3253
3267
|
if (!(error instanceof Error)) {
|
|
3254
3268
|
throw error;
|
|
3255
3269
|
}
|
|
3256
|
-
|
|
3270
|
+
let url;
|
|
3271
|
+
if (typeof urlOrRequest === 'string') {
|
|
3272
|
+
url = urlOrRequest;
|
|
3273
|
+
}
|
|
3274
|
+
else if (urlOrRequest instanceof Request) {
|
|
3275
|
+
url = urlOrRequest.url;
|
|
3276
|
+
}
|
|
3277
|
+
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
3257
3278
|
Can not fetch "${url}"
|
|
3258
3279
|
|
|
3259
3280
|
Fetch error:
|
|
@@ -3274,7 +3295,7 @@ const scraperFetch = async (url, init) => {
|
|
|
3274
3295
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3275
3296
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3276
3297
|
var _a;
|
|
3277
|
-
const { fetch =
|
|
3298
|
+
const { fetch = promptbookFetch } = tools;
|
|
3278
3299
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3279
3300
|
let { name } = knowledgeSource;
|
|
3280
3301
|
const { rootDirname = null,
|