@takagaki/cortex-decisions-viewer 0.12.298 → 0.12.302
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/build.js +9 -3
- package/dist/engine/config-view.js +2 -1
- package/dist/engine/source-state-view.js +2 -1
- package/dist/google-confirm-page.js +49 -3
- package/dist/intake-scope.js +2 -1
- package/dist/render.js +70 -21
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.REFERENCES_SECTIONS = exports.RELATED_MATERIALS_SECTIONS = exports.SEE_ALSO_SECTIONS = exports.RELATED_URL_MAX = exports.RELATED_MATERIALS_FIELD = exports.relatedMaterialsRead = exports.isRelatedUrl = exports.GRAPH_RELS = exports.GRAPH_RECORD_TYPES = exports.GUIDE_VIDEO_SOURCES = exports.PROJECT_ICON_EXTS = exports.MIRROR_RELS = void 0;
|
|
39
|
+
exports.REFERENCES_SECTIONS = exports.RELATED_MATERIALS_SECTIONS = exports.SEE_ALSO_SECTIONS = exports.RELATED_URL_MAX = exports.RELATED_MATERIALS_FIELD = exports.relatedMaterialsRead = exports.isRelatedUrl = exports.RANKED_DIR_RE = exports.GRAPH_RELS = exports.GRAPH_RECORD_TYPES = exports.GUIDE_VIDEO_SOURCES = exports.PROJECT_ICON_EXTS = exports.MIRROR_RELS = void 0;
|
|
40
40
|
exports.sanitizeBody = sanitizeBody;
|
|
41
41
|
exports.copyHashedAsset = copyHashedAsset;
|
|
42
42
|
exports.buildGuideAssets = buildGuideAssets;
|
|
@@ -84,6 +84,7 @@ const sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
|
84
84
|
const canonical_evidence_1 = require("./canonical-evidence");
|
|
85
85
|
const evidence_names_1 = require("./evidence-names");
|
|
86
86
|
const change_log_1 = require("./change-log");
|
|
87
|
+
const record_kinds_1 = require("./engine/record-kinds");
|
|
87
88
|
const repo_1 = require("./repo");
|
|
88
89
|
const engagement_1 = require("./engagement");
|
|
89
90
|
const memory_dir_1 = require("./memory-dir");
|
|
@@ -1943,7 +1944,12 @@ function identifyEvidence(value, ctx, humanLabel) {
|
|
|
1943
1944
|
* 順位のファイルが持つ 4 区画の置き場(`Cortex/<区画>/records/` の下か)。分類(frontmatter の `type`)では決めない——
|
|
1944
1945
|
* engine は置き場で順位を付けるので、`type` が無い・違う記録だけが一律の大きさで目立つ、を防ぐ
|
|
1945
1946
|
*/
|
|
1946
|
-
|
|
1947
|
+
exports.RANKED_DIR_RE = new RegExp("(?:^|\\/)(?:" +
|
|
1948
|
+
// 区画の綴りだけを engine の種類の表 `RECORD_KINDS` の「夜が書く」平らな行から作る(骨格の緩さ〈records 任意・拡張子不問〉は今のまま・cortex-engine #3349 便 E0b)
|
|
1949
|
+
record_kinds_1.RECORD_KINDS.filter((k) => k.shape === record_kinds_1.FLAT_MD && k.can.nightWrites === true)
|
|
1950
|
+
.map((k) => k.kind.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
|
|
1951
|
+
.join("|") +
|
|
1952
|
+
")\\/(?:records\\/)?[^/]+$");
|
|
1947
1953
|
/**
|
|
1948
1954
|
* 記録の点に、目次と同じ順位から決めた明るさ(`glow`・0〜1)を付ける(engine #551・オーナー決定 10/1)。
|
|
1949
1955
|
*
|
|
@@ -1957,7 +1963,7 @@ function attachGlow(nodes, glow, recordRelPaths) {
|
|
|
1957
1963
|
if (!n.recordId)
|
|
1958
1964
|
continue;
|
|
1959
1965
|
const rel = recordRelPaths.get(n.recordId);
|
|
1960
|
-
if (rel === undefined || !RANKED_DIR_RE.test(rel))
|
|
1966
|
+
if (rel === undefined || !exports.RANKED_DIR_RE.test(rel))
|
|
1961
1967
|
continue;
|
|
1962
1968
|
const g = glow.get(rel);
|
|
1963
1969
|
n.glow = g === undefined ? 0 : g;
|
|
@@ -1039,7 +1039,8 @@ var INTENT_TABLE = Object.freeze({
|
|
|
1039
1039
|
remove: { ...REF, expectsRow: true }
|
|
1040
1040
|
},
|
|
1041
1041
|
drive: {
|
|
1042
|
-
|
|
1042
|
+
// `confirmDuplicate` は入れ子の重なり(別のプロジェクトの登録の中のフォルダ)を確認して足すときだけ効く(同じ ID の重複は覆らない・cortex-engine #3322)
|
|
1043
|
+
add: { req: ["folderId"], opt: ["name", "confirmDuplicate"], expectsRow: false },
|
|
1043
1044
|
remove: { ...REF, expectsRow: true }
|
|
1044
1045
|
},
|
|
1045
1046
|
backlog: {
|
|
@@ -872,7 +872,8 @@ var INTENT_TABLE = Object.freeze({
|
|
|
872
872
|
remove: { ...REF, expectsRow: true }
|
|
873
873
|
},
|
|
874
874
|
drive: {
|
|
875
|
-
|
|
875
|
+
// `confirmDuplicate` は入れ子の重なり(別のプロジェクトの登録の中のフォルダ)を確認して足すときだけ効く(同じ ID の重複は覆らない・cortex-engine #3322)
|
|
876
|
+
add: { req: ["folderId"], opt: ["name", "confirmDuplicate"], expectsRow: false },
|
|
876
877
|
remove: { ...REF, expectsRow: true }
|
|
877
878
|
},
|
|
878
879
|
backlog: {
|
|
@@ -122,6 +122,14 @@ function googleConfirmPageJs() {
|
|
|
122
122
|
var finished = false;
|
|
123
123
|
// 人の許可(cortex-engine #3149)をこの窓で済ませたか。済ませたら info が古くても 2 回目を挟まない(1 回だけ)
|
|
124
124
|
var personDone = false;
|
|
125
|
+
// 入れ子の重なり(受け口の 409 confirmable: "drive-nested"・cortex-engine #3322)で止まった回の、確かめたフォルダの ID(409 の nestedFolderIds)。
|
|
126
|
+
// 押すと、この ID にだけ確認の旗を付けて選び直す(確認の後に選んだ別の入れ子のフォルダは、改めて 409 になる)
|
|
127
|
+
var nestedPending = [];
|
|
128
|
+
var NESTED_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
129
|
+
/** 形の合うフォルダの ID だけ・重ねず・選べる数まで */
|
|
130
|
+
function nestedIdsOf(v) {
|
|
131
|
+
return (Array.isArray(v) ? v : []).filter(function (x, i, a) { return typeof x === "string" && NESTED_ID_RE.test(x) && a.indexOf(x) === i; }).slice(0, PICK_MAX);
|
|
132
|
+
}
|
|
125
133
|
|
|
126
134
|
function setStatus(text, cls) {
|
|
127
135
|
statusEl.textContent = text || "";
|
|
@@ -186,6 +194,30 @@ function googleConfirmPageJs() {
|
|
|
186
194
|
send(Object.assign({ type: MSG.result, ok: false, message: message }, extra || {}));
|
|
187
195
|
setTimeout(function () { try { window.close(); } catch (e) { /* 閉じられなくても表示は残る */ } }, 1200);
|
|
188
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* 入れ子の重なりで止まった(別のプロジェクトの登録の中のフォルダ): 受け口の文を出し、窓は閉じずに[確認して選び直す]を出す。
|
|
199
|
+
* 本体へは失敗として返す(本体は失敗の 1 行を出す・この窓で通ったら一覧を取り直す)。同じ ID の重複(印なし)はここに来ない
|
|
200
|
+
*/
|
|
201
|
+
function nestedAsk(message, ids, extra) {
|
|
202
|
+
busy = false;
|
|
203
|
+
hideBusy();
|
|
204
|
+
nestedPending = ids;
|
|
205
|
+
goBtn.hidden = false;
|
|
206
|
+
goBtn.disabled = false;
|
|
207
|
+
goBtn.textContent = "確認して選び直す";
|
|
208
|
+
closeBtn.hidden = false;
|
|
209
|
+
setStatus("✗ " + message, "is-error");
|
|
210
|
+
// nested の印: 本体はこの失敗で足す欄を確定させない(確認して通れば、後の成功の文に置き換わる)
|
|
211
|
+
send(Object.assign({ type: MSG.result, ok: false, nested: true, message: message }, extra || {}));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 受け口が入れ子の重なりの印を返したか(値ちょうど・Drive の窓だけ)。答えは確認を頼むフォルダの ID(まだ確認していない ID だけ)。
|
|
215
|
+
* 確認した ID ばかりの 409(旗が効かなかった)・ID の無い 409 は頼まない(空)
|
|
216
|
+
*/
|
|
217
|
+
function nestedOf(r) {
|
|
218
|
+
if (!r || r.status !== 409 || !r.body || r.body.confirmable !== "drive-nested" || ctx.kind !== "drive") return [];
|
|
219
|
+
return nestedIdsOf(r.body.nestedFolderIds).filter(function (x) { return ctx.confirmNestedIds.indexOf(x) === -1; });
|
|
220
|
+
}
|
|
189
221
|
/** 続けられない(本体が見つからない・結果が読めない): 理由と[閉じる]だけ */
|
|
190
222
|
function dead(message) {
|
|
191
223
|
busy = false;
|
|
@@ -213,12 +245,16 @@ function googleConfirmPageJs() {
|
|
|
213
245
|
}
|
|
214
246
|
/** 設定の表の案件の追加の意図(契約 §3。旧キー op を持たない)。保存の門(本人の Google)はトークンを添えて通る */
|
|
215
247
|
function intentBody(kind, target) {
|
|
248
|
+
// 入れ子の重なりを確認して選び直した回だけ、確認の旗を付ける(Drive だけ・受け口が同じ ID の重複には効かせない)
|
|
249
|
+
if (kind === "drive" && ctx.confirmNestedIds.indexOf(target.folderId) !== -1) target = Object.assign({}, target, { confirmDuplicate: true });
|
|
216
250
|
return { v: 1, kind: kind, action: "add", target: target, baseRev: ctx.intent.baseRev, req: ctx.intent.req };
|
|
217
251
|
}
|
|
218
252
|
/** まとめて選んだフォルダを 1 回で送る本文(受け口の pick-drive-folders)。一番上の行の選び直しだけ replaces を添える */
|
|
219
253
|
function pickBody(docs) {
|
|
220
254
|
var body = { op: "pick-drive-folders", folderIds: docs.map(function (d) { return d.id; }), baseRev: ctx.intent.baseRev, req: ctx.intent.req };
|
|
221
255
|
if (ctx.mode === "confirm" && ctx.top && ctx.id) body.replaces = ctx.id;
|
|
256
|
+
// 確認した ID を添える(受け口はこの ID の件にだけ旗を効かせる)
|
|
257
|
+
if (ctx.confirmNestedIds.length) { body.confirmDuplicate = true; body.confirmNestedIds = ctx.confirmNestedIds.slice(); }
|
|
222
258
|
return body;
|
|
223
259
|
}
|
|
224
260
|
function loadInfo() {
|
|
@@ -393,7 +429,10 @@ function googleConfirmPageJs() {
|
|
|
393
429
|
try { state = flow + "." + b64urlEncode(location.pathname); } catch (e) { throw { message: UNAVAILABLE }; }
|
|
394
430
|
// 本体へ「これから Google へ移る」と知らせる(窓の見張りを、Google にいる間は失敗にしないため)
|
|
395
431
|
// 人の許可へ移る回は印を付ける(本体は戻りの resume の上限を 1 つ足す=人の許可を挟む試しで上限に当たらない)。今の流れの知らせは今と同じ
|
|
396
|
-
|
|
432
|
+
// 入れ子の重なりを確認して選び直す回は、確認した ID を載せる(本体は次の指示に confirmNestedIds を載せる=戻った窓がその ID にだけ旗を付ける)
|
|
433
|
+
var leaving = person ? { type: MSG.leaving, person: true } : { type: MSG.leaving };
|
|
434
|
+
if (ctx.confirmNestedIds.length) leaving.nestedIds = ctx.confirmNestedIds.slice();
|
|
435
|
+
send(leaving);
|
|
397
436
|
location.replace(person ? personAuthUrl(info, r.body.nonce, state) : authUrl(info, r.body.nonce, state));
|
|
398
437
|
})
|
|
399
438
|
.catch(function (e) { retryable(failureMessage(e)); });
|
|
@@ -507,6 +546,7 @@ function googleConfirmPageJs() {
|
|
|
507
546
|
if (r.body.check && typeof r.body.check === "object" && !Array.isArray(r.body.check)) pickChecked.check = r.body.check;
|
|
508
547
|
if (Array.isArray(r.body.checks)) pickChecked.checks = r.body.checks;
|
|
509
548
|
if (r.status === 200) succeed(r.body.message || "確認しました", Object.assign({ changed: savedN > 0 || r.body.replaced === true, status: 200 }, pickChecked));
|
|
549
|
+
else if (nestedOf(r).length) nestedAsk(r.body.detail || r.body.message || "追加できませんでした", nestedOf(r), { status: r.status, code: r.body.code || null, changed: savedN > 0 });
|
|
510
550
|
else retryable(r.body.message || "追加できませんでした", { status: r.status, code: r.body.code || null, changed: savedN > 0 });
|
|
511
551
|
} else if (r.status === 200) {
|
|
512
552
|
// 足した行の確かめの答え(受け口の check・checks・cortex-engine #3154 便 CONN-ONE-B)は、形のある時だけ結果の伝言に載せる(本体が型を確かめて読む)
|
|
@@ -514,6 +554,8 @@ function googleConfirmPageJs() {
|
|
|
514
554
|
if (r.body.check && typeof r.body.check === "object" && !Array.isArray(r.body.check)) checked.check = r.body.check;
|
|
515
555
|
if (Array.isArray(r.body.checks)) checked.checks = r.body.checks;
|
|
516
556
|
succeed(r.body.message || "確認しました", Object.assign({ changed: r.body.changed !== false, status: 200 }, checked));
|
|
557
|
+
} else if (nestedOf(r).length) {
|
|
558
|
+
nestedAsk(r.body.message || "追加できませんでした", nestedOf(r), { status: r.status, code: r.body.code || null });
|
|
517
559
|
} else {
|
|
518
560
|
retryable(r.body.message || "追加できませんでした", { status: r.status, code: r.body.code || null });
|
|
519
561
|
}
|
|
@@ -538,7 +580,7 @@ function googleConfirmPageJs() {
|
|
|
538
580
|
if (!d.intake || typeof d.intake.url !== "string" || typeof d.intake.token !== "string") return;
|
|
539
581
|
if (d.kind !== "drive" && d.kind !== "google-chat" && d.kind !== "drive-account") return;
|
|
540
582
|
flow = d.flow;
|
|
541
|
-
ctx = { intake: d.intake, ticket: typeof d.ticket === "string" ? d.ticket : null, kind: d.kind, mode: d.kind === "drive-account" ? "connect" : d.mode === "confirm" ? "confirm" : "add", url: typeof d.url === "string" ? d.url : "", id: d.kind === "drive-account" ? "" : typeof d.id === "string" ? d.id : "", intent: d.kind === "drive-account" ? null : intentOf(d.intent) };
|
|
583
|
+
ctx = { confirmNestedIds: d.kind === "drive" ? nestedIdsOf(d.confirmNestedIds) : [], intake: d.intake, ticket: typeof d.ticket === "string" ? d.ticket : null, kind: d.kind, mode: d.kind === "drive-account" ? "connect" : d.mode === "confirm" ? "confirm" : "add", url: typeof d.url === "string" ? d.url : "", id: d.kind === "drive-account" ? "" : typeof d.id === "string" ? d.id : "", intent: d.kind === "drive-account" ? null : intentOf(d.intent) };
|
|
542
584
|
// まとめて選ぶ(Drive・意図が揃っているときだけ。揃わなければ今の流れ)。選び直しの一覧は形の合う ID だけ・押した行を先頭に・PICK_MAX(10)まで
|
|
543
585
|
ctx.pick = d.pick === true && ctx.kind === "drive" && !!ctx.intent;
|
|
544
586
|
ctx.top = ctx.pick && ctx.mode === "confirm" && d.top === true && !!ctx.id;
|
|
@@ -577,7 +619,11 @@ function googleConfirmPageJs() {
|
|
|
577
619
|
if (FLOW_RE.test(returnedFlow)) returned = { params: params, flow: returnedFlow };
|
|
578
620
|
}
|
|
579
621
|
|
|
580
|
-
goBtn.addEventListener("click", function () {
|
|
622
|
+
goBtn.addEventListener("click", function () {
|
|
623
|
+
// 入れ子の重なりで止まった後の押し直しは、確認の旗つきで選び直す(Google へ移る印に nested を載せ、本体が次の指示に載せ返す)
|
|
624
|
+
if (nestedPending.length && ctx) ctx.confirmNestedIds = nestedIdsOf(ctx.confirmNestedIds.concat(nestedPending));
|
|
625
|
+
go();
|
|
626
|
+
});
|
|
581
627
|
closeBtn.addEventListener("click", function () { try { window.close(); } catch (e) { /* 閉じられなければそのまま */ } });
|
|
582
628
|
window.addEventListener("message", onOpenerMessage);
|
|
583
629
|
|
package/dist/intake-scope.js
CHANGED
|
@@ -20,7 +20,8 @@ exports.TENANT_INTAKE_TABLES = {
|
|
|
20
20
|
// `memory-history`・`memory-report` は更新の記録の一覧と 1 回の報告(cortex-engine #2893 便 RAIL-T2a・受け口の表と同じ)
|
|
21
21
|
// `member-*`・`project-info*` はメンバーとプロジェクトの情報(cortex-engine #2896 便 RAIL-T2b・受け口の表と同じ)
|
|
22
22
|
// `project-icon-*` はプロジェクトのアイコンを置く・外す(cortex-engine #2503 便 ICON-VIEWER・受け口の表と同じ)
|
|
23
|
-
|
|
23
|
+
// `skill-facts`・`skill-import-targets` はスキルの今の事実と取り込む先の候補(cortex-engine #3279 便 T2・受け口の表と同じ)
|
|
24
|
+
ops: ["state", "config", "probe", "secret", "slack-oauth-start", "google-confirm-info", "memory-refresh", "memory-runs", "memory-history", "memory-report", "member-list", "member-preview", "member-invite", "member-remove", "project-info", "project-info-update", "project-icon-set", "project-icon-remove", "skill-facts", "skill-import-targets"],
|
|
24
25
|
// Google の確認の 3 つ(便 RS-T85f 続き)と Drive の入口②の許可(便 RS-T85g・受け口の `TENANT_INTAKE_GOOGLE_PAYLOAD_OPS`)。種別は op で決まるか、google-nonce は本文の kind
|
|
25
26
|
// まとめて選ぶ `pick-drive-folders`(種別 drive・cortex-engine #3142 便 CONN-DRIVE・受け口の表と同じ)
|
|
26
27
|
configPayloadOps: ["google-nonce", "confirm-drive-folder", "confirm-google-chat-space", "connect-drive-account", "pick-drive-folders"],
|
package/dist/render.js
CHANGED
|
@@ -7249,6 +7249,10 @@ const CLIENT_JS = `
|
|
|
7249
7249
|
// 人の許可(cortex-engine #3149)へ移った回数。人の許可を挟む試しは Google から 2 回戻るので、その回数だけ resume の上限を足す(GC_START_MAX まで)。
|
|
7250
7250
|
// 栓が切(人の許可へ移らない)なら 0=上限は今の 5 回のまま
|
|
7251
7251
|
var personLeaves = 0;
|
|
7252
|
+
// 入れ子の重なり(cortex-engine #3322)を確認して選び直すと窓が知らせた ID(leaving の nestedIds)。以後の指示に confirmNestedIds を載せる(Drive だけ)
|
|
7253
|
+
var nestedIds = [];
|
|
7254
|
+
// 入れ子の重なりで止まった回の文(nested の印の失敗は確定させない。窓が閉じた・期限の時はこの文で返す)
|
|
7255
|
+
var nestedMsg = "";
|
|
7252
7256
|
var readySent = false;
|
|
7253
7257
|
var closedAt = 0;
|
|
7254
7258
|
var channel = null;
|
|
@@ -7284,6 +7288,7 @@ const CLIENT_JS = `
|
|
|
7284
7288
|
id: opts.id || "",
|
|
7285
7289
|
};
|
|
7286
7290
|
if (intentNow()) start.intent = intent;
|
|
7291
|
+
if (nestedIds.length && opts.kind === "drive") start.confirmNestedIds = nestedIds.slice();
|
|
7287
7292
|
if (opts.pick === true) {
|
|
7288
7293
|
start.pick = true;
|
|
7289
7294
|
if (Array.isArray(opts.ids)) start.ids = opts.ids;
|
|
@@ -7300,6 +7305,9 @@ const CLIENT_JS = `
|
|
|
7300
7305
|
} else if (data.type === GC_MSG.leaving) {
|
|
7301
7306
|
left = true;
|
|
7302
7307
|
if (data.person === true && personLeaves < GC_START_MAX) personLeaves += 1;
|
|
7308
|
+
if (Array.isArray(data.nestedIds)) {
|
|
7309
|
+
data.nestedIds.forEach(function (x) { if (typeof x === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(x) && nestedIds.indexOf(x) === -1 && nestedIds.length < 10) nestedIds.push(x); });
|
|
7310
|
+
}
|
|
7303
7311
|
}
|
|
7304
7312
|
else if (data.type === GC_MSG.result) {
|
|
7305
7313
|
if (data.ok) {
|
|
@@ -7309,6 +7317,8 @@ const CLIENT_JS = `
|
|
|
7309
7317
|
} else {
|
|
7310
7318
|
// まとめて選ぶで途中まで足せた(changed)ときは、失敗でも一覧を取り直す(便 CONN-DRIVE)
|
|
7311
7319
|
if (data.changed === true) afterGoogleConfirm();
|
|
7320
|
+
// 入れ子の重なりで止まった失敗は確定させない(窓で確認して通れば、後の成功の文が足す欄に出る・赤い文を残さない)
|
|
7321
|
+
if (data.nested === true) { nestedMsg = typeof data.message === "string" && data.message ? data.message : GC_UNFINISHED; return; }
|
|
7312
7322
|
// 失敗は呼び手へすぐ返す(窓は結果を送って閉じる。閉じるのを待たずに、足した場所に失敗の 1 行を出す・仕様書 §2-5)。
|
|
7313
7323
|
// 後始末はしない(期限か窓が閉じた時に任せる): 後から成功が届いたら上の枝で一覧を取り直す。2 度目からの失敗は settle が捨てる
|
|
7314
7324
|
settle({ ok: false, message: typeof data.message === "string" && data.message ? data.message : GC_UNFINISHED });
|
|
@@ -7332,7 +7342,7 @@ const CLIENT_JS = `
|
|
|
7332
7342
|
window.addEventListener("message", onOpenerMsg);
|
|
7333
7343
|
timer = setInterval(function () {
|
|
7334
7344
|
var now = Date.now();
|
|
7335
|
-
var failure = GC_UNFINISHED;
|
|
7345
|
+
var failure = nestedMsg || GC_UNFINISHED;
|
|
7336
7346
|
if (now - startedAt >= GC_TIMEOUT_MS) { end({ ok: false, message: failure }); return; }
|
|
7337
7347
|
var closed = false;
|
|
7338
7348
|
try { closed = win.closed; } catch (e) { closed = true; }
|
|
@@ -7965,21 +7975,46 @@ ${story_1.evidenceToggleHidden.toString()}
|
|
|
7965
7975
|
// 本文中のウィキリンク [[用語]](・[[用語|表示名]])を、その用語レコードへのSPA内リンクに変換する。
|
|
7966
7976
|
// 解決先は term:用語。存在しない用語は素のテキストに落とす(角括弧を外す)。
|
|
7967
7977
|
//
|
|
7968
|
-
// 🔴
|
|
7969
|
-
//
|
|
7970
|
-
//
|
|
7971
|
-
//
|
|
7972
|
-
//
|
|
7973
|
-
|
|
7974
|
-
function linkifyWiki(
|
|
7975
|
-
if (!
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
var
|
|
7982
|
-
|
|
7978
|
+
// 🔴 **HTMLの文字列には触らない。** innerHTML に入れた後の DOM の**テキストノードだけ**を走査し、
|
|
7979
|
+
// リンクは createElement / setAttribute / textContent で作る(ストーリーの名前のリンクと同じ作り)。
|
|
7980
|
+
// 清めた後の文字列に置換を重ねると、本文の書き方しだいで許可したタグの属性の境が崩れ、
|
|
7981
|
+
// 許可外の属性を足せたため(表示名・飛び先は属性にも本文にも文字列では混ぜない)。
|
|
7982
|
+
// 当てない所: a の中(入れ子のリンクを作らない)。タグをまたぐ [[用語|<strong>…</strong>]] は当てない(文字列の置換だった頃との差)。
|
|
7983
|
+
var WIKI_RE = /\\[\\[([^\\]|]+?)(?:\\|([^\\]]+?))?\\]\\]/g;
|
|
7984
|
+
function linkifyWiki(root) {
|
|
7985
|
+
if (!root) return;
|
|
7986
|
+
var has = function (k) { return Object.prototype.hasOwnProperty.call(byId, k); };
|
|
7987
|
+
var nodes = [];
|
|
7988
|
+
var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null);
|
|
7989
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
7990
|
+
nodes.forEach(function (n) {
|
|
7991
|
+
var text = n.nodeValue;
|
|
7992
|
+
if (text.indexOf("[[") < 0) return;
|
|
7993
|
+
for (var p = n.parentNode; p; p = p.parentNode) { if (p.tagName === "A") return; if (p === root) break; }
|
|
7994
|
+
var frag = document.createDocumentFragment();
|
|
7995
|
+
var last = 0;
|
|
7996
|
+
var any = false;
|
|
7997
|
+
WIKI_RE.lastIndex = 0;
|
|
7998
|
+
var m;
|
|
7999
|
+
while ((m = WIKI_RE.exec(text))) {
|
|
8000
|
+
any = true;
|
|
8001
|
+
var name = m[1].trim();
|
|
8002
|
+
var disp = (m[2] || name).trim();
|
|
8003
|
+
var id = has("term:" + name) ? "term:" + name : (has(name) ? name : null);
|
|
8004
|
+
if (m.index > last) frag.appendChild(document.createTextNode(text.slice(last, m.index)));
|
|
8005
|
+
if (!id) { frag.appendChild(document.createTextNode(disp)); }
|
|
8006
|
+
else {
|
|
8007
|
+
var a = document.createElement("a");
|
|
8008
|
+
a.className = "wikilink";
|
|
8009
|
+
a.setAttribute("data-go", id);
|
|
8010
|
+
a.textContent = disp;
|
|
8011
|
+
frag.appendChild(a);
|
|
8012
|
+
}
|
|
8013
|
+
last = m.index + m[0].length;
|
|
8014
|
+
}
|
|
8015
|
+
if (!any) return;
|
|
8016
|
+
if (last < text.length) frag.appendChild(document.createTextNode(text.slice(last)));
|
|
8017
|
+
n.parentNode.replaceChild(frag, n);
|
|
7983
8018
|
});
|
|
7984
8019
|
}
|
|
7985
8020
|
// ストーリーの本文の名前を記録へのリンクにする(story.screen-name-links)。
|
|
@@ -9970,8 +10005,8 @@ ${story_1.evidenceToggleHidden.toString()}
|
|
|
9970
10005
|
function done() { if (typeof after === "function") after(mount); }
|
|
9971
10006
|
// 並びが変わったと分かっている画面では、本文を取りに行かない(取れても別レコードのもの)
|
|
9972
10007
|
if (pageStale && rec && rec.bodyRef) { showStaleBody(mount, after); return; }
|
|
9973
|
-
if (!rec || !rec.bodyRef) { mount.innerHTML =
|
|
9974
|
-
if (bodyCache[rec.bodyRef] != null) { mount.innerHTML = bodyCache[rec.bodyRef]; done(); return; }
|
|
10008
|
+
if (!rec || !rec.bodyRef) { mount.innerHTML = (rec && rec.bodyHtml) || ""; linkifyWiki(mount); done(); return; }
|
|
10009
|
+
if (bodyCache[rec.bodyRef] != null) { mount.innerHTML = bodyCache[rec.bodyRef]; linkifyWiki(mount); done(); return; }
|
|
9975
10010
|
mount.innerHTML = '<div class="body-loading">読み込み中…</div>';
|
|
9976
10011
|
fetch(rec.bodyRef).then(function (res) {
|
|
9977
10012
|
// 🔴 **本文が無いのは「配信されていない」ではなく「この画面が古い」。** 配布は
|
|
@@ -9997,8 +10032,9 @@ ${story_1.evidenceToggleHidden.toString()}
|
|
|
9997
10032
|
showStaleBody(mount, after);
|
|
9998
10033
|
return;
|
|
9999
10034
|
}
|
|
10000
|
-
|
|
10001
|
-
|
|
10035
|
+
// キャッシュには清めた後の HTML をそのまま入れ、リンクは毎回 DOM に対して足す(文字列に戻して再解析しない)
|
|
10036
|
+
var clean = m ? html.slice(m[0].length) : html;
|
|
10037
|
+
bodyCache[rec.bodyRef] = clean; mount.innerHTML = clean; linkifyWiki(mount); done();
|
|
10002
10038
|
})
|
|
10003
10039
|
.catch(function (err) {
|
|
10004
10040
|
if (err && err.stale) { showStaleBody(mount, after); return; }
|
|
@@ -14101,6 +14137,8 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
14101
14137
|
* true のときだけ、ワークスペースを宣言した行に[通知先にする]を出す
|
|
14102
14138
|
*/
|
|
14103
14139
|
var LIVE_NOTIFY_ANY_WS = false;
|
|
14140
|
+
// 別のプロジェクトの登録と重なっている自分の Drive の登録(op=state の driveOverlap・フォルダの ID だけ・cortex-engine #3322)。組み直したプロジェクトの答えだけで持つ
|
|
14141
|
+
var LIVE_DRIVE_OVERLAP = [];
|
|
14104
14142
|
/** 組織の受け口の Slack の栓(op=state の tenantSlack・便 RS-T85f 続き)。運営の受け口では使わない */
|
|
14105
14143
|
var LIVE_TENANT_SLACK = false;
|
|
14106
14144
|
/**
|
|
@@ -17302,6 +17340,13 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
17302
17340
|
|
|
17303
17341
|
/** 栓が開くまでの、ワークスペースを宣言した行の文(#1370)。ID や組織の内部事情は書かない */
|
|
17304
17342
|
var NOTIFY_WS_PENDING_TEXT = "このワークスペースへの通知は準備中です";
|
|
17343
|
+
// 重なりの帯(症状の 1 文・行は一手を足さない。重なった部分を読む側は受け口と夜が決める・cortex-engine #3322)
|
|
17344
|
+
var DRIVE_OVERLAP_TEXT = "一部が別のプロジェクトと重なっています(その部分は下のフォルダを登録した側だけが読みます)";
|
|
17345
|
+
/** op=state の driveOverlap(フォルダの ID の配列)。形の合う ID だけ(知らない形は捨てる・無ければ空) */
|
|
17346
|
+
function driveOverlapOf(j) {
|
|
17347
|
+
var list = j && Array.isArray(j.driveOverlap) ? j.driveOverlap : [];
|
|
17348
|
+
return list.filter(function (x) { return typeof x === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(x); });
|
|
17349
|
+
}
|
|
17305
17350
|
/** 投稿の許可が無い接続の文(#1370)。サーバの NOTIFY_WORKSPACE_NO_POST と同じ症状を言う */
|
|
17306
17351
|
var NOTIFY_WS_NO_POST_TEXT = "このワークスペースは投稿の許可が無いので通知先にできません。";
|
|
17307
17352
|
/** サーバの理由コード(intake の NOTIFY_WORKSPACE_CODES.noPost と同じ綴り) */
|
|
@@ -19047,7 +19092,7 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
19047
19092
|
return sourcesOn() ? JSON.stringify([
|
|
19048
19093
|
LIVE_SOURCES, SOURCE_BUSY, SOURCE_NOTES, SOURCE_ANSWERS, SOURCE_KEY_OPEN, SOURCE_KEY_NOTES,
|
|
19049
19094
|
CONFIG ? [CONFIG.notify, (CONFIG.sources || []).map(function (x) { return x && configRowKey(x.kind, x.ref, x.workspace); })] : null,
|
|
19050
|
-
CONFIG_SAVING, CONFIG_NOTES,
|
|
19095
|
+
CONFIG_SAVING, CONFIG_NOTES, LIVE_DRIVE_OVERLAP,
|
|
19051
19096
|
]) : "";
|
|
19052
19097
|
}
|
|
19053
19098
|
/** つなぎ元の名前の引き当て(Slack のワークスペース名など。引けなければ空=ID のまま出す) */
|
|
@@ -19341,6 +19386,8 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
19341
19386
|
]);
|
|
19342
19387
|
// 準備中の 1 文は名前の列の 2 段目に置く(行の下に段を足すと、この行だけ高くなる・便 S44-5d の直し 4)
|
|
19343
19388
|
if (notifyPending) who.appendChild(el("div", { class: "src-sub", text: NOTIFY_WS_PENDING_TEXT }));
|
|
19389
|
+
// Drive の登録が別のプロジェクトの登録と入れ子で重なっている行だけ、名前の下に帯の 1 文(cortex-engine #3322)
|
|
19390
|
+
if (r.kind === "drive" && LIVE_DRIVE_OVERLAP.indexOf(r.ref) >= 0) who.appendChild(el("div", { class: "src-sub", "data-src-overlap": "1", text: DRIVE_OVERLAP_TEXT }));
|
|
19344
19391
|
// 人の確認の行の文は理由の箱(語 owner_unconfirmed)が言う。共有ドライブの一番上の行だけは、箱が言わない訳(直下を選ぶ)を名前の下に 1 句(便 CONN-DRIVE D3・cortex-engine #3151 追記 2)
|
|
19345
19392
|
if (gverify && gverify.note) who.appendChild(el("div", { class: "src-sub", "data-src-gverify-why": "1", text: gverify.note }));
|
|
19346
19393
|
if (v.why) {
|
|
@@ -23398,6 +23445,8 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
23398
23445
|
LIVE_GH_OWNERS = sanitizeGithubOwnersNow(j && j.registeredNow && j.registeredNow.githubOwners);
|
|
23399
23446
|
LIVE_GH_APP_SLUG = githubAppSlugOf({ appSlug: j && j.registeredNow && j.registeredNow.githubAppSlug });
|
|
23400
23447
|
MERGED = null;
|
|
23448
|
+
// Drive の入れ子の重なり(cortex-engine #3322)。受け口は組み直したプロジェクトの答えにだけ載せる(無ければ空)
|
|
23449
|
+
LIVE_DRIVE_OVERLAP = driveOverlapOf(j);
|
|
23401
23450
|
// 組み直したプロジェクトは fleet を読まない(無いのが成功・表の側の写しを使う・便 S72-FLEET-STATUS-FOLD 段 2)
|
|
23402
23451
|
if (tableFleetProject()) {
|
|
23403
23452
|
// fleet も sources も無い 200 の答え(受け口の不調)は今までどおり読めない側(便 S44-5d の決め)
|
package/package.json
CHANGED