@takagaki/cortex-decisions-viewer 0.12.305 → 0.12.306
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/engine/connection-words.js +17 -0
- package/dist/engine/source-state-view.js +50 -17
- package/dist/google-confirm-page.js +5 -1
- package/dist/render.js +46 -1
- package/dist/source-rows.js +17 -5
- package/package.json +1 -1
|
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var connection_words_exports = {};
|
|
22
22
|
__export(connection_words_exports, {
|
|
23
23
|
CONNECTION_WORDS: () => CONNECTION_WORDS,
|
|
24
|
+
PERSON_REGRANT_BUTTON: () => PERSON_REGRANT_BUTTON,
|
|
25
|
+
PERSON_ROW_WORDS: () => PERSON_ROW_WORDS,
|
|
24
26
|
WORD_ACTS: () => WORD_ACTS,
|
|
25
27
|
WORD_FIXERS: () => WORD_FIXERS,
|
|
26
28
|
WORD_PLACES: () => WORD_PLACES,
|
|
@@ -219,9 +221,24 @@ function connectionWordLines(w, nouns, o) {
|
|
|
219
221
|
const steps = d.steps.filter((s) => s.needs.every((k) => has[k])).map((s) => ({ act: s.act, text: fill(s.text) }));
|
|
220
222
|
return { word: code, why: fill(d.why), steps, who: d.who ? fill(d.who) : "", fixer: d.fixer, transient: d.transient };
|
|
221
223
|
}
|
|
224
|
+
var PERSON_ROW_WORDS = Object.freeze({
|
|
225
|
+
owner_unconfirmed: Object.freeze({
|
|
226
|
+
why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u8A31\u53EF\u3057\u76F4\u3059\u307E\u3067\u3001\u8AAD\u307F\u307E\u305B\u3093\u3002",
|
|
227
|
+
mine: "\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
228
|
+
other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
229
|
+
}),
|
|
230
|
+
permission_missing: Object.freeze({
|
|
231
|
+
why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u3067\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u306A\u304F\u306A\u308A\u307E\u3057\u305F\uFF08\u79FB\u3055\u308C\u305F\u30FB\u5171\u6709\u3092\u5916\u3055\u308C\u305F\uFF09\u3002",
|
|
232
|
+
mine: "\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u308B Google \u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
233
|
+
other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
var PERSON_REGRANT_BUTTON = "Google \u3067\u8A31\u53EF\u3057\u76F4\u3059";
|
|
222
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
223
238
|
0 && (module.exports = {
|
|
224
239
|
CONNECTION_WORDS,
|
|
240
|
+
PERSON_REGRANT_BUTTON,
|
|
241
|
+
PERSON_ROW_WORDS,
|
|
225
242
|
WORD_ACTS,
|
|
226
243
|
WORD_FIXERS,
|
|
227
244
|
WORD_PLACES,
|
|
@@ -120,6 +120,7 @@ __export(source_state_view_exports, {
|
|
|
120
120
|
module.exports = __toCommonJS(source_state_view_exports);
|
|
121
121
|
|
|
122
122
|
// ../infra/lambda/shared/secret-names.mjs
|
|
123
|
+
var PORTAL_USER_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
123
124
|
var FLEET_LEGACY = {
|
|
124
125
|
"intake-tokens": "cortex/intake/tokens",
|
|
125
126
|
"backlog-webhook-tokens": "cortex/backlog-webhook/tokens",
|
|
@@ -528,7 +529,7 @@ var GITHUB_REPO_RE = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
|
528
529
|
var GITHUB_READS = Object.freeze(["issues", "discussions"]);
|
|
529
530
|
var FIGMA_KEY_RE = /^[A-Za-z0-9_-]{8,}$/;
|
|
530
531
|
var DRIVE_FOLDER_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
531
|
-
var
|
|
532
|
+
var PORTAL_USER_ID_RE2 = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
532
533
|
var GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
533
534
|
var TEAMS_CHANNEL_RE = /^19:\S+$/;
|
|
534
535
|
var TEAMS_FOLDER_RE = /^\S+$/;
|
|
@@ -741,7 +742,7 @@ function checkDrive(conn, at, errors, ctx) {
|
|
|
741
742
|
}
|
|
742
743
|
checkKeys(p, ["kind", "userId"], pat, errors);
|
|
743
744
|
if (p.kind !== "person") errors.push(`${pat}.kind \u306F person \u3060\u3051\u3067\u3059: ${JSON.stringify(p.kind)}`);
|
|
744
|
-
if (typeof p.userId !== "string" || !
|
|
745
|
+
if (typeof p.userId !== "string" || !PORTAL_USER_ID_RE2.test(p.userId)) {
|
|
745
746
|
errors.push(`${pat}.userId \u304C\u30DD\u30FC\u30BF\u30EB\u306E\u4EBA\u306E ID\uFF08\u5927\u6587\u5B57\u306E 26 \u5B57\uFF09\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${JSON.stringify(p.userId)}`);
|
|
746
747
|
}
|
|
747
748
|
}
|
|
@@ -938,6 +939,16 @@ function sourceItemsOf(sources) {
|
|
|
938
939
|
return out;
|
|
939
940
|
}
|
|
940
941
|
|
|
942
|
+
// ../infra/lambda/shared/drive-person-token.mjs
|
|
943
|
+
var isObj3 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
944
|
+
var OWNER_INVALID = Object.freeze({ kind: "invalid" });
|
|
945
|
+
function driveOwnerOf(principal) {
|
|
946
|
+
if (principal === void 0) return null;
|
|
947
|
+
const ok = isObj3(principal) && Object.keys(principal).length === 2 && principal.kind === "person" && typeof principal.userId === "string" && PORTAL_USER_ID_RE.test(principal.userId);
|
|
948
|
+
return ok ? { kind: "person", userId: principal.userId } : OWNER_INVALID;
|
|
949
|
+
}
|
|
950
|
+
var DRIVE_PERSON_BUSY_403_REASONS = Object.freeze(["rateLimitExceeded", "userRateLimitExceeded", "dailyLimitExceeded", "sharingRateLimitExceeded"]);
|
|
951
|
+
|
|
941
952
|
// ../infra/lambda/shared/adapters.mjs
|
|
942
953
|
var GOLD_NIGHT_SCHEDULE = Object.freeze({
|
|
943
954
|
via: "marker",
|
|
@@ -1752,10 +1763,10 @@ var ADAPTERS = [
|
|
|
1752
1763
|
var SOURCE_CHECK_ROUTES = Object.freeze(["inline"]);
|
|
1753
1764
|
var SOURCE_CHECK_FIELDS = Object.freeze(["fn", "none", "manual", "auto", "autoNone", "add", "route"]);
|
|
1754
1765
|
var SOURCE_CHECK_ADD_FIELDS = Object.freeze(["notify", "ownerLogin", "origin", "key", "removable"]);
|
|
1755
|
-
var
|
|
1766
|
+
var isObj4 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
|
|
1756
1767
|
function sourceCheckOf(id, adapters = ADAPTERS) {
|
|
1757
1768
|
const a = adapters.find((x) => x.id === id);
|
|
1758
|
-
return a &&
|
|
1769
|
+
return a && isObj4(a.sourceCheck) ? a.sourceCheck : null;
|
|
1759
1770
|
}
|
|
1760
1771
|
|
|
1761
1772
|
// ../infra/lambda/shared/source-state.mjs
|
|
@@ -2186,11 +2197,23 @@ var WORD_TOOL_NOUNS = Object.freeze({
|
|
|
2186
2197
|
"google-drive": Object.freeze({ partner: "Google Workspace", confirm: "Google \u3067\u78BA\u8A8D\u3059\u308B", connect: null }),
|
|
2187
2198
|
"google-meet": Object.freeze({ partner: "Google Workspace", confirm: null, connect: null })
|
|
2188
2199
|
});
|
|
2200
|
+
var PERSON_ROW_WORDS = Object.freeze({
|
|
2201
|
+
owner_unconfirmed: Object.freeze({
|
|
2202
|
+
why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u8A31\u53EF\u3057\u76F4\u3059\u307E\u3067\u3001\u8AAD\u307F\u307E\u305B\u3093\u3002",
|
|
2203
|
+
mine: "\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
2204
|
+
other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
2205
|
+
}),
|
|
2206
|
+
permission_missing: Object.freeze({
|
|
2207
|
+
why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u3067\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u306A\u304F\u306A\u308A\u307E\u3057\u305F\uFF08\u79FB\u3055\u308C\u305F\u30FB\u5171\u6709\u3092\u5916\u3055\u308C\u305F\uFF09\u3002",
|
|
2208
|
+
mine: "\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u308B Google \u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
2209
|
+
other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
2210
|
+
})
|
|
2211
|
+
});
|
|
2189
2212
|
|
|
2190
2213
|
// ../infra/lambda/shared/source-state-view.mjs
|
|
2191
2214
|
var SOURCES_VIEW_VERSION = 1;
|
|
2192
2215
|
var SOURCES_UNAVAILABLE_REASONS = Object.freeze(["no-store", "read-failed", "bad-config"]);
|
|
2193
|
-
var
|
|
2216
|
+
var isObj5 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
|
|
2194
2217
|
var timeOf = (s) => typeof s === "string" ? Date.parse(s) : NaN;
|
|
2195
2218
|
var DETAIL_MAX2 = 200;
|
|
2196
2219
|
var NAME_MAX = 100;
|
|
@@ -2261,7 +2284,7 @@ function stateCoreOf(item, table = source_state_exports) {
|
|
|
2261
2284
|
const detail = tag ? `${tag}${raw ? `,${raw}` : ""}`.slice(0, DETAIL_MAX2) : raw;
|
|
2262
2285
|
return { ...base, reason, ...detail ? { detail } : {} };
|
|
2263
2286
|
}
|
|
2264
|
-
function buildSourcesView({ project, sources, calendar = null, items, notifyRows = [], secretsNow = null, table = source_state_exports }) {
|
|
2287
|
+
function buildSourcesView({ project, sources, calendar = null, items, notifyRows = [], secretsNow = null, viewerUserId = null, table = source_state_exports }) {
|
|
2265
2288
|
let pk;
|
|
2266
2289
|
try {
|
|
2267
2290
|
pk = sourceStatePk(project);
|
|
@@ -2279,16 +2302,16 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
|
|
|
2279
2302
|
};
|
|
2280
2303
|
const s = parse(sources);
|
|
2281
2304
|
const c = parse(calendar);
|
|
2282
|
-
if (!
|
|
2305
|
+
if (!isObj5(s) || !Array.isArray(s.connections) || c === void 0 || c !== null && !isObj5(c)) return sourcesUnavailable("bad-config");
|
|
2283
2306
|
const bySk = /* @__PURE__ */ new Map();
|
|
2284
2307
|
for (const it of Array.isArray(items) ? items : []) {
|
|
2285
|
-
if (
|
|
2308
|
+
if (isObj5(it) && typeof it.sk === "string" && (it.pk === void 0 || it.pk === pk) && !bySk.has(it.sk)) bySk.set(it.sk, it);
|
|
2286
2309
|
}
|
|
2287
|
-
const on = new Set((Array.isArray(notifyRows) ? notifyRows : []).filter((r) =>
|
|
2288
|
-
const secrets = Array.isArray(secretsNow) ? secretsNow.filter(
|
|
2310
|
+
const on = new Set((Array.isArray(notifyRows) ? notifyRows : []).filter((r) => isObj5(r) && r.on === true).map((r) => `${r.kind} ${r.workspace ?? ""} ${r.ref}`));
|
|
2311
|
+
const secrets = Array.isArray(secretsNow) ? secretsNow.filter(isObj5) : null;
|
|
2289
2312
|
const groups = /* @__PURE__ */ new Map();
|
|
2290
2313
|
const seen = /* @__PURE__ */ new Set();
|
|
2291
|
-
for (const conn of s.connections.filter(
|
|
2314
|
+
for (const conn of s.connections.filter(isObj5)) {
|
|
2292
2315
|
const cap = capOfTool(conn.tool);
|
|
2293
2316
|
for (const it of sourceItemsOf({ connections: [conn] })) {
|
|
2294
2317
|
const sc = sourceCheckOf(it.kind);
|
|
@@ -2322,6 +2345,14 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
|
|
|
2322
2345
|
canOwnerLogin: !!(sc && sc.add.ownerLogin),
|
|
2323
2346
|
removable: !!(sc && sc.add.removable)
|
|
2324
2347
|
};
|
|
2348
|
+
if (conn.tool === "google-drive" && Array.isArray(conn.folders)) {
|
|
2349
|
+
const folder = conn.folders.find((f) => isObj5(f) && f.id === it.ref);
|
|
2350
|
+
const owner = folder ? driveOwnerOf(folder.principal) : null;
|
|
2351
|
+
if (owner && owner.kind === "person") {
|
|
2352
|
+
row.ownerKind = "person";
|
|
2353
|
+
row.ownerMine = typeof viewerUserId === "string" && viewerUserId !== "" && viewerUserId === owner.userId;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2325
2356
|
if (sc && sc.add.origin && typeof conn[sc.add.origin.field] === "string" && conn[sc.add.origin.field]) {
|
|
2326
2357
|
row.origin = { label: sc.add.origin.label, id: conn[sc.add.origin.field] };
|
|
2327
2358
|
}
|
|
@@ -2359,7 +2390,7 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
|
|
|
2359
2390
|
}
|
|
2360
2391
|
function validateSourcesView(v, table = source_state_exports) {
|
|
2361
2392
|
const errs = [];
|
|
2362
|
-
if (!
|
|
2393
|
+
if (!isObj5(v)) return ["sources \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093"];
|
|
2363
2394
|
const only = (obj, allowed, where) => {
|
|
2364
2395
|
for (const k of Object.keys(obj)) if (!allowed.includes(k)) errs.push(`${where}.${k} \u306F\u5951\u7D04\u306B\u7121\u3044\u6B04\u3067\u3059`);
|
|
2365
2396
|
};
|
|
@@ -2401,29 +2432,31 @@ function validateSourcesView(v, table = source_state_exports) {
|
|
|
2401
2432
|
let problems = 0;
|
|
2402
2433
|
v.groups.forEach((g, gi) => {
|
|
2403
2434
|
const gw = `sources.groups[${gi}]`;
|
|
2404
|
-
if (!
|
|
2435
|
+
if (!isObj5(g)) return errs.push(`${gw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
|
|
2405
2436
|
only(g, ["kind", "label", "count", "problems", "rows"], gw);
|
|
2406
2437
|
if (!Array.isArray(g.rows)) return errs.push(`${gw}.rows \u306F\u914D\u5217\u3067\u3059`);
|
|
2407
|
-
const gp = g.rows.filter((r) =>
|
|
2438
|
+
const gp = g.rows.filter((r) => isObj5(r) && r.status === "failed" && r.fixer !== "wait").length;
|
|
2408
2439
|
if (g.count !== g.rows.length) errs.push(`${gw}.count \u304C\u884C\u306E\u6570\u3068\u9055\u3044\u307E\u3059`);
|
|
2409
2440
|
if (g.problems !== gp) errs.push(`${gw}.problems \u304C\u300C\u554F\u984C\u3042\u308A\u300D\u306E\u6570\u3068\u9055\u3044\u307E\u3059`);
|
|
2410
2441
|
total += g.rows.length;
|
|
2411
2442
|
problems += gp;
|
|
2412
2443
|
g.rows.forEach((r, ri) => {
|
|
2413
2444
|
const rw = `${gw}.rows[${ri}]`;
|
|
2414
|
-
if (!
|
|
2415
|
-
only(r, ["kind", "ref", "workspace", "name", "currentName", "status", "reason", "detail", "fixer", "checkedAt", "ingestedAt", "paused", "notify", "fixedIp", "origin", "key", "canCheck", "canOwnerLogin", "removable"], rw);
|
|
2445
|
+
if (!isObj5(r)) return errs.push(`${rw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
|
|
2446
|
+
only(r, ["kind", "ref", "workspace", "name", "currentName", "status", "reason", "detail", "fixer", "checkedAt", "ingestedAt", "paused", "notify", "fixedIp", "origin", "key", "canCheck", "canOwnerLogin", "removable", "ownerKind", "ownerMine"], rw);
|
|
2416
2447
|
if (r.kind !== g.kind) errs.push(`${rw}.kind \u304C\u307E\u3068\u307E\u308A\u3068\u9055\u3044\u307E\u3059`);
|
|
2417
2448
|
for (const k of ["ref", "name"]) if (!(typeof r[k] === "string" && r[k])) errs.push(`${rw}.${k} \u306F\u7A7A\u3067\u306A\u3044\u6587\u5B57\u5217\u3067\u3059`);
|
|
2418
2449
|
if ("currentName" in r && !(typeof r.currentName === "string" && r.currentName && r.currentName.length <= NAME_MAX && !CONTROL_RE.test(r.currentName))) errs.push(`${rw}.currentName \u306F ${NAME_MAX} \u5B57\u307E\u3067\u306E\u5236\u5FA1\u6587\u5B57\u306E\u306A\u3044\u6587\u5B57\u5217\u3067\u3059`);
|
|
2419
2450
|
for (const k of ["paused", "notify", "fixedIp", "canCheck", "canOwnerLogin", "removable"]) if (typeof r[k] !== "boolean") errs.push(`${rw}.${k} \u306F\u771F\u507D\u5024\u3067\u3059`);
|
|
2451
|
+
if ("ownerKind" in r && r.ownerKind !== "person") errs.push(`${rw}.ownerKind \u306F "person" \u3060\u3051\u3067\u3059`);
|
|
2452
|
+
if ("ownerKind" in r !== "ownerMine" in r || "ownerMine" in r && typeof r.ownerMine !== "boolean") errs.push(`${rw}.ownerKind \u3068 ownerMine \u306F\u7D44\u3067\u3001ownerMine \u306F\u771F\u507D\u5024\u3067\u3059`);
|
|
2420
2453
|
checkState(r, rw);
|
|
2421
2454
|
checkFixer(r, rw);
|
|
2422
2455
|
});
|
|
2423
2456
|
});
|
|
2424
2457
|
if (v.total !== total) errs.push("sources.total \u304C\u884C\u306E\u6570\u306E\u5408\u8A08\u3068\u9055\u3044\u307E\u3059");
|
|
2425
2458
|
if (v.meeting !== null) {
|
|
2426
|
-
if (!
|
|
2459
|
+
if (!isObj5(v.meeting)) errs.push("sources.meeting \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304B null \u3067\u3059");
|
|
2427
2460
|
else {
|
|
2428
2461
|
only(v.meeting, ["status", "reason", "detail", "checkedAt", "ingestedAt"], "sources.meeting");
|
|
2429
2462
|
checkState(v.meeting, "sources.meeting");
|
|
@@ -305,7 +305,7 @@ function googleConfirmPageJs() {
|
|
|
305
305
|
function needsPerson(info) {
|
|
306
306
|
var p = info && info.drivePerson;
|
|
307
307
|
// 🔴 名乗りの券が無ければ挟まない(受け口は本人の棚を名乗りで引く。券が無いと connect-drive-person が通らず、承認を繰り返すだけになる)
|
|
308
|
-
return ctx.kind === "drive" && !!ctx.ticket && !personDone && !!p && p.granted === false && typeof p.clientId === "string" && !!p.clientId;
|
|
308
|
+
return ctx.kind === "drive" && !!ctx.ticket && !personDone && !!p && (p.granted === false || ctx.regrant === true) && typeof p.clientId === "string" && !!p.clientId;
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
311
311
|
* 人の許可の承認(cortex-engine #3149): 認可コード+ID トークン(nonce を読むため)がフラグメントで返る・offline・初めての許可なので同意を出す。
|
|
@@ -415,6 +415,8 @@ function googleConfirmPageJs() {
|
|
|
415
415
|
info = i;
|
|
416
416
|
// 人の許可がまだなら、先にその承認へ(nonce の種別は drive-person・行の ID は結ばない)
|
|
417
417
|
person = needsPerson(info);
|
|
418
|
+
// 許可し直しなのに人の許可の承認を挟めない(受け口が人の許可を返さない)なら、成功に見せず止める(cortex-engine #3420)
|
|
419
|
+
if (ctx.regrant === true && !personDone && !person) throw { message: UNAVAILABLE };
|
|
418
420
|
if (person) return callIntake({ op: "google-nonce", kind: "drive-person" });
|
|
419
421
|
var body = { op: "google-nonce", kind: ctx.kind };
|
|
420
422
|
if (ctx.kind === "google-chat") body.url = ctx.url || ctx.id;
|
|
@@ -583,6 +585,8 @@ function googleConfirmPageJs() {
|
|
|
583
585
|
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) };
|
|
584
586
|
// まとめて選ぶ(Drive・意図が揃っているときだけ。揃わなければ今の流れ)。選び直しの一覧は形の合う ID だけ・押した行を先頭に・PICK_MAX(10)まで
|
|
585
587
|
ctx.pick = d.pick === true && ctx.kind === "drive" && !!ctx.intent;
|
|
588
|
+
// 許可し直し(cortex-engine #3420): 棚に許可が残っていても人の許可の承認を挟み直す(切れた許可は棚の有無では分からない)
|
|
589
|
+
ctx.regrant = d.regrant === true && ctx.kind === "drive" && ctx.mode === "confirm";
|
|
586
590
|
ctx.top = ctx.pick && ctx.mode === "confirm" && d.top === true && !!ctx.id;
|
|
587
591
|
ctx.ids = !ctx.pick ? [] : [ctx.id].concat(Array.isArray(d.ids) ? d.ids : []).filter(function (x, i, a) { return typeof x === "string" && PICK_ID_RE.test(x) && a.indexOf(x) === i; }).slice(0, PICK_MAX);
|
|
588
592
|
if (ctx.pick && ctx.mode === "confirm" && !ctx.top && !ctx.ids.length) ctx.pick = false;
|
package/dist/render.js
CHANGED
|
@@ -7243,6 +7243,12 @@ const CLIENT_JS = `
|
|
|
7243
7243
|
}
|
|
7244
7244
|
/** 行に人の確認の要る印(ownerPending)を重ねた写し(印が要らなければ元の行のまま)。行・タイル・[記憶の更新を開始]の確かめが同じ物を使う */
|
|
7245
7245
|
function sourceOwnerRow(r) {
|
|
7246
|
+
// 許可し直しの口が使えない画面(栓が切・選ぶ受け口でない)では、人の行の印を外して今の文のまま(押せないボタンを名指さない・cortex-engine #3420)
|
|
7247
|
+
if (r && r.ownerKind === "person" && !(intakeKindOpen("drive") && googleConfirmReady() && googlePickOn())) {
|
|
7248
|
+
var plain = {};
|
|
7249
|
+
for (var pf in r) if (Object.prototype.hasOwnProperty.call(r, pf) && pf !== "ownerKind" && pf !== "ownerMine") plain[pf] = r[pf];
|
|
7250
|
+
r = plain;
|
|
7251
|
+
}
|
|
7246
7252
|
if (!sourceOwnerPending(r)) return r;
|
|
7247
7253
|
var out = {};
|
|
7248
7254
|
for (var f in r) if (Object.prototype.hasOwnProperty.call(r, f)) out[f] = r[f];
|
|
@@ -7342,6 +7348,8 @@ const CLIENT_JS = `
|
|
|
7342
7348
|
};
|
|
7343
7349
|
if (intentNow()) start.intent = intent;
|
|
7344
7350
|
if (nestedIds.length && opts.kind === "drive") start.confirmNestedIds = nestedIds.slice();
|
|
7351
|
+
// 許可し直し(cortex-engine #3420): 棚に許可が残っていても、人の許可の承認をもう一度挟む
|
|
7352
|
+
if (opts.regrant === true) start.regrant = true;
|
|
7345
7353
|
if (opts.pick === true) {
|
|
7346
7354
|
start.pick = true;
|
|
7347
7355
|
if (Array.isArray(opts.ids)) start.ids = opts.ids;
|
|
@@ -7547,6 +7555,33 @@ const CLIENT_JS = `
|
|
|
7547
7555
|
// note: 語 owner_unconfirmed の文が言わない訳(共有ドライブの一番上の行の「直下を選ぶ」)だけ。ほかは空(理由の箱と繰り返さない)
|
|
7548
7556
|
return { btn: btn, msg: msg, why: words.why, note: words === GOOGLE_VERIFY_WORDS.driveTop ? words.why : "", setLocked: setLocked };
|
|
7549
7557
|
}
|
|
7558
|
+
/**
|
|
7559
|
+
* 持ち主が人の Drive の行で、許可が切れた・開けなくなった時の[Google で許可し直す](cortex-engine #3420)。押せるのは持ち主だけ(行の ownerMine)。
|
|
7560
|
+
* 押すと人の許可の承認を挟み直し(regrant)、同じフォルダを選び直す。選べたら、その行の確かめ([接続を確認]と同じ口)を自分で走らせる
|
|
7561
|
+
* (選び直しは新しい行を足さないので、受け口は確かめを返さない)。確認済みの行にも出す(googleVerifyAction は確認済みの行に出さない)
|
|
7562
|
+
*/
|
|
7563
|
+
function googleRegrantAction(r, btnClass, label) {
|
|
7564
|
+
if (!r || r.kind !== "drive" || !intakeKindOpen("drive") || !googleConfirmReady() || !googlePickOn()) return null;
|
|
7565
|
+
var msg = el("div", { class: "ds-toggle-msg src-gverify-msg" });
|
|
7566
|
+
var btn = el("button", { class: btnClass, type: "button", text: label, "data-src-act": "google-regrant" });
|
|
7567
|
+
var locked = false;
|
|
7568
|
+
btn.addEventListener("click", async function () {
|
|
7569
|
+
if (locked) return;
|
|
7570
|
+
btn.disabled = true;
|
|
7571
|
+
msg.className = "ds-toggle-msg src-gverify-msg";
|
|
7572
|
+
msg.textContent = "Google の画面で許可してください…";
|
|
7573
|
+
var res = await openGoogleConfirm({ kind: "drive", mode: "confirm", id: r.ref, url: r.ref, pick: true, top: false, ids: [r.ref], regrant: true });
|
|
7574
|
+
btn.disabled = locked;
|
|
7575
|
+
msg.className = "ds-toggle-msg src-gverify-msg" + (res.ok ? " is-ok" : " is-error");
|
|
7576
|
+
msg.textContent = (res.ok ? "✓ " : "✗ ") + res.message;
|
|
7577
|
+
if (res.ok) {
|
|
7578
|
+
afterGoogleConfirm();
|
|
7579
|
+
sourceCheck(r);
|
|
7580
|
+
}
|
|
7581
|
+
});
|
|
7582
|
+
function setLocked(v) { locked = !!v; btn.disabled = locked; }
|
|
7583
|
+
return { btn: btn, msg: msg, setLocked: setLocked };
|
|
7584
|
+
}
|
|
7550
7585
|
/** 今ある行の「未確認」の印と[確認する](確認済みの行には何も足さない・期限で外さない) */
|
|
7551
7586
|
function appendGoogleVerifyUi(row, kind, id) {
|
|
7552
7587
|
// 組織の受け口は Google の接続先を受けない(確認の結果を保存する口が閉じている)
|
|
@@ -7801,6 +7836,8 @@ var SOURCE_ROW_TOOLS = ${JSON.stringify(source_rows_1.SOURCE_ROW_TOOLS)};
|
|
|
7801
7836
|
// 訳の語の表(cortex-engine #3142)。行の理由の文と足す時の断りの 1 行は、ここから出す(束ねた原本の表と関数をそのまま流す・写さない)
|
|
7802
7837
|
var CONNECTION_WORDS = ${JSON.stringify(source_rows_1.CONNECTION_WORDS)};
|
|
7803
7838
|
var WORD_TOOL_NOUNS = ${JSON.stringify(source_rows_1.WORD_TOOL_NOUNS)};
|
|
7839
|
+
var PERSON_ROW_WORDS = ${JSON.stringify(source_rows_1.PERSON_ROW_WORDS)};
|
|
7840
|
+
var PERSON_REGRANT_BUTTON = ${JSON.stringify(source_rows_1.PERSON_REGRANT_BUTTON)};
|
|
7804
7841
|
var SOURCE_ROW_ACTS = ${JSON.stringify(source_rows_1.SOURCE_ROW_ACTS)};
|
|
7805
7842
|
var SOURCE_STEP_MARKS = ${JSON.stringify(source_rows_1.SOURCE_STEP_MARKS)};
|
|
7806
7843
|
${source_rows_1.connectionWordLines.toString()}
|
|
@@ -19817,7 +19854,14 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
19817
19854
|
// 持ち主の確かめは、人の確認が済んでいない行(sourceOwnerPending・門が掛かる時だけ)に、[Google で確認する]を行の右のボタン群に 1 つ(外すの左・便 S44-5d の直し 2)。
|
|
19818
19855
|
// 札は「要対応」の 1 つ・文は語 owner_unconfirmed(「接続OK」と「確認がまだ」を同時に出さない・cortex-engine #3142)。強いボタンはこれ 1 つ。
|
|
19819
19856
|
// 古い「未確認」の札と[確認する](gc-verify-row)は組み直したプロジェクトの行に出さない
|
|
19820
|
-
|
|
19857
|
+
// 持ち主が人の行の[Google で許可し直す](持ち主だけ・cortex-engine #3420)。出る行は[Google で選び直す]を置き換える(押す先は同じ選ぶ流れ)
|
|
19858
|
+
var regrant = open && v.regrant === "button" ? googleRegrantAction(r, "src-btn is-strong", v.regrantText) : null;
|
|
19859
|
+
if (regrant) {
|
|
19860
|
+
regrant.setLocked(busy || saving);
|
|
19861
|
+
var outBtn2 = acts.querySelector('[data-src-act="remove"]');
|
|
19862
|
+
if (outBtn2) acts.insertBefore(regrant.btn, outBtn2); else acts.appendChild(regrant.btn);
|
|
19863
|
+
}
|
|
19864
|
+
var gverify = open && !regrant && sourceOwnerPending(r) && !(v.regrant) ? googleVerifyAction(r.kind, r.ref, "src-btn" + (v.ownerStrong ? " is-strong" : "")) : null;
|
|
19821
19865
|
if (gverify) {
|
|
19822
19866
|
gverify.setLocked(busy || saving);
|
|
19823
19867
|
var outBtn = acts.querySelector('[data-src-act="remove"]');
|
|
@@ -19854,6 +19898,7 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
|
|
|
19854
19898
|
if (SOURCE_KEY_NOTES[key]) item.appendChild(el("div", { class: "ds-toggle-msg is-ok src-key-note", text: SOURCE_KEY_NOTES[key] }));
|
|
19855
19899
|
if (SOURCE_NOTES[key]) item.appendChild(el("div", { class: "ds-toggle-msg is-error", text: SOURCE_NOTES[key] }));
|
|
19856
19900
|
if (gverify) item.appendChild(gverify.msg);
|
|
19901
|
+
if (regrant) item.appendChild(regrant.msg);
|
|
19857
19902
|
if (saving) item.appendChild(el("div", { class: "ds-toggle-msg ds-config-saving", text: "保存中…" }));
|
|
19858
19903
|
var note = saving ? null : configNoteEl(key);
|
|
19859
19904
|
if (note) item.appendChild(note);
|
package/dist/source-rows.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - 理由の文・次の一手は訳の語の表(tools `infra/lambda/shared/connection-words.mjs`・仕様書 `docs/connection-experience-spec.md` §4)から出す
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_TILE_WORDS = exports.SOURCE_INGEST_NONE = exports.SOURCE_INGEST_HEAD = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_STEP_MARKS = exports.SOURCE_ROW_ACTS = exports.connectionWordLines = exports.WORD_TOOL_NOUNS = exports.CONNECTION_WORDS = exports.SOURCE_JOIN_STEPS = exports.SOURCE_ROW_TOOLS = exports.SOURCE_MEMORY_OFF_NOTE = exports.SOURCE_ADD_NOT_YET_TEXT = exports.SOURCE_ADD_OK_TEXT = void 0;
|
|
14
|
+
exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_TILE_WORDS = exports.SOURCE_INGEST_NONE = exports.SOURCE_INGEST_HEAD = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_STEP_MARKS = exports.SOURCE_ROW_ACTS = exports.connectionWordLines = exports.WORD_TOOL_NOUNS = exports.PERSON_REGRANT_BUTTON = exports.PERSON_ROW_WORDS = exports.CONNECTION_WORDS = exports.SOURCE_JOIN_STEPS = exports.SOURCE_ROW_TOOLS = exports.SOURCE_MEMORY_OFF_NOTE = exports.SOURCE_ADD_NOT_YET_TEXT = exports.SOURCE_ADD_OK_TEXT = void 0;
|
|
15
15
|
exports.sourceReasonLines = sourceReasonLines;
|
|
16
16
|
exports.sourceWordConnects = sourceWordConnects;
|
|
17
17
|
exports.sourceAddWordLines = sourceAddWordLines;
|
|
@@ -55,10 +55,12 @@ exports.SOURCE_JOIN_STEPS = SOURCE_JOIN_STEPS;
|
|
|
55
55
|
* 画面へは表を `JSON.stringify`・`connectionWordLines` を `toString()` で流す(render.ts)。名詞は `SOURCE_ROW_TOOLS` + 語の表の `WORD_TOOL_NOUNS`(鍵は `tool`)
|
|
56
56
|
*/
|
|
57
57
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
58
|
-
const { CONNECTION_WORDS, WORD_TOOL_NOUNS, connectionWordLines } = require("./engine/connection-words");
|
|
58
|
+
const { CONNECTION_WORDS, WORD_TOOL_NOUNS, connectionWordLines, PERSON_ROW_WORDS, PERSON_REGRANT_BUTTON } = require("./engine/connection-words");
|
|
59
59
|
exports.CONNECTION_WORDS = CONNECTION_WORDS;
|
|
60
60
|
exports.WORD_TOOL_NOUNS = WORD_TOOL_NOUNS;
|
|
61
61
|
exports.connectionWordLines = connectionWordLines;
|
|
62
|
+
exports.PERSON_ROW_WORDS = PERSON_ROW_WORDS;
|
|
63
|
+
exports.PERSON_REGRANT_BUTTON = PERSON_REGRANT_BUTTON;
|
|
62
64
|
/** 一手の押す物のうち、行のボタンにある物(強くする候補) */
|
|
63
65
|
const SOURCE_ROW_ACTS = ["check", "key", "owner"];
|
|
64
66
|
exports.SOURCE_ROW_ACTS = SOURCE_ROW_ACTS;
|
|
@@ -414,9 +416,19 @@ function sourceRowView(row, busy, nowMs, copies) {
|
|
|
414
416
|
let strong = null;
|
|
415
417
|
let gap = "";
|
|
416
418
|
let connect = false;
|
|
417
|
-
|
|
419
|
+
// 持ち主が人の Drive の行で、許可が切れた・フォルダを開けなくなった時(cortex-engine #3420)。文は行の持ち主に向け、押せるのは持ち主だけ
|
|
420
|
+
// 人の確認が済んでいない印(ownerPending)の行は理由を持たない(画面が足す印)ので、語は owner_unconfirmed として引く
|
|
421
|
+
const personReason = r.ownerPending === true && !r.reason ? "owner_unconfirmed" : String(r.reason || "");
|
|
422
|
+
const personWord = r.ownerKind === "person" && facts.state === "user" && Object.prototype.hasOwnProperty.call(PERSON_ROW_WORDS, personReason) ? PERSON_ROW_WORDS[personReason] : null;
|
|
423
|
+
const regrant = personWord ? (r.ownerMine === true ? "button" : "ask") : null;
|
|
424
|
+
const owner = !personWord && r.ownerPending === true && facts.state === "user";
|
|
418
425
|
const shown = facts.state === "user" || facts.state === "cortex";
|
|
419
|
-
if (
|
|
426
|
+
if (personWord) {
|
|
427
|
+
why = personWord.why;
|
|
428
|
+
next = (regrant === "button" ? personWord.mine : personWord.other).split("{confirm}").join(PERSON_REGRANT_BUTTON);
|
|
429
|
+
gap = sourceReasonLines(r.kind, "unreadable", "user", "", nowMs).gap;
|
|
430
|
+
}
|
|
431
|
+
else if (shown) {
|
|
420
432
|
const l = sourceReasonLines(r.kind, owner ? "owner_unconfirmed" : String(r.reason || ""), facts.state, owner ? "" : typeof r.detail === "string" ? r.detail : "", nowMs, owner && typeof r.ownerConfirm === "string" ? r.ownerConfirm : undefined);
|
|
421
433
|
why = l.why;
|
|
422
434
|
next = l.next;
|
|
@@ -443,7 +455,7 @@ function sourceRowView(row, busy, nowMs, copies) {
|
|
|
443
455
|
const copyVal = copyKey && copies && typeof copies[copyKey] === "string" ? copies[copyKey] : "";
|
|
444
456
|
const st = copyKey && Object.prototype.hasOwnProperty.call(SOURCE_JOIN_STEPS, copyKey) ? SOURCE_JOIN_STEPS[copyKey] : null;
|
|
445
457
|
const steps = shown && !owner && next && r.reason === "not_member" && copyVal && st ? [st.before, { copy: copyVal }, st.after] : null;
|
|
446
|
-
return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, connect: connect, detail: shown && !owner && typeof r.detail === "string" ? r.detail : "", ownerStrong: strong === "owner", steps: steps };
|
|
458
|
+
return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, connect: connect, detail: shown && !owner && !personWord && typeof r.detail === "string" ? r.detail : "", ownerStrong: strong === "owner", regrant: regrant, regrantText: PERSON_REGRANT_BUTTON, steps: steps };
|
|
447
459
|
}
|
|
448
460
|
/**
|
|
449
461
|
* 会議のまとまりの頭(画面 9)。会議は行にしない。状態のかたまりと、要対応・Cortex 側で対応中のときは理由と次にすること、待てば直る時は語の文を 1 文。ボタンは無い。
|
package/package.json
CHANGED