@puniyu/nipaw 1.5.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/index.d.ts +631 -0
- package/dist/index.js +566 -0
- package/package.json +54 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
// powered by nipaw_core
|
|
2
|
+
export declare class CnbClient {
|
|
3
|
+
|
|
4
|
+
constructor()
|
|
5
|
+
/**
|
|
6
|
+
* 设置访问令牌
|
|
7
|
+
*
|
|
8
|
+
* ## 参数
|
|
9
|
+
* - `token` 访问令牌
|
|
10
|
+
*/
|
|
11
|
+
setToken(token: string): void
|
|
12
|
+
/**
|
|
13
|
+
* 设置代理
|
|
14
|
+
*
|
|
15
|
+
* ## 参数
|
|
16
|
+
* - `proxy` 代理地址
|
|
17
|
+
*
|
|
18
|
+
* 支持http,https,socks5协议
|
|
19
|
+
*/
|
|
20
|
+
setProxy(proxy: string): void
|
|
21
|
+
/** 获取当前登录用户信息 */
|
|
22
|
+
getUserInfo(): Promise<UserInfo>
|
|
23
|
+
/**
|
|
24
|
+
* 获取指定用户信息
|
|
25
|
+
*
|
|
26
|
+
* ## 参数
|
|
27
|
+
* - `user_name` 用户名称
|
|
28
|
+
*/
|
|
29
|
+
getUserInfoWithName(name: string): Promise<UserInfo>
|
|
30
|
+
/**
|
|
31
|
+
* 获取指定用户贡献信息
|
|
32
|
+
*
|
|
33
|
+
* ## 参数
|
|
34
|
+
* - `user_name` 用户名称
|
|
35
|
+
*/
|
|
36
|
+
getUserContribution(userName: string): Promise<ContributionResult>
|
|
37
|
+
/**
|
|
38
|
+
* 获取组织信息
|
|
39
|
+
*
|
|
40
|
+
* ## 参数
|
|
41
|
+
* - `org_name` 组织名称
|
|
42
|
+
*/
|
|
43
|
+
getOrgInfo(orgName: string): Promise<OrgInfo>
|
|
44
|
+
/**
|
|
45
|
+
* 获取组织仓库列表
|
|
46
|
+
*
|
|
47
|
+
* ## 参数
|
|
48
|
+
* - `org_name` 组织名称
|
|
49
|
+
* - `option` 仓库列表选项
|
|
50
|
+
*/
|
|
51
|
+
getOrgRepos(orgName: string, option?: OrgRepoListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
52
|
+
/** 获取组织头像地址 */
|
|
53
|
+
getOrgAvatarUrl(orgName: string): Promise<string>
|
|
54
|
+
/**
|
|
55
|
+
* 获取指定用户头像地址
|
|
56
|
+
*
|
|
57
|
+
* ## 参数
|
|
58
|
+
* - `user_name` 用户名称
|
|
59
|
+
*/
|
|
60
|
+
getUserAvatarUrl(userName: string): Promise<string>
|
|
61
|
+
/**
|
|
62
|
+
* 获取仓库信息
|
|
63
|
+
*
|
|
64
|
+
* ## 参数
|
|
65
|
+
* - `owner` 仓库所有者
|
|
66
|
+
* - `repo` 仓库名称
|
|
67
|
+
*/
|
|
68
|
+
getRepoInfo(owner: string, repo: string): Promise<RepoInfo>
|
|
69
|
+
/**
|
|
70
|
+
* 获取指定用户仓库列表
|
|
71
|
+
*
|
|
72
|
+
* ## 参数
|
|
73
|
+
* - `user_name` 用户名称
|
|
74
|
+
* - `option` 仓库列表选项
|
|
75
|
+
*/
|
|
76
|
+
getUserRepos(option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
77
|
+
/**
|
|
78
|
+
* 获取指定用户仓库列表
|
|
79
|
+
*
|
|
80
|
+
* ## 参数
|
|
81
|
+
* - `user_name` 用户名称
|
|
82
|
+
* - `option` 仓库列表选项
|
|
83
|
+
*/
|
|
84
|
+
getUserReposWithName(userName: string, option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
85
|
+
/**
|
|
86
|
+
* 获取仓库提交信息
|
|
87
|
+
*
|
|
88
|
+
* ## 参数
|
|
89
|
+
* - `owner` 仓库所有者
|
|
90
|
+
* - `repo` 仓库名称
|
|
91
|
+
* - `sha` 提交SHA, 如果不设置则会获取默认分支的最新提交
|
|
92
|
+
*/
|
|
93
|
+
getCommitInfo(owner: string, repo: string, sha?: string | undefined | null): Promise<CommitInfo>
|
|
94
|
+
/**
|
|
95
|
+
* 获取仓库提交列表
|
|
96
|
+
*
|
|
97
|
+
* ## 参数
|
|
98
|
+
* - `owner` 仓库所有者
|
|
99
|
+
* - `repo` 仓库名称
|
|
100
|
+
* - `option` 提交列表选项
|
|
101
|
+
*/
|
|
102
|
+
getCommitInfos(owner: string, repo: string, option?: CommitListOptions | undefined | null): Promise<Array<CommitInfo>>
|
|
103
|
+
/**
|
|
104
|
+
* 添加仓库协作者
|
|
105
|
+
*
|
|
106
|
+
* # 参数
|
|
107
|
+
*
|
|
108
|
+
* * `owner` - 仓库所有者
|
|
109
|
+
* * `repo` - 仓库名称
|
|
110
|
+
* * `user_name` - 协作者用户名
|
|
111
|
+
* * `permission` - 协作者权限, 默认为 `Pull`, 可选值为 `Admin`, `Push`, `Pull`
|
|
112
|
+
*/
|
|
113
|
+
addRepoCollaborator(owner: string, repo: string, userName: string, permission?: CollaboratorPermission | undefined | null): Promise<CollaboratorResult>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare class GitCodeClient {
|
|
117
|
+
|
|
118
|
+
constructor()
|
|
119
|
+
/**
|
|
120
|
+
* 设置访问令牌
|
|
121
|
+
*
|
|
122
|
+
* ## 参数
|
|
123
|
+
* - `token` 访问令牌
|
|
124
|
+
*/
|
|
125
|
+
setToken(token: string): void
|
|
126
|
+
/**
|
|
127
|
+
* 设置代理
|
|
128
|
+
*
|
|
129
|
+
* ## 参数
|
|
130
|
+
* - `proxy` 代理地址
|
|
131
|
+
*
|
|
132
|
+
* 支持http,https,socks5协议
|
|
133
|
+
*/
|
|
134
|
+
setProxy(proxy: string): void
|
|
135
|
+
/** 获取当前登录用户信息 */
|
|
136
|
+
getUserInfo(): Promise<UserInfo>
|
|
137
|
+
/**
|
|
138
|
+
* 获取指定用户信息
|
|
139
|
+
*
|
|
140
|
+
* ## 参数
|
|
141
|
+
* - `user_name` 用户名称
|
|
142
|
+
*/
|
|
143
|
+
getUserInfoWithName(name: string): Promise<UserInfo>
|
|
144
|
+
/**
|
|
145
|
+
* 获取指定用户贡献信息
|
|
146
|
+
*
|
|
147
|
+
* ## 参数
|
|
148
|
+
* - `user_name` 用户名称
|
|
149
|
+
*/
|
|
150
|
+
getUserContribution(userName: string): Promise<ContributionResult>
|
|
151
|
+
/**
|
|
152
|
+
* 获取组织信息
|
|
153
|
+
*
|
|
154
|
+
* ## 参数
|
|
155
|
+
* - `org_name` 组织名称
|
|
156
|
+
*/
|
|
157
|
+
getOrgInfo(orgName: string): Promise<OrgInfo>
|
|
158
|
+
/**
|
|
159
|
+
* 获取组织仓库列表
|
|
160
|
+
*
|
|
161
|
+
* ## 参数
|
|
162
|
+
* - `org_name` 组织名称
|
|
163
|
+
* - `option` 仓库列表选项
|
|
164
|
+
*/
|
|
165
|
+
getOrgRepos(orgName: string, option?: OrgRepoListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
166
|
+
/** 获取组织头像地址 */
|
|
167
|
+
getOrgAvatarUrl(orgName: string): Promise<string>
|
|
168
|
+
/**
|
|
169
|
+
* 获取指定用户头像地址
|
|
170
|
+
*
|
|
171
|
+
* ## 参数
|
|
172
|
+
* - `user_name` 用户名称
|
|
173
|
+
*/
|
|
174
|
+
getUserAvatarUrl(userName: string): Promise<string>
|
|
175
|
+
/**
|
|
176
|
+
* 获取仓库信息
|
|
177
|
+
*
|
|
178
|
+
* ## 参数
|
|
179
|
+
* - `owner` 仓库所有者
|
|
180
|
+
* - `repo` 仓库名称
|
|
181
|
+
*/
|
|
182
|
+
getRepoInfo(owner: string, repo: string): Promise<RepoInfo>
|
|
183
|
+
/**
|
|
184
|
+
* 获取指定用户仓库列表
|
|
185
|
+
*
|
|
186
|
+
* ## 参数
|
|
187
|
+
* - `user_name` 用户名称
|
|
188
|
+
* - `option` 仓库列表选项
|
|
189
|
+
*/
|
|
190
|
+
getUserRepos(option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
191
|
+
/**
|
|
192
|
+
* 获取指定用户仓库列表
|
|
193
|
+
*
|
|
194
|
+
* ## 参数
|
|
195
|
+
* - `user_name` 用户名称
|
|
196
|
+
* - `option` 仓库列表选项
|
|
197
|
+
*/
|
|
198
|
+
getUserReposWithName(userName: string, option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
199
|
+
/**
|
|
200
|
+
* 获取仓库提交信息
|
|
201
|
+
*
|
|
202
|
+
* ## 参数
|
|
203
|
+
* - `owner` 仓库所有者
|
|
204
|
+
* - `repo` 仓库名称
|
|
205
|
+
* - `sha` 提交SHA, 如果不设置则会获取默认分支的最新提交
|
|
206
|
+
*/
|
|
207
|
+
getCommitInfo(owner: string, repo: string, sha?: string | undefined | null): Promise<CommitInfo>
|
|
208
|
+
/**
|
|
209
|
+
* 获取仓库提交列表
|
|
210
|
+
*
|
|
211
|
+
* ## 参数
|
|
212
|
+
* - `owner` 仓库所有者
|
|
213
|
+
* - `repo` 仓库名称
|
|
214
|
+
* - `option` 提交列表选项
|
|
215
|
+
*/
|
|
216
|
+
getCommitInfos(owner: string, repo: string, option?: CommitListOptions | undefined | null): Promise<Array<CommitInfo>>
|
|
217
|
+
/**
|
|
218
|
+
* 添加仓库协作者
|
|
219
|
+
*
|
|
220
|
+
* # 参数
|
|
221
|
+
*
|
|
222
|
+
* * `owner` - 仓库所有者
|
|
223
|
+
* * `repo` - 仓库名称
|
|
224
|
+
* * `user_name` - 协作者用户名
|
|
225
|
+
* * `permission` - 协作者权限, 默认为 `Pull`, 可选值为 `Admin`, `Push`, `Pull`
|
|
226
|
+
*/
|
|
227
|
+
addRepoCollaborator(owner: string, repo: string, userName: string, permission?: CollaboratorPermission | undefined | null): Promise<CollaboratorResult>
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export declare class GiteeClient {
|
|
231
|
+
|
|
232
|
+
constructor()
|
|
233
|
+
/**
|
|
234
|
+
* 设置访问令牌
|
|
235
|
+
*
|
|
236
|
+
* ## 参数
|
|
237
|
+
* - `token` 访问令牌
|
|
238
|
+
*/
|
|
239
|
+
setToken(token: string): void
|
|
240
|
+
/**
|
|
241
|
+
* 设置代理
|
|
242
|
+
*
|
|
243
|
+
* ## 参数
|
|
244
|
+
* - `proxy` 代理地址
|
|
245
|
+
*
|
|
246
|
+
* 支持http,https,socks5协议
|
|
247
|
+
*/
|
|
248
|
+
setProxy(proxy: string): void
|
|
249
|
+
/** 获取当前登录用户信息 */
|
|
250
|
+
getUserInfo(): Promise<UserInfo>
|
|
251
|
+
/**
|
|
252
|
+
* 获取指定用户信息
|
|
253
|
+
*
|
|
254
|
+
* ## 参数
|
|
255
|
+
* - `user_name` 用户名称
|
|
256
|
+
*/
|
|
257
|
+
getUserInfoWithName(name: string): Promise<UserInfo>
|
|
258
|
+
/**
|
|
259
|
+
* 获取指定用户贡献信息
|
|
260
|
+
*
|
|
261
|
+
* ## 参数
|
|
262
|
+
* - `user_name` 用户名称
|
|
263
|
+
*/
|
|
264
|
+
getUserContribution(userName: string): Promise<ContributionResult>
|
|
265
|
+
/**
|
|
266
|
+
* 获取组织信息
|
|
267
|
+
*
|
|
268
|
+
* ## 参数
|
|
269
|
+
* - `org_name` 组织名称
|
|
270
|
+
*/
|
|
271
|
+
getOrgInfo(orgName: string): Promise<OrgInfo>
|
|
272
|
+
/**
|
|
273
|
+
* 获取组织仓库列表
|
|
274
|
+
*
|
|
275
|
+
* ## 参数
|
|
276
|
+
* - `org_name` 组织名称
|
|
277
|
+
* - `option` 仓库列表选项
|
|
278
|
+
*/
|
|
279
|
+
getOrgRepos(orgName: string, option?: OrgRepoListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
280
|
+
/** 获取组织头像地址 */
|
|
281
|
+
getOrgAvatarUrl(orgName: string): Promise<string>
|
|
282
|
+
/**
|
|
283
|
+
* 获取指定用户头像地址
|
|
284
|
+
*
|
|
285
|
+
* ## 参数
|
|
286
|
+
* - `user_name` 用户名称
|
|
287
|
+
*/
|
|
288
|
+
getUserAvatarUrl(userName: string): Promise<string>
|
|
289
|
+
/**
|
|
290
|
+
* 获取仓库信息
|
|
291
|
+
*
|
|
292
|
+
* ## 参数
|
|
293
|
+
* - `owner` 仓库所有者
|
|
294
|
+
* - `repo` 仓库名称
|
|
295
|
+
*/
|
|
296
|
+
getRepoInfo(owner: string, repo: string): Promise<RepoInfo>
|
|
297
|
+
/**
|
|
298
|
+
* 获取指定用户仓库列表
|
|
299
|
+
*
|
|
300
|
+
* ## 参数
|
|
301
|
+
* - `user_name` 用户名称
|
|
302
|
+
* - `option` 仓库列表选项
|
|
303
|
+
*/
|
|
304
|
+
getUserRepos(option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
305
|
+
/**
|
|
306
|
+
* 获取指定用户仓库列表
|
|
307
|
+
*
|
|
308
|
+
* ## 参数
|
|
309
|
+
* - `user_name` 用户名称
|
|
310
|
+
* - `option` 仓库列表选项
|
|
311
|
+
*/
|
|
312
|
+
getUserReposWithName(userName: string, option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
313
|
+
/**
|
|
314
|
+
* 获取仓库提交信息
|
|
315
|
+
*
|
|
316
|
+
* ## 参数
|
|
317
|
+
* - `owner` 仓库所有者
|
|
318
|
+
* - `repo` 仓库名称
|
|
319
|
+
* - `sha` 提交SHA, 如果不设置则会获取默认分支的最新提交
|
|
320
|
+
*/
|
|
321
|
+
getCommitInfo(owner: string, repo: string, sha?: string | undefined | null): Promise<CommitInfo>
|
|
322
|
+
/**
|
|
323
|
+
* 获取仓库提交列表
|
|
324
|
+
*
|
|
325
|
+
* ## 参数
|
|
326
|
+
* - `owner` 仓库所有者
|
|
327
|
+
* - `repo` 仓库名称
|
|
328
|
+
* - `option` 提交列表选项
|
|
329
|
+
*/
|
|
330
|
+
getCommitInfos(owner: string, repo: string, option?: CommitListOptions | undefined | null): Promise<Array<CommitInfo>>
|
|
331
|
+
/**
|
|
332
|
+
* 添加仓库协作者
|
|
333
|
+
*
|
|
334
|
+
* # 参数
|
|
335
|
+
*
|
|
336
|
+
* * `owner` - 仓库所有者
|
|
337
|
+
* * `repo` - 仓库名称
|
|
338
|
+
* * `user_name` - 协作者用户名
|
|
339
|
+
* * `permission` - 协作者权限, 默认为 `Pull`, 可选值为 `Admin`, `Push`, `Pull`
|
|
340
|
+
*/
|
|
341
|
+
addRepoCollaborator(owner: string, repo: string, userName: string, permission?: CollaboratorPermission | undefined | null): Promise<CollaboratorResult>
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export declare class GithubClient {
|
|
345
|
+
|
|
346
|
+
constructor()
|
|
347
|
+
/**
|
|
348
|
+
* 设置访问令牌
|
|
349
|
+
*
|
|
350
|
+
* ## 参数
|
|
351
|
+
* - `token` 访问令牌
|
|
352
|
+
*/
|
|
353
|
+
setToken(token: string): void
|
|
354
|
+
/**
|
|
355
|
+
* 设置代理
|
|
356
|
+
*
|
|
357
|
+
* ## 参数
|
|
358
|
+
* - `proxy` 代理地址
|
|
359
|
+
*
|
|
360
|
+
* 支持http,https,socks5协议
|
|
361
|
+
*/
|
|
362
|
+
setProxy(proxy: string): void
|
|
363
|
+
/** 获取当前登录用户信息 */
|
|
364
|
+
getUserInfo(): Promise<UserInfo>
|
|
365
|
+
/**
|
|
366
|
+
* 获取指定用户信息
|
|
367
|
+
*
|
|
368
|
+
* ## 参数
|
|
369
|
+
* - `user_name` 用户名称
|
|
370
|
+
*/
|
|
371
|
+
getUserInfoWithName(name: string): Promise<UserInfo>
|
|
372
|
+
/**
|
|
373
|
+
* 获取指定用户贡献信息
|
|
374
|
+
*
|
|
375
|
+
* ## 参数
|
|
376
|
+
* - `user_name` 用户名称
|
|
377
|
+
*/
|
|
378
|
+
getUserContribution(userName: string): Promise<ContributionResult>
|
|
379
|
+
/**
|
|
380
|
+
* 获取组织信息
|
|
381
|
+
*
|
|
382
|
+
* ## 参数
|
|
383
|
+
* - `org_name` 组织名称
|
|
384
|
+
*/
|
|
385
|
+
getOrgInfo(orgName: string): Promise<OrgInfo>
|
|
386
|
+
/**
|
|
387
|
+
* 获取组织仓库列表
|
|
388
|
+
*
|
|
389
|
+
* ## 参数
|
|
390
|
+
* - `org_name` 组织名称
|
|
391
|
+
* - `option` 仓库列表选项
|
|
392
|
+
*/
|
|
393
|
+
getOrgRepos(orgName: string, option?: OrgRepoListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
394
|
+
/** 获取组织头像地址 */
|
|
395
|
+
getOrgAvatarUrl(orgName: string): Promise<string>
|
|
396
|
+
/**
|
|
397
|
+
* 获取指定用户头像地址
|
|
398
|
+
*
|
|
399
|
+
* ## 参数
|
|
400
|
+
* - `user_name` 用户名称
|
|
401
|
+
*/
|
|
402
|
+
getUserAvatarUrl(userName: string): Promise<string>
|
|
403
|
+
/**
|
|
404
|
+
* 获取仓库信息
|
|
405
|
+
*
|
|
406
|
+
* ## 参数
|
|
407
|
+
* - `owner` 仓库所有者
|
|
408
|
+
* - `repo` 仓库名称
|
|
409
|
+
*/
|
|
410
|
+
getRepoInfo(owner: string, repo: string): Promise<RepoInfo>
|
|
411
|
+
/**
|
|
412
|
+
* 获取指定用户仓库列表
|
|
413
|
+
*
|
|
414
|
+
* ## 参数
|
|
415
|
+
* - `user_name` 用户名称
|
|
416
|
+
* - `option` 仓库列表选项
|
|
417
|
+
*/
|
|
418
|
+
getUserRepos(option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
419
|
+
/**
|
|
420
|
+
* 获取指定用户仓库列表
|
|
421
|
+
*
|
|
422
|
+
* ## 参数
|
|
423
|
+
* - `user_name` 用户名称
|
|
424
|
+
* - `option` 仓库列表选项
|
|
425
|
+
*/
|
|
426
|
+
getUserReposWithName(userName: string, option?: ReposListOptions | undefined | null): Promise<Array<RepoInfo>>
|
|
427
|
+
/**
|
|
428
|
+
* 获取仓库提交信息
|
|
429
|
+
*
|
|
430
|
+
* ## 参数
|
|
431
|
+
* - `owner` 仓库所有者
|
|
432
|
+
* - `repo` 仓库名称
|
|
433
|
+
* - `sha` 提交SHA, 如果不设置则会获取默认分支的最新提交
|
|
434
|
+
*/
|
|
435
|
+
getCommitInfo(owner: string, repo: string, sha?: string | undefined | null): Promise<CommitInfo>
|
|
436
|
+
/**
|
|
437
|
+
* 获取仓库提交列表
|
|
438
|
+
*
|
|
439
|
+
* ## 参数
|
|
440
|
+
* - `owner` 仓库所有者
|
|
441
|
+
* - `repo` 仓库名称
|
|
442
|
+
* - `option` 提交列表选项
|
|
443
|
+
*/
|
|
444
|
+
getCommitInfos(owner: string, repo: string, option?: CommitListOptions | undefined | null): Promise<Array<CommitInfo>>
|
|
445
|
+
/**
|
|
446
|
+
* 添加仓库协作者
|
|
447
|
+
*
|
|
448
|
+
* # 参数
|
|
449
|
+
*
|
|
450
|
+
* * `owner` - 仓库所有者
|
|
451
|
+
* * `repo` - 仓库名称
|
|
452
|
+
* * `user_name` - 协作者用户名
|
|
453
|
+
* * `permission` - 协作者权限, 默认为 `Pull`, 可选值为 `Admin`, `Push`, `Pull`
|
|
454
|
+
*/
|
|
455
|
+
addRepoCollaborator(owner: string, repo: string, userName: string, permission?: CollaboratorPermission | undefined | null): Promise<CollaboratorResult>
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export declare const enum CollaboratorPermission {
|
|
459
|
+
/** 管理权限 */
|
|
460
|
+
Admin = 'Admin',
|
|
461
|
+
/** 推送权限 */
|
|
462
|
+
Push = 'Push',
|
|
463
|
+
/** 拉取权限 */
|
|
464
|
+
Pull = 'Pull'
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export interface CollaboratorResult {
|
|
468
|
+
/** 协作者用户名 */
|
|
469
|
+
login: string
|
|
470
|
+
/** 协作者头像URL */
|
|
471
|
+
avatarUrl: string
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export interface CommitData {
|
|
475
|
+
/** 作者信息 */
|
|
476
|
+
author: CommitUserInfo
|
|
477
|
+
/** 提交者信息 */
|
|
478
|
+
committer: CommitUserInfo
|
|
479
|
+
/** 提交信息 */
|
|
480
|
+
message: string
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface CommitInfo {
|
|
484
|
+
/** 提交的SHA */
|
|
485
|
+
sha: string
|
|
486
|
+
/** 提交的数据 */
|
|
487
|
+
commit: CommitData
|
|
488
|
+
/** 提交统计信息 */
|
|
489
|
+
stats: StatsInfo
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export interface CommitListOptions {
|
|
493
|
+
/** 每页数量,默认 30,最大 100 */
|
|
494
|
+
perPage?: number
|
|
495
|
+
/** 页码,默认 1 */
|
|
496
|
+
page?: number
|
|
497
|
+
/** 从此提交开始获取,默认最新提交 */
|
|
498
|
+
sha?: string
|
|
499
|
+
/** 筛选提交作者 */
|
|
500
|
+
author?: string
|
|
501
|
+
/** 筛选从此时间开始 */
|
|
502
|
+
since?: Date
|
|
503
|
+
/** 筛选到此时间结束 */
|
|
504
|
+
until?: Date
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface CommitUserInfo {
|
|
508
|
+
/** 用户名 */
|
|
509
|
+
name: string
|
|
510
|
+
/** 邮箱 */
|
|
511
|
+
email?: string
|
|
512
|
+
/** 头像URL */
|
|
513
|
+
avatarUrl: string
|
|
514
|
+
/** 提交时间 */
|
|
515
|
+
date: Date
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export interface ContributionData {
|
|
519
|
+
/** 日期 */
|
|
520
|
+
date: Date
|
|
521
|
+
/** 当日的贡献次数 */
|
|
522
|
+
count: number
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** 整体贡献统计结果,包含总数与按周组织的贡献数据 */
|
|
526
|
+
export interface ContributionResult {
|
|
527
|
+
/** 总贡献次数 */
|
|
528
|
+
total: number
|
|
529
|
+
/**
|
|
530
|
+
* 二维数组结构的贡献数据
|
|
531
|
+
* 第一维通常表示周数,第二维表示每周的贡献数据
|
|
532
|
+
*/
|
|
533
|
+
contributions: Array<Array<ContributionData>>
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface OrgInfo {
|
|
537
|
+
/** 组织id */
|
|
538
|
+
id: number
|
|
539
|
+
/** 登录名 */
|
|
540
|
+
login: string
|
|
541
|
+
/** 组织名 */
|
|
542
|
+
name?: string
|
|
543
|
+
/** 组织邮箱 */
|
|
544
|
+
email?: string
|
|
545
|
+
/** 组织头像 */
|
|
546
|
+
avatarUrl: string
|
|
547
|
+
/** 组织描述 */
|
|
548
|
+
description?: string
|
|
549
|
+
/** 组织关注数 */
|
|
550
|
+
followCount: number
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export interface OrgRepoListOptions {
|
|
554
|
+
/** 每页数量,默认 30,最大 100 */
|
|
555
|
+
perPage?: number
|
|
556
|
+
/** 页码,默认 1 */
|
|
557
|
+
page?: number
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export interface RepoInfo {
|
|
561
|
+
/** 仓库id */
|
|
562
|
+
id: string
|
|
563
|
+
/** 仓库所有者 */
|
|
564
|
+
owner: string
|
|
565
|
+
/** 仓库名称 */
|
|
566
|
+
name: string
|
|
567
|
+
/** 仓库全名 */
|
|
568
|
+
fullName: string
|
|
569
|
+
/** 仓库描述 */
|
|
570
|
+
description?: string
|
|
571
|
+
/** 仓库可见性, public/private */
|
|
572
|
+
visibility: RepoVisibility
|
|
573
|
+
/** 是否是fork仓库 */
|
|
574
|
+
fork: boolean
|
|
575
|
+
/** 仓库fork数量 */
|
|
576
|
+
forkCount: number
|
|
577
|
+
/** 仓库语言 */
|
|
578
|
+
language?: string
|
|
579
|
+
/** 仓库星标数量 */
|
|
580
|
+
starCount: number
|
|
581
|
+
/** 仓库默认分支 */
|
|
582
|
+
defaultBranch: string
|
|
583
|
+
/** 仓库创建时间 */
|
|
584
|
+
createdAt: Date
|
|
585
|
+
/** 仓库更新时间 */
|
|
586
|
+
updatedAt: Date
|
|
587
|
+
/** 仓库推送时间 */
|
|
588
|
+
pushedAt: Date
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export interface ReposListOptions {
|
|
592
|
+
/** 每页数量,默认 30,最大 100 */
|
|
593
|
+
perPage?: number
|
|
594
|
+
/** 页码,默认 1 */
|
|
595
|
+
page?: number
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export declare const enum RepoVisibility {
|
|
599
|
+
/** 公开 */
|
|
600
|
+
Public = 'Public',
|
|
601
|
+
/** 私有 */
|
|
602
|
+
Private = 'Private'
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export interface StatsInfo {
|
|
606
|
+
/** 总提交行数 */
|
|
607
|
+
total: number
|
|
608
|
+
/** 新增的行数 */
|
|
609
|
+
additions: number
|
|
610
|
+
/** 删除的行数 */
|
|
611
|
+
deletions: number
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export interface UserInfo {
|
|
615
|
+
/** 用户Id */
|
|
616
|
+
id: string
|
|
617
|
+
/** 登录用户名 */
|
|
618
|
+
login: string
|
|
619
|
+
/** 用户昵称 */
|
|
620
|
+
name?: string
|
|
621
|
+
/** 用户邮箱 */
|
|
622
|
+
email?: string
|
|
623
|
+
/** 用户头像URL */
|
|
624
|
+
avatarUrl: string
|
|
625
|
+
/** 关注者数量 */
|
|
626
|
+
followers: number
|
|
627
|
+
/** 关注的用户数量 */
|
|
628
|
+
following: number
|
|
629
|
+
/** 公开仓库数量 */
|
|
630
|
+
publicRepoCount: number
|
|
631
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
import { createRequire } from 'node:module'
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
const __dirname = new URL('.', import.meta.url).pathname
|
|
9
|
+
|
|
10
|
+
const { readFileSync } = require('node:fs')
|
|
11
|
+
let nativeBinding = null
|
|
12
|
+
const loadErrors = []
|
|
13
|
+
|
|
14
|
+
const isMusl = () => {
|
|
15
|
+
let musl = false
|
|
16
|
+
if (process.platform === 'linux') {
|
|
17
|
+
musl = isMuslFromFilesystem()
|
|
18
|
+
if (musl === null) {
|
|
19
|
+
musl = isMuslFromReport()
|
|
20
|
+
}
|
|
21
|
+
if (musl === null) {
|
|
22
|
+
musl = isMuslFromChildProcess()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return musl
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
29
|
+
|
|
30
|
+
const isMuslFromFilesystem = () => {
|
|
31
|
+
try {
|
|
32
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
33
|
+
} catch {
|
|
34
|
+
return null
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const isMuslFromReport = () => {
|
|
39
|
+
let report = null
|
|
40
|
+
if (typeof process.report?.getReport === 'function') {
|
|
41
|
+
process.report.excludeNetwork = true
|
|
42
|
+
report = process.report.getReport()
|
|
43
|
+
}
|
|
44
|
+
if (!report) {
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
51
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const isMuslFromChildProcess = () => {
|
|
59
|
+
try {
|
|
60
|
+
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
|
61
|
+
} catch (e) {
|
|
62
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function requireNative() {
|
|
68
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
69
|
+
try {
|
|
70
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
loadErrors.push(err)
|
|
73
|
+
}
|
|
74
|
+
} else if (process.platform === 'android') {
|
|
75
|
+
if (process.arch === 'arm64') {
|
|
76
|
+
try {
|
|
77
|
+
return require('./nipaw.android-arm64.node')
|
|
78
|
+
} catch (e) {
|
|
79
|
+
loadErrors.push(e)
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const binding = require('@puniyu/nipaw-android-arm64')
|
|
83
|
+
const bindingPackageVersion = require('@puniyu/nipaw-android-arm64/package.json').version
|
|
84
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
|
+
}
|
|
87
|
+
return binding
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadErrors.push(e)
|
|
90
|
+
}
|
|
91
|
+
} else if (process.arch === 'arm') {
|
|
92
|
+
try {
|
|
93
|
+
return require('./nipaw.android-arm-eabi.node')
|
|
94
|
+
} catch (e) {
|
|
95
|
+
loadErrors.push(e)
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const binding = require('@puniyu/nipaw-android-arm-eabi')
|
|
99
|
+
const bindingPackageVersion = require('@puniyu/nipaw-android-arm-eabi/package.json').version
|
|
100
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
|
+
}
|
|
103
|
+
return binding
|
|
104
|
+
} catch (e) {
|
|
105
|
+
loadErrors.push(e)
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
109
|
+
}
|
|
110
|
+
} else if (process.platform === 'win32') {
|
|
111
|
+
if (process.arch === 'x64') {
|
|
112
|
+
try {
|
|
113
|
+
return require('./nipaw.win32-x64-msvc.node')
|
|
114
|
+
} catch (e) {
|
|
115
|
+
loadErrors.push(e)
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const binding = require('@puniyu/nipaw-win32-x64-msvc')
|
|
119
|
+
const bindingPackageVersion = require('@puniyu/nipaw-win32-x64-msvc/package.json').version
|
|
120
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
121
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
122
|
+
}
|
|
123
|
+
return binding
|
|
124
|
+
} catch (e) {
|
|
125
|
+
loadErrors.push(e)
|
|
126
|
+
}
|
|
127
|
+
} else if (process.arch === 'ia32') {
|
|
128
|
+
try {
|
|
129
|
+
return require('./nipaw.win32-ia32-msvc.node')
|
|
130
|
+
} catch (e) {
|
|
131
|
+
loadErrors.push(e)
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const binding = require('@puniyu/nipaw-win32-ia32-msvc')
|
|
135
|
+
const bindingPackageVersion = require('@puniyu/nipaw-win32-ia32-msvc/package.json').version
|
|
136
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
137
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
138
|
+
}
|
|
139
|
+
return binding
|
|
140
|
+
} catch (e) {
|
|
141
|
+
loadErrors.push(e)
|
|
142
|
+
}
|
|
143
|
+
} else if (process.arch === 'arm64') {
|
|
144
|
+
try {
|
|
145
|
+
return require('./nipaw.win32-arm64-msvc.node')
|
|
146
|
+
} catch (e) {
|
|
147
|
+
loadErrors.push(e)
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const binding = require('@puniyu/nipaw-win32-arm64-msvc')
|
|
151
|
+
const bindingPackageVersion = require('@puniyu/nipaw-win32-arm64-msvc/package.json').version
|
|
152
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
153
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
154
|
+
}
|
|
155
|
+
return binding
|
|
156
|
+
} catch (e) {
|
|
157
|
+
loadErrors.push(e)
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
161
|
+
}
|
|
162
|
+
} else if (process.platform === 'darwin') {
|
|
163
|
+
try {
|
|
164
|
+
return require('./nipaw.darwin-universal.node')
|
|
165
|
+
} catch (e) {
|
|
166
|
+
loadErrors.push(e)
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const binding = require('@puniyu/nipaw-darwin-universal')
|
|
170
|
+
const bindingPackageVersion = require('@puniyu/nipaw-darwin-universal/package.json').version
|
|
171
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
172
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
173
|
+
}
|
|
174
|
+
return binding
|
|
175
|
+
} catch (e) {
|
|
176
|
+
loadErrors.push(e)
|
|
177
|
+
}
|
|
178
|
+
if (process.arch === 'x64') {
|
|
179
|
+
try {
|
|
180
|
+
return require('./nipaw.darwin-x64.node')
|
|
181
|
+
} catch (e) {
|
|
182
|
+
loadErrors.push(e)
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const binding = require('@puniyu/nipaw-darwin-x64')
|
|
186
|
+
const bindingPackageVersion = require('@puniyu/nipaw-darwin-x64/package.json').version
|
|
187
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
188
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
189
|
+
}
|
|
190
|
+
return binding
|
|
191
|
+
} catch (e) {
|
|
192
|
+
loadErrors.push(e)
|
|
193
|
+
}
|
|
194
|
+
} else if (process.arch === 'arm64') {
|
|
195
|
+
try {
|
|
196
|
+
return require('./nipaw.darwin-arm64.node')
|
|
197
|
+
} catch (e) {
|
|
198
|
+
loadErrors.push(e)
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
const binding = require('@puniyu/nipaw-darwin-arm64')
|
|
202
|
+
const bindingPackageVersion = require('@puniyu/nipaw-darwin-arm64/package.json').version
|
|
203
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
204
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
205
|
+
}
|
|
206
|
+
return binding
|
|
207
|
+
} catch (e) {
|
|
208
|
+
loadErrors.push(e)
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
212
|
+
}
|
|
213
|
+
} else if (process.platform === 'freebsd') {
|
|
214
|
+
if (process.arch === 'x64') {
|
|
215
|
+
try {
|
|
216
|
+
return require('./nipaw.freebsd-x64.node')
|
|
217
|
+
} catch (e) {
|
|
218
|
+
loadErrors.push(e)
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
const binding = require('@puniyu/nipaw-freebsd-x64')
|
|
222
|
+
const bindingPackageVersion = require('@puniyu/nipaw-freebsd-x64/package.json').version
|
|
223
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
224
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
225
|
+
}
|
|
226
|
+
return binding
|
|
227
|
+
} catch (e) {
|
|
228
|
+
loadErrors.push(e)
|
|
229
|
+
}
|
|
230
|
+
} else if (process.arch === 'arm64') {
|
|
231
|
+
try {
|
|
232
|
+
return require('./nipaw.freebsd-arm64.node')
|
|
233
|
+
} catch (e) {
|
|
234
|
+
loadErrors.push(e)
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
const binding = require('@puniyu/nipaw-freebsd-arm64')
|
|
238
|
+
const bindingPackageVersion = require('@puniyu/nipaw-freebsd-arm64/package.json').version
|
|
239
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
240
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
241
|
+
}
|
|
242
|
+
return binding
|
|
243
|
+
} catch (e) {
|
|
244
|
+
loadErrors.push(e)
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
248
|
+
}
|
|
249
|
+
} else if (process.platform === 'linux') {
|
|
250
|
+
if (process.arch === 'x64') {
|
|
251
|
+
if (isMusl()) {
|
|
252
|
+
try {
|
|
253
|
+
return require('./nipaw.linux-x64-musl.node')
|
|
254
|
+
} catch (e) {
|
|
255
|
+
loadErrors.push(e)
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
const binding = require('@puniyu/nipaw-linux-x64-musl')
|
|
259
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-x64-musl/package.json').version
|
|
260
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
261
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
262
|
+
}
|
|
263
|
+
return binding
|
|
264
|
+
} catch (e) {
|
|
265
|
+
loadErrors.push(e)
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
try {
|
|
269
|
+
return require('./nipaw.linux-x64-gnu.node')
|
|
270
|
+
} catch (e) {
|
|
271
|
+
loadErrors.push(e)
|
|
272
|
+
}
|
|
273
|
+
try {
|
|
274
|
+
const binding = require('@puniyu/nipaw-linux-x64-gnu')
|
|
275
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-x64-gnu/package.json').version
|
|
276
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
277
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
278
|
+
}
|
|
279
|
+
return binding
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} else if (process.arch === 'arm64') {
|
|
285
|
+
if (isMusl()) {
|
|
286
|
+
try {
|
|
287
|
+
return require('./nipaw.linux-arm64-musl.node')
|
|
288
|
+
} catch (e) {
|
|
289
|
+
loadErrors.push(e)
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const binding = require('@puniyu/nipaw-linux-arm64-musl')
|
|
293
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-arm64-musl/package.json').version
|
|
294
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
|
+
}
|
|
297
|
+
return binding
|
|
298
|
+
} catch (e) {
|
|
299
|
+
loadErrors.push(e)
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
try {
|
|
303
|
+
return require('./nipaw.linux-arm64-gnu.node')
|
|
304
|
+
} catch (e) {
|
|
305
|
+
loadErrors.push(e)
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
const binding = require('@puniyu/nipaw-linux-arm64-gnu')
|
|
309
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-arm64-gnu/package.json').version
|
|
310
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
311
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
312
|
+
}
|
|
313
|
+
return binding
|
|
314
|
+
} catch (e) {
|
|
315
|
+
loadErrors.push(e)
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
} else if (process.arch === 'arm') {
|
|
319
|
+
if (isMusl()) {
|
|
320
|
+
try {
|
|
321
|
+
return require('./nipaw.linux-arm-musleabihf.node')
|
|
322
|
+
} catch (e) {
|
|
323
|
+
loadErrors.push(e)
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
const binding = require('@puniyu/nipaw-linux-arm-musleabihf')
|
|
327
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-arm-musleabihf/package.json').version
|
|
328
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
|
+
}
|
|
331
|
+
return binding
|
|
332
|
+
} catch (e) {
|
|
333
|
+
loadErrors.push(e)
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
try {
|
|
337
|
+
return require('./nipaw.linux-arm-gnueabihf.node')
|
|
338
|
+
} catch (e) {
|
|
339
|
+
loadErrors.push(e)
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
const binding = require('@puniyu/nipaw-linux-arm-gnueabihf')
|
|
343
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-arm-gnueabihf/package.json').version
|
|
344
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
345
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
346
|
+
}
|
|
347
|
+
return binding
|
|
348
|
+
} catch (e) {
|
|
349
|
+
loadErrors.push(e)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
} else if (process.arch === 'loong64') {
|
|
353
|
+
if (isMusl()) {
|
|
354
|
+
try {
|
|
355
|
+
return require('./nipaw.linux-loong64-musl.node')
|
|
356
|
+
} catch (e) {
|
|
357
|
+
loadErrors.push(e)
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const binding = require('@puniyu/nipaw-linux-loong64-musl')
|
|
361
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-loong64-musl/package.json').version
|
|
362
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
|
+
}
|
|
365
|
+
return binding
|
|
366
|
+
} catch (e) {
|
|
367
|
+
loadErrors.push(e)
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
try {
|
|
371
|
+
return require('./nipaw.linux-loong64-gnu.node')
|
|
372
|
+
} catch (e) {
|
|
373
|
+
loadErrors.push(e)
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
const binding = require('@puniyu/nipaw-linux-loong64-gnu')
|
|
377
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-loong64-gnu/package.json').version
|
|
378
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
379
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
380
|
+
}
|
|
381
|
+
return binding
|
|
382
|
+
} catch (e) {
|
|
383
|
+
loadErrors.push(e)
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
} else if (process.arch === 'riscv64') {
|
|
387
|
+
if (isMusl()) {
|
|
388
|
+
try {
|
|
389
|
+
return require('./nipaw.linux-riscv64-musl.node')
|
|
390
|
+
} catch (e) {
|
|
391
|
+
loadErrors.push(e)
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
const binding = require('@puniyu/nipaw-linux-riscv64-musl')
|
|
395
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-riscv64-musl/package.json').version
|
|
396
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
|
+
}
|
|
399
|
+
return binding
|
|
400
|
+
} catch (e) {
|
|
401
|
+
loadErrors.push(e)
|
|
402
|
+
}
|
|
403
|
+
} else {
|
|
404
|
+
try {
|
|
405
|
+
return require('./nipaw.linux-riscv64-gnu.node')
|
|
406
|
+
} catch (e) {
|
|
407
|
+
loadErrors.push(e)
|
|
408
|
+
}
|
|
409
|
+
try {
|
|
410
|
+
const binding = require('@puniyu/nipaw-linux-riscv64-gnu')
|
|
411
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-riscv64-gnu/package.json').version
|
|
412
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
413
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
414
|
+
}
|
|
415
|
+
return binding
|
|
416
|
+
} catch (e) {
|
|
417
|
+
loadErrors.push(e)
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
} else if (process.arch === 'ppc64') {
|
|
421
|
+
try {
|
|
422
|
+
return require('./nipaw.linux-ppc64-gnu.node')
|
|
423
|
+
} catch (e) {
|
|
424
|
+
loadErrors.push(e)
|
|
425
|
+
}
|
|
426
|
+
try {
|
|
427
|
+
const binding = require('@puniyu/nipaw-linux-ppc64-gnu')
|
|
428
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-ppc64-gnu/package.json').version
|
|
429
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
431
|
+
}
|
|
432
|
+
return binding
|
|
433
|
+
} catch (e) {
|
|
434
|
+
loadErrors.push(e)
|
|
435
|
+
}
|
|
436
|
+
} else if (process.arch === 's390x') {
|
|
437
|
+
try {
|
|
438
|
+
return require('./nipaw.linux-s390x-gnu.node')
|
|
439
|
+
} catch (e) {
|
|
440
|
+
loadErrors.push(e)
|
|
441
|
+
}
|
|
442
|
+
try {
|
|
443
|
+
const binding = require('@puniyu/nipaw-linux-s390x-gnu')
|
|
444
|
+
const bindingPackageVersion = require('@puniyu/nipaw-linux-s390x-gnu/package.json').version
|
|
445
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
446
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
447
|
+
}
|
|
448
|
+
return binding
|
|
449
|
+
} catch (e) {
|
|
450
|
+
loadErrors.push(e)
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
454
|
+
}
|
|
455
|
+
} else if (process.platform === 'openharmony') {
|
|
456
|
+
if (process.arch === 'arm64') {
|
|
457
|
+
try {
|
|
458
|
+
return require('./nipaw.openharmony-arm64.node')
|
|
459
|
+
} catch (e) {
|
|
460
|
+
loadErrors.push(e)
|
|
461
|
+
}
|
|
462
|
+
try {
|
|
463
|
+
const binding = require('@puniyu/nipaw-openharmony-arm64')
|
|
464
|
+
const bindingPackageVersion = require('@puniyu/nipaw-openharmony-arm64/package.json').version
|
|
465
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
466
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
467
|
+
}
|
|
468
|
+
return binding
|
|
469
|
+
} catch (e) {
|
|
470
|
+
loadErrors.push(e)
|
|
471
|
+
}
|
|
472
|
+
} else if (process.arch === 'x64') {
|
|
473
|
+
try {
|
|
474
|
+
return require('./nipaw.openharmony-x64.node')
|
|
475
|
+
} catch (e) {
|
|
476
|
+
loadErrors.push(e)
|
|
477
|
+
}
|
|
478
|
+
try {
|
|
479
|
+
const binding = require('@puniyu/nipaw-openharmony-x64')
|
|
480
|
+
const bindingPackageVersion = require('@puniyu/nipaw-openharmony-x64/package.json').version
|
|
481
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
482
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
483
|
+
}
|
|
484
|
+
return binding
|
|
485
|
+
} catch (e) {
|
|
486
|
+
loadErrors.push(e)
|
|
487
|
+
}
|
|
488
|
+
} else if (process.arch === 'arm') {
|
|
489
|
+
try {
|
|
490
|
+
return require('./nipaw.openharmony-arm.node')
|
|
491
|
+
} catch (e) {
|
|
492
|
+
loadErrors.push(e)
|
|
493
|
+
}
|
|
494
|
+
try {
|
|
495
|
+
const binding = require('@puniyu/nipaw-openharmony-arm')
|
|
496
|
+
const bindingPackageVersion = require('@puniyu/nipaw-openharmony-arm/package.json').version
|
|
497
|
+
if (bindingPackageVersion !== '1.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
498
|
+
throw new Error(`Native binding package version mismatch, expected 1.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
499
|
+
}
|
|
500
|
+
return binding
|
|
501
|
+
} catch (e) {
|
|
502
|
+
loadErrors.push(e)
|
|
503
|
+
}
|
|
504
|
+
} else {
|
|
505
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
nativeBinding = requireNative()
|
|
513
|
+
|
|
514
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
515
|
+
let wasiBinding = null
|
|
516
|
+
let wasiBindingError = null
|
|
517
|
+
try {
|
|
518
|
+
wasiBinding = require('./nipaw.wasi.cjs')
|
|
519
|
+
nativeBinding = wasiBinding
|
|
520
|
+
} catch (err) {
|
|
521
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
522
|
+
wasiBindingError = err
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (!nativeBinding) {
|
|
526
|
+
try {
|
|
527
|
+
wasiBinding = require('@puniyu/nipaw-wasm32-wasi')
|
|
528
|
+
nativeBinding = wasiBinding
|
|
529
|
+
} catch (err) {
|
|
530
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
531
|
+
wasiBindingError.cause = err
|
|
532
|
+
loadErrors.push(err)
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
537
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
538
|
+
error.cause = wasiBindingError
|
|
539
|
+
throw error
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (!nativeBinding) {
|
|
544
|
+
if (loadErrors.length > 0) {
|
|
545
|
+
throw new Error(
|
|
546
|
+
`Cannot find native binding. ` +
|
|
547
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
548
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
549
|
+
{
|
|
550
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
551
|
+
cur.cause = err
|
|
552
|
+
return cur
|
|
553
|
+
}),
|
|
554
|
+
},
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
throw new Error(`Failed to load native binding`)
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
const { CnbClient, GitCodeClient, GiteeClient, GithubClient, CollaboratorPermission, RepoVisibility } = nativeBinding
|
|
561
|
+
export { CnbClient }
|
|
562
|
+
export { GitCodeClient }
|
|
563
|
+
export { GiteeClient }
|
|
564
|
+
export { GithubClient }
|
|
565
|
+
export { CollaboratorPermission }
|
|
566
|
+
export { RepoVisibility }
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@puniyu/nipaw",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "一个git平台封装库",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"author": "Puniyu",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/puniyu/nipaw.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "LGPL-3.0-or-later",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"napi-rs",
|
|
16
|
+
"NAPI",
|
|
17
|
+
"N-API",
|
|
18
|
+
"Rust",
|
|
19
|
+
"node-addon",
|
|
20
|
+
"node-addon-api"
|
|
21
|
+
],
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"napi": {
|
|
26
|
+
"binaryName": "nipaw",
|
|
27
|
+
"targets": [
|
|
28
|
+
"x86_64-pc-windows-msvc",
|
|
29
|
+
"x86_64-apple-darwin",
|
|
30
|
+
"x86_64-unknown-linux-gnu",
|
|
31
|
+
"aarch64-unknown-linux-gnu",
|
|
32
|
+
"aarch64-apple-darwin"
|
|
33
|
+
],
|
|
34
|
+
"dtsHeader": "// powered by nipaw_core\n"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">= 12.22.0 < 13 || >= 14.17.0 < 15 || >= 15.12.0 < 16 || >= 16.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@napi-rs/cli": "^3.2.0"
|
|
41
|
+
},
|
|
42
|
+
"optionalDependencies": {
|
|
43
|
+
"@puniyu/nipaw-win32-x64-msvc": "1.5.0",
|
|
44
|
+
"@puniyu/nipaw-darwin-x64": "1.5.0",
|
|
45
|
+
"@puniyu/nipaw-linux-x64-gnu": "1.5.0",
|
|
46
|
+
"@puniyu/nipaw-linux-arm64-gnu": "1.5.0",
|
|
47
|
+
"@puniyu/nipaw-darwin-arm64": "1.5.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"artifacts": "napi artifacts",
|
|
51
|
+
"build": "napi build --platform --release -p nipaw_node --esm -o dist",
|
|
52
|
+
"create-npm-dirs": "napi create-npm-dirs"
|
|
53
|
+
}
|
|
54
|
+
}
|