@apiclient.xyz/gitlab 2.5.0 → 2.6.0
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_ts/gitlab.classes.branch.d.ts +7 -0
- package/dist_ts/gitlab.classes.branch.js +13 -0
- package/dist_ts/gitlab.classes.gitlabclient.d.ts +112 -81
- package/dist_ts/gitlab.classes.gitlabclient.js +236 -156
- package/dist_ts/gitlab.classes.group.d.ts +47 -0
- package/dist_ts/gitlab.classes.group.js +97 -0
- package/dist_ts/gitlab.classes.job.d.ts +29 -0
- package/dist_ts/gitlab.classes.job.js +74 -0
- package/dist_ts/gitlab.classes.pipeline.d.ts +32 -0
- package/dist_ts/gitlab.classes.pipeline.js +87 -0
- package/dist_ts/gitlab.classes.project.d.ts +63 -0
- package/dist_ts/gitlab.classes.project.js +122 -0
- package/dist_ts/gitlab.classes.protectedbranch.d.ts +8 -0
- package/dist_ts/gitlab.classes.protectedbranch.js +15 -0
- package/dist_ts/gitlab.classes.tag.d.ts +7 -0
- package/dist_ts/gitlab.classes.tag.js +13 -0
- package/dist_ts/gitlab.classes.testreport.d.ts +34 -0
- package/dist_ts/gitlab.classes.testreport.js +67 -0
- package/dist_ts/gitlab.classes.variable.d.ts +18 -0
- package/dist_ts/gitlab.classes.variable.js +35 -0
- package/dist_ts/gitlab.helpers.d.ts +8 -0
- package/dist_ts/gitlab.helpers.js +23 -0
- package/dist_ts/index.d.ts +10 -0
- package/dist_ts/index.js +15 -1
- package/package.json +1 -1
- package/readme.md +468 -163
- package/ts/gitlab.classes.branch.ts +18 -0
- package/ts/gitlab.classes.gitlabclient.ts +297 -196
- package/ts/gitlab.classes.group.ts +137 -0
- package/ts/gitlab.classes.job.ts +104 -0
- package/ts/gitlab.classes.pipeline.ts +122 -0
- package/ts/gitlab.classes.project.ts +177 -0
- package/ts/gitlab.classes.protectedbranch.ts +21 -0
- package/ts/gitlab.classes.tag.ts +18 -0
- package/ts/gitlab.classes.testreport.ts +97 -0
- package/ts/gitlab.classes.variable.ts +50 -0
- package/ts/gitlab.helpers.ts +26 -0
- package/ts/index.ts +19 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { IGitLabVariable, IGitLabPipelineVariable } from './gitlab.interfaces.js';
|
|
2
|
+
|
|
3
|
+
export class GitLabVariable {
|
|
4
|
+
public readonly key: string;
|
|
5
|
+
public readonly value: string;
|
|
6
|
+
public readonly variableType: string;
|
|
7
|
+
public readonly protected: boolean;
|
|
8
|
+
public readonly masked: boolean;
|
|
9
|
+
public readonly environmentScope: string;
|
|
10
|
+
|
|
11
|
+
constructor(raw: IGitLabVariable) {
|
|
12
|
+
this.key = raw.key || '';
|
|
13
|
+
this.value = raw.value || '';
|
|
14
|
+
this.variableType = raw.variable_type || 'env_var';
|
|
15
|
+
this.protected = raw.protected ?? false;
|
|
16
|
+
this.masked = raw.masked ?? false;
|
|
17
|
+
this.environmentScope = raw.environment_scope || '*';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toJSON(): IGitLabVariable {
|
|
21
|
+
return {
|
|
22
|
+
key: this.key,
|
|
23
|
+
value: this.value,
|
|
24
|
+
variable_type: this.variableType,
|
|
25
|
+
protected: this.protected,
|
|
26
|
+
masked: this.masked,
|
|
27
|
+
environment_scope: this.environmentScope,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class GitLabPipelineVariable {
|
|
33
|
+
public readonly key: string;
|
|
34
|
+
public readonly value: string;
|
|
35
|
+
public readonly variableType: string;
|
|
36
|
+
|
|
37
|
+
constructor(raw: IGitLabPipelineVariable) {
|
|
38
|
+
this.key = raw.key || '';
|
|
39
|
+
this.value = raw.value || '';
|
|
40
|
+
this.variableType = raw.variable_type || 'env_var';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
toJSON(): IGitLabPipelineVariable {
|
|
44
|
+
return {
|
|
45
|
+
key: this.key,
|
|
46
|
+
value: this.value,
|
|
47
|
+
variable_type: this.variableType,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-paginate a list endpoint.
|
|
3
|
+
* If opts includes a specific page, returns just that page (no auto-pagination).
|
|
4
|
+
*/
|
|
5
|
+
export async function autoPaginate<T>(
|
|
6
|
+
fetchPage: (page: number, perPage: number) => Promise<T[]>,
|
|
7
|
+
opts?: { page?: number; perPage?: number },
|
|
8
|
+
): Promise<T[]> {
|
|
9
|
+
const perPage = opts?.perPage || 50;
|
|
10
|
+
|
|
11
|
+
// If caller requests a specific page, return just that page
|
|
12
|
+
if (opts?.page) {
|
|
13
|
+
return fetchPage(opts.page, perPage);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Otherwise auto-paginate through all pages
|
|
17
|
+
const all: T[] = [];
|
|
18
|
+
let page = 1;
|
|
19
|
+
while (true) {
|
|
20
|
+
const items = await fetchPage(page, perPage);
|
|
21
|
+
all.push(...items);
|
|
22
|
+
if (items.length < perPage) break;
|
|
23
|
+
page++;
|
|
24
|
+
}
|
|
25
|
+
return all;
|
|
26
|
+
}
|
package/ts/index.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
+
// Main client
|
|
1
2
|
export { GitLabClient } from './gitlab.classes.gitlabclient.js';
|
|
3
|
+
|
|
4
|
+
// Domain classes
|
|
5
|
+
export { GitLabGroup } from './gitlab.classes.group.js';
|
|
6
|
+
export { GitLabProject } from './gitlab.classes.project.js';
|
|
7
|
+
export { GitLabPipeline } from './gitlab.classes.pipeline.js';
|
|
8
|
+
export { GitLabJob } from './gitlab.classes.job.js';
|
|
9
|
+
export { GitLabBranch } from './gitlab.classes.branch.js';
|
|
10
|
+
export { GitLabTag } from './gitlab.classes.tag.js';
|
|
11
|
+
export { GitLabProtectedBranch } from './gitlab.classes.protectedbranch.js';
|
|
12
|
+
export { GitLabVariable, GitLabPipelineVariable } from './gitlab.classes.variable.js';
|
|
13
|
+
export { GitLabTestReport, GitLabTestSuite, GitLabTestCase } from './gitlab.classes.testreport.js';
|
|
14
|
+
|
|
15
|
+
// Helpers
|
|
16
|
+
export { autoPaginate } from './gitlab.helpers.js';
|
|
17
|
+
|
|
18
|
+
// Interfaces (raw API types)
|
|
2
19
|
export type {
|
|
3
20
|
IGitLabUser,
|
|
4
21
|
IGitLabProject,
|
|
@@ -19,4 +36,6 @@ export type {
|
|
|
19
36
|
IPipelineListOptions,
|
|
20
37
|
IJobListOptions,
|
|
21
38
|
} from './gitlab.interfaces.js';
|
|
39
|
+
|
|
40
|
+
// Commit info
|
|
22
41
|
export { commitinfo } from './00_commitinfo_data.js';
|