chukyo-sdk 0.1.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 +227 -0
- package/dist/cjs/albo/client.js +133 -0
- package/dist/cjs/albo/index.js +55 -0
- package/dist/cjs/albo/parser/albo.js +110 -0
- package/dist/cjs/albo/types/albo.js +351 -0
- package/dist/cjs/albo/types/alboCalendar.js +51 -0
- package/dist/cjs/albo/types/alboCommon.js +55 -0
- package/dist/cjs/albo/types/alboInformation.js +136 -0
- package/dist/cjs/albo/types/alboMenu.js +92 -0
- package/dist/cjs/albo/types/alboQuestionnaire.js +229 -0
- package/dist/cjs/albo/types/alboSharedItem.js +137 -0
- package/dist/cjs/albo/types/alboSystem.js +103 -0
- package/dist/cjs/albo/types/alboUniversalForm.js +51 -0
- package/dist/cjs/common/dom.js +137 -0
- package/dist/cjs/common/utils.js +29 -0
- package/dist/cjs/constants.js +127 -0
- package/dist/cjs/core/request.js +39 -0
- package/dist/cjs/cubics/client.js +49 -0
- package/dist/cjs/cubics/index.js +22 -0
- package/dist/cjs/cubics/parser/cubics.js +103 -0
- package/dist/cjs/cubics/types/cubics.js +90 -0
- package/dist/cjs/errors.js +55 -0
- package/dist/cjs/index.js +50 -0
- package/dist/cjs/manabo/client.js +135 -0
- package/dist/cjs/manabo/index.js +44 -0
- package/dist/cjs/manabo/parser/manaboClass.js +386 -0
- package/dist/cjs/manabo/parser/manaboEntry.js +38 -0
- package/dist/cjs/manabo/parser/manaboMail.js +153 -0
- package/dist/cjs/manabo/parser/manaboNews.js +26 -0
- package/dist/cjs/manabo/parser/manaboTimetable.js +93 -0
- package/dist/cjs/manabo/types/manaboClass.js +223 -0
- package/dist/cjs/manabo/types/manaboEntry.js +43 -0
- package/dist/cjs/manabo/types/manaboMail.js +117 -0
- package/dist/cjs/manabo/types/manaboNews.js +20 -0
- package/dist/cjs/manabo/types/manaboTimetable.js +79 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/shib/builder.js +239 -0
- package/dist/cjs/shib/index.js +32 -0
- package/dist/cjs/shib/parser/shibLogin.js +138 -0
- package/dist/cjs/shib/parser/shibUser.js +51 -0
- package/dist/cjs/shib/types/common.js +2 -0
- package/dist/cjs/shib/types/shibLogin.js +92 -0
- package/dist/cjs/shib/types/shibUser.js +44 -0
- package/dist/cjs/transports/fetch.js +84 -0
- package/dist/cjs/types.js +9 -0
- package/dist/esm/albo/client.d.ts +80 -0
- package/dist/esm/albo/client.d.ts.map +1 -0
- package/dist/esm/albo/client.js +129 -0
- package/dist/esm/albo/index.d.ts +12 -0
- package/dist/esm/albo/index.d.ts.map +1 -0
- package/dist/esm/albo/index.js +11 -0
- package/dist/esm/albo/parser/albo.d.ts +69 -0
- package/dist/esm/albo/parser/albo.d.ts.map +1 -0
- package/dist/esm/albo/parser/albo.js +84 -0
- package/dist/esm/albo/types/albo.d.ts +460 -0
- package/dist/esm/albo/types/albo.d.ts.map +1 -0
- package/dist/esm/albo/types/albo.js +348 -0
- package/dist/esm/albo/types/alboCalendar.d.ts +58 -0
- package/dist/esm/albo/types/alboCalendar.d.ts.map +1 -0
- package/dist/esm/albo/types/alboCalendar.js +48 -0
- package/dist/esm/albo/types/alboCommon.d.ts +52 -0
- package/dist/esm/albo/types/alboCommon.d.ts.map +1 -0
- package/dist/esm/albo/types/alboCommon.js +51 -0
- package/dist/esm/albo/types/alboInformation.d.ts +214 -0
- package/dist/esm/albo/types/alboInformation.d.ts.map +1 -0
- package/dist/esm/albo/types/alboInformation.js +133 -0
- package/dist/esm/albo/types/alboMenu.d.ts +114 -0
- package/dist/esm/albo/types/alboMenu.d.ts.map +1 -0
- package/dist/esm/albo/types/alboMenu.js +89 -0
- package/dist/esm/albo/types/alboQuestionnaire.d.ts +442 -0
- package/dist/esm/albo/types/alboQuestionnaire.d.ts.map +1 -0
- package/dist/esm/albo/types/alboQuestionnaire.js +226 -0
- package/dist/esm/albo/types/alboSharedItem.d.ts +205 -0
- package/dist/esm/albo/types/alboSharedItem.d.ts.map +1 -0
- package/dist/esm/albo/types/alboSharedItem.js +134 -0
- package/dist/esm/albo/types/alboSystem.d.ts +129 -0
- package/dist/esm/albo/types/alboSystem.d.ts.map +1 -0
- package/dist/esm/albo/types/alboSystem.js +100 -0
- package/dist/esm/albo/types/alboUniversalForm.d.ts +63 -0
- package/dist/esm/albo/types/alboUniversalForm.d.ts.map +1 -0
- package/dist/esm/albo/types/alboUniversalForm.js +48 -0
- package/dist/esm/common/dom.d.ts +35 -0
- package/dist/esm/common/dom.d.ts.map +1 -0
- package/dist/esm/common/dom.js +120 -0
- package/dist/esm/common/utils.d.ts +15 -0
- package/dist/esm/common/utils.d.ts.map +1 -0
- package/dist/esm/common/utils.js +22 -0
- package/dist/esm/constants.d.ts +113 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +124 -0
- package/dist/esm/core/request.d.ts +29 -0
- package/dist/esm/core/request.d.ts.map +1 -0
- package/dist/esm/core/request.js +33 -0
- package/dist/esm/cubics/client.d.ts +13 -0
- package/dist/esm/cubics/client.d.ts.map +1 -0
- package/dist/esm/cubics/client.js +45 -0
- package/dist/esm/cubics/index.d.ts +4 -0
- package/dist/esm/cubics/index.d.ts.map +1 -0
- package/dist/esm/cubics/index.js +3 -0
- package/dist/esm/cubics/parser/cubics.d.ts +8 -0
- package/dist/esm/cubics/parser/cubics.d.ts.map +1 -0
- package/dist/esm/cubics/parser/cubics.js +99 -0
- package/dist/esm/cubics/types/cubics.d.ts +94 -0
- package/dist/esm/cubics/types/cubics.d.ts.map +1 -0
- package/dist/esm/cubics/types/cubics.js +87 -0
- package/dist/esm/errors.d.ts +46 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +46 -0
- package/dist/esm/index.d.ts +19 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +25 -0
- package/dist/esm/manabo/client.d.ts +75 -0
- package/dist/esm/manabo/client.d.ts.map +1 -0
- package/dist/esm/manabo/client.js +131 -0
- package/dist/esm/manabo/index.d.ts +12 -0
- package/dist/esm/manabo/index.d.ts.map +1 -0
- package/dist/esm/manabo/index.js +11 -0
- package/dist/esm/manabo/parser/manaboClass.d.ts +9 -0
- package/dist/esm/manabo/parser/manaboClass.d.ts.map +1 -0
- package/dist/esm/manabo/parser/manaboClass.js +377 -0
- package/dist/esm/manabo/parser/manaboEntry.d.ts +8 -0
- package/dist/esm/manabo/parser/manaboEntry.d.ts.map +1 -0
- package/dist/esm/manabo/parser/manaboEntry.js +33 -0
- package/dist/esm/manabo/parser/manaboMail.d.ts +8 -0
- package/dist/esm/manabo/parser/manaboMail.d.ts.map +1 -0
- package/dist/esm/manabo/parser/manaboMail.js +145 -0
- package/dist/esm/manabo/parser/manaboNews.d.ts +7 -0
- package/dist/esm/manabo/parser/manaboNews.d.ts.map +1 -0
- package/dist/esm/manabo/parser/manaboNews.js +22 -0
- package/dist/esm/manabo/parser/manaboTimetable.d.ts +4 -0
- package/dist/esm/manabo/parser/manaboTimetable.d.ts.map +1 -0
- package/dist/esm/manabo/parser/manaboTimetable.js +89 -0
- package/dist/esm/manabo/types/manaboClass.d.ts +294 -0
- package/dist/esm/manabo/types/manaboClass.d.ts.map +1 -0
- package/dist/esm/manabo/types/manaboClass.js +220 -0
- package/dist/esm/manabo/types/manaboEntry.d.ts +24 -0
- package/dist/esm/manabo/types/manaboEntry.d.ts.map +1 -0
- package/dist/esm/manabo/types/manaboEntry.js +40 -0
- package/dist/esm/manabo/types/manaboMail.d.ts +103 -0
- package/dist/esm/manabo/types/manaboMail.d.ts.map +1 -0
- package/dist/esm/manabo/types/manaboMail.js +114 -0
- package/dist/esm/manabo/types/manaboNews.d.ts +15 -0
- package/dist/esm/manabo/types/manaboNews.d.ts.map +1 -0
- package/dist/esm/manabo/types/manaboNews.js +17 -0
- package/dist/esm/manabo/types/manaboTimetable.d.ts +88 -0
- package/dist/esm/manabo/types/manaboTimetable.d.ts.map +1 -0
- package/dist/esm/manabo/types/manaboTimetable.js +76 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/shib/builder.d.ts +154 -0
- package/dist/esm/shib/builder.d.ts.map +1 -0
- package/dist/esm/shib/builder.js +212 -0
- package/dist/esm/shib/index.d.ts +15 -0
- package/dist/esm/shib/index.d.ts.map +1 -0
- package/dist/esm/shib/index.js +14 -0
- package/dist/esm/shib/parser/shibLogin.d.ts +47 -0
- package/dist/esm/shib/parser/shibLogin.d.ts.map +1 -0
- package/dist/esm/shib/parser/shibLogin.js +127 -0
- package/dist/esm/shib/parser/shibUser.d.ts +11 -0
- package/dist/esm/shib/parser/shibUser.d.ts.map +1 -0
- package/dist/esm/shib/parser/shibUser.js +46 -0
- package/dist/esm/shib/types/common.d.ts +20 -0
- package/dist/esm/shib/types/common.d.ts.map +1 -0
- package/dist/esm/shib/types/common.js +1 -0
- package/dist/esm/shib/types/shibLogin.d.ts +62 -0
- package/dist/esm/shib/types/shibLogin.d.ts.map +1 -0
- package/dist/esm/shib/types/shibLogin.js +89 -0
- package/dist/esm/shib/types/shibUser.d.ts +36 -0
- package/dist/esm/shib/types/shibUser.d.ts.map +1 -0
- package/dist/esm/shib/types/shibUser.js +41 -0
- package/dist/esm/transports/fetch.d.ts +36 -0
- package/dist/esm/transports/fetch.d.ts.map +1 -0
- package/dist/esm/transports/fetch.js +80 -0
- package/dist/esm/types.d.ts +71 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +8 -0
- package/package.json +72 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseManaboMailMember = exports.parseManaboMailSend = exports.parseManaboMailView = exports.parseManaboSentMail = exports.parseManaboReceivedMail = void 0;
|
|
4
|
+
const dom_1 = require("../../common/dom");
|
|
5
|
+
const utils_1 = require("../../common/utils");
|
|
6
|
+
const manaboMail_1 = require("../types/manaboMail");
|
|
7
|
+
const collectTextExcluding = (nodes, exclude) => (0, utils_1.normalizeWhitespace)(nodes
|
|
8
|
+
.filter((node) => !exclude(node))
|
|
9
|
+
.map((node) => (0, dom_1.getTextContent)(node))
|
|
10
|
+
.join(" "));
|
|
11
|
+
const extractPagination = (document) => {
|
|
12
|
+
const summaryElement = (0, dom_1.queryOne)(".row.margin-top-md .col-sm-2", document);
|
|
13
|
+
const summaryText = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(summaryElement));
|
|
14
|
+
const pages = (0, dom_1.queryAll)("ul.pagination li", document)
|
|
15
|
+
.map((li) => {
|
|
16
|
+
const anchor = (0, dom_1.queryOne)("a", li);
|
|
17
|
+
const labelSource = anchor ?? (0, dom_1.queryOne)("span", li);
|
|
18
|
+
const label = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(labelSource));
|
|
19
|
+
return {
|
|
20
|
+
label,
|
|
21
|
+
page: anchor ? ((0, dom_1.getAttribute)(anchor, "page") ?? label) : label,
|
|
22
|
+
active: (anchor ? (0, dom_1.elementHasClass)(anchor, "active") : false) || (0, dom_1.elementHasClass)(li, "active"),
|
|
23
|
+
};
|
|
24
|
+
})
|
|
25
|
+
.filter((page) => page.label.length > 0);
|
|
26
|
+
return { summary: summaryText.length ? summaryText : null, pages };
|
|
27
|
+
};
|
|
28
|
+
const parseManaboReceivedMail = (html) => {
|
|
29
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
30
|
+
const { summary, pages } = extractPagination(document);
|
|
31
|
+
const mails = (0, dom_1.queryAll)("table.table-default tbody tr", document).map((row) => {
|
|
32
|
+
const cells = (0, dom_1.queryAll)("td", row);
|
|
33
|
+
const checkbox = (0, dom_1.queryOne)('input[type="checkbox"]', row);
|
|
34
|
+
const mailId = (0, dom_1.getAttribute)(checkbox, "value") ?? (0, dom_1.getAttribute)(checkbox, "name") ?? "";
|
|
35
|
+
const titleAnchor = (0, dom_1.queryOne)("td.title a.a-mail-view", row);
|
|
36
|
+
const statusIcon = (0, dom_1.queryOne)("td.title img.icon", row);
|
|
37
|
+
const senderCell = cells[2];
|
|
38
|
+
const senderImage = (0, dom_1.getAttribute)((0, dom_1.queryOne)("img", senderCell), "src");
|
|
39
|
+
const humanSender = (0, dom_1.queryOne)("span.margin-left-sm", senderCell);
|
|
40
|
+
const classSender = (0, dom_1.queryOne)("a", senderCell);
|
|
41
|
+
const senderName = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(humanSender ?? classSender));
|
|
42
|
+
const receivedAt = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[3] ?? null));
|
|
43
|
+
const statusAltRaw = (0, utils_1.normalizeWhitespace)((0, dom_1.getAttribute)(statusIcon, "alt") ?? "");
|
|
44
|
+
return {
|
|
45
|
+
id: mailId,
|
|
46
|
+
title: (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(titleAnchor)),
|
|
47
|
+
statusIconAlt: statusAltRaw.length ? statusAltRaw : null,
|
|
48
|
+
statusIconSrc: (0, dom_1.getAttribute)(statusIcon, "src"),
|
|
49
|
+
mailLink: (0, dom_1.getAttribute)(titleAnchor, "href"),
|
|
50
|
+
senderName: senderName.length ? senderName : null,
|
|
51
|
+
senderImage,
|
|
52
|
+
receivedAt,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return manaboMail_1.ManaboReceivedMailSchema.safeParse({ summary, pages, mails });
|
|
56
|
+
};
|
|
57
|
+
exports.parseManaboReceivedMail = parseManaboReceivedMail;
|
|
58
|
+
const parseManaboSentMail = (html) => {
|
|
59
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
60
|
+
const summaryRaw = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)(".row.margin-top-md .col-sm-2", document)));
|
|
61
|
+
const mails = (0, dom_1.queryAll)("table.table-default tbody tr", document).map((row) => {
|
|
62
|
+
const cells = (0, dom_1.queryAll)("td", row);
|
|
63
|
+
const checkbox = (0, dom_1.queryOne)('input[type="checkbox"]', row);
|
|
64
|
+
const mailId = (0, dom_1.getAttribute)(checkbox, "value") ?? (0, dom_1.getAttribute)(checkbox, "name") ?? "";
|
|
65
|
+
const titleCell = cells[1];
|
|
66
|
+
const titleAnchor = (0, dom_1.queryOne)("a.a-mail-view", titleCell);
|
|
67
|
+
const statusIcon = (0, dom_1.queryOne)("img.icon", titleCell);
|
|
68
|
+
const recipientCell = cells[2];
|
|
69
|
+
const recipientImage = (0, dom_1.getAttribute)((0, dom_1.queryOne)("img", recipientCell), "src");
|
|
70
|
+
const humanSender = (0, dom_1.queryOne)("span.margin-left-sm", recipientCell);
|
|
71
|
+
const classSender = (0, dom_1.queryOne)("a", recipientCell);
|
|
72
|
+
const recipientName = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(humanSender ?? classSender));
|
|
73
|
+
const sentAt = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[3] ?? null));
|
|
74
|
+
const unreadCountRaw = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[4] ?? null));
|
|
75
|
+
const unreadCount = Number(unreadCountRaw.replace(/[^\d]/g, "")) || 0;
|
|
76
|
+
const statusAltRaw = (0, utils_1.normalizeWhitespace)((0, dom_1.getAttribute)(statusIcon, "alt") ?? "");
|
|
77
|
+
return {
|
|
78
|
+
id: mailId,
|
|
79
|
+
title: (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(titleAnchor)),
|
|
80
|
+
statusIconAlt: statusAltRaw.length ? statusAltRaw : null,
|
|
81
|
+
statusIconSrc: (0, dom_1.getAttribute)(statusIcon, "src"),
|
|
82
|
+
mailLink: (0, dom_1.getAttribute)(titleAnchor, "href"),
|
|
83
|
+
recipientName: recipientName.length ? recipientName : null,
|
|
84
|
+
recipientImage,
|
|
85
|
+
sentAt,
|
|
86
|
+
unreadCount,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
return manaboMail_1.ManaboSentMailSchema.safeParse({ summary: summaryRaw.length ? summaryRaw : null, mails });
|
|
90
|
+
};
|
|
91
|
+
exports.parseManaboSentMail = parseManaboSentMail;
|
|
92
|
+
const parseManaboMailView = (html) => {
|
|
93
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
94
|
+
const title = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)(".modal-title", document)));
|
|
95
|
+
const replyButton = (0, dom_1.queryOne)(".a-reply-mail", document);
|
|
96
|
+
const nextButton = (0, dom_1.queryOne)(".a-reopen-mail", document);
|
|
97
|
+
const senderBlocks = (0, dom_1.queryAll)(".modal-body .margin-top-lg", document);
|
|
98
|
+
const senderBlock = senderBlocks[0];
|
|
99
|
+
const bodyBlock = senderBlocks[1];
|
|
100
|
+
const senderImage = (0, dom_1.getAttribute)((0, dom_1.queryOne)("img", senderBlock), "src");
|
|
101
|
+
const senderName = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)("b", senderBlock)));
|
|
102
|
+
const sentAtRaw = senderBlock
|
|
103
|
+
? collectTextExcluding(senderBlock.children ?? [], (node) => {
|
|
104
|
+
if (!(0, dom_1.isElement)(node)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const name = node.name.toLowerCase();
|
|
108
|
+
return name === "a" || name === "script";
|
|
109
|
+
})
|
|
110
|
+
: "";
|
|
111
|
+
const sentAt = (0, utils_1.normalizeWhitespace)(sentAtRaw);
|
|
112
|
+
const bodyHtml = bodyBlock ? (0, dom_1.getInnerHtml)(bodyBlock).trim() : "";
|
|
113
|
+
return manaboMail_1.ManaboMailViewSchema.safeParse({
|
|
114
|
+
title,
|
|
115
|
+
replyMailId: (0, dom_1.getAttribute)(replyButton, "reply_mail_id"),
|
|
116
|
+
fromMemberId: (0, dom_1.getAttribute)(replyButton, "from_member_id"),
|
|
117
|
+
nextMailId: (0, dom_1.getAttribute)(nextButton, "mail_id"),
|
|
118
|
+
senderName,
|
|
119
|
+
senderImage,
|
|
120
|
+
sentAt,
|
|
121
|
+
bodyHtml,
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
exports.parseManaboMailView = parseManaboMailView;
|
|
125
|
+
const parseManaboMailSend = (html) => {
|
|
126
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
127
|
+
const modalTitle = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)(".modal-title", document)));
|
|
128
|
+
const form = (0, dom_1.queryOne)("#form-mail", document);
|
|
129
|
+
return manaboMail_1.ManaboMailSendSchema.safeParse({
|
|
130
|
+
modalTitle,
|
|
131
|
+
form: {
|
|
132
|
+
action: (0, dom_1.getAttribute)((0, dom_1.queryOne)('input[name="action"]', form), "value") ?? "",
|
|
133
|
+
replyMailId: (0, dom_1.getAttribute)((0, dom_1.queryOne)('input[name="reply_mail_id"]', form), "value"),
|
|
134
|
+
signature: (0, dom_1.getAttribute)((0, dom_1.queryOne)('input[name="signature"]', form), "value"),
|
|
135
|
+
csrfToken: (0, dom_1.getAttribute)((0, dom_1.queryOne)('input[name="csrf_token"]', form), "value") ?? "",
|
|
136
|
+
},
|
|
137
|
+
submitLabel: (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)(".button-send-mail", document))),
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
exports.parseManaboMailSend = parseManaboMailSend;
|
|
141
|
+
const parseManaboMailMember = (html) => {
|
|
142
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
143
|
+
const members = (0, dom_1.queryAll)(".div-mail-members li", document)
|
|
144
|
+
.map((item) => {
|
|
145
|
+
const anchor = (0, dom_1.queryOne)("a.a-set-mail-member", item);
|
|
146
|
+
const name = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(anchor));
|
|
147
|
+
const image = (0, dom_1.getAttribute)((0, dom_1.queryOne)("img", item), "src");
|
|
148
|
+
return { memberId: (0, dom_1.getAttribute)(anchor, "member_id") ?? "", name, image };
|
|
149
|
+
})
|
|
150
|
+
.filter((member) => member.memberId.length > 0);
|
|
151
|
+
return manaboMail_1.ManaboMailMemberSchema.safeParse({ members });
|
|
152
|
+
};
|
|
153
|
+
exports.parseManaboMailMember = parseManaboMailMember;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseManaboNews = void 0;
|
|
4
|
+
const dom_1 = require("../../common/dom");
|
|
5
|
+
const utils_1 = require("../../common/utils");
|
|
6
|
+
const manaboNews_1 = require("../types/manaboNews");
|
|
7
|
+
const parseManaboNews = (html) => {
|
|
8
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
9
|
+
const rows = (0, dom_1.queryAll)(".table-info tbody tr", document);
|
|
10
|
+
const items = [];
|
|
11
|
+
let message = null;
|
|
12
|
+
rows.forEach((row) => {
|
|
13
|
+
const text = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(row));
|
|
14
|
+
if (!text.length) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if ((0, dom_1.queryOne)("a", row)) {
|
|
18
|
+
items.push({ text });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
message = text;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return manaboNews_1.ManaboNewsSchema.safeParse({ message, items });
|
|
25
|
+
};
|
|
26
|
+
exports.parseManaboNews = parseManaboNews;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseManaboTimetable = void 0;
|
|
4
|
+
const dom_1 = require("../../common/dom");
|
|
5
|
+
const utils_1 = require("../../common/utils");
|
|
6
|
+
const manaboTimetable_1 = require("../types/manaboTimetable");
|
|
7
|
+
const collectTextExcluding = (nodes, exclude) => (0, utils_1.normalizeWhitespace)(nodes
|
|
8
|
+
.filter((node) => !exclude(node))
|
|
9
|
+
.map((node) => (0, dom_1.getTextContent)(node))
|
|
10
|
+
.join(" "));
|
|
11
|
+
/** 「NEW」バッジ(`<a><small class="label label-danger">NEW</small></a>`)を包む `<a>` の href。無ければ null。 */
|
|
12
|
+
const findNewContentHref = (root) => {
|
|
13
|
+
const badge = (0, dom_1.queryOne)("small.label-danger", root);
|
|
14
|
+
if (!badge) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const wrappingAnchor = (0, dom_1.closest)(badge, "a");
|
|
18
|
+
return wrappingAnchor ? (0, dom_1.getAttribute)(wrappingAnchor, "href") : null;
|
|
19
|
+
};
|
|
20
|
+
const buildSlot = (cell, day) => {
|
|
21
|
+
const student = (0, dom_1.queryOne)("div.student", cell);
|
|
22
|
+
const anchor = student ? (0, dom_1.queryOne)("a", student) : null;
|
|
23
|
+
if (!student || !anchor) {
|
|
24
|
+
return { day, className: null, teacher: null, href: null, isNew: false, newContentHref: null };
|
|
25
|
+
}
|
|
26
|
+
const classNameElement = (0, dom_1.queryOne)("b", anchor);
|
|
27
|
+
const classNameText = (0, utils_1.normalizeWhitespace)(classNameElement ? (0, dom_1.getTextContent)(classNameElement) : "");
|
|
28
|
+
const teacherText = collectTextExcluding(anchor.children ?? [], (node) => {
|
|
29
|
+
if (!(0, dom_1.isElement)(node))
|
|
30
|
+
return false;
|
|
31
|
+
return node.name === "b" || node.name === "a" || (node.name === "small" && (0, dom_1.elementHasClass)(node, "label"));
|
|
32
|
+
});
|
|
33
|
+
const newContentHref = findNewContentHref(student);
|
|
34
|
+
return {
|
|
35
|
+
day,
|
|
36
|
+
className: classNameText.length ? classNameText : null,
|
|
37
|
+
teacher: teacherText.length ? teacherText : null,
|
|
38
|
+
href: (0, dom_1.getAttribute)(anchor, "href"),
|
|
39
|
+
isNew: newContentHref !== null,
|
|
40
|
+
newContentHref,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const buildPeriod = (row, days) => {
|
|
44
|
+
const period = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)("th.time", row)));
|
|
45
|
+
const cells = (0, dom_1.queryAll)("td", row);
|
|
46
|
+
const slots = cells.map((cell, index) => buildSlot(cell, days[index] ?? ""));
|
|
47
|
+
return { period, slots };
|
|
48
|
+
};
|
|
49
|
+
const buildOtherClass = (row) => {
|
|
50
|
+
const cells = (0, dom_1.queryAll)("td", row);
|
|
51
|
+
const student = (0, dom_1.queryOne)("span.student", cells[0] ?? undefined);
|
|
52
|
+
const classAnchor = student ? (0, dom_1.queryOne)("a", student) : null;
|
|
53
|
+
const className = (0, utils_1.normalizeWhitespace)(classAnchor ? (0, dom_1.getTextContent)(classAnchor) : "");
|
|
54
|
+
const newContentHref = student ? findNewContentHref(student) : null;
|
|
55
|
+
const dayPeriod = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[1]));
|
|
56
|
+
const teacher = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[2]));
|
|
57
|
+
const classroom = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(cells[3]));
|
|
58
|
+
return {
|
|
59
|
+
className,
|
|
60
|
+
href: classAnchor ? (0, dom_1.getAttribute)(classAnchor, "href") : null,
|
|
61
|
+
dayPeriod: dayPeriod.length ? dayPeriod : null,
|
|
62
|
+
teacher: teacher.length ? teacher : null,
|
|
63
|
+
classroom: classroom.length ? classroom : null,
|
|
64
|
+
isNew: newContentHref !== null,
|
|
65
|
+
newContentHref,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const parseManaboTimetable = (html) => {
|
|
69
|
+
const document = (0, dom_1.loadDocument)(html);
|
|
70
|
+
const title = (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)((0, dom_1.queryOne)("#time_table_name", document)));
|
|
71
|
+
const terms = (0, dom_1.queryAll)(".calendar .nav-tabs a.a-load-timetable[archive_id]", document).map((anchor) => {
|
|
72
|
+
const enclosingLi = (0, dom_1.closest)(anchor, "li");
|
|
73
|
+
return {
|
|
74
|
+
archiveId: (0, dom_1.getAttribute)(anchor, "archive_id") ?? "",
|
|
75
|
+
label: (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(anchor)),
|
|
76
|
+
active: (0, dom_1.elementHasClass)(anchor, "active") || (enclosingLi ? (0, dom_1.elementHasClass)(enclosingLi, "active") : false),
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
const viewModes = (0, dom_1.queryAll)(".panel-body .text-right a.a-load-timetable", document).map((anchor) => ({
|
|
80
|
+
archiveId: (0, dom_1.getAttribute)(anchor, "archive_id") ?? "",
|
|
81
|
+
mode: (0, dom_1.getAttribute)(anchor, "mode"),
|
|
82
|
+
label: (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(anchor)),
|
|
83
|
+
active: (0, dom_1.elementHasClass)(anchor, "active"),
|
|
84
|
+
}));
|
|
85
|
+
const table = (0, dom_1.queryOne)(".table-calendar", document);
|
|
86
|
+
const dayHeaders = table ? (0, dom_1.queryAll)("thead tr th.data", table) : [];
|
|
87
|
+
const days = dayHeaders.map((element) => (0, utils_1.normalizeWhitespace)((0, dom_1.getTextContent)(element)));
|
|
88
|
+
const periodRows = table ? (0, dom_1.queryAll)("tbody tr", table) : [];
|
|
89
|
+
const periods = periodRows.map((row) => buildPeriod(row, days));
|
|
90
|
+
const otherClasses = (0, dom_1.queryAll)(".other-class table tbody tr", document).map((row) => buildOtherClass(row));
|
|
91
|
+
return manaboTimetable_1.ManaboTimetableSchema.safeParse({ title, terms, viewModes, days, periods, otherClasses });
|
|
92
|
+
};
|
|
93
|
+
exports.parseManaboTimetable = parseManaboTimetable;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManaboClassQuizResultSchema = exports.ManaboClassQuizResultQuestionSchema = exports.ManaboClassSyllabusSchema = exports.ManaboClassSyllabusPlanItemSchema = exports.ManaboClassSyllabusReferenceSchema = exports.ManaboClassSyllabusTextbookSchema = exports.ManaboClassSyllabusEvaluationSchema = exports.ManaboClassNewsSchema = exports.ManaboClassNewsItemSchema = exports.ManaboClassEntrySchema = exports.ManaboClassEntryRowSchema = exports.ManaboClassContentSchema = exports.ManaboClassActivityContentSchema = exports.ManaboClassResourceContentSchema = exports.ManaboClassContentToggleAreaSchema = exports.ManaboClassContentContentSchema = exports.ManaboClassContentAttachedFileSchema = exports.ManaboClassContentActionSchema = exports.ManaboClassContentFileSchema = exports.ManaboClassContentDurationSchema = exports.ManaboClassContentIconSchema = exports.ManaboClassDirectorySchema = exports.ManaboClassDirectoryItemSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// manabo の授業ページ関連スキーマ群(ディレクトリ / 教材一覧 / 出席表 / お知らせ / シラバス / 小テスト結果)。
|
|
6
|
+
/** ディレクトリ(週・回)の 1 項目 */
|
|
7
|
+
exports.ManaboClassDirectoryItemSchema = zod_1.z.object({
|
|
8
|
+
/** ディレクトリ ID @example "123456" */
|
|
9
|
+
directoryId: zod_1.z.string().meta({ description: "ディレクトリ ID", example: "123456" }),
|
|
10
|
+
/** ディレクトリ名(例: "第1回 マージと分割統治法") @example "第1回 マージと分割統治法" */
|
|
11
|
+
title: zod_1.z.string().meta({ description: "ディレクトリ名", example: "第1回 マージと分割統治法" }),
|
|
12
|
+
});
|
|
13
|
+
/** 授業のディレクトリ一覧(左ペイン) */
|
|
14
|
+
exports.ManaboClassDirectorySchema = zod_1.z.object({
|
|
15
|
+
/** 授業 ID @example "85146" */
|
|
16
|
+
classId: zod_1.z.string().meta({ description: "授業 ID", example: "85146" }),
|
|
17
|
+
/** 授業名 @example "情報リテラシー" */
|
|
18
|
+
className: zod_1.z.string().meta({ description: "授業名", example: "情報リテラシー" }),
|
|
19
|
+
/** ディレクトリ一覧 */
|
|
20
|
+
directories: zod_1.z.array(exports.ManaboClassDirectoryItemSchema).meta({ description: "ディレクトリ一覧" }),
|
|
21
|
+
});
|
|
22
|
+
/** 教材行の先頭アイコン(種別+受講済み表示) */
|
|
23
|
+
exports.ManaboClassContentIconSchema = zod_1.z.object({
|
|
24
|
+
/** プラグインアイコンの src(パスで種別が分かる。例: /plugins/quiz/images/...) @example "/plugins/quiz/images/icon.png" */
|
|
25
|
+
pluginIconSrc: zod_1.z.string().meta({ description: "プラグインアイコンの src(パスで種別が分かる)", example: "/plugins/quiz/images/icon.png" }),
|
|
26
|
+
/** 受講済み(img-checked が付与されているか) @example false */
|
|
27
|
+
isIconChecked: zod_1.z.boolean().meta({ description: "受講済み(img-checked が付与されているか)", example: false }),
|
|
28
|
+
});
|
|
29
|
+
/** 期間・締切などのラベル/値ペア(例: 提出受付期間) */
|
|
30
|
+
exports.ManaboClassContentDurationSchema = zod_1.z.object({
|
|
31
|
+
/** ラベル(例: "提出受付期間:") @example "提出受付期間:" */
|
|
32
|
+
label: zod_1.z.string().meta({ description: "ラベル", example: "提出受付期間:" }),
|
|
33
|
+
/** 値(例: "~ 4月14日(月) 18:05") @example "~ 4月14日(月) 18:05" */
|
|
34
|
+
value: zod_1.z.string().meta({ description: "値", example: "~ 4月14日(月) 18:05" }),
|
|
35
|
+
});
|
|
36
|
+
/** 教材に添付されたファイル */
|
|
37
|
+
exports.ManaboClassContentFileSchema = zod_1.z.object({
|
|
38
|
+
/** ファイル名(例: "ソート問題.pdf") @example "ソート問題.pdf" */
|
|
39
|
+
fileName: zod_1.z.string().meta({ description: "ファイル名", example: "ソート問題.pdf" }),
|
|
40
|
+
/** ダウンロードリンク @example "/class/85146/content/download/1001" */
|
|
41
|
+
href: zod_1.z.string().meta({ description: "ダウンロードリンク", example: "/class/85146/content/download/1001" }),
|
|
42
|
+
/** ファイル種別アイコンの src(例: /common/images/icons/pdf.png) @example "/common/images/icons/pdf.png" */
|
|
43
|
+
icon: zod_1.z.string().meta({ description: "ファイル種別アイコンの src", example: "/common/images/icons/pdf.png" }),
|
|
44
|
+
});
|
|
45
|
+
/** 開閉エリア内のアクションボタン(受講/結果 等) */
|
|
46
|
+
exports.ManaboClassContentActionSchema = zod_1.z.object({
|
|
47
|
+
/** ボタン文言(例: "受講" / "結果") @example "受講" */
|
|
48
|
+
title: zod_1.z.string().meta({ description: "ボタン文言", example: "受講" }),
|
|
49
|
+
/** リンク先 @example "/class/85146/content/open/1001" */
|
|
50
|
+
href: zod_1.z.string().meta({ description: "リンク先", example: "/class/85146/content/open/1001" }),
|
|
51
|
+
});
|
|
52
|
+
/** 資料教材の中身(コメント+ファイル群+期間) */
|
|
53
|
+
exports.ManaboClassContentAttachedFileSchema = zod_1.z.object({
|
|
54
|
+
/** 説明コメント(HTML。details/summary 等を含む) @example "<p>配布資料です。</p>" */
|
|
55
|
+
comment: zod_1.z.string().meta({ description: "説明コメント(HTML)", example: "<p>配布資料です。</p>" }),
|
|
56
|
+
/** 添付ファイル一覧 */
|
|
57
|
+
files: zod_1.z.array(exports.ManaboClassContentFileSchema).meta({ description: "添付ファイル一覧" }),
|
|
58
|
+
/** 期間・締切ラベル群 */
|
|
59
|
+
duration: zod_1.z.array(exports.ManaboClassContentDurationSchema).meta({ description: "期間・締切ラベル群" }),
|
|
60
|
+
});
|
|
61
|
+
/** 受講型教材のタイトル部(クリックで開閉するリンク) */
|
|
62
|
+
exports.ManaboClassContentContentSchema = zod_1.z.object({
|
|
63
|
+
/** 教材タイトル @example "第1回 小テスト" */
|
|
64
|
+
title: zod_1.z.string().meta({ description: "教材タイトル", example: "第1回 小テスト" }),
|
|
65
|
+
/** コンテンツ ID(content_id) @example "1001" */
|
|
66
|
+
contentId: zod_1.z.string().meta({ description: "コンテンツ ID", example: "1001" }),
|
|
67
|
+
/** プラグイン種別("board" / "quiz" / "report" 等) @example "quiz" */
|
|
68
|
+
pluginKey: zod_1.z.string().meta({ description: "プラグイン種別", example: "quiz" }),
|
|
69
|
+
/** 期間・締切ラベル群 */
|
|
70
|
+
duration: zod_1.z.array(exports.ManaboClassContentDurationSchema).meta({ description: "期間・締切ラベル群" }),
|
|
71
|
+
});
|
|
72
|
+
/** 受講型教材の開閉エリア(説明と受講可否/アクション) */
|
|
73
|
+
exports.ManaboClassContentToggleAreaSchema = zod_1.z.object({
|
|
74
|
+
/** 説明本文(HTML) @example "<p>第1回の小テストです。</p>" */
|
|
75
|
+
description: zod_1.z.string().meta({ description: "説明本文(HTML)", example: "<p>第1回の小テストです。</p>" }),
|
|
76
|
+
/** 期限切れか(エラー表示から判定) @example false */
|
|
77
|
+
isExpired: zod_1.z.boolean().meta({ description: "期限切れか", example: false }),
|
|
78
|
+
/** まだ受講できない("まだ受講できません" 表示)か @example false */
|
|
79
|
+
isNotAvailableYet: zod_1.z.boolean().meta({ description: "まだ受講できないか", example: false }),
|
|
80
|
+
/** アクションボタン群 */
|
|
81
|
+
actions: zod_1.z.array(exports.ManaboClassContentActionSchema).meta({ description: "アクションボタン群" }),
|
|
82
|
+
});
|
|
83
|
+
/** 資料(ファイル添付)教材。plugin_key = "resource" 相当で、クリック開閉のない直接表示 */
|
|
84
|
+
exports.ManaboClassResourceContentSchema = zod_1.z.object({
|
|
85
|
+
/** 種別識別子(固定値 "resource") @example "resource" */
|
|
86
|
+
type: zod_1.z.literal("resource").meta({ description: "種別識別子", example: "resource" }),
|
|
87
|
+
icon: exports.ManaboClassContentIconSchema,
|
|
88
|
+
attachedFile: exports.ManaboClassContentAttachedFileSchema,
|
|
89
|
+
});
|
|
90
|
+
/** 受講型教材(board / quiz / report など)。開閉エリアに説明と受講/結果ボタンを持つ。実際の種別は content.pluginKey を参照 */
|
|
91
|
+
exports.ManaboClassActivityContentSchema = zod_1.z.object({
|
|
92
|
+
/** 種別識別子(固定値 "activity") @example "activity" */
|
|
93
|
+
type: zod_1.z.literal("activity").meta({ description: "種別識別子", example: "activity" }),
|
|
94
|
+
icon: exports.ManaboClassContentIconSchema,
|
|
95
|
+
content: exports.ManaboClassContentContentSchema,
|
|
96
|
+
toggleArea: exports.ManaboClassContentToggleAreaSchema,
|
|
97
|
+
});
|
|
98
|
+
/** 教材一覧(資料 or 受講型の判別ユニオン配列) */
|
|
99
|
+
exports.ManaboClassContentSchema = zod_1.z.object({
|
|
100
|
+
/** 教材の配列。type="resource"(資料)または type="activity"(受講型) */
|
|
101
|
+
contents: zod_1.z.array(zod_1.z.union([exports.ManaboClassResourceContentSchema, exports.ManaboClassActivityContentSchema])).meta({
|
|
102
|
+
description: "教材の配列。type=\"resource\"(資料)または type=\"activity\"(受講型)",
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
/** 出席表の 1 行 */
|
|
106
|
+
exports.ManaboClassEntryRowSchema = zod_1.z.object({
|
|
107
|
+
/** 対象ディレクトリ名(回) @example "第1回 マージと分割統治法" */
|
|
108
|
+
directory: zod_1.z.string().meta({ description: "対象ディレクトリ名(回)", example: "第1回 マージと分割統治法" }),
|
|
109
|
+
/** 講義日(未設定は null) @example "2025-04-14" */
|
|
110
|
+
lectureDate: zod_1.z.string().nullable().meta({ description: "講義日", example: "2025-04-14" }),
|
|
111
|
+
/** 出欠状態(例: "出席" / "欠席") @example "出席" */
|
|
112
|
+
status: zod_1.z.string().meta({ description: "出欠状態", example: "出席" }),
|
|
113
|
+
});
|
|
114
|
+
/** 出席表(出欠一覧) */
|
|
115
|
+
exports.ManaboClassEntrySchema = zod_1.z.object({
|
|
116
|
+
/** 出席行。出席表が無い場合は空配列 */
|
|
117
|
+
rows: zod_1.z.array(exports.ManaboClassEntryRowSchema).meta({ description: "出席行。出席表が無い場合は空配列" }),
|
|
118
|
+
});
|
|
119
|
+
/** 授業のお知らせ 1 件 */
|
|
120
|
+
exports.ManaboClassNewsItemSchema = zod_1.z.object({
|
|
121
|
+
/** DOM 上の id 属性(例: "class-news-238195") @example "class-news-238195" */
|
|
122
|
+
id: zod_1.z.string().nullable().meta({ description: "DOM 上の id 属性", example: "class-news-238195" }),
|
|
123
|
+
/** お知らせ ID(id から接頭辞を除いた数値部分。例: "238195") @example "238195" */
|
|
124
|
+
newsId: zod_1.z.string().nullable().meta({ description: "お知らせ ID(id から接頭辞を除いた数値部分)", example: "238195" }),
|
|
125
|
+
/** タイトル @example "レポート提出締切のお知らせ" */
|
|
126
|
+
title: zod_1.z.string().meta({ description: "タイトル", example: "レポート提出締切のお知らせ" }),
|
|
127
|
+
/** 本文(HTML。リンクや添付を含む) @example "<p>締切は4月14日です。</p>" */
|
|
128
|
+
bodyHtml: zod_1.z.string().meta({ description: "本文(HTML)", example: "<p>締切は4月14日です。</p>" }),
|
|
129
|
+
});
|
|
130
|
+
/** 授業のお知らせ一覧 */
|
|
131
|
+
exports.ManaboClassNewsSchema = zod_1.z.object({
|
|
132
|
+
/** お知らせ項目 */
|
|
133
|
+
items: zod_1.z.array(exports.ManaboClassNewsItemSchema).meta({ description: "お知らせ項目" }),
|
|
134
|
+
});
|
|
135
|
+
/** 成績評価方法・基準の 1 項目 */
|
|
136
|
+
exports.ManaboClassSyllabusEvaluationSchema = zod_1.z.object({
|
|
137
|
+
/** 評価種別(例: "課題・レポート") @example "課題・レポート" */
|
|
138
|
+
type: zod_1.z.string().meta({ description: "評価種別", example: "課題・レポート" }),
|
|
139
|
+
/** 割合(例: "70%") @example "70%" */
|
|
140
|
+
weight: zod_1.z.string().meta({ description: "割合", example: "70%" }),
|
|
141
|
+
});
|
|
142
|
+
/** 教科書・教材 */
|
|
143
|
+
exports.ManaboClassSyllabusTextbookSchema = zod_1.z.object({
|
|
144
|
+
/** 区分ラベル(例: "教科書・教材") @example "教科書・教材" */
|
|
145
|
+
type: zod_1.z.string().meta({ description: "区分ラベル", example: "教科書・教材" }),
|
|
146
|
+
/** 書名・内容 @example "アルゴリズムとデータ構造" */
|
|
147
|
+
title: zod_1.z.string().meta({ description: "書名・内容", example: "アルゴリズムとデータ構造" }),
|
|
148
|
+
});
|
|
149
|
+
/** 参考文献 */
|
|
150
|
+
exports.ManaboClassSyllabusReferenceSchema = zod_1.z.object({
|
|
151
|
+
/** 書名 @example "計算機科学入門" */
|
|
152
|
+
title: zod_1.z.string().meta({ description: "書名", example: "計算機科学入門" }),
|
|
153
|
+
/** 書籍コード(data-code。ISBN 等) @example "9784000000000" */
|
|
154
|
+
code: zod_1.z.string().meta({ description: "書籍コード(ISBN 等)", example: "9784000000000" }),
|
|
155
|
+
});
|
|
156
|
+
/** 授業計画の 1 回分 */
|
|
157
|
+
exports.ManaboClassSyllabusPlanItemSchema = zod_1.z.object({
|
|
158
|
+
/** 回番号 @example 1 */
|
|
159
|
+
no: zod_1.z.number().meta({ description: "回番号", example: 1 }),
|
|
160
|
+
/** 項目(タイトル) @example "ガイダンス" */
|
|
161
|
+
item: zod_1.z.string().meta({ description: "項目(タイトル)", example: "ガイダンス" }),
|
|
162
|
+
/** 内容 @example "授業の進め方について説明する" */
|
|
163
|
+
content: zod_1.z.string().meta({ description: "内容", example: "授業の進め方について説明する" }),
|
|
164
|
+
});
|
|
165
|
+
/** シラバス詳細 */
|
|
166
|
+
exports.ManaboClassSyllabusSchema = zod_1.z.object({
|
|
167
|
+
/** 授業概要・目的 @example "情報リテラシーの基礎を学ぶ" */
|
|
168
|
+
object: zod_1.z.string().meta({ description: "授業概要・目的", example: "情報リテラシーの基礎を学ぶ" }),
|
|
169
|
+
/** 学修到達目標(箇条書き) @example ["基本操作を習得する"] */
|
|
170
|
+
goal: zod_1.z.array(zod_1.z.string()).meta({ description: "学修到達目標(箇条書き)", example: ["基本操作を習得する"] }),
|
|
171
|
+
/** 授業方法 @example "講義形式で実施する" */
|
|
172
|
+
method: zod_1.z.string().meta({ description: "授業方法", example: "講義形式で実施する" }),
|
|
173
|
+
/** 活用される授業方法(チェックされた項目名) @example ["グループワーク"] */
|
|
174
|
+
usedMethods: zod_1.z.array(zod_1.z.string()).meta({ description: "活用される授業方法", example: ["グループワーク"] }),
|
|
175
|
+
/** 成績評価方法・基準 */
|
|
176
|
+
evaluation: zod_1.z.array(exports.ManaboClassSyllabusEvaluationSchema).meta({ description: "成績評価方法・基準" }),
|
|
177
|
+
/** 教科書・教材 */
|
|
178
|
+
textbooks: zod_1.z.array(exports.ManaboClassSyllabusTextbookSchema).meta({ description: "教科書・教材" }),
|
|
179
|
+
/** 参考文献 */
|
|
180
|
+
references: zod_1.z.array(exports.ManaboClassSyllabusReferenceSchema).meta({ description: "参考文献" }),
|
|
181
|
+
/** 質問への対応(オフィスアワー等) @example "水曜3限、研究室にて対応" */
|
|
182
|
+
officeHour: zod_1.z.string().meta({ description: "質問への対応(オフィスアワー等)", example: "水曜3限、研究室にて対応" }),
|
|
183
|
+
/** 授業計画(全回) */
|
|
184
|
+
plan: zod_1.z.array(exports.ManaboClassSyllabusPlanItemSchema).meta({ description: "授業計画(全回)" }),
|
|
185
|
+
/** 履修者へのコメント @example "積極的な参加を歓迎します" */
|
|
186
|
+
comment: zod_1.z.string().meta({ description: "履修者へのコメント", example: "積極的な参加を歓迎します" }),
|
|
187
|
+
/** 事前事後学習 @example "教科書の該当章を事前に読んでおくこと" */
|
|
188
|
+
prePostStudy: zod_1.z.string().meta({ description: "事前事後学習", example: "教科書の該当章を事前に読んでおくこと" }),
|
|
189
|
+
});
|
|
190
|
+
/** 小テスト結果の 1 問 */
|
|
191
|
+
exports.ManaboClassQuizResultQuestionSchema = zod_1.z.object({
|
|
192
|
+
/** ページ(rowspan でまとめられたページ番号。例: "1") @example "1" */
|
|
193
|
+
page: zod_1.z.string().meta({ description: "ページ(rowspan でまとめられたページ番号)", example: "1" }),
|
|
194
|
+
/** 問題番号 @example "1" */
|
|
195
|
+
questionNumber: zod_1.z.string().meta({ description: "問題番号", example: "1" }),
|
|
196
|
+
/** 問題文 @example "次のうち正しいものを選べ" */
|
|
197
|
+
questionText: zod_1.z.string().meta({ description: "問題文", example: "次のうち正しいものを選べ" }),
|
|
198
|
+
/** 正解 @example "選択肢A" */
|
|
199
|
+
correctAnswer: zod_1.z.string().meta({ description: "正解", example: "選択肢A" }),
|
|
200
|
+
/** 学生の解答 @example "選択肢A" */
|
|
201
|
+
studentAnswer: zod_1.z.string().meta({ description: "学生の解答", example: "選択肢A" }),
|
|
202
|
+
/** 正誤(採点アイコンから判定。point_good→true / point_worst→false / アイコン無し→null) @example true */
|
|
203
|
+
isCorrect: zod_1.z.boolean().nullable().meta({ description: "正誤(採点アイコンから判定)", example: true }),
|
|
204
|
+
/** 獲得点(採点結果セルの「NN 点」から抽出。表示が無ければ null) @example 10 */
|
|
205
|
+
points: zod_1.z.number().nullable().meta({ description: "獲得点", example: 10 }),
|
|
206
|
+
/** 採点結果アイコンの src(UI 表示用に保持) @example "/common/images/icons/point_good.png" */
|
|
207
|
+
resultIconSrc: zod_1.z.string().nullable().meta({ description: "採点結果アイコンの src", example: "/common/images/icons/point_good.png" }),
|
|
208
|
+
/** 教員からのコメント @example "よくできました" */
|
|
209
|
+
teacherComment: zod_1.z.string().nullable().meta({ description: "教員からのコメント", example: "よくできました" }),
|
|
210
|
+
});
|
|
211
|
+
/** 小テスト結果ページ全体 */
|
|
212
|
+
exports.ManaboClassQuizResultSchema = zod_1.z.object({
|
|
213
|
+
/** 得点(獲得点 / 満点) */
|
|
214
|
+
score: zod_1.z.object({
|
|
215
|
+
/** 獲得点 @example 80 */
|
|
216
|
+
obtained: zod_1.z.number().meta({ description: "獲得点", example: 80 }),
|
|
217
|
+
/** 満点 @example 100 */
|
|
218
|
+
total: zod_1.z.number().meta({ description: "満点", example: 100 }),
|
|
219
|
+
}).meta({ description: "得点(獲得点 / 満点)" }),
|
|
220
|
+
/** 受験結果一覧のページ概要(例: "1件中 1 〜 1件")。無ければ null @example "1件中 1 〜 1件" */
|
|
221
|
+
paginationSummary: zod_1.z.string().nullable().meta({ description: "受験結果一覧のページ概要", example: "1件中 1 〜 1件" }),
|
|
222
|
+
questions: zod_1.z.array(exports.ManaboClassQuizResultQuestionSchema).meta({ description: "設問ごとの結果一覧" }),
|
|
223
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManaboEntryResponseSchema = exports.ManaboEntryFormSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// manabo の出欠(出席カード)関連スキーマ。
|
|
6
|
+
/** 出欠カードのフォーム(出席受付モーダル) */
|
|
7
|
+
exports.ManaboEntryFormSchema = zod_1.z.object({
|
|
8
|
+
/** フォームの action 値 @example "glexa_modal_entry_form_accept" */
|
|
9
|
+
action: zod_1.z.string().meta({ description: "フォームの action 値", example: "glexa_modal_entry_form_accept" }),
|
|
10
|
+
/** 授業 ID @example "85146" */
|
|
11
|
+
classId: zod_1.z.string().meta({ description: "授業 ID", example: "85146" }),
|
|
12
|
+
/** ディレクトリ ID("0" の場合は授業直下) @example "0" */
|
|
13
|
+
directoryId: zod_1.z.string().meta({ description: "ディレクトリ ID(\"0\" の場合は授業直下)", example: "0" }),
|
|
14
|
+
/** 出欠エントリ ID @example "12345" */
|
|
15
|
+
entryId: zod_1.z.string().meta({ description: "出欠エントリ ID", example: "12345" }),
|
|
16
|
+
/** ワンタイム識別子(uniqid) @example "6800abcdef123" */
|
|
17
|
+
uniqid: zod_1.z.string().meta({ description: "ワンタイム識別子(uniqid)", example: "6800abcdef123" }),
|
|
18
|
+
/**
|
|
19
|
+
* 出席コード(パスワード)の入力が必要か。
|
|
20
|
+
* `true` の場合は教員指示のコードを {@link ManaboClient.submitEntry} の `code` に渡す。
|
|
21
|
+
* `false`(パスワードなし授業)の場合は `code` を省略してそのまま送信する。
|
|
22
|
+
* @example true
|
|
23
|
+
*/
|
|
24
|
+
requiresCode: zod_1.z.boolean().meta({ description: "出席コード(パスワード)の入力が必要か", example: true }),
|
|
25
|
+
/** フォーム内のメッセージ群(例: "出席を受付中です") @example ["出席を受付中です"] */
|
|
26
|
+
messages: zod_1.z.array(zod_1.z.string()).meta({ description: "フォーム内のメッセージ群", example: ["出席を受付中です"] }),
|
|
27
|
+
});
|
|
28
|
+
/** 出席登録リクエストへの JSON レスポンス */
|
|
29
|
+
exports.ManaboEntryResponseSchema = zod_1.z.object({
|
|
30
|
+
/** 処理成功フラグ @example true */
|
|
31
|
+
success: zod_1.z.boolean().meta({ description: "処理成功フラグ", example: true }),
|
|
32
|
+
/** 返却 HTML(無ければ空文字 / null) @example null */
|
|
33
|
+
html: zod_1.z.string().nullable().meta({ description: "返却 HTML", example: null }),
|
|
34
|
+
/** エラー文字列(成功時は空文字、出席コード誤り等で文言が入る) @example "出席コードを確認してください" */
|
|
35
|
+
error: zod_1.z.string().nullable().meta({ description: "エラー文字列", example: "出席コードを確認してください" }),
|
|
36
|
+
/** 受付状態の詳細(失敗時は null) */
|
|
37
|
+
data: zod_1.z.object({
|
|
38
|
+
/** 受付状態フラグ(0=既に受付済み / 1=新規受付可)※ API 由来の値をそのまま保持 @example 1 */
|
|
39
|
+
is_accepted: zod_1.z.number().meta({ description: "受付状態フラグ(0=既に受付済み / 1=新規受付可)", example: 1 }),
|
|
40
|
+
}).nullable().meta({ description: "受付状態の詳細(失敗時は null)" }),
|
|
41
|
+
/** システムメッセージ(無ければ null) @example null */
|
|
42
|
+
sysmsg: zod_1.z.string().nullable().meta({ description: "システムメッセージ", example: null }),
|
|
43
|
+
});
|