browser-git-ops 0.0.2 → 0.0.4
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/README.md +71 -97
- package/dist/git/abstractAdapter.d.ts +183 -0
- package/dist/git/abstractAdapter.d.ts.map +1 -0
- package/dist/git/adapter.d.ts +23 -1
- package/dist/git/adapter.d.ts.map +1 -1
- package/dist/git/githubAdapter.d.ts +354 -35
- package/dist/git/githubAdapter.d.ts.map +1 -1
- package/dist/git/gitlabAdapter.d.ts +297 -20
- package/dist/git/gitlabAdapter.d.ts.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6012 -843
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +6012 -843
- package/dist/index.mjs.map +4 -4
- package/dist/virtualfs/changeTracker.d.ts +66 -0
- package/dist/virtualfs/changeTracker.d.ts.map +1 -0
- package/dist/virtualfs/conflictManager.d.ts +69 -0
- package/dist/virtualfs/conflictManager.d.ts.map +1 -0
- package/dist/virtualfs/hashUtils.d.ts +13 -0
- package/dist/virtualfs/hashUtils.d.ts.map +1 -0
- package/dist/virtualfs/indexManager.d.ts +57 -0
- package/dist/virtualfs/indexManager.d.ts.map +1 -0
- package/dist/virtualfs/indexedDatabaseStorage.d.ts +7 -0
- package/dist/virtualfs/indexedDatabaseStorage.d.ts.map +1 -0
- package/dist/virtualfs/inmemoryStorage.d.ts +8 -0
- package/dist/virtualfs/inmemoryStorage.d.ts.map +1 -0
- package/dist/virtualfs/localChangeApplier.d.ts +21 -0
- package/dist/virtualfs/localChangeApplier.d.ts.map +1 -0
- package/dist/virtualfs/localFileManager.d.ts +58 -0
- package/dist/virtualfs/localFileManager.d.ts.map +1 -0
- package/dist/virtualfs/metadataManager.d.ts +18 -0
- package/dist/virtualfs/metadataManager.d.ts.map +1 -0
- package/dist/virtualfs/opfsStorage.d.ts +2 -63
- package/dist/virtualfs/opfsStorage.d.ts.map +1 -1
- package/dist/virtualfs/remoteSynchronizer.d.ts +192 -0
- package/dist/virtualfs/remoteSynchronizer.d.ts.map +1 -0
- package/dist/virtualfs/storageBackend.d.ts +57 -4
- package/dist/virtualfs/storageBackend.d.ts.map +1 -1
- package/dist/virtualfs/types.d.ts +37 -0
- package/dist/virtualfs/types.d.ts.map +1 -1
- package/dist/virtualfs/virtualfs.d.ts +290 -86
- package/dist/virtualfs/virtualfs.d.ts.map +1 -1
- package/package.json +29 -13
- package/dist/virtualfs/indexedDbStorage.d.ts +0 -62
- package/dist/virtualfs/indexedDbStorage.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,145 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://deepwiki.com/nojaja/browser-git-ops)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
ブラウザの永続化レイヤは OPFS と IndexedDB を個別のバックエンド実装として提供し、VirtualFS が抽象化して利用します。
|
|
3
|
+
# browser-git-ops
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
A browser-native Git operations library that provides a VirtualFS and platform adapters for GitHub and GitLab. It implements multiple persistent backends (OPFS, IndexedDB, and an in-memory backend) and abstracts them behind a common VirtualFS API.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
- `VirtualFS`:ローカルワークスペースとベーススナップショットを管理し、create/update/delete の変更セットを生成します。
|
|
10
|
-
- ストレージ分離:`OpfsStorage`(OPFS 対応)と `IndexedDbStorage`(IndexedDB 対応)を個別実装として提供。
|
|
11
|
-
- `GitHubAdapter` / `GitLabAdapter`:各プラットフォーム向けのアダプタ実装(HTTP 再試行や blob/tree/commit フローを含む)。
|
|
7
|
+
- Live Demo: https://nojaja.github.io/browser-git-ops/
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
**[日本語ドキュメント (Japanese)](README_ja.md)**
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
- `
|
|
18
|
-
-
|
|
19
|
-
- 単体テストを複数更新・追加し、OPFS / IndexedDB の分岐やトランザクションエラー経路のカバレッジを強化しました。
|
|
11
|
+
Key features
|
|
12
|
+
- VirtualFS: local workspace snapshoting and change-set generation (create/update/delete).
|
|
13
|
+
- Multiple backends: `OpfsStorage` (OPFS), `IndexedDatabaseStorage` (IndexedDB), and `InMemoryStorage` (testing).
|
|
14
|
+
- Platform adapters: `GitHubAdapter` and `GitLabAdapter` implementing common push/fetch flows via Web APIs, enabling cross-origin operations without CORS proxy workarounds.
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
Status summary
|
|
17
|
+
- Core VirtualFS functionality implemented (delta generation, index management, local edits).
|
|
18
|
+
- Persistence backends for OPFS and IndexedDB implemented.
|
|
19
|
+
- GitHubAdapter includes primary push flow; GitLab adapter exists but may require extra environment verification.
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
ライブラリはバンドル/パッケージとして次をエクスポートします(`src/index.ts` を参照):
|
|
21
|
+
Quick Install via npm (library consumers)
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- `GitHubAdapter`, `GitLabAdapter` — 各プラットフォーム向けアダプタ
|
|
23
|
+
```bash
|
|
24
|
+
npm i browser-git-ops
|
|
25
|
+
```
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
Usage (basic)
|
|
32
28
|
|
|
33
29
|
```ts
|
|
34
30
|
import { VirtualFS, OpfsStorage, GitHubAdapter } from 'browser-git-ops'
|
|
35
31
|
|
|
36
32
|
async function example() {
|
|
37
|
-
const
|
|
33
|
+
const backend = new lib.OpfsStorage('test01')
|
|
34
|
+
const vfs = new VirtualFS({ backend })
|
|
38
35
|
await vfs.init()
|
|
36
|
+
await vfs.setAdapter(null, { type: 'gitlab', opts: { projectId: 'ORG', host: 'HOST', token: 'token', branch: 'main' } })
|
|
39
37
|
|
|
40
|
-
await vfs.
|
|
38
|
+
await vfs.pull()
|
|
39
|
+
const list = await vfs.listPaths()
|
|
40
|
+
await vfs.writeFile('README.md', 'hello world')
|
|
41
41
|
const changes = await vfs.getChangeSet()
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const idx = await vfs.getIndex()
|
|
44
|
+
const pushInput = { parentSha: idx.head, message: 'Example push', changes: changes }
|
|
45
|
+
const pushRes = await vfs.push(pushInput as any)
|
|
45
46
|
}
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## プロジェクト構成(抜粋)
|
|
51
|
-
|
|
52
|
-
- `src/` - ソースコード
|
|
53
|
-
- `virtualfs/virtualfs.ts` - `VirtualFS` 本体
|
|
54
|
-
- `virtualfs/opfsStorage.ts` - OPFS バックエンド
|
|
55
|
-
- `virtualfs/indexedDbStorage.ts` - IndexedDB バックエンド
|
|
56
|
-
- `git/githubAdapter.ts` - GitHub 向けアダプタ
|
|
57
|
-
- `git/gitlabAdapter.ts` - GitLab 向けアダプタ
|
|
58
|
-
- `examples/` - ブラウザ実行用のサンプル UI
|
|
59
|
-
- `test/` - Jest(unit)および Playwright(e2e)テスト
|
|
60
|
-
|
|
61
|
-
(詳細はソース内のファイル参照を推奨)
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## 技術スタック
|
|
66
|
-
|
|
67
|
-
- TypeScript
|
|
68
|
-
- ビルド: `esbuild`(ブラウザ向けバンドル) + `tsc`(型定義出力)
|
|
69
|
-
- テスト: Jest(unit) / Playwright(e2e)
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 特記事項 / 現在のステータス
|
|
74
|
-
|
|
75
|
-
- 実装済み
|
|
76
|
-
- `VirtualFS` のコア機能(差分生成・index 管理・ローカル編集)
|
|
77
|
-
- `OpfsStorage` と `IndexedDbStorage` の永続化 API
|
|
78
|
-
- `GitHubAdapter` の主要な push フロー
|
|
79
|
-
- テスト
|
|
80
|
-
- unit テストは多数あり、OPFS/IndexedDB 分岐やトランザクションエラー経路をカバー
|
|
81
|
-
- E2E は Playwright ベースのサンプル UI を含む
|
|
82
|
-
- 要検証 / ⚠️ 注意
|
|
83
|
-
- GitLab の API 実装は環境差異を考慮した追加検証が必要です。
|
|
84
|
-
- OPFS の利用可否はブラウザ実装に依存します(polyfill でテストは行っていますが、実ブラウザでの動作確認を推奨)。
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## セットアップ(開発者向け)
|
|
89
|
-
|
|
90
|
-
1. リポジトリをクローン
|
|
49
|
+
install
|
|
91
50
|
|
|
92
51
|
```bash
|
|
93
52
|
git clone https://github.com/nojaja/browser-git-ops.git
|
|
94
|
-
cd
|
|
53
|
+
cd browser-git-ops
|
|
95
54
|
npm ci
|
|
96
55
|
```
|
|
97
56
|
|
|
98
|
-
|
|
57
|
+
Build & test
|
|
99
58
|
|
|
100
59
|
```bash
|
|
101
|
-
npm run
|
|
102
|
-
npm run test
|
|
60
|
+
npm run build # build browser bundles and types
|
|
61
|
+
npm run test # unit tests (Jest)
|
|
62
|
+
npm run test:e2e # Playwright E2E (runs after build)
|
|
103
63
|
npm run lint # ESLint
|
|
104
|
-
npm run build # 型定義 + ブラウザバンドル出力 (dist/)
|
|
105
64
|
```
|
|
106
65
|
|
|
107
|
-
|
|
66
|
+
Project layout (excerpt)
|
|
67
|
+
|
|
68
|
+
- `src/` — source
|
|
69
|
+
- `virtualfs/virtualfs.ts` — `VirtualFS` core
|
|
70
|
+
- `virtualfs/opfsStorage.ts` — OPFS backend
|
|
71
|
+
- `virtualfs/indexedDatabaseStorage.ts` — IndexedDB backend
|
|
72
|
+
- `virtualfs/inmemoryStorage.ts` — In-memory backend (tests)
|
|
73
|
+
- `git/githubAdapter.ts` — GitHub adapter
|
|
74
|
+
- `git/gitlabAdapter.ts` — GitLab adapter
|
|
75
|
+
- `examples/` — browser sample UI and Playwright scenarios
|
|
76
|
+
- `test/` — Jest unit tests and Playwright E2E tests
|
|
77
|
+
|
|
78
|
+
Configuration
|
|
108
79
|
|
|
109
|
-
|
|
80
|
+
- Set `GH_TOKEN` or appropriate credentials when using platform adapters.
|
|
81
|
+
- OPFS availability depends on the browser; polyfills/mocks are used in tests.
|
|
110
82
|
|
|
111
|
-
|
|
83
|
+
Examples
|
|
112
84
|
|
|
113
|
-
-
|
|
114
|
-
- `init()` — バックエンド初期化・index 読み込み。
|
|
115
|
-
- `writeWorkspace(path, content)` / `deleteWorkspace(path)` / `renameWorkspace(from,to)` — ローカル編集操作。
|
|
116
|
-
- `getChangeSet()` — create/update/delete の変更配列を取得。
|
|
117
|
-
- `applyBaseSnapshot(snapshot, headSha)` — リモートスナップショット適用(conflicts を返す)。
|
|
85
|
+
- See the `examples/` directory for a browser sample and Playwright scenarios.
|
|
118
86
|
|
|
119
|
-
|
|
87
|
+
API surface (overview)
|
|
120
88
|
|
|
121
|
-
|
|
89
|
+
- `new VirtualFS(options?)` — options: `{ storageDir?: string, backend?: StorageBackend }`
|
|
90
|
+
- `init()` — initialize backend and load index
|
|
91
|
+
- `writeFile(path, content)`, `deleteFile(path)`, `renameFile(from,to)` — local edits
|
|
92
|
+
- `getChangeSet()` — returns list of create/update/delete changes
|
|
93
|
+
- `applyBaseSnapshot(snapshot, headSha)` — apply remote snapshot, returns conflicts if any
|
|
122
94
|
|
|
123
|
-
|
|
95
|
+
Testing & CI
|
|
124
96
|
|
|
125
|
-
-
|
|
126
|
-
-
|
|
97
|
+
- Run unit tests locally with `npm run test`.
|
|
98
|
+
- `npm run test:e2e` requires a build (`npm run build`) before execution.
|
|
127
99
|
|
|
128
|
-
|
|
100
|
+
Contributing
|
|
129
101
|
|
|
130
|
-
|
|
102
|
+
- Issues and PRs are welcome. Please open an Issue first to discuss design when appropriate.
|
|
103
|
+
- Follow TypeScript + ESLint conventions; include tests for new behavior.
|
|
131
104
|
|
|
132
|
-
|
|
133
|
-
- コーディング規約: TypeScript + ESLint。PR ではテスト追加を推奨します。
|
|
105
|
+
Support / Getting help
|
|
134
106
|
|
|
135
|
-
|
|
107
|
+
- Report issues at: https://github.com/nojaja/browser-git-ops/issues
|
|
136
108
|
|
|
137
|
-
|
|
109
|
+
License
|
|
138
110
|
|
|
139
|
-
- MIT —
|
|
111
|
+
- Licensed under the MIT License — see the `LICENSE` file for details.
|
|
140
112
|
|
|
141
|
-
|
|
113
|
+
Maintainers
|
|
142
114
|
|
|
143
|
-
|
|
115
|
+
- Maintained by `nojaja` (https://github.com/nojaja). See repository for contributors and history.
|
|
144
116
|
|
|
145
|
-
|
|
117
|
+
TODO
|
|
118
|
+
- Add code examples that demonstrate push/pull flows end-to-end.
|
|
119
|
+
- Add a CONTRIBUTING.md with contributor guidelines and PR checklist.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export type FetchWithRetryFunction = (_input: RequestInfo, _init: RequestInit, _attempts?: number, _baseDelay?: number) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* Simple logger interface for dependency injection.
|
|
4
|
+
* If a caller injects an object matching this interface, the adapter
|
|
5
|
+
* will forward debug/info/warn/error messages to it. If no logger is
|
|
6
|
+
* provided, no logging will be performed by the adapter.
|
|
7
|
+
*/
|
|
8
|
+
export interface Logger {
|
|
9
|
+
debug: (..._messages: any[]) => void;
|
|
10
|
+
info: (..._messages: any[]) => void;
|
|
11
|
+
warn: (..._messages: any[]) => void;
|
|
12
|
+
error: (..._messages: any[]) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compute SHA-1 of string content using Web Crypto
|
|
16
|
+
* @param content The input string
|
|
17
|
+
* @returns Promise resolving to hex-encoded SHA-1
|
|
18
|
+
*/
|
|
19
|
+
export declare function shaOf(content: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Determine whether an HTTP status should be considered retryable
|
|
22
|
+
* @param status HTTP status code
|
|
23
|
+
* @returns true if retryable (5xx or 429)
|
|
24
|
+
*/
|
|
25
|
+
export declare function classifyStatus(status: number): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Calculate delay before retrying based on response or exponential backoff
|
|
28
|
+
* @param response Response or null when not available
|
|
29
|
+
* @param index Attempt index (0-based)
|
|
30
|
+
* @param baseDelay Base delay in ms
|
|
31
|
+
* @returns delay in milliseconds
|
|
32
|
+
*/
|
|
33
|
+
export declare function getDelayForResponse(response: Response | null, index: number, baseDelay: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Process HTTP response and throw on non-ok. If retryable, delay before throwing.
|
|
36
|
+
* @param response Fetch Response
|
|
37
|
+
* @param index Attempt index
|
|
38
|
+
* @param baseDelay Base delay in ms
|
|
39
|
+
* @returns Promise resolving to the response when ok
|
|
40
|
+
*/
|
|
41
|
+
export declare function processResponseWithDelay(response: Response, index: number, baseDelay: number): Promise<Response>;
|
|
42
|
+
/**
|
|
43
|
+
* Perform fetch with retry/backoff logic
|
|
44
|
+
* @param input RequestInfo
|
|
45
|
+
* @param init RequestInit
|
|
46
|
+
* @param attempts number of attempts
|
|
47
|
+
* @param baseDelay base delay in ms
|
|
48
|
+
* @returns Promise resolving to Response
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchWithRetry(input: RequestInfo, init: RequestInit, attempts?: number, baseDelay?: number): Promise<Response>;
|
|
51
|
+
/**
|
|
52
|
+
* Error indicating the operation is retryable and may succeed on later attempts.
|
|
53
|
+
*/
|
|
54
|
+
export declare class RetryableError extends Error {
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Error indicating the operation failed in a non-retryable way.
|
|
58
|
+
*/
|
|
59
|
+
export declare class NonRetryableError extends Error {
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Map items with limited concurrency
|
|
63
|
+
* @template T,R
|
|
64
|
+
* @param items Array of items to map
|
|
65
|
+
* @param mapper Async mapper function
|
|
66
|
+
* @param concurrency concurrency limit
|
|
67
|
+
* @returns Promise resolving to array of mapped results
|
|
68
|
+
*/
|
|
69
|
+
export declare function mapWithConcurrency<T, R>(items: T[], mapper: (_t: T) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Abstract base class providing shared utilities for Git adapters
|
|
72
|
+
*/
|
|
73
|
+
export declare abstract class AbstractGitAdapter {
|
|
74
|
+
protected baseUrl: string;
|
|
75
|
+
protected headers: Record<string, string>;
|
|
76
|
+
protected options: any;
|
|
77
|
+
protected logger?: Logger;
|
|
78
|
+
protected maxRetries: number;
|
|
79
|
+
protected baseBackoff: number;
|
|
80
|
+
/**
|
|
81
|
+
* Construct base adapter
|
|
82
|
+
* @param options adapter options
|
|
83
|
+
*/
|
|
84
|
+
constructor(options?: any);
|
|
85
|
+
/**
|
|
86
|
+
* Delegate to shared shaOf implementation
|
|
87
|
+
* @param content input string
|
|
88
|
+
* @returns hex sha1
|
|
89
|
+
*/
|
|
90
|
+
protected shaOf(content: string): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Replace or set the logger at runtime.
|
|
93
|
+
* Use this if DI happens after construction.
|
|
94
|
+
* @param logger optional logger instance to set (or undefined to clear)
|
|
95
|
+
* @returns void
|
|
96
|
+
*/
|
|
97
|
+
setLogger(logger: Logger | undefined): void;
|
|
98
|
+
/**
|
|
99
|
+
* Log debug messages when a logger is present.
|
|
100
|
+
* @param _messages messages to log (unused when no logger)
|
|
101
|
+
*/
|
|
102
|
+
protected logDebug(..._messages: any[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* Log an informational message if a logger is present.
|
|
105
|
+
* @param args items to log
|
|
106
|
+
*/
|
|
107
|
+
protected logInfo(..._messages: any[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Log a warning message if a logger is present.
|
|
110
|
+
* @param args items to log
|
|
111
|
+
*/
|
|
112
|
+
protected logWarn(..._messages: any[]): void;
|
|
113
|
+
/**
|
|
114
|
+
* Log an error message if a logger is present.
|
|
115
|
+
* @param args items to log
|
|
116
|
+
*/
|
|
117
|
+
protected logError(..._messages: any[]): void;
|
|
118
|
+
/**
|
|
119
|
+
* Proxy to shared fetchWithRetry implementation
|
|
120
|
+
* @param input RequestInfo
|
|
121
|
+
* @param init RequestInit
|
|
122
|
+
* @param attempts retry attempts
|
|
123
|
+
* @param baseDelay base delay ms
|
|
124
|
+
* @returns Promise resolving to Response
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* Normalize different header-like shapes into a plain object.
|
|
128
|
+
* @param headerLike headers in Headers, array, or plain object form
|
|
129
|
+
* @returns plain header map
|
|
130
|
+
*/
|
|
131
|
+
private normalizeHeaders;
|
|
132
|
+
/**
|
|
133
|
+
* Format a fetch request into a minimal object suitable for logging.
|
|
134
|
+
* @returns formatted request log object
|
|
135
|
+
*/
|
|
136
|
+
private formatRequestForLog;
|
|
137
|
+
/**
|
|
138
|
+
* Format a fetch Response into a minimal object suitable for logging.
|
|
139
|
+
* @returns formatted response log object
|
|
140
|
+
*/
|
|
141
|
+
private formatResponseForLog;
|
|
142
|
+
/**
|
|
143
|
+
* Proxy to shared `fetchWithRetry` implementation while emitting
|
|
144
|
+
* minimal request/response logs for debugging and test inspection.
|
|
145
|
+
* @param input fetch input
|
|
146
|
+
* @param init fetch init
|
|
147
|
+
* @param attempts retry attempts
|
|
148
|
+
* @param baseDelay base delay ms
|
|
149
|
+
* @returns Promise resolving to Response
|
|
150
|
+
*/
|
|
151
|
+
protected fetchWithRetry(input: RequestInfo, init: RequestInit, attempts?: number, baseDelay?: number): Promise<Response>;
|
|
152
|
+
/**
|
|
153
|
+
* Determine if a status code is retryable
|
|
154
|
+
* @param status HTTP status code
|
|
155
|
+
* @returns boolean
|
|
156
|
+
*/
|
|
157
|
+
protected isRetryableStatus(status: number): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Compute backoff milliseconds for attempt
|
|
160
|
+
* @param attempt attempt number (1..)
|
|
161
|
+
* @returns milliseconds to wait
|
|
162
|
+
*/
|
|
163
|
+
protected backoffMs(attempt: number): number;
|
|
164
|
+
/**
|
|
165
|
+
* Delegate to shared mapWithConcurrency implementation
|
|
166
|
+
* @template T,R
|
|
167
|
+
* @param items items to map
|
|
168
|
+
* @param mapper async mapper
|
|
169
|
+
* @param concurrency concurrency limit
|
|
170
|
+
* @returns Promise resolving to mapped results
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* Map items with limited concurrency by delegating to the shared helper.
|
|
174
|
+
* @template T,R
|
|
175
|
+
* @param items items to map
|
|
176
|
+
* @param mapper async mapper
|
|
177
|
+
* @param concurrency concurrency limit
|
|
178
|
+
* @returns Promise resolving to mapped results
|
|
179
|
+
*/
|
|
180
|
+
protected mapWithConcurrency<T, R>(items: T[], mapper: (_t: T) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
181
|
+
}
|
|
182
|
+
export default AbstractGitAdapter;
|
|
183
|
+
//# sourceMappingURL=abstractAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstractAdapter.d.ts","sourceRoot":"","sources":["../../src/git/abstractAdapter.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAK5I;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACpC,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACnC,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CACrC;AACD;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CA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;IACI,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAK3C;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE;IAUtC;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE;IAUrC;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE;IAUrC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE;IAUtC;;;;;;;OAOG;IACH;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;OAGG;YACW,oBAAoB;IAiBlC;;;;;;;;OAQG;cACa,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,SAAI,EAAE,SAAS,SAAM;IA2BnG;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAI1C;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM;IAMnC;;;;;;;OAOG;IACH;;;;;;;OAOG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,SAAI;CAG9F;AAED,eAAe,kBAAkB,CAAA"}
|
package/dist/git/adapter.d.ts
CHANGED
|
@@ -7,10 +7,32 @@ export interface Change {
|
|
|
7
7
|
export interface CommitResult {
|
|
8
8
|
commitSha: string;
|
|
9
9
|
}
|
|
10
|
+
export type CommitHistoryQuery = {
|
|
11
|
+
ref: string;
|
|
12
|
+
perPage?: number;
|
|
13
|
+
page?: number;
|
|
14
|
+
};
|
|
15
|
+
export type CommitSummary = {
|
|
16
|
+
sha: string;
|
|
17
|
+
message: string;
|
|
18
|
+
author: string;
|
|
19
|
+
date: string;
|
|
20
|
+
parents: string[];
|
|
21
|
+
};
|
|
22
|
+
export type CommitHistoryPage = {
|
|
23
|
+
items: CommitSummary[];
|
|
24
|
+
nextPage?: number;
|
|
25
|
+
lastPage?: number;
|
|
26
|
+
};
|
|
10
27
|
export interface GitAdapter {
|
|
11
28
|
createBlobs(_changes: Change[], _concurrency?: number): Promise<Record<string, string>>;
|
|
12
29
|
createTree(_changes: Change[], _baseTreeSha?: string): Promise<string>;
|
|
13
30
|
createCommit(_message: string, _parentSha: string, _treeSha: string): Promise<string>;
|
|
14
|
-
updateRef(
|
|
31
|
+
updateRef(_reference: string, _commitSha: string, _force?: boolean): Promise<void>;
|
|
32
|
+
listCommits?(_query: CommitHistoryQuery): Promise<CommitHistoryPage>;
|
|
33
|
+
listBranches?(_query?: import('../virtualfs/types.ts').BranchListQuery): Promise<import('../virtualfs/types.ts').BranchListPage>;
|
|
34
|
+
getRepositoryMetadata?(): Promise<import('../virtualfs/types.ts').RepositoryMetadata>;
|
|
35
|
+
resolveRef?(_reference: string): Promise<string>;
|
|
36
|
+
createBranch?(_branchName: string, _fromSha: string): Promise<import('../virtualfs/types.ts').CreateBranchResult>;
|
|
15
37
|
}
|
|
16
38
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/git/adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IAEzB,WAAW,CAA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