browser-git-ops 0.0.5 → 0.0.8
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 +104 -14
- package/dist/git/abstractAdapter.d.ts +60 -5
- package/dist/git/abstractAdapter.d.ts.map +1 -1
- package/dist/git/githubAdapter.d.ts +14 -9
- package/dist/git/githubAdapter.d.ts.map +1 -1
- package/dist/git/gitlabAdapter.d.ts +43 -8
- package/dist/git/gitlabAdapter.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1359 -1064
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +1356 -1061
- package/dist/index.mjs.map +3 -3
- package/dist/virtualfs/changeTracker.d.ts +1 -0
- package/dist/virtualfs/changeTracker.d.ts.map +1 -1
- package/dist/virtualfs/conflictManager.d.ts +3 -1
- package/dist/virtualfs/conflictManager.d.ts.map +1 -1
- package/dist/virtualfs/indexedDatabaseStorage.d.ts.map +1 -1
- package/dist/virtualfs/inmemoryStorage.d.ts.map +1 -1
- package/dist/virtualfs/localChangeApplier.d.ts +6 -3
- package/dist/virtualfs/localChangeApplier.d.ts.map +1 -1
- package/dist/virtualfs/localFileManager.d.ts.map +1 -1
- package/dist/virtualfs/metadataManager.d.ts.map +1 -1
- package/dist/virtualfs/opfsStorage.d.ts.map +1 -1
- package/dist/virtualfs/remoteSynchronizer.d.ts +114 -17
- package/dist/virtualfs/remoteSynchronizer.d.ts.map +1 -1
- package/dist/virtualfs/storageBackend.d.ts +16 -16
- package/dist/virtualfs/types.d.ts +24 -4
- package/dist/virtualfs/types.d.ts.map +1 -1
- package/dist/virtualfs/utils/urlParser.d.ts +19 -0
- package/dist/virtualfs/utils/urlParser.d.ts.map +1 -0
- package/dist/virtualfs/virtualfs.d.ts +114 -27
- package/dist/virtualfs/virtualfs.d.ts.map +1 -1
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ A browser-native Git operations library that provides a VirtualFS and platform a
|
|
|
35
35
|
- ✅ Persistence backends for OPFS and IndexedDB
|
|
36
36
|
- ✅ GitHubAdapter with primary push/pull flows
|
|
37
37
|
- ✅ GitLabAdapter with primary push/pull flows
|
|
38
|
+
- ✅ GitLab tree API pagination (offset-based, per_page=100) for repositories with 100+ files
|
|
39
|
+
- ✅ GitHub truncated tree detection with warning log for repositories exceeding 100,000 entries / 7 MB
|
|
38
40
|
|
|
39
41
|
## Installation
|
|
40
42
|
|
|
@@ -61,20 +63,23 @@ import { VirtualFS, OpfsStorage, GitHubAdapter } from 'browser-git-ops'
|
|
|
61
63
|
|
|
62
64
|
async function example() {
|
|
63
65
|
// 1. Initialize VirtualFS with OPFS backend
|
|
64
|
-
const backend = new OpfsStorage('my-workspace')
|
|
66
|
+
const backend = new OpfsStorage('appname','my-workspace')
|
|
65
67
|
const vfs = new VirtualFS({ backend })
|
|
66
68
|
await vfs.init()
|
|
67
69
|
|
|
68
70
|
// 2. Configure adapter (GitHub or GitLab)
|
|
69
|
-
await vfs.setAdapter(
|
|
71
|
+
await vfs.setAdapter({
|
|
70
72
|
type: 'github',
|
|
73
|
+
branch: 'main',
|
|
74
|
+
token: 'your-github-token',
|
|
71
75
|
opts: {
|
|
72
76
|
owner: 'your-username',
|
|
73
77
|
repo: 'your-repo',
|
|
74
|
-
token: 'your-github-token',
|
|
75
|
-
branch: 'main'
|
|
76
78
|
}
|
|
77
79
|
})
|
|
80
|
+
// Alternative overloads:
|
|
81
|
+
// await vfs.setAdapter('github', 'https://github.com/your-username/your-repo', 'main', 'your-github-token')
|
|
82
|
+
// await vfs.setAdapter('https://github.com/your-username/your-repo', 'main', 'your-github-token')
|
|
78
83
|
|
|
79
84
|
// 3. Pull latest content from remote
|
|
80
85
|
await vfs.pull()
|
|
@@ -88,8 +93,13 @@ async function example() {
|
|
|
88
93
|
await vfs.writeFile('docs/guide.md', '## Getting Started')
|
|
89
94
|
|
|
90
95
|
// 6. Stat a file (Stats includes gitBlobSha/gitCommitSha when available)
|
|
96
|
+
// 6. Stat a file — returned object implements fs.Stats-like shape
|
|
97
|
+
// When the file is tracked by a configured adapter, the returned
|
|
98
|
+
// stats may include Git-specific identifiers: gitBlobSha, gitCommitSha, gitRef.
|
|
91
99
|
const s = await vfs.stat('README.md')
|
|
92
100
|
console.log('size=', s.size, 'isFile=', s.isFile())
|
|
101
|
+
// Git-specific fields (may be undefined for non-tracked files):
|
|
102
|
+
console.log('gitBlobSha=', s.gitBlobSha, 'gitCommitSha=', s.gitCommitSha, 'gitRef=', s.gitRef)
|
|
93
103
|
|
|
94
104
|
// 7. Delete a file (use unlink instead of deleteFile)
|
|
95
105
|
await vfs.unlink('docs/guide.md')
|
|
@@ -124,15 +134,18 @@ await vfs.init()
|
|
|
124
134
|
### Using GitLab Adapter
|
|
125
135
|
|
|
126
136
|
```typescript
|
|
127
|
-
await vfs.setAdapter(
|
|
137
|
+
await vfs.setAdapter({
|
|
128
138
|
type: 'gitlab',
|
|
139
|
+
branch: 'main',
|
|
140
|
+
token: 'your-gitlab-token',
|
|
129
141
|
opts: {
|
|
130
142
|
projectId: 'username/project',
|
|
131
143
|
host: 'gitlab.com',
|
|
132
|
-
token: 'your-gitlab-token',
|
|
133
|
-
branch: 'main'
|
|
134
144
|
}
|
|
135
145
|
})
|
|
146
|
+
// Alternative overloads:
|
|
147
|
+
// await vfs.setAdapter('gitlab', 'https://gitlab.com/username/project', 'main', 'your-gitlab-token')
|
|
148
|
+
// await vfs.setAdapter('https://gitlab.com/username/project', 'main', 'your-gitlab-token')
|
|
136
149
|
```
|
|
137
150
|
|
|
138
151
|
## Development
|
|
@@ -197,6 +210,7 @@ To use the GitHub adapter, you need:
|
|
|
197
210
|
- **Personal Access Token** with `repo` scope
|
|
198
211
|
- Repository owner and name
|
|
199
212
|
- Target branch (default: `main`)
|
|
213
|
+
- **Large repositories**: If the recursive tree response exceeds 100,000 entries or 7 MB, the `truncated` flag is detected and a warning is logged. Files within the returned tree are still available.
|
|
200
214
|
|
|
201
215
|
### GitLab Adapter
|
|
202
216
|
|
|
@@ -205,6 +219,7 @@ To use the GitLab adapter, you need:
|
|
|
205
219
|
- Project ID (format: `username/project` or numeric ID)
|
|
206
220
|
- GitLab instance host (default: `gitlab.com`)
|
|
207
221
|
- Target branch (default: `main`)
|
|
222
|
+
- **Large repositories**: Tree listing is automatically paginated (offset-based, `per_page=100`) so that repositories with any number of files are fully fetched during `pull`.
|
|
208
223
|
|
|
209
224
|
### Browser Compatibility
|
|
210
225
|
|
|
@@ -238,8 +253,13 @@ class VirtualFS {
|
|
|
238
253
|
async getChangeSet(): Promise<ChangeItem[]>
|
|
239
254
|
async revertChanges(): Promise<void>
|
|
240
255
|
|
|
241
|
-
// Remote Synchronization
|
|
242
|
-
async setAdapter(
|
|
256
|
+
// Remote Synchronization (overloads)
|
|
257
|
+
async setAdapter(meta: AdapterMeta): Promise<void>
|
|
258
|
+
async setAdapter(type: string, url: string, branch?: string, token?: string): Promise<void>
|
|
259
|
+
async setAdapter(url: string, branch?: string, token?: string): Promise<void>
|
|
260
|
+
async getAdapter(): Promise<AdapterMeta | null>
|
|
261
|
+
async getAdapterInstance(): Promise<any | null>
|
|
262
|
+
getAdapterMeta(): AdapterMeta | null
|
|
243
263
|
async pull(reference?: string, baseSnapshot?: Record<string, string>): Promise<any>
|
|
244
264
|
async push(input: CommitInput): Promise<any>
|
|
245
265
|
|
|
@@ -251,24 +271,88 @@ class VirtualFS {
|
|
|
251
271
|
async getIndex(): Promise<IndexFile>
|
|
252
272
|
async saveIndex(): Promise<void>
|
|
253
273
|
}
|
|
274
|
+
|
|
275
|
+
// AdapterMeta and related types:
|
|
276
|
+
// interface AdapterMeta {
|
|
277
|
+
// type: string;
|
|
278
|
+
// url?: string; // Repository URL (can be derived from opts)
|
|
279
|
+
// branch?: string; // Target branch (default: 'main')
|
|
280
|
+
// token?: string;
|
|
281
|
+
// opts?: {
|
|
282
|
+
// host?: string;
|
|
283
|
+
// owner?: string; // GitHub
|
|
284
|
+
// projectId?: string; // GitLab
|
|
285
|
+
// repo?: string;
|
|
286
|
+
// }
|
|
287
|
+
// }
|
|
288
|
+
// Stored (normalized) format in indexManager:
|
|
289
|
+
// { type, url, branch, token, opts: { host, owner, projectId, repo } }
|
|
290
|
+
// When branch is omitted it defaults to 'main'.
|
|
291
|
+
|
|
292
|
+
// Stats-like object returned by `vfs.stat(path)` includes standard fields
|
|
293
|
+
// similar to Node.js `fs.Stats` and may include Git identifiers when available.
|
|
294
|
+
// Example Type (informational):
|
|
295
|
+
// interface FsStatsLike {
|
|
296
|
+
// dev: number; ino: number; mode: number; nlink: number; uid: number; gid: number;
|
|
297
|
+
// size: number; atime: Date; mtime: Date; ctime: Date; birthtime: Date;
|
|
298
|
+
// isFile(): boolean; isDirectory(): boolean;
|
|
299
|
+
// // Git-specific (optional):
|
|
300
|
+
// gitBlobSha?: string; // blob SHA for tracked file
|
|
301
|
+
// gitCommitSha?: string; // latest commit SHA touching this path
|
|
302
|
+
// gitRef?: string; // reference/branch used to derive these values
|
|
303
|
+
// }
|
|
254
304
|
```
|
|
255
305
|
|
|
306
|
+
#### Adapter Retrieval and Management
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Get persisted adapter metadata (configuration, not instance)
|
|
310
|
+
async getAdapter(): Promise<AdapterMeta | null>
|
|
311
|
+
// Example:
|
|
312
|
+
const meta = await vfs.getAdapter()
|
|
313
|
+
if (meta) {
|
|
314
|
+
console.log('Adapter type:', meta.type)
|
|
315
|
+
console.log('Branch:', meta.branch) // top-level field (default: 'main')
|
|
316
|
+
console.log('Token:', meta.token)
|
|
317
|
+
console.log('Owner:', meta.opts?.owner) // GitHub case
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Get cached adapter metadata synchronously
|
|
321
|
+
getAdapterMeta(): AdapterMeta | null
|
|
322
|
+
// Example:
|
|
323
|
+
const meta = vfs.getAdapterMeta()
|
|
324
|
+
|
|
325
|
+
// Get or create adapter instance (lazy initialization)
|
|
326
|
+
async getAdapterInstance(): Promise<any | null>
|
|
327
|
+
// Example:
|
|
328
|
+
const adapter = await vfs.getAdapterInstance()
|
|
329
|
+
if (adapter) {
|
|
330
|
+
// adapter.resolveRef, adapter.push, etc. are now available
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Note**:
|
|
335
|
+
- `getAdapter()` and `getAdapterInstance()` serve different purposes
|
|
336
|
+
- `getAdapter()` returns persisted metadata (type, url, branch, token, opts)
|
|
337
|
+
- `getAdapterInstance()` creates/retrieves the adapter instance from metadata
|
|
338
|
+
- `getAdapterMeta()` synchronously returns cached metadata (no Promise)
|
|
339
|
+
|
|
256
340
|
### Storage Backends
|
|
257
341
|
|
|
258
342
|
```typescript
|
|
259
343
|
// OPFS Backend
|
|
260
344
|
class OpfsStorage implements StorageBackend {
|
|
261
|
-
constructor(rootName?: string)
|
|
345
|
+
constructor(namespace: string, rootName?: string)
|
|
262
346
|
}
|
|
263
347
|
|
|
264
348
|
// IndexedDB Backend
|
|
265
349
|
class IndexedDatabaseStorage implements StorageBackend {
|
|
266
|
-
constructor(rootName?: string)
|
|
350
|
+
constructor(namespace: string, rootName?: string)
|
|
267
351
|
}
|
|
268
352
|
|
|
269
353
|
// In-Memory Backend (for testing)
|
|
270
354
|
class InMemoryStorage implements StorageBackend {
|
|
271
|
-
constructor()
|
|
355
|
+
constructor(namespace: string, rootName?: string)
|
|
272
356
|
}
|
|
273
357
|
```
|
|
274
358
|
|
|
@@ -276,22 +360,28 @@ class InMemoryStorage implements StorageBackend {
|
|
|
276
360
|
|
|
277
361
|
```typescript
|
|
278
362
|
// GitHub Adapter
|
|
363
|
+
// Truncated tree responses (100,000+ entries) are automatically detected
|
|
364
|
+
// and logged as a warning; fetched files are still returned.
|
|
279
365
|
class GitHubAdapter {
|
|
280
366
|
constructor(options: {
|
|
281
367
|
owner: string
|
|
282
368
|
repo: string
|
|
283
369
|
token: string
|
|
284
|
-
branch
|
|
370
|
+
branch?: string
|
|
371
|
+
host?: string // GitHub Enterprise host (optional)
|
|
285
372
|
})
|
|
286
373
|
}
|
|
287
374
|
|
|
288
375
|
// GitLab Adapter
|
|
376
|
+
// Tree listing is automatically paginated (per_page=100) to support
|
|
377
|
+
// repositories with any number of files.
|
|
289
378
|
class GitLabAdapter {
|
|
290
379
|
constructor(options: {
|
|
291
380
|
projectId: string
|
|
292
381
|
host: string
|
|
293
382
|
token: string
|
|
294
|
-
branch
|
|
383
|
+
branch?: string
|
|
384
|
+
host?: string // Self-hosted GitLab instance (optional)
|
|
295
385
|
})
|
|
296
386
|
}
|
|
297
387
|
```
|
|
@@ -58,6 +58,18 @@ export declare class RetryableError extends Error {
|
|
|
58
58
|
*/
|
|
59
59
|
export declare class NonRetryableError extends Error {
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Error indicating that retry attempts were exhausted and no further retries will be made.
|
|
63
|
+
*/
|
|
64
|
+
export declare class RetryExhaustedError extends RetryableError {
|
|
65
|
+
code: string;
|
|
66
|
+
cause?: any;
|
|
67
|
+
/**
|
|
68
|
+
* @param {string} message error message
|
|
69
|
+
* @param {any} [cause] original cause
|
|
70
|
+
*/
|
|
71
|
+
constructor(message: string, cause?: any);
|
|
72
|
+
}
|
|
61
73
|
/**
|
|
62
74
|
* Map items with limited concurrency
|
|
63
75
|
* @template T,R
|
|
@@ -66,7 +78,44 @@ export declare class NonRetryableError extends Error {
|
|
|
66
78
|
* @param concurrency concurrency limit
|
|
67
79
|
* @returns Promise resolving to array of mapped results
|
|
68
80
|
*/
|
|
69
|
-
export
|
|
81
|
+
export type MapWithConcurrencyOptions = {
|
|
82
|
+
controller?: AbortController;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Process a single item from the items array.
|
|
86
|
+
* @template T,R
|
|
87
|
+
* @param {T[]} items source items
|
|
88
|
+
* @param {Function} mapper async mapper
|
|
89
|
+
* @param {R[]} results results array
|
|
90
|
+
* @param {number} index_ item index
|
|
91
|
+
* @param {AbortController} [controller] optional abort controller
|
|
92
|
+
* @returns {Promise<void>}
|
|
93
|
+
*/
|
|
94
|
+
export declare function processOne<T, R>(items: T[], mapper: (_t: T) => Promise<R>, results: R[], index_: number, controller?: AbortController): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Worker that processes items sequentially from a shared index.
|
|
97
|
+
* @template T,R
|
|
98
|
+
* @param {T[]} items source items
|
|
99
|
+
* @param {Function} mapper async mapper
|
|
100
|
+
* @param {R[]} results results array
|
|
101
|
+
* @param {{value:number}} indexReference shared index reference
|
|
102
|
+
* @param {number} indexReference.value current index value
|
|
103
|
+
* @param {AbortController} [controller] optional abort controller
|
|
104
|
+
* @returns {Promise<void>}
|
|
105
|
+
*/
|
|
106
|
+
export declare function queueRunWorker<T, R>(items: T[], mapper: (_t: T) => Promise<R>, results: R[], indexReference: {
|
|
107
|
+
value: number;
|
|
108
|
+
}, controller?: AbortController): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Map items with limited concurrency.
|
|
111
|
+
* @template T,R
|
|
112
|
+
* @param {T[]} items items to map
|
|
113
|
+
* @param {Function} mapper async mapper function
|
|
114
|
+
* @param {number} concurrency concurrency limit
|
|
115
|
+
* @param {MapWithConcurrencyOptions} [options] options with optional controller
|
|
116
|
+
* @returns {Promise<R[]>} mapped results
|
|
117
|
+
*/
|
|
118
|
+
export declare function mapWithConcurrency<T, R>(items: T[], mapper: (_t: T) => Promise<R>, concurrency?: number, options?: MapWithConcurrencyOptions): Promise<R[]>;
|
|
70
119
|
/**
|
|
71
120
|
* Abstract base class providing shared utilities for Git adapters
|
|
72
121
|
*/
|
|
@@ -102,17 +151,17 @@ export declare abstract class AbstractGitAdapter {
|
|
|
102
151
|
protected logDebug(..._messages: any[]): void;
|
|
103
152
|
/**
|
|
104
153
|
* Log an informational message if a logger is present.
|
|
105
|
-
* @param
|
|
154
|
+
* @param _messages items to log
|
|
106
155
|
*/
|
|
107
156
|
protected logInfo(..._messages: any[]): void;
|
|
108
157
|
/**
|
|
109
158
|
* Log a warning message if a logger is present.
|
|
110
|
-
* @param
|
|
159
|
+
* @param _messages items to log
|
|
111
160
|
*/
|
|
112
161
|
protected logWarn(..._messages: any[]): void;
|
|
113
162
|
/**
|
|
114
163
|
* Log an error message if a logger is present.
|
|
115
|
-
* @param
|
|
164
|
+
* @param _messages items to log
|
|
116
165
|
*/
|
|
117
166
|
protected logError(..._messages: any[]): void;
|
|
118
167
|
/**
|
|
@@ -123,11 +172,16 @@ export declare abstract class AbstractGitAdapter {
|
|
|
123
172
|
private normalizeHeaders;
|
|
124
173
|
/**
|
|
125
174
|
* Format a fetch request into a minimal object suitable for logging.
|
|
175
|
+
* @param input fetch input (URL or Request)
|
|
176
|
+
* @param init fetch initialization options
|
|
177
|
+
* @param attempts retry attempts count
|
|
178
|
+
* @param baseDelay base delay in milliseconds
|
|
126
179
|
* @returns formatted request log object
|
|
127
180
|
*/
|
|
128
181
|
private formatRequestForLog;
|
|
129
182
|
/**
|
|
130
183
|
* Format a fetch Response into a minimal object suitable for logging.
|
|
184
|
+
* @param response HTTP response object
|
|
131
185
|
* @returns formatted response log object
|
|
132
186
|
*/
|
|
133
187
|
private formatResponseForLog;
|
|
@@ -159,9 +213,10 @@ export declare abstract class AbstractGitAdapter {
|
|
|
159
213
|
* @param items items to map
|
|
160
214
|
* @param mapper async mapper
|
|
161
215
|
* @param concurrency concurrency limit
|
|
216
|
+
* @param [options] options with optional controller
|
|
162
217
|
* @returns Promise resolving to mapped results
|
|
163
218
|
*/
|
|
164
|
-
protected mapWithConcurrency<T, R>(items: T[], mapper: (_t: T) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
219
|
+
protected mapWithConcurrency<T, R>(items: T[], mapper: (_t: T) => Promise<R>, concurrency?: number, options?: MapWithConcurrencyOptions): Promise<R[]>;
|
|
165
220
|
}
|
|
166
221
|
export default AbstractGitAdapter;
|
|
167
222
|
//# sourceMappingURL=abstractAdapter.d.ts.map
|
|
@@ -1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AAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,SAAI,EAAE,OAAO,CAAC,EAAE,yBAAyB;CAGnI;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GitAdapter } from './adapter.ts';
|
|
2
2
|
import AbstractGitAdapter, { fetchWithRetry, classifyStatus, getDelayForResponse, processResponseWithDelay, mapWithConcurrency, shaOf } from './abstractAdapter.ts';
|
|
3
|
-
type GHOptions = {
|
|
3
|
+
export type GHOptions = {
|
|
4
4
|
owner: string;
|
|
5
5
|
repo: string;
|
|
6
6
|
token: string;
|
|
@@ -16,12 +16,15 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
16
16
|
private blobCache;
|
|
17
17
|
/**
|
|
18
18
|
* GitHubAdapter を初期化します。
|
|
19
|
-
* @param {GHOptions}
|
|
19
|
+
* @param {GHOptions} options 設定オブジェクト
|
|
20
20
|
*/
|
|
21
21
|
constructor(options: GHOptions);
|
|
22
22
|
/**
|
|
23
23
|
* List commits for a ref (GitHub commits API)
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {Object} query query parameters
|
|
25
|
+
* @param {string} query.ref reference name (branch/tag/SHA)
|
|
26
|
+
* @param {number} [query.perPage] items per page
|
|
27
|
+
* @param {number} [query.page] page number
|
|
25
28
|
* @returns {Promise<import('./adapter').CommitHistoryPage>} ページ情報を返します
|
|
26
29
|
*/
|
|
27
30
|
listCommits(query: {
|
|
@@ -98,7 +101,8 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
98
101
|
private _makeRepoMetadata;
|
|
99
102
|
/**
|
|
100
103
|
* List branches via GitHub API and map to BranchListPage.
|
|
101
|
-
|
|
104
|
+
* @param {import('../virtualfs/types.ts').BranchListQuery} [query] query parameters
|
|
105
|
+
* @returns {Promise<{items:any[],nextPage?:number,lastPage?:number}>}
|
|
102
106
|
*/
|
|
103
107
|
listBranches(query?: import('../virtualfs/types.ts').BranchListQuery): Promise<{
|
|
104
108
|
items: {
|
|
@@ -122,15 +126,15 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
122
126
|
private _mapBranchItems;
|
|
123
127
|
/**
|
|
124
128
|
* 参照を更新します。
|
|
125
|
-
* @param {string}
|
|
129
|
+
* @param {string} reference 参照名(例: heads/main)
|
|
126
130
|
* @param {string} commitSha コミット SHA
|
|
127
131
|
* @param {boolean} force 強制更新フラグ
|
|
128
132
|
*/
|
|
129
133
|
updateRef(reference: string, commitSha: string, force?: boolean): Promise<void>;
|
|
130
134
|
/**
|
|
131
135
|
* Create a branch (ref) on the remote repository.
|
|
132
|
-
* @param branchName branch name to create
|
|
133
|
-
* @param fromSha commit sha to point the new branch at
|
|
136
|
+
* @param {string} branchName branch name to create
|
|
137
|
+
* @param {string} fromSha commit sha to point the new branch at
|
|
134
138
|
* @returns {Promise<import('../virtualfs/types.ts').CreateBranchResult>} created branch info
|
|
135
139
|
*/
|
|
136
140
|
createBranch(branchName: string, fromSha: string): Promise<import('../virtualfs/types.ts').CreateBranchResult>;
|
|
@@ -149,8 +153,8 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
149
153
|
getCommitTreeSha(commitSha: string): Promise<string>;
|
|
150
154
|
/**
|
|
151
155
|
* 指定 ref の先頭コミット SHA を取得します。
|
|
152
|
-
* @param
|
|
153
|
-
|
|
156
|
+
* @param {string} reference 䉶: `heads/main`
|
|
157
|
+
* @returns {Promise<string>} 参照先のコミット SHA
|
|
154
158
|
*/
|
|
155
159
|
getRef(reference: string): Promise<string>;
|
|
156
160
|
/**
|
|
@@ -235,6 +239,7 @@ export declare class GitHubAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
235
239
|
/**
|
|
236
240
|
* Decode a base64 string into UTF-8 text. Uses global Buffer when available,
|
|
237
241
|
* falls back to atob/TextDecoder for browsers.
|
|
242
|
+
* @param {string} safe base64 string to decode
|
|
238
243
|
* @returns {string} decoded UTF-8 string
|
|
239
244
|
*/
|
|
240
245
|
private _decodeBase64ToString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubAdapter.d.ts","sourceRoot":"","sources":["../../src/git/githubAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,kBAAkB,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,KAAK,EAAqB,MAAM,sBAAsB,CAAA;AAEtL,
|
|
1
|
+
{"version":3,"file":"githubAdapter.d.ts","sourceRoot":"","sources":["../../src/git/githubAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,kBAAkB,EAAE,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,KAAK,EAAqB,MAAM,sBAAsB,CAAA;AAEtL,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAGD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAAmB,YAAW,UAAU;IACzE,OAAO,CAAC,eAAe,CAAqF;IAC5G,OAAO,CAAC,YAAY,CAAkE;IAEtF,OAAO,CAAC,SAAS,CAAiC;IAElD;;;OAGG;gBACS,OAAO,EAAE,SAAS;IAgB9B;;;;;;;OAOG;IACG,WAAW,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;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E,MAAM,EAAE,SAAS,UAAQ;IAQhD;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM;;;;IAU7B;;;;;;OAMG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAepD;;;;;OAKG;YACW,aAAa;IAY3B;;;;OAIG;YACW,mBAAmB;IAKjC;;;;OAIG;YACW,gBAAgB;IAK9B;;;;OAIG;YACW,2BAA2B;IAUzC;;;;OAIG;YACW,uBAAuB;IAgBrC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;;;OAKG;IACG,aAAa,CAAC,MAAM,SAAS,EAAE,WAAW,SAAI,GAAG,OAAO,CAAC,GAAG,CAAC;IAWnE;;;;;;;;OAQG;YACW,wBAAwB;IAItC;;;;OAIG;YACW,qBAAqB;IAkBnC;;;;;;;;OAQG;YACW,oBAAoB;IAalC;;;;;;;;OAQG;YACW,eAAe;IAM7B;;;;;;;OAOG;YACW,oBAAoB;CAenC;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAA;AAEnH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxE,eAAe,aAAa,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GitAdapter } from './adapter.ts';
|
|
2
2
|
import AbstractGitAdapter from './abstractAdapter.ts';
|
|
3
|
-
type GLOptions = {
|
|
3
|
+
export type GLOptions = {
|
|
4
4
|
projectId: string;
|
|
5
5
|
token: string;
|
|
6
6
|
host?: string;
|
|
@@ -15,12 +15,15 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
15
15
|
private projectMetadata;
|
|
16
16
|
/**
|
|
17
17
|
* GitLabAdapter を初期化します。
|
|
18
|
-
* @param {
|
|
18
|
+
* @param {GLOptions} options 設定オブジェクト
|
|
19
19
|
*/
|
|
20
20
|
constructor(options: GLOptions);
|
|
21
21
|
/**
|
|
22
22
|
* List commits for a ref (GitLab commits API)
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {Object} query query parameters
|
|
24
|
+
* @param {string} query.ref reference name
|
|
25
|
+
* @param {number} [query.perPage] items per page
|
|
26
|
+
* @param {number} [query.page] page number
|
|
24
27
|
* @returns {Promise<import('./adapter').CommitHistoryPage>} ページ情報を返します
|
|
25
28
|
*/
|
|
26
29
|
listCommits(query: {
|
|
@@ -46,6 +49,7 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
46
49
|
private _parseJsonArray;
|
|
47
50
|
/**
|
|
48
51
|
* GitLab のページングヘッダを解析します(x-next-page / x-total-pages)。
|
|
52
|
+
* @param {Response} resp HTTP レスポンス
|
|
49
53
|
* @returns {{nextPage?: number, lastPage?: number}} ページ番号情報
|
|
50
54
|
*/
|
|
51
55
|
private _parsePagingHeaders;
|
|
@@ -78,9 +82,9 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
78
82
|
createCommit(message: string, parentSha: string, _treeSha: string): Promise<any>;
|
|
79
83
|
/**
|
|
80
84
|
* リファレンス更新は不要なため noop 実装です。
|
|
81
|
-
* @param {string}
|
|
85
|
+
* @param {string} _reference ref 名
|
|
82
86
|
* @param {string} _commitSha コミット SHA
|
|
83
|
-
* @param {boolean} [_force]
|
|
87
|
+
* @param {boolean} [_force] 強制フラグ
|
|
84
88
|
* @returns {Promise<void>}
|
|
85
89
|
*/
|
|
86
90
|
updateRef(_reference: string, _commitSha: string, _force?: boolean): Promise<void>;
|
|
@@ -88,7 +92,8 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
88
92
|
* actions を用いて GitLab のコミット API を呼び出します。
|
|
89
93
|
* @param {string} branch ブランチ名
|
|
90
94
|
* @param {string} message コミットメッセージ
|
|
91
|
-
* @param {{type:string,path:string,content?:string}
|
|
95
|
+
* @param {Array<{type:string,path:string,content?:string}>} changes 変更一覧
|
|
96
|
+
* @param {string} [expectedParentSha] 下発コミット SHA
|
|
92
97
|
* @returns {Promise<any>} コミット応答(id など)
|
|
93
98
|
*/
|
|
94
99
|
createCommitWithActions(branch: string, message: string, changes: Array<{
|
|
@@ -109,6 +114,7 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
109
114
|
private _makeProjectMetadata;
|
|
110
115
|
/**
|
|
111
116
|
* List branches via GitLab API and map to BranchListPage.
|
|
117
|
+
* @param {import('../virtualfs/types.ts').BranchListQuery} [query] query parameters
|
|
112
118
|
* @returns {Promise<{items:any[],nextPage?:number,lastPage?:number}>}
|
|
113
119
|
*/
|
|
114
120
|
listBranches(query?: import('../virtualfs/types.ts').BranchListQuery): Promise<{
|
|
@@ -126,11 +132,18 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
126
132
|
}>;
|
|
127
133
|
/**
|
|
128
134
|
* Create a branch in GitLab: POST /projects/{projectId}/repository/branches
|
|
129
|
-
* @param branchName name of branch to create
|
|
130
|
-
* @param fromSha branch/tag name or SHA to base the new branch on
|
|
135
|
+
* @param {string} branchName name of branch to create
|
|
136
|
+
* @param {string} fromSha branch/tag name or SHA to base the new branch on
|
|
131
137
|
* @returns {Promise<import('../virtualfs/types.ts').CreateBranchResult>} created branch info
|
|
132
138
|
*/
|
|
133
139
|
createBranch(branchName: string, fromSha: string): Promise<import('../virtualfs/types.ts').CreateBranchResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Extract SHA from commit response text.
|
|
142
|
+
* @param {string} text response text
|
|
143
|
+
* @param {string} fallback fallback SHA value
|
|
144
|
+
* @returns {string} extracted SHA or fallback
|
|
145
|
+
*/
|
|
146
|
+
private _extractShaFromCommitResponseText;
|
|
134
147
|
/**
|
|
135
148
|
* Normalize common createBranch error messages into thrown Errors.
|
|
136
149
|
* @param {string} message error message text
|
|
@@ -147,6 +160,7 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
147
160
|
private _mapBranchItems;
|
|
148
161
|
/**
|
|
149
162
|
* Convert change descriptors to GitLab API actions
|
|
163
|
+
* @param {Array<{type:string,path:string,content?:string}>} changes change descriptors
|
|
150
164
|
* @returns {Array<any>} API-compatible actions array
|
|
151
165
|
*/
|
|
152
166
|
private createActions;
|
|
@@ -179,6 +193,9 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
179
193
|
private _waitAttempt;
|
|
180
194
|
/**
|
|
181
195
|
* Prepare JSON body for commit API call.
|
|
196
|
+
* @param {string} branch branch name
|
|
197
|
+
* @param {string} message commit message
|
|
198
|
+
* @param {any[]} actions commit actions
|
|
182
199
|
* @returns {string} JSON body
|
|
183
200
|
*/
|
|
184
201
|
private _prepareCommitBody;
|
|
@@ -192,6 +209,7 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
192
209
|
/**
|
|
193
210
|
* リポジトリのスナップショットを取得します。
|
|
194
211
|
* @param {string} branch ブランチ名 (default: 'main')
|
|
212
|
+
* @param {number} concurrency fetch concurrency level
|
|
195
213
|
* @returns {Promise<{headSha:string,shas:Record<string,string>,fetchContent:(paths:string[])=>Promise<Record<string,string>>}>}
|
|
196
214
|
*/
|
|
197
215
|
fetchSnapshot(branch?: string, concurrency?: number): Promise<any>;
|
|
@@ -201,8 +219,15 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
201
219
|
* @returns {Promise<string>} head SHA or branch
|
|
202
220
|
*/
|
|
203
221
|
private _determineHeadSha;
|
|
222
|
+
/**
|
|
223
|
+
* Safely fetch branch head SHA, returning null on failure.
|
|
224
|
+
* @param {string} branch branch name
|
|
225
|
+
* @returns {Promise<string|null>} head SHA or null
|
|
226
|
+
*/
|
|
227
|
+
private _safeGetBranchHead;
|
|
204
228
|
/**
|
|
205
229
|
* Fetch repository tree and build shas map and fileSet.
|
|
230
|
+
* Paginates through all pages using offset-based pagination (per_page=100).
|
|
206
231
|
* @param {string} branch branch name
|
|
207
232
|
* @returns {Promise<{shas:Record<string,string>,fileSet:Set<string>}>}
|
|
208
233
|
*/
|
|
@@ -224,6 +249,7 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
224
249
|
* @param {Record<string,string>} snapshot snapshot map
|
|
225
250
|
* @param {string} p file path
|
|
226
251
|
* @param {string} branch branch
|
|
252
|
+
* @param {AbortSignal} [signal] optional abort signal
|
|
227
253
|
* @returns {Promise<string|null>} file content or null
|
|
228
254
|
*/
|
|
229
255
|
private _fetchFileContentForPath;
|
|
@@ -231,11 +257,13 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
231
257
|
* Fetch raw file content from GitLab; return null on failure.
|
|
232
258
|
* @param {string} path file path
|
|
233
259
|
* @param {string} branch branch name
|
|
260
|
+
* @param {AbortSignal} [signal] optional abort signal
|
|
234
261
|
* @returns {Promise<string|null>} file content or null
|
|
235
262
|
*/
|
|
236
263
|
private _fetchFileRaw;
|
|
237
264
|
/**
|
|
238
265
|
* Build shas map and fileSet from tree entries
|
|
266
|
+
* @param {any[]} files tree file entries
|
|
239
267
|
* @returns {{shas:Record<string,string>,fileSet:Set<string>}}
|
|
240
268
|
*/
|
|
241
269
|
private _buildShasAndFileSet;
|
|
@@ -254,6 +282,13 @@ export declare class GitLabAdapter extends AbstractGitAdapter implements GitAdap
|
|
|
254
282
|
* @returns {Promise<string|null>} resolved sha or null
|
|
255
283
|
*/
|
|
256
284
|
private _runResolvers;
|
|
285
|
+
/**
|
|
286
|
+
* Try running a single resolver, returning null on failure.
|
|
287
|
+
* @param {Function} r resolver function
|
|
288
|
+
* @param {string} reference commit-ish to resolve
|
|
289
|
+
* @returns {Promise<string|null>} resolved sha or null
|
|
290
|
+
*/
|
|
291
|
+
private _tryRunResolver;
|
|
257
292
|
/**
|
|
258
293
|
* Try to resolve a branch name to its commit SHA.
|
|
259
294
|
* @param {string} reference branch name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlabAdapter.d.ts","sourceRoot":"","sources":["../../src/git/gitlabAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"gitlabAdapter.d.ts","sourceRoot":"","sources":["../../src/git/gitlabAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,kBAA2C,MAAM,sBAAsB,CAAA;AAE9E,MAAM,MAAM,SAAS,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,kBAAmB,YAAW,UAAU;IACzE,OAAO,CAAC,cAAc,CAA8E;IACpG,OAAO,CAAC,eAAe,CAAkE;IAEzF;;;OAGG;gBACS,OAAO,EAAE,SAAS;IAa9B;;;;;;;OAOG;IACG,WAAW,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;IAezE;;;;OAIG;IACH,OAAO,CAAC,eAAe;IASvB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;IAQhC;;;;;OAKG;IACG,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM;IAWvD;;;;;;OAMG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAiBvE;;;;;;OAMG;IACG,SAAS,CAAC,UAA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ASG;YACW,wBAAwB;IA2BtC;;;;;;;;OAQG;YACW,wBAAwB;IAetC;;;;;;OAMG;YACW,aAAa;IAgB3B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;;;OAMG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAepD;;;;;OAKG;YACW,aAAa;IAQ3B;;;;;OAKG;YACW,eAAe;IAU7B;;;;OAIG;YACW,iBAAiB;IAU/B;;;;OAIG;YACW,cAAc;IAU5B;;;;OAIG;YACW,iBAAiB;CAShC;AAED,eAAe,aAAa,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,11 @@ export { default as InMemoryStorage } from './virtualfs/inmemoryStorage.ts';
|
|
|
5
5
|
export { default as GitHubAdapter } from './git/githubAdapter.ts';
|
|
6
6
|
export { default as GitLabAdapter } from './git/gitlabAdapter.ts';
|
|
7
7
|
export { default } from './virtualfs/virtualfs.ts';
|
|
8
|
+
export type { IndexFile, AdapterMeta, AdapterOptions, AdapterOptionsBase, GitHubAdapterOptions, GitLabAdapterOptions, CommitInput, BranchListQuery, BranchListPage, RepositoryMetadata, CreateBranchInput, CreateBranchResult, IndexEntry, BranchInfo, Change as VfsChange, FileState } from './virtualfs/types.ts';
|
|
9
|
+
export type { StorageBackend, StorageBackendConstructor, Segment } from './virtualfs/storageBackend.ts';
|
|
10
|
+
export type { Logger } from './git/abstractAdapter.ts';
|
|
11
|
+
export type { CommitHistoryQuery, CommitHistoryPage, CommitSummary, CommitResult, GitAdapter, Change as GitChange } from './git/adapter.ts';
|
|
12
|
+
export type { GHOptions } from './git/githubAdapter.ts';
|
|
13
|
+
export type { GLOptions } from './git/gitlabAdapter.ts';
|
|
14
|
+
export type { RemoteSnapshotDescriptor } from './virtualfs/virtualfs.ts';
|
|
8
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAGlD,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,EAAE,MAA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