atl-fetch 1.0.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/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/cli/cli.d.ts +61 -0
- package/dist/cli/cli.js +131 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +4 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +13 -0
- package/dist/ports/file/file-port.d.ts +89 -0
- package/dist/ports/file/file-port.js +155 -0
- package/dist/ports/file/index.d.ts +1 -0
- package/dist/ports/file/index.js +1 -0
- package/dist/ports/http/http-port.d.ts +107 -0
- package/dist/ports/http/http-port.js +238 -0
- package/dist/ports/http/index.d.ts +1 -0
- package/dist/ports/http/index.js +1 -0
- package/dist/services/auth/auth-service.d.ts +79 -0
- package/dist/services/auth/auth-service.js +158 -0
- package/dist/services/auth/index.d.ts +1 -0
- package/dist/services/auth/index.js +1 -0
- package/dist/services/confluence/confluence-service.d.ts +152 -0
- package/dist/services/confluence/confluence-service.js +510 -0
- package/dist/services/confluence/index.d.ts +1 -0
- package/dist/services/confluence/index.js +1 -0
- package/dist/services/diff/diff-service.d.ts +84 -0
- package/dist/services/diff/diff-service.js +881 -0
- package/dist/services/diff/index.d.ts +1 -0
- package/dist/services/diff/index.js +1 -0
- package/dist/services/fetch/fetch-service.d.ts +112 -0
- package/dist/services/fetch/fetch-service.js +302 -0
- package/dist/services/fetch/index.d.ts +1 -0
- package/dist/services/fetch/index.js +1 -0
- package/dist/services/jira/index.d.ts +1 -0
- package/dist/services/jira/index.js +1 -0
- package/dist/services/jira/jira-service.d.ts +100 -0
- package/dist/services/jira/jira-service.js +354 -0
- package/dist/services/output/index.d.ts +4 -0
- package/dist/services/output/index.js +4 -0
- package/dist/services/output/output-service.d.ts +67 -0
- package/dist/services/output/output-service.js +228 -0
- package/dist/services/storage/index.d.ts +6 -0
- package/dist/services/storage/index.js +6 -0
- package/dist/services/storage/storage-service.d.ts +77 -0
- package/dist/services/storage/storage-service.js +738 -0
- package/dist/services/text-converter/index.d.ts +1 -0
- package/dist/services/text-converter/index.js +1 -0
- package/dist/services/text-converter/text-converter.d.ts +35 -0
- package/dist/services/text-converter/text-converter.js +681 -0
- package/dist/services/url-parser/index.d.ts +1 -0
- package/dist/services/url-parser/index.js +1 -0
- package/dist/services/url-parser/url-parser.d.ts +43 -0
- package/dist/services/url-parser/url-parser.js +283 -0
- package/dist/types/auth.d.ts +25 -0
- package/dist/types/auth.js +1 -0
- package/dist/types/confluence.d.ts +68 -0
- package/dist/types/confluence.js +1 -0
- package/dist/types/diff.d.ts +77 -0
- package/dist/types/diff.js +7 -0
- package/dist/types/fetch.d.ts +65 -0
- package/dist/types/fetch.js +1 -0
- package/dist/types/file.d.ts +22 -0
- package/dist/types/file.js +1 -0
- package/dist/types/http.d.ts +45 -0
- package/dist/types/http.js +1 -0
- package/dist/types/jira.d.ts +90 -0
- package/dist/types/jira.js +1 -0
- package/dist/types/output.d.ts +55 -0
- package/dist/types/output.js +7 -0
- package/dist/types/result.d.ts +104 -0
- package/dist/types/result.js +119 -0
- package/dist/types/storage.d.ts +209 -0
- package/dist/types/storage.js +6 -0
- package/dist/types/url-parser.d.ts +46 -0
- package/dist/types/url-parser.js +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jira Issue のコメントの型
|
|
3
|
+
*/
|
|
4
|
+
export interface JiraComment {
|
|
5
|
+
/** コメント ID */
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/** 作成者の表示名 */
|
|
8
|
+
readonly author: string;
|
|
9
|
+
/** コメント本文 */
|
|
10
|
+
readonly body: string;
|
|
11
|
+
/** 作成日時(ISO 8601 形式) */
|
|
12
|
+
readonly created: string;
|
|
13
|
+
/** 更新日時(ISO 8601 形式) */
|
|
14
|
+
readonly updated: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Jira Issue の変更履歴アイテムの型
|
|
18
|
+
*/
|
|
19
|
+
export interface JiraChangelogItem {
|
|
20
|
+
/** 変更されたフィールド名 */
|
|
21
|
+
readonly field: string;
|
|
22
|
+
/** 変更前の値(null の場合は新規追加) */
|
|
23
|
+
readonly fromString: string | null;
|
|
24
|
+
/** 変更後の値(null の場合は削除) */
|
|
25
|
+
readonly toString: string | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Jira Issue の変更履歴エントリの型
|
|
29
|
+
*/
|
|
30
|
+
export interface JiraChangelogEntry {
|
|
31
|
+
/** 変更履歴 ID */
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** 変更者の表示名 */
|
|
34
|
+
readonly author: string;
|
|
35
|
+
/** 変更日時(ISO 8601 形式) */
|
|
36
|
+
readonly created: string;
|
|
37
|
+
/** 変更アイテムのリスト */
|
|
38
|
+
readonly items: readonly JiraChangelogItem[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Jira Issue の添付ファイルの型
|
|
42
|
+
*/
|
|
43
|
+
export interface JiraAttachment {
|
|
44
|
+
/** 添付ファイル ID */
|
|
45
|
+
readonly id: string;
|
|
46
|
+
/** ファイル名 */
|
|
47
|
+
readonly filename: string;
|
|
48
|
+
/** MIME タイプ */
|
|
49
|
+
readonly mimeType: string;
|
|
50
|
+
/** ファイルサイズ(バイト) */
|
|
51
|
+
readonly size: number;
|
|
52
|
+
/** コンテンツダウンロード URL */
|
|
53
|
+
readonly contentUrl: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Jira Issue の型
|
|
57
|
+
*/
|
|
58
|
+
export interface JiraIssue {
|
|
59
|
+
/** Issue キー(例: PROJECT-123) */
|
|
60
|
+
readonly key: string;
|
|
61
|
+
/** Issue タイトル(要約) */
|
|
62
|
+
readonly summary: string;
|
|
63
|
+
/** Issue 説明(null の場合は説明なし) */
|
|
64
|
+
readonly description: string | null;
|
|
65
|
+
/** コメント一覧 */
|
|
66
|
+
readonly comments: readonly JiraComment[];
|
|
67
|
+
/** 変更履歴一覧 */
|
|
68
|
+
readonly changelog: readonly JiraChangelogEntry[];
|
|
69
|
+
/** 添付ファイル一覧 */
|
|
70
|
+
readonly attachments: readonly JiraAttachment[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Jira サービスのエラーの型
|
|
74
|
+
*/
|
|
75
|
+
export type JiraError = {
|
|
76
|
+
kind: 'NOT_FOUND';
|
|
77
|
+
message: string;
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'FORBIDDEN';
|
|
80
|
+
message: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: 'AUTH_FAILED';
|
|
83
|
+
message: string;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'NETWORK_ERROR';
|
|
86
|
+
message: string;
|
|
87
|
+
} | {
|
|
88
|
+
kind: 'PARSE_ERROR';
|
|
89
|
+
message: string;
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 出力サービスに関する型定義
|
|
3
|
+
*
|
|
4
|
+
* OutputService で使用する型を定義する。
|
|
5
|
+
* JSON / Markdown / YAML 形式での出力に対応。
|
|
6
|
+
*/
|
|
7
|
+
import type { Result } from 'neverthrow';
|
|
8
|
+
/**
|
|
9
|
+
* 出力形式
|
|
10
|
+
*/
|
|
11
|
+
export type OutputFormat = 'json' | 'markdown' | 'yaml';
|
|
12
|
+
/**
|
|
13
|
+
* 出力オプション
|
|
14
|
+
*
|
|
15
|
+
* 出力時の設定を指定する。
|
|
16
|
+
*/
|
|
17
|
+
export interface OutputOptions {
|
|
18
|
+
/** 出力形式 */
|
|
19
|
+
readonly format: OutputFormat;
|
|
20
|
+
/** 出力先ファイルパス(指定時はファイル出力、未指定時は標準出力) */
|
|
21
|
+
readonly outputPath?: string;
|
|
22
|
+
/** カラー出力を有効にするか */
|
|
23
|
+
readonly colorEnabled: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 出力サービスのエラーの型
|
|
27
|
+
*/
|
|
28
|
+
export type OutputError = {
|
|
29
|
+
kind: 'WRITE_FAILED';
|
|
30
|
+
message: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'INVALID_FORMAT';
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 出力サービスのインターフェース
|
|
37
|
+
*/
|
|
38
|
+
export interface OutputServiceInterface {
|
|
39
|
+
/**
|
|
40
|
+
* Jira Issue を指定形式でフォーマットする
|
|
41
|
+
*
|
|
42
|
+
* @param issue Jira Issue
|
|
43
|
+
* @param options 出力オプション
|
|
44
|
+
* @returns フォーマット済み文字列
|
|
45
|
+
*/
|
|
46
|
+
formatJiraIssue(issue: import('./jira.js').JiraIssue, options: Pick<OutputOptions, 'format'>): Result<string, OutputError>;
|
|
47
|
+
/**
|
|
48
|
+
* Confluence ページを指定形式でフォーマットする
|
|
49
|
+
*
|
|
50
|
+
* @param page Confluence ページ
|
|
51
|
+
* @param options 出力オプション
|
|
52
|
+
* @returns フォーマット済み文字列
|
|
53
|
+
*/
|
|
54
|
+
formatConfluencePage(page: import('./confluence.js').ConfluencePage, options: Pick<OutputOptions, 'format'>): Result<string, OutputError>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result 型 - 成功または失敗を表現する discriminated union
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* function divide(a: number, b: number): Result<number, DivisionError> {
|
|
7
|
+
* if (b === 0) {
|
|
8
|
+
* return err({ kind: 'DIVISION_BY_ZERO', message: 'Cannot divide by zero' });
|
|
9
|
+
* }
|
|
10
|
+
* return ok(a / b);
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* 成功を表す型
|
|
16
|
+
*/
|
|
17
|
+
export interface Ok<T> {
|
|
18
|
+
readonly success: true;
|
|
19
|
+
readonly value: T;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 失敗を表す型
|
|
23
|
+
*/
|
|
24
|
+
export interface Err<E> {
|
|
25
|
+
readonly success: false;
|
|
26
|
+
readonly error: E;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Result 型 - 成功(Ok)または失敗(Err)のどちらかを表す
|
|
30
|
+
*/
|
|
31
|
+
export type Result<T, E> = Ok<T> | Err<E>;
|
|
32
|
+
/**
|
|
33
|
+
* 成功 Result を作成する
|
|
34
|
+
*
|
|
35
|
+
* @param value - 成功値
|
|
36
|
+
* @returns 成功 Result
|
|
37
|
+
*/
|
|
38
|
+
export declare function ok<T>(value: T): Ok<T>;
|
|
39
|
+
/**
|
|
40
|
+
* 失敗 Result を作成する
|
|
41
|
+
*
|
|
42
|
+
* @param error - エラー値
|
|
43
|
+
* @returns 失敗 Result
|
|
44
|
+
*/
|
|
45
|
+
export declare function err<E>(error: E): Err<E>;
|
|
46
|
+
/**
|
|
47
|
+
* Result が成功かどうかを判定する型ガード
|
|
48
|
+
*
|
|
49
|
+
* @param result - 判定対象の Result
|
|
50
|
+
* @returns 成功の場合 true
|
|
51
|
+
*/
|
|
52
|
+
export declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Result が失敗かどうかを判定する型ガード
|
|
55
|
+
*
|
|
56
|
+
* @param result - 判定対象の Result
|
|
57
|
+
* @returns 失敗の場合 true
|
|
58
|
+
*/
|
|
59
|
+
export declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
|
|
60
|
+
/**
|
|
61
|
+
* 成功 Result から値を取り出す
|
|
62
|
+
* 失敗 Result の場合はエラーをスローする
|
|
63
|
+
*
|
|
64
|
+
* @param result - 対象の Result
|
|
65
|
+
* @returns 成功値
|
|
66
|
+
* @throws 失敗 Result の場合
|
|
67
|
+
*/
|
|
68
|
+
export declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
69
|
+
/**
|
|
70
|
+
* 失敗 Result からエラー値を取り出す
|
|
71
|
+
* 成功 Result の場合はエラーをスローする
|
|
72
|
+
*
|
|
73
|
+
* @param result - 対象の Result
|
|
74
|
+
* @returns エラー値
|
|
75
|
+
* @throws 成功 Result の場合
|
|
76
|
+
*/
|
|
77
|
+
export declare function unwrapErr<T, E>(result: Result<T, E>): E;
|
|
78
|
+
/**
|
|
79
|
+
* 成功 Result から値を取り出す
|
|
80
|
+
* 失敗 Result の場合はデフォルト値を返す
|
|
81
|
+
*
|
|
82
|
+
* @param result - 対象の Result
|
|
83
|
+
* @param defaultValue - 失敗時のデフォルト値
|
|
84
|
+
* @returns 成功値またはデフォルト値
|
|
85
|
+
*/
|
|
86
|
+
export declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
|
|
87
|
+
/**
|
|
88
|
+
* 成功 Result の値を変換する
|
|
89
|
+
* 失敗 Result の場合はそのまま返す
|
|
90
|
+
*
|
|
91
|
+
* @param result - 対象の Result
|
|
92
|
+
* @param fn - 変換関数
|
|
93
|
+
* @returns 変換された Result
|
|
94
|
+
*/
|
|
95
|
+
export declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
96
|
+
/**
|
|
97
|
+
* 失敗 Result のエラー値を変換する
|
|
98
|
+
* 成功 Result の場合はそのまま返す
|
|
99
|
+
*
|
|
100
|
+
* @param result - 対象の Result
|
|
101
|
+
* @param fn - 変換関数
|
|
102
|
+
* @returns 変換された Result
|
|
103
|
+
*/
|
|
104
|
+
export declare function mapErr<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result 型 - 成功または失敗を表現する discriminated union
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* function divide(a: number, b: number): Result<number, DivisionError> {
|
|
7
|
+
* if (b === 0) {
|
|
8
|
+
* return err({ kind: 'DIVISION_BY_ZERO', message: 'Cannot divide by zero' });
|
|
9
|
+
* }
|
|
10
|
+
* return ok(a / b);
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* 成功 Result を作成する
|
|
16
|
+
*
|
|
17
|
+
* @param value - 成功値
|
|
18
|
+
* @returns 成功 Result
|
|
19
|
+
*/
|
|
20
|
+
export function ok(value) {
|
|
21
|
+
return { success: true, value };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 失敗 Result を作成する
|
|
25
|
+
*
|
|
26
|
+
* @param error - エラー値
|
|
27
|
+
* @returns 失敗 Result
|
|
28
|
+
*/
|
|
29
|
+
export function err(error) {
|
|
30
|
+
return { error, success: false };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result が成功かどうかを判定する型ガード
|
|
34
|
+
*
|
|
35
|
+
* @param result - 判定対象の Result
|
|
36
|
+
* @returns 成功の場合 true
|
|
37
|
+
*/
|
|
38
|
+
export function isOk(result) {
|
|
39
|
+
return result.success;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Result が失敗かどうかを判定する型ガード
|
|
43
|
+
*
|
|
44
|
+
* @param result - 判定対象の Result
|
|
45
|
+
* @returns 失敗の場合 true
|
|
46
|
+
*/
|
|
47
|
+
export function isErr(result) {
|
|
48
|
+
return !result.success;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 成功 Result から値を取り出す
|
|
52
|
+
* 失敗 Result の場合はエラーをスローする
|
|
53
|
+
*
|
|
54
|
+
* @param result - 対象の Result
|
|
55
|
+
* @returns 成功値
|
|
56
|
+
* @throws 失敗 Result の場合
|
|
57
|
+
*/
|
|
58
|
+
export function unwrap(result) {
|
|
59
|
+
if (isOk(result)) {
|
|
60
|
+
return result.value;
|
|
61
|
+
}
|
|
62
|
+
throw new Error(`Attempted to unwrap an Err value: ${String(result.error)}`);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 失敗 Result からエラー値を取り出す
|
|
66
|
+
* 成功 Result の場合はエラーをスローする
|
|
67
|
+
*
|
|
68
|
+
* @param result - 対象の Result
|
|
69
|
+
* @returns エラー値
|
|
70
|
+
* @throws 成功 Result の場合
|
|
71
|
+
*/
|
|
72
|
+
export function unwrapErr(result) {
|
|
73
|
+
if (isErr(result)) {
|
|
74
|
+
return result.error;
|
|
75
|
+
}
|
|
76
|
+
throw new Error('Attempted to unwrapErr an Ok value');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 成功 Result から値を取り出す
|
|
80
|
+
* 失敗 Result の場合はデフォルト値を返す
|
|
81
|
+
*
|
|
82
|
+
* @param result - 対象の Result
|
|
83
|
+
* @param defaultValue - 失敗時のデフォルト値
|
|
84
|
+
* @returns 成功値またはデフォルト値
|
|
85
|
+
*/
|
|
86
|
+
export function unwrapOr(result, defaultValue) {
|
|
87
|
+
if (isOk(result)) {
|
|
88
|
+
return result.value;
|
|
89
|
+
}
|
|
90
|
+
return defaultValue;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 成功 Result の値を変換する
|
|
94
|
+
* 失敗 Result の場合はそのまま返す
|
|
95
|
+
*
|
|
96
|
+
* @param result - 対象の Result
|
|
97
|
+
* @param fn - 変換関数
|
|
98
|
+
* @returns 変換された Result
|
|
99
|
+
*/
|
|
100
|
+
export function mapResult(result, fn) {
|
|
101
|
+
if (isOk(result)) {
|
|
102
|
+
return ok(fn(result.value));
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 失敗 Result のエラー値を変換する
|
|
108
|
+
* 成功 Result の場合はそのまま返す
|
|
109
|
+
*
|
|
110
|
+
* @param result - 対象の Result
|
|
111
|
+
* @param fn - 変換関数
|
|
112
|
+
* @returns 変換された Result
|
|
113
|
+
*/
|
|
114
|
+
export function mapErr(result, fn) {
|
|
115
|
+
if (isErr(result)) {
|
|
116
|
+
return err(fn(result.error));
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ストレージサービスに関する型定義
|
|
3
|
+
*
|
|
4
|
+
* Jira Issue / Confluence ページをディレクトリ構造で保存するための型を定義する。
|
|
5
|
+
*/
|
|
6
|
+
import type { Result } from 'neverthrow';
|
|
7
|
+
import type { ConfluenceAttachment, ConfluenceVersion } from './confluence.js';
|
|
8
|
+
import type { DiffHunk, DiffStats } from './diff.js';
|
|
9
|
+
import type { JiraAttachment, JiraChangelogEntry, JiraComment } from './jira.js';
|
|
10
|
+
/**
|
|
11
|
+
* Manifest のリソースタイプ
|
|
12
|
+
*/
|
|
13
|
+
export type ManifestResourceType = 'jiraIssue' | 'confluencePage';
|
|
14
|
+
/**
|
|
15
|
+
* Manifest の問題レベル
|
|
16
|
+
*/
|
|
17
|
+
export type ManifestIssueLevel = 'error' | 'warning';
|
|
18
|
+
/**
|
|
19
|
+
* Manifest の問題
|
|
20
|
+
*/
|
|
21
|
+
export interface ManifestIssue {
|
|
22
|
+
/** 問題レベル */
|
|
23
|
+
readonly level: ManifestIssueLevel;
|
|
24
|
+
/** エラーコード */
|
|
25
|
+
readonly code: string;
|
|
26
|
+
/** エラーメッセージ */
|
|
27
|
+
readonly message: string;
|
|
28
|
+
/** 追加コンテキスト */
|
|
29
|
+
readonly context?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 添付ファイルダウンロード結果のステータス
|
|
33
|
+
*/
|
|
34
|
+
export type AttachmentResultStatus = 'success' | 'failed' | 'skipped';
|
|
35
|
+
/**
|
|
36
|
+
* 添付ファイルダウンロード結果
|
|
37
|
+
*/
|
|
38
|
+
export interface AttachmentResult {
|
|
39
|
+
/** 添付ファイル ID */
|
|
40
|
+
readonly id: string;
|
|
41
|
+
/** ファイル名 */
|
|
42
|
+
readonly filename: string;
|
|
43
|
+
/** MIME タイプ */
|
|
44
|
+
readonly mimeType: string;
|
|
45
|
+
/** ファイルサイズ(バイト) */
|
|
46
|
+
readonly size: number;
|
|
47
|
+
/** ダウンロード結果ステータス */
|
|
48
|
+
readonly status: AttachmentResultStatus;
|
|
49
|
+
/** 保存先パス(成功時のみ) */
|
|
50
|
+
readonly savedPath?: string;
|
|
51
|
+
/** エラーメッセージ(失敗時のみ) */
|
|
52
|
+
readonly error?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Manifest(取得メタデータ)
|
|
56
|
+
*/
|
|
57
|
+
export interface Manifest {
|
|
58
|
+
/** 取得対象の種別 */
|
|
59
|
+
readonly resourceType: ManifestResourceType;
|
|
60
|
+
/** 入力URL(正規化後) */
|
|
61
|
+
readonly sourceUrl: string;
|
|
62
|
+
/** 取得時刻(ISO 8601 形式) */
|
|
63
|
+
readonly fetchedAt: string;
|
|
64
|
+
/** CLI バージョン */
|
|
65
|
+
readonly cliVersion: string;
|
|
66
|
+
/** 取得結果サマリ */
|
|
67
|
+
readonly summary: {
|
|
68
|
+
readonly success: boolean;
|
|
69
|
+
readonly resourceId: string;
|
|
70
|
+
readonly title: string;
|
|
71
|
+
};
|
|
72
|
+
/** エラー・警告一覧 */
|
|
73
|
+
readonly issues: readonly ManifestIssue[];
|
|
74
|
+
/** 添付ファイル取得結果 */
|
|
75
|
+
readonly attachments: readonly AttachmentResult[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Jira Issue 保存オプション
|
|
79
|
+
*/
|
|
80
|
+
export interface JiraStorageOptions {
|
|
81
|
+
/** 出力先ベースディレクトリ */
|
|
82
|
+
readonly baseDir: string;
|
|
83
|
+
/** 入力 URL */
|
|
84
|
+
readonly sourceUrl: string;
|
|
85
|
+
/** CLI バージョン */
|
|
86
|
+
readonly cliVersion: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Jira Issue 保存データ
|
|
90
|
+
*/
|
|
91
|
+
export interface JiraSaveData {
|
|
92
|
+
/** Issue キー(例: PROJECT-123) */
|
|
93
|
+
readonly key: string;
|
|
94
|
+
/** Issue タイトル(要約) */
|
|
95
|
+
readonly summary: string;
|
|
96
|
+
/** Issue 説明(null の場合は説明なし) */
|
|
97
|
+
readonly description: string | null;
|
|
98
|
+
/** 説明のプレーンテキスト(null の場合は説明なし) */
|
|
99
|
+
readonly descriptionPlainText: string | null;
|
|
100
|
+
/** コメント一覧 */
|
|
101
|
+
readonly comments: readonly JiraComment[];
|
|
102
|
+
/** 変更履歴一覧 */
|
|
103
|
+
readonly changelog: readonly JiraChangelogEntry[];
|
|
104
|
+
/** 添付ファイル一覧 */
|
|
105
|
+
readonly attachments: readonly JiraAttachment[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Confluence ページ保存オプション
|
|
109
|
+
*/
|
|
110
|
+
export interface ConfluenceStorageOptions {
|
|
111
|
+
/** 出力先ベースディレクトリ */
|
|
112
|
+
readonly baseDir: string;
|
|
113
|
+
/** 入力 URL */
|
|
114
|
+
readonly sourceUrl: string;
|
|
115
|
+
/** CLI バージョン */
|
|
116
|
+
readonly cliVersion: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Confluence ページ保存データ
|
|
120
|
+
*/
|
|
121
|
+
export interface ConfluenceSaveData {
|
|
122
|
+
/** ページ ID */
|
|
123
|
+
readonly id: string;
|
|
124
|
+
/** ページタイトル */
|
|
125
|
+
readonly title: string;
|
|
126
|
+
/** ページ本文(Storage Format) */
|
|
127
|
+
readonly body: string;
|
|
128
|
+
/** ページ本文のプレーンテキスト */
|
|
129
|
+
readonly bodyPlainText: string;
|
|
130
|
+
/** スペースキー */
|
|
131
|
+
readonly spaceKey: string;
|
|
132
|
+
/** 現在のバージョン番号 */
|
|
133
|
+
readonly currentVersion: number;
|
|
134
|
+
/** バージョン一覧 */
|
|
135
|
+
readonly versions: readonly ConfluenceVersion[];
|
|
136
|
+
/** 添付ファイル一覧 */
|
|
137
|
+
readonly attachments: readonly ConfluenceAttachment[];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* ストレージサービスのエラーの型
|
|
141
|
+
*/
|
|
142
|
+
export type StorageError = {
|
|
143
|
+
kind: 'DIRECTORY_CREATE_FAILED';
|
|
144
|
+
message: string;
|
|
145
|
+
path: string;
|
|
146
|
+
} | {
|
|
147
|
+
kind: 'FILE_WRITE_FAILED';
|
|
148
|
+
message: string;
|
|
149
|
+
path: string;
|
|
150
|
+
} | {
|
|
151
|
+
kind: 'INVALID_DATA';
|
|
152
|
+
message: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Jira Issue 保存結果
|
|
156
|
+
*/
|
|
157
|
+
export interface JiraSaveResult {
|
|
158
|
+
/** 保存先ディレクトリパス */
|
|
159
|
+
readonly directory: string;
|
|
160
|
+
/** 生成された Manifest */
|
|
161
|
+
readonly manifest: Manifest;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Confluence ページ保存結果
|
|
165
|
+
*/
|
|
166
|
+
export interface ConfluenceSaveResult {
|
|
167
|
+
/** 保存先ディレクトリパス */
|
|
168
|
+
readonly directory: string;
|
|
169
|
+
/** 生成された Manifest */
|
|
170
|
+
readonly manifest: Manifest;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* バージョン間差分メタデータ
|
|
174
|
+
*
|
|
175
|
+
* design.md の Version Diff Schema に準拠
|
|
176
|
+
*/
|
|
177
|
+
export interface VersionDiff {
|
|
178
|
+
/** 比較元バージョン */
|
|
179
|
+
readonly fromVersion: number;
|
|
180
|
+
/** 比較先バージョン */
|
|
181
|
+
readonly toVersion: number;
|
|
182
|
+
/** 差分生成時刻(ISO 8601 形式) */
|
|
183
|
+
readonly generatedAt: string;
|
|
184
|
+
/** 差分統計 */
|
|
185
|
+
readonly stats: DiffStats;
|
|
186
|
+
/** 差分ハンク一覧 */
|
|
187
|
+
readonly hunks: readonly DiffHunk[];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* ストレージサービスのインターフェース
|
|
191
|
+
*/
|
|
192
|
+
export interface StorageServiceInterface {
|
|
193
|
+
/**
|
|
194
|
+
* Jira Issue をディレクトリ構造で保存する
|
|
195
|
+
*
|
|
196
|
+
* @param data 保存データ
|
|
197
|
+
* @param options 保存オプション
|
|
198
|
+
* @returns 成功時は Ok(JiraSaveResult)、失敗時は Err(StorageError)
|
|
199
|
+
*/
|
|
200
|
+
saveJiraIssue(data: JiraSaveData, options: JiraStorageOptions): Promise<Result<JiraSaveResult, StorageError>>;
|
|
201
|
+
/**
|
|
202
|
+
* Confluence ページをディレクトリ構造で保存する
|
|
203
|
+
*
|
|
204
|
+
* @param data 保存データ
|
|
205
|
+
* @param options 保存オプション
|
|
206
|
+
* @returns 成功時は Ok(ConfluenceSaveResult)、失敗時は Err(StorageError)
|
|
207
|
+
*/
|
|
208
|
+
saveConfluencePage(data: ConfluenceSaveData, options: ConfluenceStorageOptions): Promise<Result<ConfluenceSaveResult, StorageError>>;
|
|
209
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Result } from 'neverthrow';
|
|
2
|
+
/**
|
|
3
|
+
* URL 解析結果の型
|
|
4
|
+
*/
|
|
5
|
+
export interface UrlParseResult {
|
|
6
|
+
/** リソースタイプ(jira または confluence) */
|
|
7
|
+
readonly type: 'jira' | 'confluence';
|
|
8
|
+
/** Atlassian Cloud の組織名(サブドメイン) */
|
|
9
|
+
readonly organization: string;
|
|
10
|
+
/** リソース ID(Jira の場合は Issue キー、Confluence の場合はページ ID) */
|
|
11
|
+
readonly resourceId: string;
|
|
12
|
+
/** プロジェクトキー(Jira の場合のみ) */
|
|
13
|
+
readonly projectKey?: string;
|
|
14
|
+
/** スペースキー(Confluence の場合のみ) */
|
|
15
|
+
readonly spaceKey?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* URL 解析エラーの型
|
|
19
|
+
*/
|
|
20
|
+
export type UrlParseError = {
|
|
21
|
+
kind: 'INVALID_FORMAT';
|
|
22
|
+
message: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'UNSUPPORTED_HOST';
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'MISSING_RESOURCE_ID';
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* URL バリデーションエラーの型
|
|
32
|
+
*/
|
|
33
|
+
export type UrlValidationError = {
|
|
34
|
+
kind: 'NOT_ATLASSIAN_CLOUD';
|
|
35
|
+
message: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'UNSUPPORTED_RESOURCE';
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* URL パーサーサービスのインターフェース
|
|
42
|
+
*/
|
|
43
|
+
export interface UrlParserService {
|
|
44
|
+
parse(url: string): Result<UrlParseResult, UrlParseError>;
|
|
45
|
+
validate(url: string): Result<void, UrlValidationError>;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|