@promptbook/legacy-documents 0.100.0-3 → 0.100.0-5
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 +37 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +37 -4
- package/umd/index.umd.js.map +1 -1
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.100.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.100.0-4`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/legacy-documents",
|
|
3
|
-
"version": "0.100.0-
|
|
3
|
+
"version": "0.100.0-5",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/legacy-documents.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.100.0-
|
|
98
|
+
"@promptbook/core": "0.100.0-5"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-5';
|
|
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
|
|
@@ -1024,7 +1024,23 @@
|
|
|
1024
1024
|
.join('/') +
|
|
1025
1025
|
'.' +
|
|
1026
1026
|
extension;
|
|
1027
|
-
|
|
1027
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
1028
|
+
try {
|
|
1029
|
+
await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
|
|
1030
|
+
}
|
|
1031
|
+
catch (error) {
|
|
1032
|
+
// Note: If we can't create cache directory, continue without it
|
|
1033
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
1034
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
1035
|
+
error.message.includes('read-only') ||
|
|
1036
|
+
error.message.includes('EACCES') ||
|
|
1037
|
+
error.message.includes('EPERM') ||
|
|
1038
|
+
error.message.includes('ENOENT'))) ;
|
|
1039
|
+
else {
|
|
1040
|
+
// Re-throw other unexpected errors
|
|
1041
|
+
throw error;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1028
1044
|
let isDestroyed = true;
|
|
1029
1045
|
const fileHandler = {
|
|
1030
1046
|
filename: cacheFilename,
|
|
@@ -3646,7 +3662,23 @@
|
|
|
3646
3662
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
3647
3663
|
const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
3648
3664
|
const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
|
|
3649
|
-
|
|
3665
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
3666
|
+
try {
|
|
3667
|
+
await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
|
|
3668
|
+
}
|
|
3669
|
+
catch (error) {
|
|
3670
|
+
// Note: If we can't create cache directory, we'll handle it when trying to write the file
|
|
3671
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
3672
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
3673
|
+
error.message.includes('read-only') ||
|
|
3674
|
+
error.message.includes('EACCES') ||
|
|
3675
|
+
error.message.includes('EPERM') ||
|
|
3676
|
+
error.message.includes('ENOENT'))) ;
|
|
3677
|
+
else {
|
|
3678
|
+
// Re-throw other unexpected errors
|
|
3679
|
+
throw error;
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3650
3682
|
const fileContent = Buffer.from(await response.arrayBuffer());
|
|
3651
3683
|
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
3652
3684
|
throw new LimitReachedError(`File is too large (${Math.round(fileContent.length / 1024 / 1024)}MB). Maximum allowed size is ${Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024)}MB.`);
|
|
@@ -3661,7 +3693,8 @@
|
|
|
3661
3693
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
3662
3694
|
error.message.includes('read-only') ||
|
|
3663
3695
|
error.message.includes('EACCES') ||
|
|
3664
|
-
error.message.includes('EPERM')
|
|
3696
|
+
error.message.includes('EPERM') ||
|
|
3697
|
+
error.message.includes('ENOENT'))) {
|
|
3665
3698
|
// Return a handler that works directly with the downloaded content
|
|
3666
3699
|
return {
|
|
3667
3700
|
source: name,
|