@canyonjs/git-provider 0.0.3 → 0.0.5
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.mjs +3 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -199,14 +199,14 @@ var GitlabAdapter = class {
|
|
|
199
199
|
}
|
|
200
200
|
fileRawUrl(repoID, filePath, ref) {
|
|
201
201
|
const encodedPath = encodeURIComponent(filePath);
|
|
202
|
-
return `${this.base}/
|
|
202
|
+
return `${this.base}/projects/${encodeURIComponent(repoID)}/repository/files/${encodedPath}/raw?ref=${encodeURIComponent(ref)}`;
|
|
203
203
|
}
|
|
204
204
|
async getRawFileText(repoID, filePath, ref) {
|
|
205
205
|
const { data } = await get(this.fileRawUrl(repoID, filePath, ref), { headers: this.headers() });
|
|
206
206
|
return typeof data === "string" ? data : "";
|
|
207
207
|
}
|
|
208
208
|
async getRepoInfo(repoID) {
|
|
209
|
-
const { data } = await get(`${this.base}/
|
|
209
|
+
const { data } = await get(`${this.base}/projects/${encodeURIComponent(repoID)}`, { headers: this.headers() });
|
|
210
210
|
return {
|
|
211
211
|
id: String(data.id),
|
|
212
212
|
pathWithNamespace: data.path_with_namespace,
|
|
@@ -214,7 +214,7 @@ var GitlabAdapter = class {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
async getCompare(repoID, base, head) {
|
|
217
|
-
const { data } = await get(`${this.base}/
|
|
217
|
+
const { data } = await get(`${this.base}/projects/${encodeURIComponent(repoID)}/repository/compare?from=${encodeURIComponent(base)}&to=${encodeURIComponent(head)}`, { headers: this.headers() });
|
|
218
218
|
const diffRows = data.diffs ?? [];
|
|
219
219
|
const comparedPaths = diffRows.map(comparedRefsFromGitlabDiff).filter((entry) => entry != null).filter((entry) => pathMatchesLineDiffExtensions(entry.keyPath));
|
|
220
220
|
const lineBuckets = comparedPaths.length > 1500 ? /* @__PURE__ */ new Map() : await computeLineBucketsByRef(comparedPaths, base, head, (path, ref) => this.getRawFileText(repoID, path, ref));
|