@sparted/shared-library 1.0.8-alpha.2 → 1.0.8-alpha.3
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/github/branch/create-branch.d.ts +1 -1
- package/dist/github/branch/create-branch.js +1 -1
- package/dist/github/branch/create-branch.js.map +1 -1
- package/dist/github/branch/update-branch.d.ts +1 -1
- package/dist/github/branch/update-branch.js +1 -1
- package/dist/github/branch/update-branch.js.map +1 -1
- package/dist/github/merge/create-merge-request.d.ts +13 -0
- package/dist/github/merge/create-merge-request.js +29 -0
- package/dist/github/merge/create-merge-request.js.map +1 -0
- package/dist/github/merge/index.d.ts +1 -0
- package/dist/github/merge/index.js +10 -0
- package/dist/github/merge/index.js.map +1 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/src/github/branch/create-branch.ts +2 -2
- package/src/github/branch/update-branch.ts +2 -2
- package/src/github/merge/create-merge-request.ts +40 -0
- package/src/github/merge/index.ts +1 -0
|
@@ -4,7 +4,7 @@ export declare type CreateBranchArgs = {
|
|
|
4
4
|
shaLastCommitOfBranch: string;
|
|
5
5
|
};
|
|
6
6
|
export declare type CreateBranchResponse = {
|
|
7
|
-
|
|
7
|
+
ref: string;
|
|
8
8
|
};
|
|
9
9
|
export declare type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;
|
|
10
10
|
export declare type CreateBranchFactory = (instance: AxiosInstance) => CreateBranch;
|
|
@@ -7,7 +7,7 @@ var zod = require('zod');
|
|
|
7
7
|
var utils = require('../commit/utils.js');
|
|
8
8
|
|
|
9
9
|
const createBranchResponseSchema = zod.z.object({
|
|
10
|
-
|
|
10
|
+
ref: zod.z.string(),
|
|
11
11
|
});
|
|
12
12
|
const createBranchFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
13
|
const { branchName, shaLastCommitOfBranch } = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-branch.js","sources":["../../../src/github/branch/create-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type CreateBranchArgs = {\n branchName: string;\n shaLastCommitOfBranch: string;\n};\n\nexport type CreateBranchResponse = {\n
|
|
1
|
+
{"version":3,"file":"create-branch.js","sources":["../../../src/github/branch/create-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type CreateBranchArgs = {\n branchName: string;\n shaLastCommitOfBranch: string;\n};\n\nexport type CreateBranchResponse = {\n ref: string;\n};\n\nconst createBranchResponseSchema = z.object({\n ref: z.string(),\n});\n\nexport type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;\n\nexport type CreateBranchFactory = (instance: AxiosInstance) => CreateBranch;\n\nexport const createBranchFactory: CreateBranchFactory = (instance) => async (args) => {\n const { branchName, shaLastCommitOfBranch } = args;\n\n try {\n const { data } = await instance.post<CreateBranchResponse>('/git/refs', {\n ref: `refs/heads/${branchName}`,\n sha: shaLastCommitOfBranch,\n });\n\n return createBranchResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAcA,MAAM,0BAA0B,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC1C,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAMI,MAAM,mBAAmB,GAAwB,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACnF,IAAA,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC;IAEnD,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAuB,WAAW,EAAE;YACtE,GAAG,EAAE,CAAc,WAAA,EAAA,UAAU,CAAE,CAAA;AAC/B,YAAA,GAAG,EAAE,qBAAqB;AAC3B,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -4,7 +4,7 @@ export declare type UpdateBranchArgs = {
|
|
|
4
4
|
shaTree: string;
|
|
5
5
|
};
|
|
6
6
|
export declare type UpdateBranchResponse = {
|
|
7
|
-
|
|
7
|
+
ref: string;
|
|
8
8
|
};
|
|
9
9
|
export declare type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;
|
|
10
10
|
export declare type UpdateBranchFactory = (instance: AxiosInstance) => UpdateBranch;
|
|
@@ -7,7 +7,7 @@ var zod = require('zod');
|
|
|
7
7
|
var utils = require('../commit/utils.js');
|
|
8
8
|
|
|
9
9
|
const updateBranchResponseSchema = zod.z.object({
|
|
10
|
-
|
|
10
|
+
ref: zod.z.string(),
|
|
11
11
|
});
|
|
12
12
|
const updateBranchFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
13
|
const { branchName, shaTree } = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-branch.js","sources":["../../../src/github/branch/update-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type UpdateBranchArgs = {\n branchName: string;\n shaTree: string;\n};\n\nexport type UpdateBranchResponse = {\n
|
|
1
|
+
{"version":3,"file":"update-branch.js","sources":["../../../src/github/branch/update-branch.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type UpdateBranchArgs = {\n branchName: string;\n shaTree: string;\n};\n\nexport type UpdateBranchResponse = {\n ref: string;\n};\n\nconst updateBranchResponseSchema = z.object({\n ref: z.string(),\n});\n\nexport type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;\n\nexport type UpdateBranchFactory = (instance: AxiosInstance) => UpdateBranch;\n\nexport const updateBranchFactory: UpdateBranchFactory = (instance) => async (args) => {\n const { branchName, shaTree } = args;\n\n try {\n const { data } = await instance.patch<UpdateBranchResponse>(`/git/refs/heads/${branchName}`, {\n sha: shaTree,\n });\n\n return updateBranchResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAcA,MAAM,0BAA0B,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC1C,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAMI,MAAM,mBAAmB,GAAwB,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACnF,IAAA,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAErC,IAAI;AACF,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAuB,CAAA,gBAAA,EAAmB,UAAU,CAAA,CAAE,EAAE;AAC3F,YAAA,GAAG,EAAE,OAAO;AACb,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
export declare type CreateMergeRequestArgs = {
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
head: string;
|
|
6
|
+
base: string;
|
|
7
|
+
};
|
|
8
|
+
export declare type CreateMergeRequestResponse = {
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type CreateMergeRequest = (args: CreateMergeRequestArgs) => Promise<CreateMergeRequestResponse>;
|
|
12
|
+
export declare type CreateMergeRequestFactory = (instance: AxiosInstance) => CreateMergeRequest;
|
|
13
|
+
export declare const createMergeRequestFactory: CreateMergeRequestFactory;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
+
var zod = require('zod');
|
|
7
|
+
var utils = require('../commit/utils.js');
|
|
8
|
+
|
|
9
|
+
const createMergeRequestResponseSchema = zod.z.object({
|
|
10
|
+
url: zod.z.string(),
|
|
11
|
+
});
|
|
12
|
+
const createMergeRequestFactory = (instance) => (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const { title, body, head, base } = args;
|
|
14
|
+
try {
|
|
15
|
+
const { data } = yield instance.post('/pulls', {
|
|
16
|
+
title,
|
|
17
|
+
body,
|
|
18
|
+
head,
|
|
19
|
+
base,
|
|
20
|
+
});
|
|
21
|
+
return createMergeRequestResponseSchema.parse(data);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw utils.handleError(error);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.createMergeRequestFactory = createMergeRequestFactory;
|
|
29
|
+
//# sourceMappingURL=create-merge-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-merge-request.js","sources":["../../../src/github/merge/create-merge-request.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport { z } from 'zod';\n\nimport { handleError } from '../commit/utils';\n\nexport type CreateMergeRequestArgs = {\n title: string;\n body: string;\n head: string;\n base: string;\n};\n\nexport type CreateMergeRequestResponse = {\n url: string;\n};\n\nconst createMergeRequestResponseSchema = z.object({\n url: z.string(),\n});\n\nexport type CreateMergeRequest = (args: CreateMergeRequestArgs) => Promise<CreateMergeRequestResponse>;\n\nexport type CreateMergeRequestFactory = (instance: AxiosInstance) => CreateMergeRequest;\n\nexport const createMergeRequestFactory: CreateMergeRequestFactory = (instance) => async (args) => {\n const { title, body, head, base } = args;\n\n try {\n const { data } = await instance.post<CreateMergeRequestResponse>('/pulls', {\n title,\n body,\n head,\n base,\n });\n\n return createMergeRequestResponseSchema.parse(data);\n } catch (error) {\n throw handleError(error);\n }\n};\n"],"names":["z","__awaiter","handleError"],"mappings":";;;;;;;;AAgBA,MAAM,gCAAgC,GAAGA,KAAC,CAAC,MAAM,CAAC;AAChD,IAAA,GAAG,EAAEA,KAAC,CAAC,MAAM,EAAE;AAChB,CAAA,CAAC,CAAC;AAMI,MAAM,yBAAyB,GAA8B,CAAC,QAAQ,KAAK,CAAO,IAAI,KAAIC,gBAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;IAC/F,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEzC,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAA6B,QAAQ,EAAE;YACzE,KAAK;YACL,IAAI;YACJ,IAAI;YACJ,IAAI;AACL,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,gCAAgC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACrD,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAMC,iBAAW,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-merge-request';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var createMergeRequest = require('./create-merge-request.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.createMergeRequestFactory = createMergeRequest.createMergeRequestFactory;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -9,11 +9,11 @@ export type CreateBranchArgs = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type CreateBranchResponse = {
|
|
12
|
-
|
|
12
|
+
ref: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const createBranchResponseSchema = z.object({
|
|
16
|
-
|
|
16
|
+
ref: z.string(),
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;
|
|
@@ -9,11 +9,11 @@ export type UpdateBranchArgs = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export type UpdateBranchResponse = {
|
|
12
|
-
|
|
12
|
+
ref: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const updateBranchResponseSchema = z.object({
|
|
16
|
-
|
|
16
|
+
ref: z.string(),
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { handleError } from '../commit/utils';
|
|
5
|
+
|
|
6
|
+
export type CreateMergeRequestArgs = {
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
head: string;
|
|
10
|
+
base: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type CreateMergeRequestResponse = {
|
|
14
|
+
url: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const createMergeRequestResponseSchema = z.object({
|
|
18
|
+
url: z.string(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type CreateMergeRequest = (args: CreateMergeRequestArgs) => Promise<CreateMergeRequestResponse>;
|
|
22
|
+
|
|
23
|
+
export type CreateMergeRequestFactory = (instance: AxiosInstance) => CreateMergeRequest;
|
|
24
|
+
|
|
25
|
+
export const createMergeRequestFactory: CreateMergeRequestFactory = (instance) => async (args) => {
|
|
26
|
+
const { title, body, head, base } = args;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const { data } = await instance.post<CreateMergeRequestResponse>('/pulls', {
|
|
30
|
+
title,
|
|
31
|
+
body,
|
|
32
|
+
head,
|
|
33
|
+
base,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return createMergeRequestResponseSchema.parse(data);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
throw handleError(error);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-merge-request';
|