backlog-exporter 0.6.0 → 0.7.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/README.md +91 -184
- package/oclif.manifest.json +2 -366
- package/package.json +4 -1
- package/dist/commands/all/index.d.ts +0 -13
- package/dist/commands/all/index.js +0 -140
- package/dist/commands/document/index.d.ts +0 -13
- package/dist/commands/document/index.js +0 -84
- package/dist/commands/issue/index.d.ts +0 -14
- package/dist/commands/issue/index.js +0 -93
- package/dist/commands/update/index.d.ts +0 -25
- package/dist/commands/update/index.js +0 -320
- package/dist/commands/wiki/index.d.ts +0 -12
- package/dist/commands/wiki/index.js +0 -71
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/utils/backlog-api.d.ts +0 -70
- package/dist/utils/backlog-api.js +0 -435
- package/dist/utils/backlog.d.ts +0 -16
- package/dist/utils/backlog.js +0 -34
- package/dist/utils/common.d.ts +0 -25
- package/dist/utils/common.js +0 -54
- package/dist/utils/log.d.ts +0 -6
- package/dist/utils/log.js +0 -18
- package/dist/utils/settings.d.ts +0 -43
- package/dist/utils/settings.js +0 -63
- package/dist/utils/sleep.d.ts +0 -28
- package/dist/utils/sleep.js +0 -42
package/dist/utils/settings.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* フォルダタイプの定義
|
|
5
|
-
*/
|
|
6
|
-
export var FolderType;
|
|
7
|
-
(function (FolderType) {
|
|
8
|
-
FolderType["DOCUMENT"] = "document";
|
|
9
|
-
FolderType["ISSUE"] = "issue";
|
|
10
|
-
FolderType["WIKI"] = "wiki";
|
|
11
|
-
})(FolderType || (FolderType = {}));
|
|
12
|
-
/**
|
|
13
|
-
* 設定ファイルのパスを取得する
|
|
14
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
15
|
-
* @returns 設定ファイルのパス
|
|
16
|
-
*/
|
|
17
|
-
export function getSettingsFilePath(directory) {
|
|
18
|
-
return join(directory, 'backlog-settings.json');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 設定ファイルを読み込む
|
|
22
|
-
* @param directory 設定ファイルが保存されているディレクトリ
|
|
23
|
-
* @returns 設定情報
|
|
24
|
-
*/
|
|
25
|
-
export async function loadSettings(directory) {
|
|
26
|
-
const settingsPath = getSettingsFilePath(directory);
|
|
27
|
-
try {
|
|
28
|
-
const data = await fs.readFile(settingsPath, 'utf8');
|
|
29
|
-
return JSON.parse(data);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// ファイルが存在しない場合や読み込みエラーの場合は空のオブジェクトを返す
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 設定ファイルを保存する
|
|
38
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
39
|
-
* @param settings 保存する設定情報
|
|
40
|
-
*/
|
|
41
|
-
export async function saveSettings(directory, settings) {
|
|
42
|
-
const settingsPath = getSettingsFilePath(directory);
|
|
43
|
-
// ディレクトリが存在しない場合は作成
|
|
44
|
-
await fs.mkdir(directory, { recursive: true });
|
|
45
|
-
// 設定ファイルを保存
|
|
46
|
-
await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 設定ファイルを更新する
|
|
50
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
51
|
-
* @param newSettings 更新する設定情報
|
|
52
|
-
*/
|
|
53
|
-
export async function updateSettings(directory, newSettings) {
|
|
54
|
-
// 既存の設定を読み込む
|
|
55
|
-
const currentSettings = await loadSettings(directory);
|
|
56
|
-
// 新しい設定で更新(apiKeyは除外)
|
|
57
|
-
const { apiKey, ...settingsToSave } = newSettings;
|
|
58
|
-
const updatedSettings = { ...currentSettings, ...settingsToSave };
|
|
59
|
-
// 更新した設定を保存
|
|
60
|
-
await saveSettings(directory, updatedSettings);
|
|
61
|
-
// apiKeyは戻り値には含める
|
|
62
|
-
return { ...updatedSettings, apiKey };
|
|
63
|
-
}
|
package/dist/utils/sleep.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
/**
|
|
3
|
-
* 指定したミリ秒だけ待機する
|
|
4
|
-
* @param ms 待機時間(ミリ秒)
|
|
5
|
-
*/
|
|
6
|
-
export declare const sleep: (ms: number) => Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* APIリクエストのレート制限対策のためのユーティリティ
|
|
9
|
-
* 100リクエストごとに15秒間待機する
|
|
10
|
-
*/
|
|
11
|
-
export declare class RateLimiter {
|
|
12
|
-
private readonly command;
|
|
13
|
-
private requestCount;
|
|
14
|
-
constructor(command: Command);
|
|
15
|
-
/**
|
|
16
|
-
* 現在のリクエスト数を取得する
|
|
17
|
-
*/
|
|
18
|
-
getCount(): number;
|
|
19
|
-
/**
|
|
20
|
-
* APIリクエストをカウントし、必要に応じて待機する
|
|
21
|
-
* @returns 現在のリクエスト数
|
|
22
|
-
*/
|
|
23
|
-
increment(): Promise<number>;
|
|
24
|
-
/**
|
|
25
|
-
* リクエスト数を設定する
|
|
26
|
-
*/
|
|
27
|
-
setCount(count: number): void;
|
|
28
|
-
}
|
package/dist/utils/sleep.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 指定したミリ秒だけ待機する
|
|
3
|
-
* @param ms 待機時間(ミリ秒)
|
|
4
|
-
*/
|
|
5
|
-
export const sleep = (ms) => new Promise((resolve) => {
|
|
6
|
-
setTimeout(resolve, ms);
|
|
7
|
-
});
|
|
8
|
-
/**
|
|
9
|
-
* APIリクエストのレート制限対策のためのユーティリティ
|
|
10
|
-
* 100リクエストごとに15秒間待機する
|
|
11
|
-
*/
|
|
12
|
-
export class RateLimiter {
|
|
13
|
-
command;
|
|
14
|
-
requestCount = 0;
|
|
15
|
-
constructor(command) {
|
|
16
|
-
this.command = command;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 現在のリクエスト数を取得する
|
|
20
|
-
*/
|
|
21
|
-
getCount() {
|
|
22
|
-
return this.requestCount;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* APIリクエストをカウントし、必要に応じて待機する
|
|
26
|
-
* @returns 現在のリクエスト数
|
|
27
|
-
*/
|
|
28
|
-
async increment() {
|
|
29
|
-
this.requestCount++;
|
|
30
|
-
if (this.requestCount > 1 && this.requestCount % 100 === 0) {
|
|
31
|
-
this.command.log('レート制限を回避するため15秒間待機します...');
|
|
32
|
-
await sleep(15_000);
|
|
33
|
-
}
|
|
34
|
-
return this.requestCount;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* リクエスト数を設定する
|
|
38
|
-
*/
|
|
39
|
-
setCount(count) {
|
|
40
|
-
this.requestCount = count;
|
|
41
|
-
}
|
|
42
|
-
}
|