Socket
Socket
Sign inDemoInstall

gitlab-fetch

Package Overview
Dependencies
17
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0-dev.13830735 to 1.1.0-dev.13831620

9

CHANGELOG.md
# Changelog
## develop
* ~deprecated Deprecate `HooksApi#getHooks`, `#getHook`, `#addHook`, `#editHook` and `#deleteHook`.
* Renamed to `#getAll`, `#get`, `#create`, `#edit` and `#delete`.
* Original methods will be removed in a future major version.
* ~deprecated `HooksApi#getHooks`, `#getHook`, `#addHook`, `#editHook` and `#deleteHook`.
- Renamed to `#getAll`, `#get`, `#create`, `#edit` and `#delete`.
* ~deprecated `RepositoryApi#getFile(path: string, ifExists: true)`.
- Use `#tryGetFile`.
* Added `#tryGet` methods to `BranchesApi`, `CommitsApi`, `GroupApi`, `HooksApi`, `MergeRequestsApi`, `ProjectApi`, `TagsApi` and `UsersApi` (and `RepositoryApi#tryGetFile` and `MergeRequestsApi#tryGetVersion`)
- Equivalent of existing `#get` (or similar) methods, except they return `undefined` if they recieve a 404 response.

@@ -8,0 +11,0 @@ ## 1.0.0

@@ -13,2 +13,3 @@ import { AbstractApi, Config } from '../common';

get(name: string): Promise<Branch>;
tryGet(name: string): Promise<Branch | undefined>;
protect(name: string, params?: ProtectBranchParams): Promise<Branch>;

@@ -15,0 +16,0 @@ unprotect(name: string): Promise<Branch>;

