@remnic/core 9.3.519 → 9.3.521
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/dist/index.d.ts +18 -1
- package/dist/index.js +513 -175
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/binary-lifecycle/backend.ts +162 -14
- package/src/binary-lifecycle/manifest.ts +24 -12
- package/src/binary-lifecycle/pipeline.test.ts +565 -1
- package/src/binary-lifecycle/pipeline.ts +296 -54
- package/src/binary-lifecycle/types.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -924,6 +924,8 @@ interface BinaryAssetRecord {
|
|
|
924
924
|
originalPath: string;
|
|
925
925
|
/** Path (or URL) in the backend storage. */
|
|
926
926
|
mirroredPath: string;
|
|
927
|
+
/** Optional user-resolvable target to write into markdown links. */
|
|
928
|
+
redirectPath?: string;
|
|
927
929
|
/** SHA-256 hex digest of file content. */
|
|
928
930
|
contentHash: string;
|
|
929
931
|
/** File size in bytes. */
|
|
@@ -976,15 +978,23 @@ interface BinaryStorageBackend {
|
|
|
976
978
|
exists(remotePath: string): Promise<boolean>;
|
|
977
979
|
/** Delete a file from the backend. */
|
|
978
980
|
delete(remotePath: string): Promise<void>;
|
|
981
|
+
/** Return the user-resolvable markdown target for a stored backend path. */
|
|
982
|
+
getRedirectTarget?(remotePath: string): string;
|
|
979
983
|
}
|
|
980
984
|
declare class FilesystemBackend implements BinaryStorageBackend {
|
|
981
985
|
readonly type = "filesystem";
|
|
982
986
|
private readonly basePath;
|
|
983
987
|
constructor(basePath: string);
|
|
984
988
|
private resolveRemotePath;
|
|
989
|
+
private isInsideBase;
|
|
990
|
+
private realBasePathIfExists;
|
|
991
|
+
private ensureBaseDirectory;
|
|
992
|
+
private ensureSafeParentDirectory;
|
|
993
|
+
private resolveExistingRemotePath;
|
|
985
994
|
upload(localPath: string, remotePath: string): Promise<string>;
|
|
986
995
|
exists(remotePath: string): Promise<boolean>;
|
|
987
996
|
delete(remotePath: string): Promise<void>;
|
|
997
|
+
getRedirectTarget(remotePath: string): string;
|
|
988
998
|
}
|
|
989
999
|
declare class NoneBackend implements BinaryStorageBackend {
|
|
990
1000
|
readonly type = "none";
|
|
@@ -1026,7 +1036,8 @@ declare function manifestDir(memoryDir: string): string;
|
|
|
1026
1036
|
declare function manifestPath(memoryDir: string): string;
|
|
1027
1037
|
/**
|
|
1028
1038
|
* Read the manifest from disk. Returns a fresh empty manifest if the file
|
|
1029
|
-
* does not exist
|
|
1039
|
+
* does not exist. Existing invalid manifests fail closed so the pipeline does
|
|
1040
|
+
* not overwrite state needed for safe cleanup.
|
|
1030
1041
|
*/
|
|
1031
1042
|
declare function readManifest(memoryDir: string): Promise<BinaryLifecycleManifest>;
|
|
1032
1043
|
/**
|
|
@@ -1051,10 +1062,16 @@ interface PipelineLogger {
|
|
|
1051
1062
|
warn(msg: string): void;
|
|
1052
1063
|
error(msg: string): void;
|
|
1053
1064
|
}
|
|
1065
|
+
type ReadMarkdownFile = (filePath: string) => Promise<string>;
|
|
1066
|
+
type WriteMarkdownFile = (filePath: string, content: string) => Promise<void>;
|
|
1054
1067
|
interface PipelineOptions {
|
|
1055
1068
|
dryRun?: boolean;
|
|
1056
1069
|
/** Force-clean all files past grace period, ignoring redirect status. */
|
|
1057
1070
|
forceClean?: boolean;
|
|
1071
|
+
/** Test hook for deterministic markdown read failures. */
|
|
1072
|
+
readMarkdownFile?: ReadMarkdownFile;
|
|
1073
|
+
/** Test hook for deterministic markdown write failures. */
|
|
1074
|
+
writeMarkdownFile?: WriteMarkdownFile;
|
|
1058
1075
|
}
|
|
1059
1076
|
/**
|
|
1060
1077
|
* Run the binary lifecycle pipeline: scan, mirror, redirect, clean.
|