@anysphere/file-service 0.0.0-e7879422 → 0.0.0-e7bc2215
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.d.ts +120 -21
- package/index.js +5 -4
- package/package.json +14 -10
package/index.d.ts
CHANGED
|
@@ -12,10 +12,6 @@ export interface DiffChunk {
|
|
|
12
12
|
diffType: DiffType
|
|
13
13
|
text: string
|
|
14
14
|
}
|
|
15
|
-
export interface WalkDirConfig {
|
|
16
|
-
maxNumFiles: number
|
|
17
|
-
blocklistPath?: string
|
|
18
|
-
}
|
|
19
15
|
export interface CommitData {
|
|
20
16
|
sha: string
|
|
21
17
|
date: number
|
|
@@ -46,10 +42,80 @@ export interface VerifyData {
|
|
|
46
42
|
fileContent: string
|
|
47
43
|
filePath: string
|
|
48
44
|
}
|
|
49
|
-
export interface
|
|
45
|
+
export interface IndexedFile {
|
|
50
46
|
path: string
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
diff: Array<string>
|
|
48
|
+
}
|
|
49
|
+
export interface IndexedPullRequest {
|
|
50
|
+
prNumber: number
|
|
51
|
+
generation: number
|
|
52
|
+
sha: string
|
|
53
|
+
commitSecret: string
|
|
54
|
+
body: string
|
|
55
|
+
changedFiles: Array<IndexedFile>
|
|
56
|
+
unixTimestamp: number
|
|
57
|
+
trimmedTooLarge: boolean
|
|
58
|
+
title?: string
|
|
59
|
+
author?: string
|
|
60
|
+
date?: Date
|
|
61
|
+
}
|
|
62
|
+
export interface JsPullRequestExtractionOptions {
|
|
63
|
+
lastIndexedCommit?: string
|
|
64
|
+
lastIndexedCommitGeneration?: number
|
|
65
|
+
syncBitmap?: Buffer
|
|
66
|
+
limitCommits?: number
|
|
67
|
+
limitPerPr?: number
|
|
68
|
+
context?: number
|
|
69
|
+
workerThreads?: number
|
|
70
|
+
jsConcurrency?: number
|
|
71
|
+
jsChunkSize?: number
|
|
72
|
+
}
|
|
73
|
+
export interface JsPullRequestHydrationOptions {
|
|
74
|
+
limitPerPr?: number
|
|
75
|
+
context?: number
|
|
76
|
+
workerThreads?: number
|
|
77
|
+
interestingPaths?: Array<string>
|
|
78
|
+
}
|
|
79
|
+
export interface JsHandshakeData {
|
|
80
|
+
lastSeenCommit: string
|
|
81
|
+
lastSeenCommitSecret: string
|
|
82
|
+
origin: string
|
|
83
|
+
}
|
|
84
|
+
export interface JsRepositoryTip {
|
|
85
|
+
commitSha: string
|
|
86
|
+
commitShaSecret: string
|
|
87
|
+
generation: number
|
|
88
|
+
}
|
|
89
|
+
export interface ExtractResults {
|
|
90
|
+
repositoryTip?: JsRepositoryTip
|
|
91
|
+
progress: IndexedPullRequestProgress
|
|
92
|
+
interrupted: boolean
|
|
93
|
+
}
|
|
94
|
+
export interface IndexedPullRequestProgress {
|
|
95
|
+
/** Total number of commits in the repository */
|
|
96
|
+
total: number
|
|
97
|
+
/** Number of commits that have been synced to the server */
|
|
98
|
+
synced: number
|
|
99
|
+
/** Number of commits that have been synced to the server in this run */
|
|
100
|
+
newSynced: number
|
|
101
|
+
/** Number of commits that have been marked as ignored in this run */
|
|
102
|
+
newIgnored: number
|
|
103
|
+
/** Number of commits that have failed to be indexed in this run */
|
|
104
|
+
newFailed: number
|
|
105
|
+
/** Time (in seconds) since the start of the indexing process */
|
|
106
|
+
elapsed: number
|
|
107
|
+
}
|
|
108
|
+
export const MULTI_ROOT_ABSOLUTE_PATH: string
|
|
109
|
+
export interface WalkDirConfig {
|
|
110
|
+
maxNumFiles: number
|
|
111
|
+
logFilePath?: string
|
|
112
|
+
blocklistPath?: string
|
|
113
|
+
unifiedJsonBlocklistPath?: string
|
|
114
|
+
}
|
|
115
|
+
export interface LocalCodebaseFileInfo {
|
|
116
|
+
unencryptedRelativePath: string
|
|
117
|
+
hash: string
|
|
118
|
+
children?: Array<LocalCodebaseFileInfo>
|
|
53
119
|
}
|
|
54
120
|
export declare class DiffClient {
|
|
55
121
|
constructor()
|
|
@@ -64,15 +130,6 @@ export declare class DiffClient {
|
|
|
64
130
|
*/
|
|
65
131
|
diffLines(text1: string, text2: string): Array<DiffChunk>
|
|
66
132
|
}
|
|
67
|
-
export declare class MerkleClient {
|
|
68
|
-
constructor(absoluteRootDirectory: string)
|
|
69
|
-
initWithRipgrepIgnore(logFilesPath: string | undefined | null, config: WalkDirConfig): Promise<void>
|
|
70
|
-
getSubtreeHash(relativePath: string): Promise<string>
|
|
71
|
-
getNumEmbeddableFiles(): Promise<number>
|
|
72
|
-
getImportantPaths(k: number): Promise<Array<string>>
|
|
73
|
-
getAllFiles(): Promise<Array<string>>
|
|
74
|
-
getAllDirFilesToEmbed(absoluteFilePath: string): Promise<Array<string>>
|
|
75
|
-
}
|
|
76
133
|
export declare class GitClient {
|
|
77
134
|
constructor(absoluteRootDirectory: string)
|
|
78
135
|
getTotalCommitCount(): Promise<number>
|
|
@@ -82,10 +139,52 @@ export declare class GitClient {
|
|
|
82
139
|
getRepoHeadSha(): Promise<string | null>
|
|
83
140
|
getCommitChain(hash: string, depth: number, getFiles: CommitChainGetFiles): Promise<Array<CommitData>>
|
|
84
141
|
}
|
|
85
|
-
export declare class
|
|
86
|
-
|
|
142
|
+
export declare class GitGraph {
|
|
143
|
+
constructor(repo: string, globalCursorIgnoreLegacy?: string | undefined | null, globalCursorJsonUnifiedBlocklist?: string | undefined | null)
|
|
144
|
+
/**
|
|
145
|
+
* Get a list of all paths in this repository, up to a maximum depth of `max_depth`. The
|
|
146
|
+
* paths are returned breadth-first, meaning that all paths at depth 0 are returned before any
|
|
147
|
+
* paths at depth 1, and so on.
|
|
148
|
+
* The iteration takes into account `gitignore` and `cursorignore` rules.
|
|
149
|
+
*
|
|
150
|
+
* @param maxDepth - maximum depth to search for paths. A depth of 0 means only the root path
|
|
151
|
+
* is returned.
|
|
152
|
+
* @param limit - maximum number of paths to return. If `None`, all paths are returned.
|
|
153
|
+
*/
|
|
154
|
+
getBfsPaths(maxDepth: number, limit?: number | undefined | null): Promise<Array<string>>
|
|
155
|
+
/**
|
|
156
|
+
* Get a sorted list of relevant paths in this repository, from most relevant to least
|
|
157
|
+
* relevant. The list is biased towards the current user, using a heuristic that takes into account
|
|
158
|
+
* the most recently opened/edited files in the editor, which must be passed in as
|
|
159
|
+
* `lastEditedFiles`. If no recent files are provided, the returned paths will be sorted
|
|
160
|
+
* based on the global popularity of the files in the repository (i.e. the number of times each
|
|
161
|
+
* file has been modified throughout the Git history).
|
|
162
|
+
*
|
|
163
|
+
* @param lastEditedFiles - list of files that were recently opened/edited in the editor.
|
|
164
|
+
* @param maxCommits - maximum number of commits to consider when calculating the relevant paths.
|
|
165
|
+
* @param maxPaths - number of relevant paths to return
|
|
166
|
+
*/
|
|
167
|
+
getRelevantPaths(lastEditedFiles: Array<string>, maxCommits: number, maxPaths: number): Promise<Array<string>>
|
|
168
|
+
}
|
|
169
|
+
export declare class RepositoryIndexer {
|
|
170
|
+
constructor(repo: string, blockListLegacy?: string | undefined | null, blockListJson?: string | undefined | null)
|
|
171
|
+
extractPullRequests(options: JsPullRequestExtractionOptions, callback: (err: Error | null, indexed: IndexedPullRequest[], ignored: number[], progress: IndexedPullRequestProgress) => Promise<boolean>): Promise<ExtractResults>
|
|
172
|
+
hydratePullRequests(pullRequests: Array<string>, options: JsPullRequestHydrationOptions, callback: (err: Error | null, arg: IndexedPullRequest) => any): Promise<void>
|
|
173
|
+
getHandshakeData(): Promise<JsHandshakeData | null>
|
|
174
|
+
verifyCommitOwnership(secret: string, candidates: Array<string>): Promise<JsHandshakeData | null>
|
|
87
175
|
}
|
|
88
|
-
export declare class
|
|
89
|
-
constructor(
|
|
90
|
-
|
|
176
|
+
export declare class MerkleClient {
|
|
177
|
+
constructor(rootPathsMap: Record<string, string>)
|
|
178
|
+
build(allowIncremental: boolean, config: WalkDirConfig): Promise<void>
|
|
179
|
+
getSubtreeHash(relativePath: string): Promise<string>
|
|
180
|
+
getNumEmbeddableFiles(): Promise<number>
|
|
181
|
+
getSimhash(): Promise<Float32Array>
|
|
182
|
+
getImportantPaths(k: number): Promise<Array<string>>
|
|
183
|
+
getAllFiles(): Promise<Array<string>>
|
|
184
|
+
getAllDirFilesToEmbed(absoluteFilePath: string): Promise<Array<string>>
|
|
185
|
+
onDidCreate(absoluteFilePath: string): void
|
|
186
|
+
onDidChange(absoluteFilePath: string): void
|
|
187
|
+
onDidDelete(absoluteFilePath: string): void
|
|
188
|
+
getTreeStructure(): Promise<LocalCodebaseFileInfo | null>
|
|
189
|
+
dispose(): void
|
|
91
190
|
}
|
package/index.js
CHANGED
|
@@ -310,13 +310,14 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { DiffType, DiffClient,
|
|
313
|
+
const { DiffType, DiffClient, GitClient, CommitFileStatus, CommitChainGetFiles, GitGraph, RepositoryIndexer, MULTI_ROOT_ABSOLUTE_PATH, MerkleClient } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.DiffType = DiffType
|
|
316
316
|
module.exports.DiffClient = DiffClient
|
|
317
|
-
module.exports.MerkleClient = MerkleClient
|
|
318
317
|
module.exports.GitClient = GitClient
|
|
319
318
|
module.exports.CommitFileStatus = CommitFileStatus
|
|
320
319
|
module.exports.CommitChainGetFiles = CommitChainGetFiles
|
|
321
|
-
module.exports.
|
|
322
|
-
module.exports.
|
|
320
|
+
module.exports.GitGraph = GitGraph
|
|
321
|
+
module.exports.RepositoryIndexer = RepositoryIndexer
|
|
322
|
+
module.exports.MULTI_ROOT_ABSOLUTE_PATH = MULTI_ROOT_ABSOLUTE_PATH
|
|
323
|
+
module.exports.MerkleClient = MerkleClient
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anysphere/file-service",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-e7bc2215",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"additional": [
|
|
10
10
|
"aarch64-apple-darwin",
|
|
11
11
|
"aarch64-pc-windows-msvc",
|
|
12
|
+
"aarch64-unknown-linux-musl",
|
|
13
|
+
"x86_64-unknown-linux-musl",
|
|
12
14
|
"universal-apple-darwin",
|
|
13
15
|
"aarch64-unknown-linux-gnu"
|
|
14
16
|
]
|
|
@@ -18,10 +20,10 @@
|
|
|
18
20
|
"index.js",
|
|
19
21
|
"index.d.ts"
|
|
20
22
|
],
|
|
21
|
-
"license": "
|
|
23
|
+
"license": "UNLICENSED",
|
|
22
24
|
"devDependencies": {
|
|
23
25
|
"@napi-rs/cli": "^2.18.4",
|
|
24
|
-
"ava": "^
|
|
26
|
+
"ava": "^6.3.0"
|
|
25
27
|
},
|
|
26
28
|
"ava": {
|
|
27
29
|
"timeout": "3m"
|
|
@@ -40,12 +42,14 @@
|
|
|
40
42
|
"version": "napi version"
|
|
41
43
|
},
|
|
42
44
|
"optionalDependencies": {
|
|
43
|
-
"@anysphere/file-service-win32-x64-msvc": "0.0.0-
|
|
44
|
-
"@anysphere/file-service-darwin-x64": "0.0.0-
|
|
45
|
-
"@anysphere/file-service-linux-x64-gnu": "0.0.0-
|
|
46
|
-
"@anysphere/file-service-darwin-arm64": "0.0.0-
|
|
47
|
-
"@anysphere/file-service-win32-arm64-msvc": "0.0.0-
|
|
48
|
-
"@anysphere/file-service-
|
|
49
|
-
"@anysphere/file-service-linux-
|
|
45
|
+
"@anysphere/file-service-win32-x64-msvc": "0.0.0-e7bc2215",
|
|
46
|
+
"@anysphere/file-service-darwin-x64": "0.0.0-e7bc2215",
|
|
47
|
+
"@anysphere/file-service-linux-x64-gnu": "0.0.0-e7bc2215",
|
|
48
|
+
"@anysphere/file-service-darwin-arm64": "0.0.0-e7bc2215",
|
|
49
|
+
"@anysphere/file-service-win32-arm64-msvc": "0.0.0-e7bc2215",
|
|
50
|
+
"@anysphere/file-service-linux-arm64-musl": "0.0.0-e7bc2215",
|
|
51
|
+
"@anysphere/file-service-linux-x64-musl": "0.0.0-e7bc2215",
|
|
52
|
+
"@anysphere/file-service-darwin-universal": "0.0.0-e7bc2215",
|
|
53
|
+
"@anysphere/file-service-linux-arm64-gnu": "0.0.0-e7bc2215"
|
|
50
54
|
}
|
|
51
55
|
}
|