mindspace: version runtime contracts and audit packages

This commit is contained in:
john
2026-07-27 17:43:38 +08:00
parent e94052ff24
commit 70264a4c4c
23 changed files with 1448 additions and 20 deletions
+7 -3
View File
@@ -9,17 +9,21 @@ import {
createMindSpacePublicUrl,
normalizeMindSpacePublicRelativePath,
} from './mindspace-canonical-url.mjs';
import { normalizeMindSpaceStorageKey } from './mindspace-storage-adapter.mjs';
import {
assertMindSpaceStorageAdapterContract,
normalizeMindSpaceStorageKey,
} from './mindspace-storage-adapter.mjs';
function serviceError(message, code, details = {}) {
return Object.assign(new Error(message), { code, ...details });
}
function requireStorageAdapter(storageAdapter) {
if (!storageAdapter || typeof storageAdapter.putObject !== 'function') {
try {
return assertMindSpaceStorageAdapterContract(storageAdapter);
} catch (error) {
throw serviceError('MindSpace storage adapter is required', 'missing_mindspace_storage_adapter');
}
return storageAdapter;
}
function packageStorageKey(packageRecord, relativePath) {