@webneat/codewiki 0.0.6 → 0.0.7

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.cts CHANGED
@@ -1643,6 +1643,7 @@ type EntitiesToDescribe = {
1643
1643
  };
1644
1644
  interface CodeWiki {
1645
1645
  readonly config: Config;
1646
+ update_config(config: Partial<Config>): void;
1646
1647
  update(): Promise<void>;
1647
1648
  counts(): WikiCounts;
1648
1649
  to_describe(limit: number): EntitiesToDescribe;
@@ -1685,10 +1686,7 @@ interface DependenciesWiki {
1685
1686
  used_by_symbol<K extends keyof ExternalDependency>(symbol_id: number, options?: SelectOptions<ExternalDependency, K>): Array<Pick<ExternalDependency, K>>;
1686
1687
  }
1687
1688
 
1688
- declare function context_from_config(config: Config): Promise<Context>;
1689
- declare function context_from_db(db_path: string): Promise<Context>;
1690
-
1691
1689
  declare function create(config: Config): Promise<CodeWiki>;
1692
1690
  declare function load(db_path: string): Promise<CodeWiki>;
1693
1691
 
1694
- export { type CodeWiki, type Config, type Context, type ContextDependency, type DependenciesWiki, type DirectoriesWiki, type Directory, type EntitiesToDescribe, type ExternalDependency, type File, type FilesWiki, type RelationOptions, type SearchOptions, type SelectOptions, type Symbol, type SymbolsWiki, type WikiCounts, context_from_config, context_from_db, create, load };
1692
+ export { type CodeWiki, type Config, type Context, type ContextDependency, type DependenciesWiki, type DirectoriesWiki, type Directory, type EntitiesToDescribe, type ExternalDependency, type File, type FilesWiki, type RelationOptions, type SearchOptions, type SelectOptions, type Symbol, type SymbolsWiki, type WikiCounts, create, load };
package/dist/index.d.ts CHANGED
@@ -1643,6 +1643,7 @@ type EntitiesToDescribe = {
1643
1643
  };
1644
1644
  interface CodeWiki {
1645
1645
  readonly config: Config;
1646
+ update_config(config: Partial<Config>): void;
1646
1647
  update(): Promise<void>;
1647
1648
  counts(): WikiCounts;
1648
1649
  to_describe(limit: number): EntitiesToDescribe;
@@ -1685,10 +1686,7 @@ interface DependenciesWiki {
1685
1686
  used_by_symbol<K extends keyof ExternalDependency>(symbol_id: number, options?: SelectOptions<ExternalDependency, K>): Array<Pick<ExternalDependency, K>>;
1686
1687
  }
1687
1688
 
1688
- declare function context_from_config(config: Config): Promise<Context>;
1689
- declare function context_from_db(db_path: string): Promise<Context>;
1690
-
1691
1689
  declare function create(config: Config): Promise<CodeWiki>;
1692
1690
  declare function load(db_path: string): Promise<CodeWiki>;
1693
1691
 
1694
- export { type CodeWiki, type Config, type Context, type ContextDependency, type DependenciesWiki, type DirectoriesWiki, type Directory, type EntitiesToDescribe, type ExternalDependency, type File, type FilesWiki, type RelationOptions, type SearchOptions, type SelectOptions, type Symbol, type SymbolsWiki, type WikiCounts, context_from_config, context_from_db, create, load };
1692
+ export { type CodeWiki, type Config, type Context, type ContextDependency, type DependenciesWiki, type DirectoriesWiki, type Directory, type EntitiesToDescribe, type ExternalDependency, type File, type FilesWiki, type RelationOptions, type SearchOptions, type SelectOptions, type Symbol, type SymbolsWiki, type WikiCounts, create, load };
package/dist/index.js CHANGED
@@ -2327,6 +2327,21 @@ async function update6(ctx) {
2327
2327
  await link_symbols(ctx);
2328
2328
  }
2329
2329
 
2330
+ // src/update_config.ts
2331
+ function update_config(ctx, config, updates) {
2332
+ if (Object.keys(updates).length === 0) return;
2333
+ const new_config = { ...config, ...updates };
2334
+ err.or_throw(
2335
+ configs_exports.upsert(ctx, {
2336
+ project_path: new_config.project_path,
2337
+ description: new_config.description ?? null,
2338
+ package_json_path: new_config.package_json_path ?? null,
2339
+ node_modules_paths: new_config.node_modules_paths ? JSON.stringify(new_config.node_modules_paths) : null
2340
+ })
2341
+ );
2342
+ Object.assign(config, updates);
2343
+ }
2344
+
2330
2345
  // src/counts.ts
2331
2346
  import { count as count10 } from "drizzle-orm";
2332
2347
  function counts(ctx) {
@@ -2646,6 +2661,7 @@ async function create(config) {
2646
2661
  const ctx = await context_from_config(config);
2647
2662
  return {
2648
2663
  config,
2664
+ update_config: (updates) => update_config(ctx, config, updates),
2649
2665
  update: () => update6(ctx),
2650
2666
  counts: () => counts(ctx),
2651
2667
  to_describe: (limit) => to_describe(ctx, limit),
@@ -2667,6 +2683,7 @@ async function load(db_path) {
2667
2683
  };
2668
2684
  return {
2669
2685
  config,
2686
+ update_config: (updates) => update_config(ctx, config, updates),
2670
2687
  update: () => update6(ctx),
2671
2688
  counts: () => counts(ctx),
2672
2689
  to_describe: (limit) => to_describe(ctx, limit),
@@ -2677,8 +2694,6 @@ async function load(db_path) {
2677
2694
  };
2678
2695
  }
2679
2696
  export {
2680
- context_from_config,
2681
- context_from_db,
2682
2697
  create,
2683
2698
  load
2684
2699
  };