@feng0531/dsh-vcs 0.10.4 → 0.10.6

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/index.mjs CHANGED
@@ -790,16 +790,14 @@ export function registerDirectAssets(ctx, load = filename => readFile(new URL('.
790
790
  }));
791
791
  }
792
792
 
793
- export function apply(ctx) {
794
- const host=createSvnHttpsHost(ctx,adapter);
795
- ctx.effect(()=>()=>{ host.dispose(); adapter.clearHistoricalCache?.(); });
793
+ export function registerVcsRpc(ctx, handleHost) {
796
794
  const connection=ctx.connection;
797
795
  if(!('browserPeer' in connection)){
798
796
  // Older hosts expose explicit owner registration.
799
- connection.register(ctx,RPC_CHANNEL,host.handle);
797
+ connection.register(ctx,RPC_CHANNEL,handleHost);
800
798
  }else{
801
799
  const handle=(endpoint,payload,signal,peer)=>
802
- peer?.principal?.kind==='owner'?host.handle(endpoint,payload,signal):failure('vcs/forbidden','VCS requires the local owner.');
800
+ peer?.principal?.kind==='owner'?handleHost(endpoint,payload,signal,peer):failure('vcs/forbidden','VCS requires the local owner.');
803
801
  if(typeof connection.authorizeIndex==='function' && typeof connection.register==='function'){
804
802
  // Pre-split authentication hosts can resolve webServer from Connection's
805
803
  // scope during rpc.handle(). Pass the VCS scope, which injects webServer.
@@ -808,6 +806,12 @@ export function apply(ctx) {
808
806
  connection.rpc.handle(RPC_CHANNEL,handle);
809
807
  }
810
808
  }
809
+ }
810
+
811
+ export function apply(ctx) {
812
+ const host=createSvnHttpsHost(ctx,adapter);
813
+ ctx.effect(()=>()=>{ host.dispose(); adapter.clearHistoricalCache?.(); });
814
+ registerVcsRpc(ctx,host.handle);
811
815
  registerAssets(ctx);
812
816
  registerDirectAssets(ctx);
813
817
  registerFrontendAssets(ctx,{running:runningFrontend});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-vcs",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "private": false,
5
5
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
6
6
  "type": "module",
package/vcs.mjs CHANGED
@@ -327,7 +327,7 @@ async function commitDetails(repo,{commit,parentIndex=0,signal}={},includeMessag
327
327
  if(typeof commit!=='string'||!isObjectId(commit))throw new Error('Invalid commit id');
328
328
  if(!Number.isInteger(parentIndex)||parentIndex<0)throw new Error('Invalid parent index');
329
329
  signal?.throwIfAborted();
330
- repo=await checkedGitRepo(repo,signal,'Commit details support Git only');
330
+ repo=await checkedGitRepo(repo,signal,'Commit details support Git only',undefined,false);
331
331
  const raw=await git(repo.root,['log','-z','--no-show-signature','--encoding=UTF-8','--max-count=1','--format='+HISTORY_FORMAT,commit,'--'],MAX_TEXT,{signal});
332
332
  const metadata=parseHistory(raw.toString('utf8'),1)[0];
333
333
  if(!metadata||metadata.id!==commit)throw new Error('Commit object required');
@@ -379,7 +379,7 @@ export async function getHistoricalSegment(repo, {commit,path:file,offset,line,s
379
379
  export async function getHistoricalFile(repo,{commit,path:file,signal}={}) {
380
380
  if(typeof file !== 'string' || !file || file.includes('\0')) throw Error('Invalid historical path');
381
381
  try {validateHistoricalPath(file);} catch {throw Error('Path is not part of selected commit');}
382
- repo = await checkedGitRepo(repo, signal, 'Historical file supports Git only');
382
+ repo = await checkedGitRepo(repo, signal, 'Historical file supports Git only', undefined, false);
383
383
  const entry = await historicalAccess.lookup(repo.root, {commit,path:file,signal});
384
384
  if (entry.type !== 'blob' || !['100644','100755'].includes(entry.mode)) throw Error('Historical file preview requires a regular file');
385
385
  const result = await content(() => git(repo.root, ['cat-file','blob',entry.oid], MAX_TEXT, {signal}));
@@ -388,13 +388,13 @@ export async function getHistoricalFile(repo,{commit,path:file,signal}={}) {
388
388
  }
389
389
 
390
390
  export async function getHistoricalTreePage(repo, options = {}) {
391
- repo = await checkedGitRepo(repo, options.signal, 'Historical tree supports Git only');
391
+ repo = await checkedGitRepo(repo, options.signal, 'Historical tree supports Git only', undefined, false);
392
392
  return historicalAccess.treePage(repo.root, options);
393
393
  }
394
394
 
395
395
  export async function getHistoricalTree(repo,{commit,signal}={}) {
396
396
  if(typeof commit!=='string'||!isObjectId(commit))throw new Error('Invalid commit id');
397
- repo=await checkedGitRepo(repo,signal,'Historical tree supports Git only');
397
+ repo=await checkedGitRepo(repo,signal,'Historical tree supports Git only',undefined,false);
398
398
  const type=(await git(repo.root,['cat-file','-t',commit],MAX_TEXT,{signal})).toString('utf8').trim();if(type!=='commit')throw new Error('Commit object required');
399
399
  const text=(await git(repo.root,['ls-tree','-r','-t','-z','--full-tree',commit],MAX_TEXT,{signal})).toString('utf8');
400
400
  const fields=text.split(String.fromCharCode(0));if(fields.pop()!=='')throw new Error('Truncated historical tree');
@@ -557,7 +557,7 @@ export async function listPathHistory(repo,{commit,path:file,offset=0,limit=50,f
557
557
 
558
558
  export async function getRevisionChanges(repo,{base,target,signal}={}){
559
559
  for(const oid of [base,target])if(typeof oid!=='string'||!isObjectId(oid))throw new Error('Invalid revision commit id');
560
- signal?.throwIfAborted();repo=await checkedGitRepo(repo,signal,'Revision comparison supports Git only');
560
+ signal?.throwIfAborted();repo=await checkedGitRepo(repo,signal,'Revision comparison supports Git only',undefined,false);
561
561
  for(const oid of new Set([base,target])){
562
562
  const type=(await git(repo.root,['cat-file','-t',oid],MAX_TEXT,{signal})).toString('utf8').trim();
563
563
  if(type!=='commit')throw new Error('Commit object required');