File tree Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change 1
1
export * from "./socket.ts" ;
2
+ export * from "./push.ts" ;
2
3
export * from "./patch.ts" ;
3
4
export * from "./deletePage.ts" ;
4
5
export * from "./pin.ts" ;
Original file line number Diff line number Diff line change @@ -68,6 +68,28 @@ export type PushError =
68
68
| NetworkError
69
69
| AbortError ;
70
70
71
+ /**
72
+ * pushしたいcommitを作る関数
73
+ *
74
+ * {@linkcode push} で使う
75
+ *
76
+ * @param page ページのメタデータ
77
+ * @param attempts 何回目の試行か
78
+ * @param prev 前回のcommitの変更
79
+ * @param reason 再試行した場合、その理由が渡される
80
+ * @returns commits
81
+ */
82
+ export type CommitMakeHandler = (
83
+ page : PushMetadata ,
84
+ attempts : number ,
85
+ prev : Change [ ] | [ DeletePageChange ] | [ PinChange ] ,
86
+ reason ?: "NotFastForwardError" | "DuplicateTitleError" ,
87
+ ) =>
88
+ | Promise < Change [ ] | [ DeletePageChange ] | [ PinChange ] >
89
+ | Change [ ]
90
+ | [ DeletePageChange ]
91
+ | [ PinChange ] ;
92
+
71
93
/** 特定のページのcommitをpushする
72
94
*
73
95
* serverからpush errorが返ってきた場合、エラーに応じてpushを再試行する
@@ -81,16 +103,7 @@ export type PushError =
81
103
export const push = async (
82
104
project : string ,
83
105
title : string ,
84
- makeCommit : (
85
- page : PushMetadata ,
86
- attempts : number ,
87
- prev : Change [ ] | [ DeletePageChange ] | [ PinChange ] ,
88
- reason ?: "NotFastForwardError" | "DuplicateTitleError" ,
89
- ) =>
90
- | Promise < Change [ ] | [ DeletePageChange ] | [ PinChange ] >
91
- | Change [ ]
92
- | [ DeletePageChange ]
93
- | [ PinChange ] ,
106
+ makeCommit : CommitMakeHandler ,
94
107
options ?: PushOptions ,
95
108
) : Promise < Result < string , PushError > > => {
96
109
const result = await connect ( options ?. socket ) ;
You can’t perform that action at this time.
0 commit comments