@c3-oss/prosa 0.3.1 → 0.3.2

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 CHANGED
@@ -38,6 +38,11 @@ declare function initBundle(rootPath: string): Promise<Bundle>;
38
38
  * than the current code expects.
39
39
  */
40
40
  declare function openBundle(rootPath: string): Promise<Bundle>;
41
+ /**
42
+ * Open an existing bundle or transparently initialize one if the store path is
43
+ * missing or has not been initialized yet.
44
+ */
45
+ declare function openOrInitBundle(rootPath: string): Promise<Bundle>;
41
46
  declare function closeBundle(bundle: Bundle): void;
42
47
 
43
48
  declare function runMigrations(db: Db): {
@@ -385,4 +390,4 @@ interface CompileResult {
385
390
  }
386
391
  declare function compileCursor(bundle: Bundle, root: string, options?: CompileOptions): Promise<CompileResult>;
387
392
 
388
- export { type Bundle, type BundleManifest, COMPILE_PROVIDERS, type CanonicalToolType, type CompileResult$2 as ClaudeCompileResult, type CompileResult$3 as CodexCompileResult, type CompileImportSummary, type CompileLogger, type CompileOptions, type CompileProviderConfig, type Confidence, type CompileResult as CursorCompileResult, type DuckDbQueryOptions, type DuckDbQueryResult, type EdgeType, type CompileResult$1 as GeminiCompileResult, type ImportBatch, type ImportCounts, type MessageRole, type ObjectId, type ObjectMeta, PARQUET_TABLES, PROSA_PARSER_VERSION, PROSA_SCHEMA_VERSION, type ParquetCompileSummary, type ParquetExportOptions, type ParquetExportResult, type ParquetTable, type ProviderCompileSummary, type RegisterResult, type SearchEngine, type SearchHit, type SearchIndexStatus, type SearchOptions, type SessionDetail, type SessionDetailEvent, type SessionListFilters, type SessionRow, type SessionRowFull, type SourceFileRow, type SourceTool, type TantivyCompileSummary, type ToolCallStatus, closeBundle, compileClaude, compileCodex, compileCursor, compileGemini, countSessions, currentSchemaVersion, defaultBundlePath, disableFts5Triggers, emptyCounts, enableFts5Triggers, exportBundleParquet, exportCompileParquet, exportSessionMarkdown, finishBatch, getBytes, getCompileProvider, getJson, getObjectMeta, getSearchIndexStatus, getSearchIndexStatuses, getSession, getText, initBundle, listSessions, markIndexesAfterImport, openBundle, putBytes, putJson, putText, queryDuckDbParquet, rebuildFts5Index, rebuildTantivyIndex, recordError, registerSourceFile, resolveCompilePath, runCompileImports, runMigrations, searchFullText, startBatch };
393
+ export { type Bundle, type BundleManifest, COMPILE_PROVIDERS, type CanonicalToolType, type CompileResult$2 as ClaudeCompileResult, type CompileResult$3 as CodexCompileResult, type CompileImportSummary, type CompileLogger, type CompileOptions, type CompileProviderConfig, type Confidence, type CompileResult as CursorCompileResult, type DuckDbQueryOptions, type DuckDbQueryResult, type EdgeType, type CompileResult$1 as GeminiCompileResult, type ImportBatch, type ImportCounts, type MessageRole, type ObjectId, type ObjectMeta, PARQUET_TABLES, PROSA_PARSER_VERSION, PROSA_SCHEMA_VERSION, type ParquetCompileSummary, type ParquetExportOptions, type ParquetExportResult, type ParquetTable, type ProviderCompileSummary, type RegisterResult, type SearchEngine, type SearchHit, type SearchIndexStatus, type SearchOptions, type SessionDetail, type SessionDetailEvent, type SessionListFilters, type SessionRow, type SessionRowFull, type SourceFileRow, type SourceTool, type TantivyCompileSummary, type ToolCallStatus, closeBundle, compileClaude, compileCodex, compileCursor, compileGemini, countSessions, currentSchemaVersion, defaultBundlePath, disableFts5Triggers, emptyCounts, enableFts5Triggers, exportBundleParquet, exportCompileParquet, exportSessionMarkdown, finishBatch, getBytes, getCompileProvider, getJson, getObjectMeta, getSearchIndexStatus, getSearchIndexStatuses, getSession, getText, initBundle, listSessions, markIndexesAfterImport, openBundle, openOrInitBundle, putBytes, putJson, putText, queryDuckDbParquet, rebuildFts5Index, rebuildTantivyIndex, recordError, registerSourceFile, resolveCompilePath, runCompileImports, runMigrations, searchFullText, startBatch };
package/dist/index.js CHANGED
@@ -534,6 +534,18 @@ async function openBundle(rootPath) {
534
534
  }
535
535
  return { path: resolved, db, manifest, paths };
536
536
  }
537
+ async function openOrInitBundle(rootPath) {
538
+ const resolved = path.resolve(rootPath);
539
+ const paths = bundlePaths(resolved);
540
+ const dirStat = await stat(resolved).catch(() => null);
541
+ if (dirStat && !dirStat.isDirectory()) {
542
+ throw new Error(`bundle path not found or not a directory: ${resolved}`);
543
+ }
544
+ if (!dirStat || !await exists(paths.manifest)) {
545
+ return await initBundle(resolved);
546
+ }
547
+ return await openBundle(resolved);
548
+ }
537
549
  function closeBundle(bundle) {
538
550
  closeDb(bundle.db);
539
551
  }
@@ -5443,6 +5455,7 @@ export {
5443
5455
  listSessions,
5444
5456
  markIndexesAfterImport,
5445
5457
  openBundle,
5458
+ openOrInitBundle,
5446
5459
  putBytes,
5447
5460
  putJson,
5448
5461
  putText,