megastudy-letter 1.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 +79 -0
- package/dist/MegastudyLetterClient.d.ts +25 -0
- package/dist/MegastudyLetterClient.d.ts.map +1 -0
- package/dist/MegastudyLetterClient.js +203 -0
- package/dist/MegastudyLetterClient.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +177 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cookieJar.d.ts +20 -0
- package/dist/internal/cookieJar.d.ts.map +1 -0
- package/dist/internal/cookieJar.js +150 -0
- package/dist/internal/cookieJar.js.map +1 -0
- package/dist/internal/encoding.d.ts +2 -0
- package/dist/internal/encoding.d.ts.map +1 -0
- package/dist/internal/encoding.js +43 -0
- package/dist/internal/encoding.js.map +1 -0
- package/dist/internal/html.d.ts +4 -0
- package/dist/internal/html.d.ts.map +1 -0
- package/dist/internal/html.js +37 -0
- package/dist/internal/html.js.map +1 -0
- package/dist/internal/http.d.ts +24 -0
- package/dist/internal/http.d.ts.map +1 -0
- package/dist/internal/http.js +57 -0
- package/dist/internal/http.js.map +1 -0
- package/dist/internal/multipartEucKr.d.ts +18 -0
- package/dist/internal/multipartEucKr.d.ts.map +1 -0
- package/dist/internal/multipartEucKr.js +37 -0
- package/dist/internal/multipartEucKr.js.map +1 -0
- package/dist/internal/parsers/classList.d.ts +3 -0
- package/dist/internal/parsers/classList.d.ts.map +1 -0
- package/dist/internal/parsers/classList.js +19 -0
- package/dist/internal/parsers/classList.js.map +1 -0
- package/dist/internal/parsers/parentList.d.ts +3 -0
- package/dist/internal/parsers/parentList.d.ts.map +1 -0
- package/dist/internal/parsers/parentList.js +52 -0
- package/dist/internal/parsers/parentList.js.map +1 -0
- package/dist/internal/parsers/writeContext.d.ts +3 -0
- package/dist/internal/parsers/writeContext.d.ts.map +1 -0
- package/dist/internal/parsers/writeContext.js +25 -0
- package/dist/internal/parsers/writeContext.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CookieJar = void 0;
|
|
4
|
+
function normalizeDomain(domain) {
|
|
5
|
+
return domain.trim().toLowerCase().replace(/^\./, '');
|
|
6
|
+
}
|
|
7
|
+
function domainMatches(host, cookie) {
|
|
8
|
+
const normalizedHost = host.toLowerCase();
|
|
9
|
+
const normalizedDomain = cookie.domain.toLowerCase();
|
|
10
|
+
if (cookie.hostOnly)
|
|
11
|
+
return normalizedHost === normalizedDomain;
|
|
12
|
+
return (normalizedHost === normalizedDomain ||
|
|
13
|
+
normalizedHost.endsWith(`.${normalizedDomain}`));
|
|
14
|
+
}
|
|
15
|
+
function pathMatches(requestPath, cookiePath) {
|
|
16
|
+
if (!cookiePath)
|
|
17
|
+
return true;
|
|
18
|
+
if (!requestPath.startsWith('/'))
|
|
19
|
+
return true;
|
|
20
|
+
if (!cookiePath.startsWith('/'))
|
|
21
|
+
return true;
|
|
22
|
+
return requestPath.startsWith(cookiePath);
|
|
23
|
+
}
|
|
24
|
+
function isExpired(cookie, now) {
|
|
25
|
+
return cookie.expiresAt !== undefined && cookie.expiresAt <= now;
|
|
26
|
+
}
|
|
27
|
+
function parseSetCookie(setCookie, requestUrl, now) {
|
|
28
|
+
const parts = setCookie.split(';').map((p) => p.trim());
|
|
29
|
+
const [nameValue, ...attrParts] = parts;
|
|
30
|
+
const eq = nameValue.indexOf('=');
|
|
31
|
+
if (eq <= 0)
|
|
32
|
+
return undefined;
|
|
33
|
+
const name = nameValue.slice(0, eq).trim();
|
|
34
|
+
const value = nameValue.slice(eq + 1);
|
|
35
|
+
if (!name)
|
|
36
|
+
return undefined;
|
|
37
|
+
let domain = requestUrl.hostname;
|
|
38
|
+
let hostOnly = true;
|
|
39
|
+
let path = '/';
|
|
40
|
+
let secure = false;
|
|
41
|
+
let expiresAt;
|
|
42
|
+
let maxAgeSeconds;
|
|
43
|
+
for (const attr of attrParts) {
|
|
44
|
+
const [rawKey, ...rawRest] = attr.split('=');
|
|
45
|
+
const key = rawKey.trim().toLowerCase();
|
|
46
|
+
const rest = rawRest.join('=').trim();
|
|
47
|
+
if (key === 'domain' && rest) {
|
|
48
|
+
domain = normalizeDomain(rest);
|
|
49
|
+
hostOnly = false;
|
|
50
|
+
}
|
|
51
|
+
else if (key === 'path' && rest) {
|
|
52
|
+
path = rest.startsWith('/') ? rest : `/${rest}`;
|
|
53
|
+
}
|
|
54
|
+
else if (key === 'secure') {
|
|
55
|
+
secure = true;
|
|
56
|
+
}
|
|
57
|
+
else if (key === 'max-age' && rest) {
|
|
58
|
+
const parsed = Number(rest);
|
|
59
|
+
if (Number.isFinite(parsed))
|
|
60
|
+
maxAgeSeconds = parsed;
|
|
61
|
+
}
|
|
62
|
+
else if (key === 'expires' && rest) {
|
|
63
|
+
const parsed = Date.parse(rest);
|
|
64
|
+
if (!Number.isNaN(parsed))
|
|
65
|
+
expiresAt = parsed;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (maxAgeSeconds !== undefined) {
|
|
69
|
+
expiresAt = now + maxAgeSeconds * 1000;
|
|
70
|
+
}
|
|
71
|
+
const cookie = {
|
|
72
|
+
name,
|
|
73
|
+
value,
|
|
74
|
+
domain: normalizeDomain(domain),
|
|
75
|
+
hostOnly,
|
|
76
|
+
path,
|
|
77
|
+
secure,
|
|
78
|
+
expiresAt,
|
|
79
|
+
createdAt: now,
|
|
80
|
+
};
|
|
81
|
+
return cookie;
|
|
82
|
+
}
|
|
83
|
+
class CookieJar {
|
|
84
|
+
constructor() {
|
|
85
|
+
this.cookies = [];
|
|
86
|
+
}
|
|
87
|
+
setCookiesFromResponse(requestUrl, setCookieHeaders) {
|
|
88
|
+
const url = new URL(requestUrl);
|
|
89
|
+
const now = Date.now();
|
|
90
|
+
for (const header of setCookieHeaders) {
|
|
91
|
+
const cookie = parseSetCookie(header, url, now);
|
|
92
|
+
if (!cookie)
|
|
93
|
+
continue;
|
|
94
|
+
this.cookies = this.cookies.filter((c) => !(c.name === cookie.name &&
|
|
95
|
+
c.domain === cookie.domain &&
|
|
96
|
+
c.path === cookie.path));
|
|
97
|
+
if (!isExpired(cookie, now))
|
|
98
|
+
this.cookies.push(cookie);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
getCookieHeader(requestUrl) {
|
|
102
|
+
const url = new URL(requestUrl);
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
const candidates = this.cookies
|
|
105
|
+
.filter((c) => !isExpired(c, now))
|
|
106
|
+
.filter((c) => domainMatches(url.hostname, c))
|
|
107
|
+
.filter((c) => pathMatches(url.pathname, c.path))
|
|
108
|
+
.filter((c) => !c.secure || url.protocol === 'https:');
|
|
109
|
+
if (candidates.length === 0)
|
|
110
|
+
return undefined;
|
|
111
|
+
const sorted = [...candidates].sort((a, b) => {
|
|
112
|
+
if (a.path.length !== b.path.length)
|
|
113
|
+
return b.path.length - a.path.length;
|
|
114
|
+
return b.createdAt - a.createdAt;
|
|
115
|
+
});
|
|
116
|
+
return sorted.map((c) => `${c.name}=${c.value}`).join('; ');
|
|
117
|
+
}
|
|
118
|
+
getCookieValue(name) {
|
|
119
|
+
const now = Date.now();
|
|
120
|
+
const matched = this.cookies
|
|
121
|
+
.filter((c) => c.name === name)
|
|
122
|
+
.filter((c) => !isExpired(c, now))
|
|
123
|
+
.sort((a, b) => b.createdAt - a.createdAt);
|
|
124
|
+
return matched[0]?.value;
|
|
125
|
+
}
|
|
126
|
+
hasCookie(name) {
|
|
127
|
+
return this.getCookieValue(name) !== undefined;
|
|
128
|
+
}
|
|
129
|
+
toJSON() {
|
|
130
|
+
const now = Date.now();
|
|
131
|
+
return this.cookies
|
|
132
|
+
.filter((c) => !isExpired(c, now))
|
|
133
|
+
.map(({ createdAt: _createdAt, ...rest }) => rest);
|
|
134
|
+
}
|
|
135
|
+
static fromJSON(cookies) {
|
|
136
|
+
const jar = new CookieJar();
|
|
137
|
+
const now = Date.now();
|
|
138
|
+
jar.cookies = cookies
|
|
139
|
+
.map((c) => ({
|
|
140
|
+
...c,
|
|
141
|
+
domain: normalizeDomain(c.domain),
|
|
142
|
+
path: c.path || '/',
|
|
143
|
+
createdAt: now,
|
|
144
|
+
}))
|
|
145
|
+
.filter((c) => !isExpired(c, now));
|
|
146
|
+
return jar;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.CookieJar = CookieJar;
|
|
150
|
+
//# sourceMappingURL=cookieJar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookieJar.js","sourceRoot":"","sources":["../../src/internal/cookieJar.ts"],"names":[],"mappings":";;;AAcA,SAAS,eAAe,CAAC,MAAc;IACrC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,MAAc;IACjD,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,cAAc,KAAK,gBAAgB,CAAC;IAChE,OAAO,CACL,cAAc,KAAK,gBAAgB;QACnC,cAAc,CAAC,QAAQ,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAChD,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,WAAmB,EAAE,UAAkB;IAC1D,IAAI,CAAC,UAAU;QAAE,OAAO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
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/internal/encoding.ts"],"names":[],"mappings":"AAgCA,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAW1E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readResponseText = readResponseText;
|
|
4
|
+
function normalizeEncoding(raw) {
|
|
5
|
+
const v = raw.trim().toLowerCase();
|
|
6
|
+
if (v === 'euc-kr' ||
|
|
7
|
+
v === 'euckr' ||
|
|
8
|
+
v === 'euc_kr' ||
|
|
9
|
+
v === 'ks_c_5601-1987' ||
|
|
10
|
+
v === 'cp949' ||
|
|
11
|
+
v === 'windows-949') {
|
|
12
|
+
return 'euc-kr';
|
|
13
|
+
}
|
|
14
|
+
if (v === 'utf8')
|
|
15
|
+
return 'utf-8';
|
|
16
|
+
return v;
|
|
17
|
+
}
|
|
18
|
+
function parseCharsetFromContentType(contentType) {
|
|
19
|
+
if (!contentType)
|
|
20
|
+
return null;
|
|
21
|
+
const m = contentType.match(/charset\s*=\s*["']?\s*([^;"'\s]+)/i);
|
|
22
|
+
if (!m)
|
|
23
|
+
return null;
|
|
24
|
+
return normalizeEncoding(m[1]);
|
|
25
|
+
}
|
|
26
|
+
function sniffCharsetFromBytes(bytes) {
|
|
27
|
+
const head = bytes
|
|
28
|
+
.slice(0, 2048)
|
|
29
|
+
.reduce((acc, b) => acc + (b <= 0x7f ? String.fromCharCode(b) : ' '), '');
|
|
30
|
+
const m = head.match(/charset\s*=\s*["']?\s*([a-zA-Z0-9._-]+)/i);
|
|
31
|
+
if (!m)
|
|
32
|
+
return null;
|
|
33
|
+
return normalizeEncoding(m[1]);
|
|
34
|
+
}
|
|
35
|
+
async function readResponseText(response) {
|
|
36
|
+
const contentType = response.headers.get('content-type');
|
|
37
|
+
const buffer = new Uint8Array(await response.arrayBuffer());
|
|
38
|
+
const charset = parseCharsetFromContentType(contentType) ?? sniffCharsetFromBytes(buffer);
|
|
39
|
+
const fallbackEncoding = contentType?.toLowerCase().includes('text/html') === true ? 'euc-kr' : 'utf-8';
|
|
40
|
+
const encoding = charset ?? fallbackEncoding;
|
|
41
|
+
return new TextDecoder(encoding).decode(buffer);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/internal/encoding.ts"],"names":[],"mappings":";;AAgCA,4CAWC;AA3CD,SAAS,iBAAiB,CAAC,GAAW;IACpC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,IACE,CAAC,KAAK,QAAQ;QACd,CAAC,KAAK,OAAO;QACb,CAAC,KAAK,QAAQ;QACd,CAAC,KAAK,gBAAgB;QACtB,CAAC,KAAK,OAAO;QACb,CAAC,KAAK,aAAa,EACnB,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,2BAA2B,CAAC,WAA0B;IAC7D,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAClE,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAiB;IAC9C,MAAM,IAAI,GAAG,KAAK;SACf,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;SACd,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC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
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeHtmlEntities = decodeHtmlEntities;
|
|
4
|
+
exports.stripTags = stripTags;
|
|
5
|
+
exports.cleanText = cleanText;
|
|
6
|
+
function decodeHtmlEntity(entity) {
|
|
7
|
+
const named = {
|
|
8
|
+
nbsp: ' ',
|
|
9
|
+
amp: '&',
|
|
10
|
+
lt: '<',
|
|
11
|
+
gt: '>',
|
|
12
|
+
quot: '"',
|
|
13
|
+
apos: "'",
|
|
14
|
+
};
|
|
15
|
+
const namedMatch = entity.match(/^&([a-zA-Z]+);$/);
|
|
16
|
+
if (namedMatch)
|
|
17
|
+
return named[namedMatch[1]] ?? entity;
|
|
18
|
+
const decMatch = entity.match(/^&#(\d+);$/);
|
|
19
|
+
if (decMatch)
|
|
20
|
+
return String.fromCodePoint(Number(decMatch[1]));
|
|
21
|
+
const hexMatch = entity.match(/^&#x([0-9a-fA-F]+);$/);
|
|
22
|
+
if (hexMatch)
|
|
23
|
+
return String.fromCodePoint(Number.parseInt(hexMatch[1], 16));
|
|
24
|
+
return entity;
|
|
25
|
+
}
|
|
26
|
+
function decodeHtmlEntities(input) {
|
|
27
|
+
return input.replace(/&[a-zA-Z]+;|&#\d+;|&#x[0-9a-fA-F]+;/g, decodeHtmlEntity);
|
|
28
|
+
}
|
|
29
|
+
function stripTags(input) {
|
|
30
|
+
return input.replace(/<[^>]*>/g, '');
|
|
31
|
+
}
|
|
32
|
+
function cleanText(input) {
|
|
33
|
+
return decodeHtmlEntities(stripTags(input))
|
|
34
|
+
.replace(/\s+/g, ' ')
|
|
35
|
+
.trim();
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/internal/html.ts"],"names":[],"mappings":";;AAsBA,gDAKC;AAED,8BAEC;AAED,8BAIC;AArCD,SAAS,gBAA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|
+
export type HttpClientOptions = {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
userAgent?: string;
|
|
5
|
+
};
|
|
6
|
+
export type RequestHeaders = Record<string, string | undefined>;
|
|
7
|
+
export declare class HttpClient {
|
|
8
|
+
private baseUrl;
|
|
9
|
+
private cookieJar;
|
|
10
|
+
private userAgent;
|
|
11
|
+
constructor(cookieJar: CookieJar, options: HttpClientOptions);
|
|
12
|
+
getCookieJar(): CookieJar;
|
|
13
|
+
private buildUrl;
|
|
14
|
+
private mergeHeaders;
|
|
15
|
+
request(pathOrUrl: string, init?: RequestInit & {
|
|
16
|
+
headers?: RequestHeaders;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
status: number;
|
|
19
|
+
url: string;
|
|
20
|
+
text: string;
|
|
21
|
+
headers: Headers;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/internal/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEhE,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,SAAS,CAAS;gBAEd,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB;IAQ5D,YAAY,IAAI,SAAS;IAIzB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,YAAY;IAad,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,WAAW,GAAG;QAAE,OAAO,CAAC,EAAE,cAAc,CAAA;KAAO,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAsBlK"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpClient = void 0;
|
|
4
|
+
const encoding_1 = require("./encoding");
|
|
5
|
+
class HttpClient {
|
|
6
|
+
constructor(cookieJar, options) {
|
|
7
|
+
this.cookieJar = cookieJar;
|
|
8
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, '');
|
|
9
|
+
this.userAgent =
|
|
10
|
+
options.userAgent ??
|
|
11
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36';
|
|
12
|
+
}
|
|
13
|
+
getCookieJar() {
|
|
14
|
+
return this.cookieJar;
|
|
15
|
+
}
|
|
16
|
+
buildUrl(pathOrUrl) {
|
|
17
|
+
if (/^https?:\/\//i.test(pathOrUrl))
|
|
18
|
+
return pathOrUrl;
|
|
19
|
+
if (!pathOrUrl.startsWith('/'))
|
|
20
|
+
return `${this.baseUrl}/${pathOrUrl}`;
|
|
21
|
+
return `${this.baseUrl}${pathOrUrl}`;
|
|
22
|
+
}
|
|
23
|
+
mergeHeaders(headers) {
|
|
24
|
+
const h = new Headers();
|
|
25
|
+
h.set('user-agent', this.userAgent);
|
|
26
|
+
h.set('accept-language', 'ko,en-US;q=0.9,en;q=0.8');
|
|
27
|
+
if (headers) {
|
|
28
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
29
|
+
if (v === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
h.set(k, v);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return h;
|
|
35
|
+
}
|
|
36
|
+
async request(pathOrUrl, init = {}) {
|
|
37
|
+
const url = this.buildUrl(pathOrUrl);
|
|
38
|
+
const headers = this.mergeHeaders(init.headers);
|
|
39
|
+
const cookie = this.cookieJar.getCookieHeader(url);
|
|
40
|
+
if (cookie)
|
|
41
|
+
headers.set('cookie', cookie);
|
|
42
|
+
const response = await fetch(url, { ...init, headers, redirect: 'follow' });
|
|
43
|
+
const setCookies =
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
response.headers.getSetCookie?.() ??
|
|
46
|
+
(response.headers.get('set-cookie')
|
|
47
|
+
? [response.headers.get('set-cookie')]
|
|
48
|
+
: []);
|
|
49
|
+
if (Array.isArray(setCookies) && setCookies.length > 0) {
|
|
50
|
+
this.cookieJar.setCookiesFromResponse(url, setCookies);
|
|
51
|
+
}
|
|
52
|
+
const text = await (0, encoding_1.readResponseText)(response);
|
|
53
|
+
return { status: response.status, url: response.url, text, headers: response.headers };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.HttpClient = HttpClient;
|
|
57
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/internal/http.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAS9C,MAAa,UAAU;IAKrB,YAAY,SAAoB,EAAE,OAA0B;QAC1D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS;YACZ,OAAO,CAAC,SAAS;gBACjB,iHAAiH,CAAC;IACtH,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,QAAQ,CAAC,SAAiB;QAChC,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS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QAAQ,CAAC,OAAe,CAAC,YAAY,EAAE,EAAE;YAC1C,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;gBACjC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAW,CAAC;gBAChD,CAAC,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAgB,EAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACzF,CAAC;CACF;AA1DD,gCA0DC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type MultipartField = {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type MultipartFile = {
|
|
6
|
+
name: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
contentType: string;
|
|
9
|
+
data: Uint8Array;
|
|
10
|
+
};
|
|
11
|
+
export declare function buildMultipartEucKrBody(params: {
|
|
12
|
+
fields: MultipartField[];
|
|
13
|
+
file?: MultipartFile;
|
|
14
|
+
}): {
|
|
15
|
+
body: Buffer;
|
|
16
|
+
contentType: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=multipartEucKr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipartEucKr.d.ts","sourceRoot":"","sources":["../../src/internal/multipartEucKr.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAkCxC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildMultipartEucKrBody = buildMultipartEucKrBody;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const iconv_lite_1 = __importDefault(require("iconv-lite"));
|
|
9
|
+
function buildMultipartEucKrBody(params) {
|
|
10
|
+
const boundary = `----megastudy-letter-${node_crypto_1.default.randomBytes(12).toString('hex')}`;
|
|
11
|
+
const chunks = [];
|
|
12
|
+
const pushAscii = (s) => {
|
|
13
|
+
chunks.push(Buffer.from(s, 'utf8'));
|
|
14
|
+
};
|
|
15
|
+
const pushEucKr = (s) => {
|
|
16
|
+
chunks.push(iconv_lite_1.default.encode(s, 'euc-kr'));
|
|
17
|
+
};
|
|
18
|
+
for (const field of params.fields) {
|
|
19
|
+
pushAscii(`--${boundary}\r\n`);
|
|
20
|
+
pushAscii(`Content-Disposition: form-data; name="${field.name}"\r\n\r\n`);
|
|
21
|
+
pushEucKr(field.value);
|
|
22
|
+
pushAscii('\r\n');
|
|
23
|
+
}
|
|
24
|
+
if (params.file) {
|
|
25
|
+
pushAscii(`--${boundary}\r\n`);
|
|
26
|
+
pushAscii(`Content-Disposition: form-data; name="${params.file.name}"; filename="${params.file.filename}"\r\n`);
|
|
27
|
+
pushAscii(`Content-Type: ${params.file.contentType}\r\n\r\n`);
|
|
28
|
+
chunks.push(Buffer.from(params.file.data));
|
|
29
|
+
pushAscii('\r\n');
|
|
30
|
+
}
|
|
31
|
+
pushAscii(`--${boundary}--\r\n`);
|
|
32
|
+
return {
|
|
33
|
+
body: Buffer.concat(chunks),
|
|
34
|
+
contentType: `multipart/form-data; boundary=${boundary}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=multipartEucKr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipartEucKr.js","sourceRoot":"","sources":["../../src/internal/multipartEucKr.ts"],"names":[],"mappings":";;;;;AAgBA,0DAqCC;AArDD,8DAAiC;AAEjC,4DAA+B;AAc/B,SAAgB,uBAAuB,CAAC,MAGvC;IACC,MAAM,QAAQ,GAAG,wBAAwB,qBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAClF,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE;QAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE;QAC9B,MAAM,CAAC,IAAI,CAAC,oBAAK,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,SAAS,CAAC,KAAK,QAAQ,MAAM,CAAC,CAAC;QAC/B,SAAS,CAAC,yCAAyC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC;QAC1E,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,SAAS,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,SAAS,CAAC,KAAK,QAAQ,MAAM,CAAC,CAAC;QAC/B,SAAS,CACP,yCAAyC,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAgB,MAAM,CAAC,IAAI,CAAC,QAAQ,OAAO,CACrG,CAAC;QACF,SAAS,CAAC,iBAAiB,MAAM,CAAC,IAAI,CAAC,WAAW,UAAU,CAAC,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,SAAS,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,KAAK,QAAQ,QAAQ,CAAC,CAAC;IAEjC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC3B,WAAW,EAAE,iCAAiC,QAAQ,EAAE;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classList.d.ts","sourceRoot":"","sources":["../../../src/internal/parsers/classList.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAgB1D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseClassList = parseClassList;
|
|
4
|
+
const html_1 = require("../html");
|
|
5
|
+
function parseClassList(html) {
|
|
6
|
+
const options = [...html.matchAll(/<option[^>]*>[\s\S]*?<\/option>/gi)];
|
|
7
|
+
const result = [];
|
|
8
|
+
for (const match of options) {
|
|
9
|
+
const optionHtml = match[0];
|
|
10
|
+
const valueMatch = optionHtml.match(/value\s*=\s*(["'])([\s\S]*?)\1/i);
|
|
11
|
+
const value = valueMatch?.[2] ?? '';
|
|
12
|
+
const label = (0, html_1.cleanText)(optionHtml);
|
|
13
|
+
if (!value)
|
|
14
|
+
continue;
|
|
15
|
+
result.push({ value, label });
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=classList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classList.js","sourceRoot":"","sources":["../../../src/internal/parsers/classList.ts"],"names":[],"mappings":";;AAGA,wCAgBC;AAnBD,kCAAoC;AAGpC,SAAgB,cAAc,CAAC,IAAY;IACzC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;IACxE,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CACjC,iCAAiC,CAClC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parentList.d.ts","sourceRoot":"","sources":["../../../src/internal/parsers/parentList.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQxD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAsDpE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseParentList = parseParentList;
|
|
4
|
+
const html_1 = require("../html");
|
|
5
|
+
function extractAnchorText(html) {
|
|
6
|
+
const m = html.match(/<a\b[^>]*>([\s\S]*?)<\/a>/i);
|
|
7
|
+
if (!m)
|
|
8
|
+
return (0, html_1.cleanText)(html);
|
|
9
|
+
return (0, html_1.cleanText)(m[1]);
|
|
10
|
+
}
|
|
11
|
+
function parseParentList(html) {
|
|
12
|
+
const tbodyMatch = html.match(/<tbody>([\s\S]*?)<\/tbody>/i);
|
|
13
|
+
if (!tbodyMatch)
|
|
14
|
+
return [];
|
|
15
|
+
const tbody = tbodyMatch[1];
|
|
16
|
+
const rowMatches = [...tbody.matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)];
|
|
17
|
+
const items = [];
|
|
18
|
+
for (const rowMatch of rowMatches) {
|
|
19
|
+
const rowHtml = rowMatch[0];
|
|
20
|
+
const cells = [...rowHtml.matchAll(/<td\b[^>]*>([\s\S]*?)<\/td>/gi)].map((m) => m[1]);
|
|
21
|
+
if (cells.length < 6)
|
|
22
|
+
continue;
|
|
23
|
+
const numberText = (0, html_1.cleanText)(cells[0]);
|
|
24
|
+
const number = /^\d+$/.test(numberText) ? Number(numberText) : undefined;
|
|
25
|
+
const status = (0, html_1.cleanText)(cells[1]) || undefined;
|
|
26
|
+
const subjectHtml = cells[2];
|
|
27
|
+
const title = extractAnchorText(subjectHtml);
|
|
28
|
+
const isSecret = /bbsLock/i.test(subjectHtml) || /비밀글/.test((0, html_1.cleanText)(subjectHtml));
|
|
29
|
+
const viewMatch = subjectHtml.match(/javascript:\s*View\(\s*(\d+)\s*,\s*'(\w+)'\s*\)\s*;?/i);
|
|
30
|
+
const code = viewMatch ? Number(viewMatch[1]) : undefined;
|
|
31
|
+
const canView = viewMatch ? viewMatch[2].toLowerCase() === 'ok' : false;
|
|
32
|
+
const writer = (0, html_1.cleanText)(cells[3]);
|
|
33
|
+
const date = (0, html_1.cleanText)(cells[4]);
|
|
34
|
+
const viewsText = (0, html_1.cleanText)(cells[5]);
|
|
35
|
+
const views = /^\d+$/.test(viewsText) ? Number(viewsText) : 0;
|
|
36
|
+
const isNotice = /board_tr_hot/i.test(rowHtml) || /notice/i.test((0, html_1.cleanText)(cells[0]));
|
|
37
|
+
items.push({
|
|
38
|
+
number,
|
|
39
|
+
status,
|
|
40
|
+
title,
|
|
41
|
+
writer,
|
|
42
|
+
date,
|
|
43
|
+
views,
|
|
44
|
+
isNotice,
|
|
45
|
+
isSecret,
|
|
46
|
+
canView,
|
|
47
|
+
code,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return items;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=parentList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parentList.js","sourceRoot":"","sources":["../../../src/internal/parsers/parentList.ts"],"names":[],"mappings":";;AASA,0CAsDC;AA/DD,kCAAoC;AAGpC,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACnD,IAAI,CAAC,CAAC;QAAE,OAAO,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,IAAA,gBAAS,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,KAA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QAC1D,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAExE,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9D,MAAM,QAAQ,GACZ,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvE,KAAK,CAAC,IAAI,CAAC;YACT,MAAM;YACN,MAAM;YACN,KAAK;YACL,MAAM;YACN,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,QAAQ;YACR,OAAO;YACP,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeContext.d.ts","sourceRoot":"","sources":["../../../src/internal/parsers/writeContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA4B5D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseWriteContext = parseWriteContext;
|
|
4
|
+
function firstMatch(html, re) {
|
|
5
|
+
const m = html.match(re);
|
|
6
|
+
return m?.[1];
|
|
7
|
+
}
|
|
8
|
+
function parseWriteContext(html) {
|
|
9
|
+
const code = firstMatch(html, /name="Code"[^>]*value="([^"]*)"/i) ??
|
|
10
|
+
firstMatch(html, /id="Code"[^>]*value="([^"]*)"/i) ??
|
|
11
|
+
'';
|
|
12
|
+
const oldfile = firstMatch(html, /name="oldfile"[^>]*value="([^"]*)"/i) ??
|
|
13
|
+
firstMatch(html, /id="oldfile"[^>]*value="([^"]*)"/i) ??
|
|
14
|
+
'';
|
|
15
|
+
const sessionMcode = firstMatch(html, /name="SessionMcode"[^>]*value="([^"]*)"/i) ?? '';
|
|
16
|
+
const pass = firstMatch(html, /name="Pass"[^>]*value="([^"]*)"/i) ?? '';
|
|
17
|
+
const wrkrNo = firstMatch(html, /name="wrkr_no"[^>]*value="([^"]*)"/i) ?? '';
|
|
18
|
+
const checkedCampus = firstMatch(html, /name="SCode_detail"[^>]*value="([^"]+)"[^>]*checked/i) ?? firstMatch(html, /name="SCode_detail"[^>]*value="([^"]+)"/i);
|
|
19
|
+
const scodeDetail = checkedCampus ?? '';
|
|
20
|
+
if (!sessionMcode || !pass || !scodeDetail || !wrkrNo) {
|
|
21
|
+
throw new Error('Failed to parse write context (SessionMcode/Pass/SCode_detail/wrkr_no).');
|
|
22
|
+
}
|
|
23
|
+
return { code, oldfile, sessionMcode, pass, scodeDetail, wrkrNo };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=writeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeContext.js","sourceRoot":"","sources":["../../../src/internal/parsers/writeContext.ts"],"names":[],"mappings":";;AAOA,8CA4BC;AAjCD,SAAS,UAAU,CAAC,IAAY,EAAE,EAAU;IAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,MAAM,IAAI,GACR,UAAU,CAAC,IAAI,EAAE,kCAAkC,CAAC;QACpD,UAAU,CAAC,IAAI,EAAE,gCAAgC,CAAC;QAClD,EAAE,CAAC;IACL,MAAM,OAAO,GACX,UAAU,CAAC,IAAI,EAAE,qCAAqC,CAAC;QACvD,UAAU,CAAC,IAAI,EAAE,mCAAmC,CAAC;QACrD,EAAE,CAAC;IACL,MAAM,YAAY,GAChB,UAAU,CAAC,IAAI,EAAE,0CAA0C,CAAC,IAAI,EAAE,CAAC;IACrE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,kCAAkC,CAAC,IAAI,EAAE,CAAC;IACxE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,qCAAqC,CAAC,IAAI,EAAE,CAAC;IAE7E,MAAM,aAAa,GACjB,UAAU,CACR,IAAI,EACJ,sDAAsD,CACvD,IAAI,UAAU,CAAC,IAAI,EAAE,0CAA0C,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,aAAa,IAAI,EAAE,CAAC;IAExC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type ParentLetterListMode = 'Y' | 'N';
|
|
2
|
+
export type ParentLetterListItem = {
|
|
3
|
+
number?: number;
|
|
4
|
+
status?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
writer: string;
|
|
7
|
+
date: string;
|
|
8
|
+
views: number;
|
|
9
|
+
isNotice: boolean;
|
|
10
|
+
isSecret: boolean;
|
|
11
|
+
canView: boolean;
|
|
12
|
+
code?: number;
|
|
13
|
+
};
|
|
14
|
+
export type ParentLetterListResult = {
|
|
15
|
+
page: number;
|
|
16
|
+
listMode: ParentLetterListMode;
|
|
17
|
+
items: ParentLetterListItem[];
|
|
18
|
+
};
|
|
19
|
+
export type ClassOption = {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
export type WriteContext = {
|
|
24
|
+
code: string;
|
|
25
|
+
oldfile: string;
|
|
26
|
+
sessionMcode: string;
|
|
27
|
+
pass: string;
|
|
28
|
+
scodeDetail: string;
|
|
29
|
+
wrkrNo: string;
|
|
30
|
+
};
|
|
31
|
+
export type LoginParams = {
|
|
32
|
+
userId: string;
|
|
33
|
+
password: string;
|
|
34
|
+
returnUrl?: string;
|
|
35
|
+
};
|
|
36
|
+
export type ListParentLettersParams = {
|
|
37
|
+
page?: number;
|
|
38
|
+
listMode?: ParentLetterListMode;
|
|
39
|
+
};
|
|
40
|
+
export type GetClassListParams = {
|
|
41
|
+
acacode?: string;
|
|
42
|
+
dbClass?: string;
|
|
43
|
+
};
|
|
44
|
+
export type PostParentLetterInput = {
|
|
45
|
+
receiver: string;
|
|
46
|
+
classId: string;
|
|
47
|
+
writer: string;
|
|
48
|
+
relation: string;
|
|
49
|
+
title: string;
|
|
50
|
+
content: string;
|
|
51
|
+
scodeDetail?: string;
|
|
52
|
+
pass?: string;
|
|
53
|
+
file?: {
|
|
54
|
+
filename: string;
|
|
55
|
+
data: Uint8Array;
|
|
56
|
+
contentType?: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type PostParentLetterResult = {
|
|
60
|
+
ok: boolean;
|
|
61
|
+
message?: string;
|
|
62
|
+
raw?: string;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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