@helpfeel/cosense-cli 1.5.1 → 1.5.2
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { parseProjectUrlStrict } from '../lib/parseUrl.ts';
|
|
4
4
|
import { requestJson } from '../lib/request.ts';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveCredential } from '../lib/settings.ts';
|
|
6
6
|
|
|
7
7
|
export const previewEditSummary =
|
|
8
8
|
'ページ編集opsをdry-runしてpreviewIdを取得する';
|
|
@@ -56,7 +56,7 @@ stdinから受け取る入力形式(既存ページ編集モード, JSON):
|
|
|
56
56
|
|
|
57
57
|
HTTPエラー:
|
|
58
58
|
HTTP 401 認証なし
|
|
59
|
-
HTTP 403
|
|
59
|
+
HTTP 403 権限不足(PAT利用時、projectのmemberでない 等)
|
|
60
60
|
HTTP 404 pageId に対応するpageが存在しない / pageId が不正な形式
|
|
61
61
|
HTTP 409 {"error":"NotFastForward","latest":...}
|
|
62
62
|
preview生成後にページが更新された。最新stateを再取得して ops を作り直す必要がある
|
|
@@ -384,8 +384,8 @@ export const previewEdit = async (args: string[]): Promise<void> => {
|
|
|
384
384
|
}
|
|
385
385
|
const { changes, newLineIds, updatedLineIds } = translateOps(ops);
|
|
386
386
|
|
|
387
|
-
//
|
|
388
|
-
const credential =
|
|
387
|
+
// projectに紐づくService Accountがあればそれを、無ければPATを使う(読み取りと同じ)
|
|
388
|
+
const credential = resolveCredential(origin, projectName);
|
|
389
389
|
|
|
390
390
|
const apiUrl = `${origin}/api/pages/v2/${projectName}/page-edit-for-ai/preview`;
|
|
391
391
|
const requestBody = pageId ? { pageId, changes } : { changes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { encodeTitleForUrl } from '../lib/encodeTitle.ts';
|
|
2
2
|
import { parseProjectUrlStrict } from '../lib/parseUrl.ts';
|
|
3
3
|
import { requestJson } from '../lib/request.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveCredential } from '../lib/settings.ts';
|
|
5
5
|
|
|
6
6
|
export const submitEditSummary =
|
|
7
7
|
'previewEditで取得したpreviewIdを使ってページ編集を確定する';
|
|
@@ -26,7 +26,7 @@ Usage:
|
|
|
26
26
|
HTTPエラー:
|
|
27
27
|
HTTP 400 preview を生成した時と違う project の URL を渡している
|
|
28
28
|
HTTP 401 認証なし
|
|
29
|
-
HTTP 403
|
|
29
|
+
HTTP 403 権限不足(PAT利用時、projectのmemberでない 等)
|
|
30
30
|
HTTP 404 preview が見つからない / 期限切れ (5分) / 既にconsume済み / 他userのpreview
|
|
31
31
|
HTTP 409 {"error":"NotFastForward","latest":...}
|
|
32
32
|
preview生成後にページが更新された。最新stateを再取得して ops を作り直し、
|
|
@@ -50,8 +50,8 @@ export const submitEdit = async (args: string[]): Promise<void> => {
|
|
|
50
50
|
|
|
51
51
|
const { origin, projectName } = parseProjectUrlStrict(projectUrl);
|
|
52
52
|
const apiUrl = `${origin}/api/pages/v2/${projectName}/page-edit-for-ai/submit`;
|
|
53
|
-
//
|
|
54
|
-
const credential =
|
|
53
|
+
// projectに紐づくService Accountがあればそれを、無ければPATを使う(読み取りと同じ)
|
|
54
|
+
const credential = resolveCredential(origin, projectName);
|
|
55
55
|
const response = (await requestJson(apiUrl, {
|
|
56
56
|
credential,
|
|
57
57
|
method: 'POST',
|