@oh-my-ghaad/gitlab 0.0.7 → 0.0.9
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/.turbo/turbo-build.log +19 -0
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +39 -11
- package/dist/index.js +39 -11
- package/package.json +2 -2
- package/src/adapter.ts +40 -11
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @oh-my-ghaad/gitlab@0.0.7 build /Volumes/T7/repos/oh-my-ghaad/packages/adapter-gitlab
|
|
4
|
+
> tsup src/index.ts --dts --dts-resolve --format esm,cjs
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.0
|
|
9
|
+
[34mCLI[39m Target: esnext
|
|
10
|
+
[34mESM[39m Build start
|
|
11
|
+
[34mCJS[39m Build start
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m9.24 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 12ms
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m8.20 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 12ms
|
|
16
|
+
DTS Build start
|
|
17
|
+
DTS ⚡️ Build success in 505ms
|
|
18
|
+
DTS dist/index.d.ts 1.41 KB
|
|
19
|
+
DTS dist/index.d.cts 1.41 KB
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [0.0.9](https://github.com/cmgriffing/oh-my-ghaad/compare/v0.0.8...v0.0.9) (2025-10-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* handle missing default branch in gitlab adapter ([40d3a7e](https://github.com/cmgriffing/oh-my-ghaad/commit/40d3a7ebb80f175161101444f47d187f6ed9259a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [0.0.8](https://github.com/cmgriffing/oh-my-ghaad/compare/v0.0.7...v0.0.8) (2025-10-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* instead of storing owner and repo separate, store the whole RepositoryResponse object ([db60e6b](https://github.com/cmgriffing/oh-my-ghaad/commit/db60e6b65f2232613a2de3ba6c0a45a51cbb0b27))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [0.0.7](https://github.com/cmgriffing/oh-my-ghaad/compare/v0.0.6...v0.0.7) (2025-10-04)
|
|
2
20
|
|
|
3
21
|
|
package/dist/index.cjs
CHANGED
|
@@ -101,7 +101,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
101
101
|
}
|
|
102
102
|
async fetchFile(path) {
|
|
103
103
|
const fileOrError = await this.api.RepositoryFiles.show(
|
|
104
|
-
this.repo,
|
|
104
|
+
this.repo.id,
|
|
105
105
|
path,
|
|
106
106
|
"HEAD"
|
|
107
107
|
).catch((error) => {
|
|
@@ -125,7 +125,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
125
125
|
}
|
|
126
126
|
async fetchDirectory(directoryPath) {
|
|
127
127
|
const filesOrError = await this.api.Repositories.allRepositoryTrees(
|
|
128
|
-
this.repo,
|
|
128
|
+
this.repo.id,
|
|
129
129
|
{
|
|
130
130
|
path: directoryPath
|
|
131
131
|
}
|
|
@@ -149,7 +149,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
async createFile(path, content, message) {
|
|
152
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
152
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
153
153
|
(error) => {
|
|
154
154
|
console.error(error);
|
|
155
155
|
return error;
|
|
@@ -161,12 +161,40 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
161
161
|
}
|
|
162
162
|
throw new Error("Failed to fetch default branch");
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
let branch = branchesOrError.find((branch2) => branch2.default);
|
|
165
165
|
if (!branch) {
|
|
166
|
-
|
|
166
|
+
branch = {
|
|
167
|
+
name: "main",
|
|
168
|
+
merged: true,
|
|
169
|
+
protected: false,
|
|
170
|
+
default: true,
|
|
171
|
+
developersCanPush: true,
|
|
172
|
+
developersCanMerge: true,
|
|
173
|
+
canPush: true,
|
|
174
|
+
webUrl: "",
|
|
175
|
+
commit: {
|
|
176
|
+
id: "",
|
|
177
|
+
shortId: "",
|
|
178
|
+
title: "",
|
|
179
|
+
authorName: "",
|
|
180
|
+
authorEmail: "",
|
|
181
|
+
sha: "",
|
|
182
|
+
message: "",
|
|
183
|
+
author: {
|
|
184
|
+
name: "",
|
|
185
|
+
email: "",
|
|
186
|
+
date: ""
|
|
187
|
+
},
|
|
188
|
+
committer: {
|
|
189
|
+
name: "",
|
|
190
|
+
email: "",
|
|
191
|
+
date: ""
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
167
195
|
}
|
|
168
196
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
169
|
-
this.repo,
|
|
197
|
+
this.repo.id,
|
|
170
198
|
path,
|
|
171
199
|
branch.name
|
|
172
200
|
).catch((error) => {
|
|
@@ -183,7 +211,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
183
211
|
throw new Error("File already exists");
|
|
184
212
|
}
|
|
185
213
|
const createdFileOrError = await this.api.Commits.create(
|
|
186
|
-
this.repo,
|
|
214
|
+
this.repo.id,
|
|
187
215
|
branch.name,
|
|
188
216
|
message || `Create file: ${path}`,
|
|
189
217
|
[
|
|
@@ -207,7 +235,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
207
235
|
return;
|
|
208
236
|
}
|
|
209
237
|
async updateFile(path, content, message) {
|
|
210
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
238
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
211
239
|
(error) => {
|
|
212
240
|
console.error(error);
|
|
213
241
|
return error;
|
|
@@ -224,7 +252,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
224
252
|
throw new Error("Failed to find default branch");
|
|
225
253
|
}
|
|
226
254
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
227
|
-
this.repo,
|
|
255
|
+
this.repo.id,
|
|
228
256
|
path,
|
|
229
257
|
branch.name
|
|
230
258
|
).catch((error) => {
|
|
@@ -241,7 +269,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
241
269
|
throw new Error("File does not exist");
|
|
242
270
|
}
|
|
243
271
|
const createdFileOrError = await this.api.Commits.create(
|
|
244
|
-
this.repo,
|
|
272
|
+
this.repo.id,
|
|
245
273
|
branch.name,
|
|
246
274
|
message || `Create file: ${path}`,
|
|
247
275
|
[
|
|
@@ -266,7 +294,7 @@ var GitlabAdapter = class extends import_core.Adapter {
|
|
|
266
294
|
}
|
|
267
295
|
async deleteFile(path, message) {
|
|
268
296
|
const responseOrError = await this.api.RepositoryFiles.remove(
|
|
269
|
-
this.repo,
|
|
297
|
+
this.repo.id,
|
|
270
298
|
path,
|
|
271
299
|
"HEAD",
|
|
272
300
|
message || `Delete file: ${path}`
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
76
76
|
}
|
|
77
77
|
async fetchFile(path) {
|
|
78
78
|
const fileOrError = await this.api.RepositoryFiles.show(
|
|
79
|
-
this.repo,
|
|
79
|
+
this.repo.id,
|
|
80
80
|
path,
|
|
81
81
|
"HEAD"
|
|
82
82
|
).catch((error) => {
|
|
@@ -100,7 +100,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
100
100
|
}
|
|
101
101
|
async fetchDirectory(directoryPath) {
|
|
102
102
|
const filesOrError = await this.api.Repositories.allRepositoryTrees(
|
|
103
|
-
this.repo,
|
|
103
|
+
this.repo.id,
|
|
104
104
|
{
|
|
105
105
|
path: directoryPath
|
|
106
106
|
}
|
|
@@ -124,7 +124,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
async createFile(path, content, message) {
|
|
127
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
127
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
128
128
|
(error) => {
|
|
129
129
|
console.error(error);
|
|
130
130
|
return error;
|
|
@@ -136,12 +136,40 @@ var GitlabAdapter = class extends Adapter {
|
|
|
136
136
|
}
|
|
137
137
|
throw new Error("Failed to fetch default branch");
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
let branch = branchesOrError.find((branch2) => branch2.default);
|
|
140
140
|
if (!branch) {
|
|
141
|
-
|
|
141
|
+
branch = {
|
|
142
|
+
name: "main",
|
|
143
|
+
merged: true,
|
|
144
|
+
protected: false,
|
|
145
|
+
default: true,
|
|
146
|
+
developersCanPush: true,
|
|
147
|
+
developersCanMerge: true,
|
|
148
|
+
canPush: true,
|
|
149
|
+
webUrl: "",
|
|
150
|
+
commit: {
|
|
151
|
+
id: "",
|
|
152
|
+
shortId: "",
|
|
153
|
+
title: "",
|
|
154
|
+
authorName: "",
|
|
155
|
+
authorEmail: "",
|
|
156
|
+
sha: "",
|
|
157
|
+
message: "",
|
|
158
|
+
author: {
|
|
159
|
+
name: "",
|
|
160
|
+
email: "",
|
|
161
|
+
date: ""
|
|
162
|
+
},
|
|
163
|
+
committer: {
|
|
164
|
+
name: "",
|
|
165
|
+
email: "",
|
|
166
|
+
date: ""
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
142
170
|
}
|
|
143
171
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
144
|
-
this.repo,
|
|
172
|
+
this.repo.id,
|
|
145
173
|
path,
|
|
146
174
|
branch.name
|
|
147
175
|
).catch((error) => {
|
|
@@ -158,7 +186,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
158
186
|
throw new Error("File already exists");
|
|
159
187
|
}
|
|
160
188
|
const createdFileOrError = await this.api.Commits.create(
|
|
161
|
-
this.repo,
|
|
189
|
+
this.repo.id,
|
|
162
190
|
branch.name,
|
|
163
191
|
message || `Create file: ${path}`,
|
|
164
192
|
[
|
|
@@ -182,7 +210,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
182
210
|
return;
|
|
183
211
|
}
|
|
184
212
|
async updateFile(path, content, message) {
|
|
185
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
213
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
186
214
|
(error) => {
|
|
187
215
|
console.error(error);
|
|
188
216
|
return error;
|
|
@@ -199,7 +227,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
199
227
|
throw new Error("Failed to find default branch");
|
|
200
228
|
}
|
|
201
229
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
202
|
-
this.repo,
|
|
230
|
+
this.repo.id,
|
|
203
231
|
path,
|
|
204
232
|
branch.name
|
|
205
233
|
).catch((error) => {
|
|
@@ -216,7 +244,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
216
244
|
throw new Error("File does not exist");
|
|
217
245
|
}
|
|
218
246
|
const createdFileOrError = await this.api.Commits.create(
|
|
219
|
-
this.repo,
|
|
247
|
+
this.repo.id,
|
|
220
248
|
branch.name,
|
|
221
249
|
message || `Create file: ${path}`,
|
|
222
250
|
[
|
|
@@ -241,7 +269,7 @@ var GitlabAdapter = class extends Adapter {
|
|
|
241
269
|
}
|
|
242
270
|
async deleteFile(path, message) {
|
|
243
271
|
const responseOrError = await this.api.RepositoryFiles.remove(
|
|
244
|
-
this.repo,
|
|
272
|
+
this.repo.id,
|
|
245
273
|
path,
|
|
246
274
|
"HEAD",
|
|
247
275
|
message || `Delete file: ${path}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-ghaad/gitlab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@gitbeaker/rest": "^43.5.0",
|
|
13
|
-
"@oh-my-ghaad/core": "0.0.
|
|
13
|
+
"@oh-my-ghaad/core": "0.0.9"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"tsup": "^8.5.0",
|
package/src/adapter.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
65
65
|
|
|
66
66
|
async fetchFile(path: string) {
|
|
67
67
|
const fileOrError = await this.api.RepositoryFiles.show(
|
|
68
|
-
this.repo,
|
|
68
|
+
this.repo.id,
|
|
69
69
|
path,
|
|
70
70
|
"HEAD"
|
|
71
71
|
).catch((error: GitbeakerRequestError) => {
|
|
@@ -96,7 +96,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
96
96
|
|
|
97
97
|
async fetchDirectory(directoryPath: string) {
|
|
98
98
|
const filesOrError = await this.api.Repositories.allRepositoryTrees(
|
|
99
|
-
this.repo,
|
|
99
|
+
this.repo.id,
|
|
100
100
|
{
|
|
101
101
|
path: directoryPath,
|
|
102
102
|
}
|
|
@@ -129,7 +129,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async createFile(path: string, content: string, message?: string) {
|
|
132
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
132
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
133
133
|
(error: GitbeakerRequestError) => {
|
|
134
134
|
console.error(error);
|
|
135
135
|
return error;
|
|
@@ -146,14 +146,43 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
146
146
|
throw new Error("Failed to fetch default branch");
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
let branch = branchesOrError.find((branch) => branch.default);
|
|
150
150
|
|
|
151
151
|
if (!branch) {
|
|
152
|
-
throw new Error("Failed to find default branch");
|
|
152
|
+
// throw new Error("Failed to find default branch");
|
|
153
|
+
branch = {
|
|
154
|
+
name: "main",
|
|
155
|
+
merged: true,
|
|
156
|
+
protected: false,
|
|
157
|
+
default: true,
|
|
158
|
+
developersCanPush: true,
|
|
159
|
+
developersCanMerge: true,
|
|
160
|
+
canPush: true,
|
|
161
|
+
webUrl: "",
|
|
162
|
+
commit: {
|
|
163
|
+
id: "",
|
|
164
|
+
shortId: "",
|
|
165
|
+
title: "",
|
|
166
|
+
authorName: "",
|
|
167
|
+
authorEmail: "",
|
|
168
|
+
sha: "",
|
|
169
|
+
message: "",
|
|
170
|
+
author: {
|
|
171
|
+
name: "",
|
|
172
|
+
email: "",
|
|
173
|
+
date: "",
|
|
174
|
+
},
|
|
175
|
+
committer: {
|
|
176
|
+
name: "",
|
|
177
|
+
email: "",
|
|
178
|
+
date: "",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
153
182
|
}
|
|
154
183
|
|
|
155
184
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
156
|
-
this.repo,
|
|
185
|
+
this.repo.id,
|
|
157
186
|
path,
|
|
158
187
|
branch.name
|
|
159
188
|
).catch((error: GitbeakerRequestError) => {
|
|
@@ -176,7 +205,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
176
205
|
}
|
|
177
206
|
|
|
178
207
|
const createdFileOrError = await this.api.Commits.create(
|
|
179
|
-
this.repo,
|
|
208
|
+
this.repo.id,
|
|
180
209
|
branch.name,
|
|
181
210
|
message || `Create file: ${path}`,
|
|
182
211
|
[
|
|
@@ -206,7 +235,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
206
235
|
}
|
|
207
236
|
|
|
208
237
|
async updateFile(path: string, content: string, message?: string) {
|
|
209
|
-
const branchesOrError = await this.api.Branches.all(this.repo).catch(
|
|
238
|
+
const branchesOrError = await this.api.Branches.all(this.repo.id).catch(
|
|
210
239
|
(error: GitbeakerRequestError) => {
|
|
211
240
|
console.error(error);
|
|
212
241
|
return error;
|
|
@@ -230,7 +259,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
230
259
|
}
|
|
231
260
|
|
|
232
261
|
const existingFileOrError = await this.api.RepositoryFiles.show(
|
|
233
|
-
this.repo,
|
|
262
|
+
this.repo.id,
|
|
234
263
|
path,
|
|
235
264
|
branch.name
|
|
236
265
|
).catch((error: GitbeakerRequestError) => {
|
|
@@ -253,7 +282,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
253
282
|
}
|
|
254
283
|
|
|
255
284
|
const createdFileOrError = await this.api.Commits.create(
|
|
256
|
-
this.repo,
|
|
285
|
+
this.repo.id,
|
|
257
286
|
branch.name,
|
|
258
287
|
message || `Create file: ${path}`,
|
|
259
288
|
[
|
|
@@ -284,7 +313,7 @@ export class GitlabAdapter extends Adapter implements IAdapter {
|
|
|
284
313
|
|
|
285
314
|
async deleteFile(path: string, message?: string) {
|
|
286
315
|
const responseOrError = await this.api.RepositoryFiles.remove(
|
|
287
|
-
this.repo,
|
|
316
|
+
this.repo.id,
|
|
288
317
|
path,
|
|
289
318
|
"HEAD",
|
|
290
319
|
message || `Delete file: ${path}`
|