@@ -16,2 +16,5 @@ "use strict";

}
tryGet(name) {
return this.fetch('GET', `/${utils_1.encode(name)}`, undefined, { undefined404: true });
}
protect(name, params = {}) {

@@ -18,0 +21,0 @@ return this.fetch('PUT', `/${utils_1.encode(name)}/protect`, params);

@@ -63,2 +63,3 @@ import { AbstractApi, Config } from '../common';

get(ref: string): Promise<Commit>;
tryGet(ref: string): Promise<Commit | undefined>;
create(branch: string, commitMessage: string, actions: CommitAction[], params?: CreateCommitParams): Promise<Commit>;

@@ -65,0 +66,0 @@ cherryPick(sha: string, branch: string): Promise<Commit>;

@@ -19,2 +19,5 @@ "use strict";

}
tryGet(ref) {
return this.fetch('GET', `/${utils_1.encode(ref)}`, undefined, { undefined404: true });
}
create(branch, commitMessage, actions, params = {}) {

@@ -21,0 +24,0 @@ return this.fetch('POST', undefined, {}, {

@@ -38,4 +38,5 @@ import { AbstractApi, Config } from '../common';

get(): Promise<Group>;
tryGet(): Promise<Group | undefined>;
getProjects(params?: ListGroupProjectsParams): Promise<Project[]>;
delete(): Promise<void>;
}

@@ -35,2 +35,5 @@ "use strict";

}
tryGet() {
return this.fetch('GET', undefined, undefined, { undefined404: true });
}
getProjects(params = {}) {

@@ -37,0 +40,0 @@ return this.fetch('GET', '/projects', params);

@@ -33,2 +33,3 @@ import { AbstractApi, Config } from '../common';

get(hookId: number): Promise<Hook>;
tryGet(hookId: number): Promise<Hook | undefined>;
create(url: string, params?: AddHookParams): Promise<Hook>;

@@ -35,0 +36,0 @@ edit(hookId: number, url: string, params?: EditHookParams): Promise<Hook>;

@@ -25,2 +25,5 @@ "use strict";

}
tryGet(hookId) {
return this.fetch('GET', `/${hookId}`, undefined, { undefined404: true });
}
create(url, params = {}) {

@@ -27,0 +30,0 @@ return this.fetch('POST', ``, Object.assign({ url }, params));

@@ -34,2 +34,3 @@ import { AbstractApi, Config } from '../common';

get(iid: number): Promise<MergeRequest>;
tryGet(iid: number): Promise<MergeRequest | undefined>;
getCommits(iid: number, params?: PaginationParams): Promise<Commit[]>;

@@ -40,2 +41,3 @@ getChanges(iid: number): Promise<MergeRequest>;

getVersion(iid: number, versionId: number): Promise<MergeRequestVersion>;
tryGetVersion(iid: number, versionId: number): Promise<MergeRequestVersion | undefined>;
create(sourceBranch: string, targetBranch: string, title: string, params?: CreateMergeRequestsParams): Promise<MergeRequest>;

@@ -42,0 +44,0 @@ edit(iid: number, params?: EditMergeRequestParams): Promise<MergeRequest>;

@@ -15,2 +15,5 @@ "use strict";

}
tryGet(iid) {
return this.fetch('GET', `/${iid}`, undefined, { undefined404: true });
}
getCommits(iid, params = {}) {

@@ -31,2 +34,5 @@ return this.fetch('GET', `/${iid}/commits`, params);

}
tryGetVersion(iid, versionId) {
return this.fetch('GET', `/${iid}/versions/${versionId}`, undefined, { undefined404: true });
}
create(sourceBranch, targetBranch, title, params = {}) {

@@ -33,0 +39,0 @@ return this.fetch('POST', undefined, Object.assign({ source_branch: sourceBranch, target_branch: targetBranch, title }, params));

@@ -34,2 +34,3 @@ import { AbstractApi, Config } from '../common';

get(): Promise<Project>;
tryGet(): Promise<Project | undefined>;
edit(params?: EditProjectParams): Promise<Project>;

@@ -36,0 +37,0 @@ delete(): Promise<Project>;

@@ -23,2 +23,5 @@ "use strict";

}
tryGet() {
return this.fetch('GET', undefined, undefined, { undefined404: true });
}
edit(params = {}) {

@@ -25,0 +28,0 @@ return this.fetch('PUT', undefined, params);

@@ -24,3 +24,5 @@ /// <reference types="node" />

getFile(path: string): Promise<RepositoryFile>;
/** @deprecated Use #tryGetFile instead. */
getFile(path: string, ifExists: true): Promise<RepositoryFile | undefined>;
tryGetFile(path: string): Promise<RepositoryFile | undefined>;
getFileContent(path: string): Promise<Buffer>;

@@ -27,0 +29,0 @@ getBlobContent(sha: string): Promise<Buffer>;

@@ -13,3 +13,2 @@ "use strict";

const project_1 = require("./project");
const debug_1 = require("../common/debug");
const utils_1 = require("../common/utils");

@@ -36,13 +35,8 @@ class RepositoryApi extends common_1.AbstractApi {

return __awaiter(this, void 0, void 0, function* () {
const [response, file] = yield this.fetchUnchecked('GET', `/files/${utils_1.encode(path)}`, { ref: this.ref });
if (response.status === 200) {
return file;
}
else if (ifExists && response.status === 404) {
return undefined;
}
debug_1.network(response);
throw new Error(`Unexpected HTTP status (${response.status}) from ${response.url}`);
return this.fetch('GET', `/files/${utils_1.encode(path)}`, { ref: this.ref }, { undefined404: ifExists });
});
}
tryGetFile(path) {
return this.getFile(path, true);
}
getFileContent(path) {

@@ -49,0 +43,0 @@ return this.fetch('GET', `/files/${utils_1.encode(path)}/raw`, { ref: this.ref });

@@ -13,2 +13,3 @@ import { AbstractApi, Config } from '../common';

get(name: string): Promise<Tag>;
tryGet(name: string): Promise<Tag | undefined>;
create(name: string, ref: string, params?: CreateTagParams): Promise<Tag>;

@@ -15,0 +16,0 @@ delete(name: string): Promise<void>;

@@ -16,2 +16,5 @@ "use strict";

}
tryGet(name) {
return this.fetch('GET', `/${utils_1.encode(name)}`, undefined, { undefined404: true });
}
create(name, ref, params = {}) {

@@ -18,0 +21,0 @@ return this.fetch('POST', undefined, Object.assign({ tag_name: name, ref }, params));

@@ -18,2 +18,3 @@ import { AbstractApi, Config } from '../common';

get(id: number): Promise<UserSummary | User>;
tryGet(id: number): Promise<UserSummary | User>;
getCurrent(params?: GetCurrentUserParams): Promise<User>;

@@ -20,0 +21,0 @@ delete(id: number): Promise<void>;

@@ -14,2 +14,5 @@ "use strict";

}
tryGet(id) {
return this.fetch('GET', `/${id}`, undefined, { undefined404: true });
}
getCurrent(params = {}) {

@@ -16,0 +19,0 @@ return this.fetch('GET', undefined, params, { baseApiPath: '/user' });

@@ -82,2 +82,6 @@ "use strict";

const [response, body] = yield this.fetchUnchecked(method, path, params, options);
if (response.status === 404 && options.undefined404) {
debug_1.network(' => (Ignored)');
return undefined;
}
if (response.status < 200 || response.status >= 300) {

@@ -84,0 +88,0 @@ debug_1.network(' => %O', body);

{
"name": "gitlab-fetch",
"version": "1.1.0-dev.13830735",
"version": "1.1.0-dev.13831620",
"author": "Jay Anslow <jay@anslow.me.uk>",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc