@eliceio/cdk-cli 0.0.0-stage → 0.1.0-alpha.1

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.
Files changed (128) hide show
  1. package/README.md +511 -2
  2. package/es/bin/index.d.ts +2 -0
  3. package/es/bin/index.js +10 -0
  4. package/es/cli.d.ts +5 -0
  5. package/es/cli.js +171 -0
  6. package/es/commands/build/index.d.ts +27 -0
  7. package/es/commands/build/index.js +154 -0
  8. package/es/commands/check/index.d.ts +9 -0
  9. package/es/commands/check/index.js +31 -0
  10. package/es/commands/create/index.d.ts +8 -0
  11. package/es/commands/create/index.js +22 -0
  12. package/es/commands/create/scaffold.d.ts +24 -0
  13. package/es/commands/create/scaffold.js +82 -0
  14. package/es/commands/dev/index.d.ts +6 -0
  15. package/es/commands/dev/index.js +40 -0
  16. package/es/commands/doctor/index.d.ts +33 -0
  17. package/es/commands/doctor/index.js +230 -0
  18. package/es/core/collect.d.ts +21 -0
  19. package/es/core/collect.js +89 -0
  20. package/es/core/config.d.ts +55 -0
  21. package/es/core/config.js +109 -0
  22. package/es/core/manifest.d.ts +15 -0
  23. package/es/core/manifest.js +43 -0
  24. package/es/core/minify.d.ts +18 -0
  25. package/es/core/minify.js +93 -0
  26. package/es/core/prepare.d.ts +12 -0
  27. package/es/core/prepare.js +86 -0
  28. package/es/core/protocol.d.ts +2 -0
  29. package/es/core/protocol.js +4 -0
  30. package/es/core/zip.d.ts +4 -0
  31. package/es/core/zip.js +17 -0
  32. package/es/dev/grading.d.ts +15 -0
  33. package/es/dev/grading.js +37 -0
  34. package/es/dev/host-page.d.ts +7 -0
  35. package/es/dev/host-page.js +240 -0
  36. package/es/dev/inject.d.ts +8 -0
  37. package/es/dev/inject.js +38 -0
  38. package/es/dev/mock-api.d.ts +65 -0
  39. package/es/dev/mock-api.js +269 -0
  40. package/es/dev/server.d.ts +24 -0
  41. package/es/dev/server.js +294 -0
  42. package/es/engines/static/index.d.ts +3 -0
  43. package/es/engines/static/index.js +11 -0
  44. package/es/engines/types.d.ts +12 -0
  45. package/es/engines/vite/index.d.ts +2 -0
  46. package/es/engines/vite/index.js +4 -0
  47. package/es/index.d.ts +2 -0
  48. package/es/index.js +2 -0
  49. package/es/rules/check.d.ts +2 -0
  50. package/es/rules/check.js +209 -0
  51. package/es/rules/index.d.ts +8 -0
  52. package/es/rules/index.js +7 -0
  53. package/es/rules/manifest.d.ts +39 -0
  54. package/es/rules/manifest.js +168 -0
  55. package/es/rules/node.d.ts +11 -0
  56. package/es/rules/node.js +87 -0
  57. package/es/rules/path.d.ts +7 -0
  58. package/es/rules/path.js +35 -0
  59. package/es/rules/refs.d.ts +19 -0
  60. package/es/rules/refs.js +111 -0
  61. package/es/rules/skip.d.ts +12 -0
  62. package/es/rules/skip.js +55 -0
  63. package/es/rules/spec.d.ts +3 -0
  64. package/es/rules/spec.js +6 -0
  65. package/es/rules/types.d.ts +138 -0
  66. package/es/rules/unused.d.ts +7 -0
  67. package/es/rules/unused.js +21 -0
  68. package/es/rules/zip.d.ts +13 -0
  69. package/es/rules/zip.js +45 -0
  70. package/es/rules.json.js +3 -0
  71. package/es/types.d.ts +4 -0
  72. package/es/version.d.ts +1 -0
  73. package/es/version.js +3 -0
  74. package/package.json +48 -3
  75. package/rules.json +555 -0
  76. package/templates/_shared/lib/cdk-mock.d.ts +94 -0
  77. package/templates/_shared/lib/cdk-mock.js +429 -0
  78. package/templates/_shared/lib/cdk.js +3 -0
  79. package/templates/_shared/lib/elice-content.css +252 -0
  80. package/templates/_shared/lib/elice-content.d.ts +121 -0
  81. package/templates/_shared/lib/elice-content.js +541 -0
  82. package/templates/_shared/lib/elice-tokens.css +446 -0
  83. package/templates/blank/README.md +64 -0
  84. package/templates/blank/content.json +4 -0
  85. package/templates/blank/edit.html +15 -0
  86. package/templates/blank/elice.config.json +12 -0
  87. package/templates/blank/gitignore +3 -0
  88. package/templates/blank/index.html +15 -0
  89. package/templates/blank/instructor.html +15 -0
  90. package/templates/blank/screens/edit.js +21 -0
  91. package/templates/blank/screens/instructor.js +9 -0
  92. package/templates/blank/screens/learn.js +19 -0
  93. package/templates/blank/styles.css +1 -0
  94. package/templates/quiz/README.md +108 -0
  95. package/templates/quiz/content.json +81 -0
  96. package/templates/quiz/core/behaviors.d.ts +59 -0
  97. package/templates/quiz/core/behaviors.js +309 -0
  98. package/templates/quiz/core/dom.d.ts +13 -0
  99. package/templates/quiz/core/dom.js +83 -0
  100. package/templates/quiz/core/editor.d.ts +48 -0
  101. package/templates/quiz/core/editor.js +206 -0
  102. package/templates/quiz/core/markdown.d.ts +2 -0
  103. package/templates/quiz/core/markdown.js +84 -0
  104. package/templates/quiz/core/model.d.ts +20 -0
  105. package/templates/quiz/core/model.js +203 -0
  106. package/templates/quiz/edit.html +17 -0
  107. package/templates/quiz/elice.config.json +14 -0
  108. package/templates/quiz/gitignore +3 -0
  109. package/templates/quiz/grading.json +13 -0
  110. package/templates/quiz/index.html +17 -0
  111. package/templates/quiz/instructor.html +17 -0
  112. package/templates/quiz/screens/edit.js +139 -0
  113. package/templates/quiz/screens/instructor.js +27 -0
  114. package/templates/quiz/screens/learn.js +50 -0
  115. package/templates/quiz/styles.css +510 -0
  116. package/templates/quiz/ui/templates/choice.js +22 -0
  117. package/templates/quiz/ui/templates/edit.d.ts +14 -0
  118. package/templates/quiz/ui/templates/edit.js +187 -0
  119. package/templates/quiz/ui/templates/group.js +47 -0
  120. package/templates/quiz/ui/templates/index.d.ts +5 -0
  121. package/templates/quiz/ui/templates/index.js +17 -0
  122. package/templates/quiz/ui/templates/order.js +35 -0
  123. package/templates/quiz/ui/templates/page.js +29 -0
  124. package/templates/quiz/ui/templates/question.js +28 -0
  125. package/templates/quiz/ui/templates/text.js +16 -0
  126. package/templates/quiz/ui/texts.d.ts +3 -0
  127. package/templates/quiz/ui/texts.js +128 -0
  128. package/templates/quiz/ui/theme.css +50 -0
package/rules.json ADDED
@@ -0,0 +1,555 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "manifest": {
4
+ "file": "metadata.json",
5
+ "kinds": ["material", "description"],
6
+ "defaultKind": "material",
7
+ "modes": ["learn", "instructor", "edit"],
8
+ "required": ["learn"],
9
+ "kindModes": {
10
+ "material": ["learn", "instructor", "edit"],
11
+ "description": ["learn"]
12
+ },
13
+ "gradingTypes": ["on_access", "on_submit", "pattern", "rubric"],
14
+ "commentaryFile": "commentary.txt",
15
+ "defaultEntry": "index.html"
16
+ },
17
+ "limits": {
18
+ "maxZipBytes": 20971520,
19
+ "maxUnpackedBytes": 209715200,
20
+ "maxFiles": 300,
21
+ "maxEntries": 3000,
22
+ "warnRatio": 0.8,
23
+ "maxImageBytes": 1048576
24
+ },
25
+ "allowedExtensions": [
26
+ "html",
27
+ "htm",
28
+ "css",
29
+ "js",
30
+ "mjs",
31
+ "json",
32
+ "map",
33
+ "txt",
34
+ "md",
35
+ "csv",
36
+ "xml",
37
+ "vtt",
38
+ "svg",
39
+ "png",
40
+ "jpg",
41
+ "jpeg",
42
+ "gif",
43
+ "webp",
44
+ "avif",
45
+ "ico",
46
+ "bmp",
47
+ "mp3",
48
+ "wav",
49
+ "ogg",
50
+ "m4a",
51
+ "mp4",
52
+ "webm",
53
+ "woff",
54
+ "woff2",
55
+ "ttf",
56
+ "otf",
57
+ "glb",
58
+ "gltf",
59
+ "bin",
60
+ "wasm",
61
+ "pdf"
62
+ ],
63
+ "imageExtensions": ["png", "jpg", "jpeg", "gif", "webp", "avif", "bmp", "svg"],
64
+ "excluded": {
65
+ "secret": {
66
+ "level": "error",
67
+ "files": [".env", ".env.*", "elice.config.*", "grading.json", "answers.*", "*.pem", "*.key"],
68
+ "dirs": []
69
+ },
70
+ "dev": {
71
+ "level": "error",
72
+ "files": [],
73
+ "dirs": [".git", "node_modules"]
74
+ },
75
+ "junk": {
76
+ "level": "warn",
77
+ "files": [".DS_Store", "Thumbs.db", "desktop.ini"],
78
+ "dirs": ["__MACOSX"]
79
+ }
80
+ },
81
+ "forbiddenApis": [
82
+ {
83
+ "id": "api.parent-access",
84
+ "pattern": "\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",
85
+ "title": "부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"
86
+ },
87
+ {
88
+ "id": "api.cookie",
89
+ "pattern": "\\bdocument\\.cookie\\b",
90
+ "title": "쿠키 사용 (sandbox에서 예외가 남)"
91
+ },
92
+ {
93
+ "id": "api.storage",
94
+ "pattern": "\\b(?:localStorage|sessionStorage|indexedDB)\\b",
95
+ "title": "브라우저 저장소 사용 (sandbox에서 예외가 남, 입력값 저장은 SDK 사용)"
96
+ },
97
+ {
98
+ "id": "api.eval",
99
+ "pattern": "\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",
100
+ "title": "eval · new Function · 문자열 setTimeout 사용"
101
+ },
102
+ {
103
+ "id": "api.dialog",
104
+ "pattern": "\\b(?:alert|confirm|prompt)\\s*\\(",
105
+ "title": "alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"
106
+ },
107
+ {
108
+ "id": "api.window-open",
109
+ "pattern": "\\bwindow\\.open\\s*\\(",
110
+ "title": "새 창 열기 (sandbox에서 막힘)"
111
+ },
112
+ {
113
+ "id": "api.external-send",
114
+ "pattern": "\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",
115
+ "title": "외부 주소로 요청을 보냄 (학생 정보 유출 위험)"
116
+ },
117
+ {
118
+ "id": "sec.html-injection",
119
+ "pattern": "\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",
120
+ "title": "HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"
121
+ },
122
+ {
123
+ "id": "sec.redirect",
124
+ "pattern": "\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",
125
+ "title": "주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"
126
+ },
127
+ {
128
+ "id": "sec.postmessage-wildcard",
129
+ "pattern": "\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",
130
+ "title": "postMessage 대상이 * (아무 창이나 받을 수 있음)"
131
+ }
132
+ ],
133
+ "secretPatterns": [
134
+ {
135
+ "source": "elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",
136
+ "title": "개인키",
137
+ "pattern": "-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"
138
+ },
139
+ {
140
+ "source": "elice-hardcoded-secret",
141
+ "title": "하드코딩된 비밀 값",
142
+ "pattern": "(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",
143
+ "flags": "i",
144
+ "not": "os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"
145
+ },
146
+ {
147
+ "source": "detected-aws-access-key-id-value",
148
+ "title": "AWS 액세스 키",
149
+ "pattern": "\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",
150
+ "not": "example|sample|test|fake"
151
+ },
152
+ {
153
+ "source": "detected-aws-secret-access-key",
154
+ "title": "AWS 비밀 키",
155
+ "pattern": "[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",
156
+ "flags": "i",
157
+ "not": "example|sample|test|fake|xxxxxx"
158
+ },
159
+ {
160
+ "source": "detected-aws-session-token",
161
+ "title": "AWS 세션 토큰",
162
+ "pattern": "AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",
163
+ "flags": "i",
164
+ "not": "example|sample|test|fake"
165
+ },
166
+ {
167
+ "source": "detected-aws-appsync-graphql-key",
168
+ "title": "AWS AppSync 키",
169
+ "pattern": "da2-[a-z0-9]{26}"
170
+ },
171
+ {
172
+ "source": "detected-amazon-mws-auth-token",
173
+ "title": "Amazon MWS 토큰",
174
+ "pattern": "amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
175
+ },
176
+ {
177
+ "source": "detected-artifactory-token",
178
+ "title": "Artifactory 토큰",
179
+ "pattern": "\\bAKC[a-zA-Z0-9]{10,}\\n",
180
+ "not": "sha(?:128|256|512)"
181
+ },
182
+ {
183
+ "source": "detected-artifactory-password",
184
+ "title": "Artifactory 비밀번호",
185
+ "pattern": "[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",
186
+ "not": "sha(?:1|2|3|118|256|512)"
187
+ },
188
+ {
189
+ "source": "detected-bcrypt-hash",
190
+ "title": "bcrypt 해시",
191
+ "pattern": "\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"
192
+ },
193
+ {
194
+ "source": "detected-codeclimate",
195
+ "title": "Code Climate 토큰",
196
+ "pattern": "codeclima.{0,50}[\"'`]?[0-9a-f]{64}",
197
+ "flags": "i"
198
+ },
199
+ {
200
+ "source": "detected-etc-shadow",
201
+ "title": "/etc/shadow 내용",
202
+ "pattern": "^\\s*root:[x!*]*:\\d*:\\d*",
203
+ "flags": "m"
204
+ },
205
+ {
206
+ "source": "detected-facebook-access-token",
207
+ "title": "Facebook 액세스 토큰",
208
+ "pattern": "EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"
209
+ },
210
+ {
211
+ "source": "detected-facebook-oauth",
212
+ "title": "Facebook OAuth 비밀",
213
+ "pattern": "[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"
214
+ },
215
+ {
216
+ "source": "detected-google-gcm-service-account",
217
+ "title": "Google 서비스 계정 키",
218
+ "pattern": "[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"
219
+ },
220
+ {
221
+ "source": "detected-google-oauth-access-token",
222
+ "title": "Google OAuth 토큰",
223
+ "pattern": "ya29\\.[0-9A-Za-z_-]+"
224
+ },
225
+ {
226
+ "source": "detected-heroku-api-key",
227
+ "title": "Heroku API 키",
228
+ "pattern": "[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"
229
+ },
230
+ {
231
+ "source": "detected-hockeyapp",
232
+ "title": "HockeyApp 토큰",
233
+ "pattern": "hockey.{0,50}[\"'`]?[0-9a-f]{32}",
234
+ "flags": "i"
235
+ },
236
+ {
237
+ "source": "detected-mailchimp-api-key",
238
+ "title": "Mailchimp API 키",
239
+ "pattern": "[0-9a-f]{32}-us\\d{1,2}"
240
+ },
241
+ {
242
+ "source": "detected-mailgun-api-key",
243
+ "title": "Mailgun API 키",
244
+ "pattern": "key-[0-9a-zA-Z]{32}"
245
+ },
246
+ {
247
+ "source": "detected-onfido-live-api-token",
248
+ "title": "Onfido API 토큰",
249
+ "pattern": "api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"
250
+ },
251
+ {
252
+ "source": "detected-outlook-team",
253
+ "title": "Outlook 웹훅",
254
+ "pattern": "https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"
255
+ },
256
+ {
257
+ "source": "detected-paypal-braintree-access-token",
258
+ "title": "PayPal Braintree 토큰",
259
+ "pattern": "access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"
260
+ },
261
+ {
262
+ "source": "detected-picatic-api-key",
263
+ "title": "Picatic API 키",
264
+ "pattern": "sk_live_[0-9a-z]{32}"
265
+ },
266
+ {
267
+ "source": "detected-sauce-token",
268
+ "title": "Sauce Labs 토큰",
269
+ "pattern": "sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",
270
+ "flags": "i"
271
+ },
272
+ {
273
+ "source": "detected-slack-token",
274
+ "title": "Slack 토큰",
275
+ "pattern": "xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"
276
+ },
277
+ {
278
+ "source": "detected-slack-webhook",
279
+ "title": "Slack 웹훅",
280
+ "pattern": "https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",
281
+ "not": "T00000000/B00000000/X{24}"
282
+ },
283
+ {
284
+ "source": "detected-sonarqube-docs-api-key",
285
+ "title": "SonarQube 토큰",
286
+ "pattern": "sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",
287
+ "flags": "i"
288
+ },
289
+ {
290
+ "source": "detected-square-access-token",
291
+ "title": "Square 액세스 토큰",
292
+ "pattern": "sq0atp-[0-9A-Za-z_-]{22}"
293
+ },
294
+ {
295
+ "source": "detected-square-oauth-secret",
296
+ "title": "Square OAuth 비밀",
297
+ "pattern": "sq0csp-[0-9A-Za-z\\\\_-]{43}"
298
+ },
299
+ {
300
+ "source": "detected-ssh-password",
301
+ "title": "sshpass 비밀번호",
302
+ "pattern": "sshpass[ ]-p\\s*['\"]"
303
+ },
304
+ {
305
+ "source": "detected-stripe-api-key",
306
+ "title": "Stripe API 키",
307
+ "pattern": "sk_live_[0-9a-zA-Z]{24}"
308
+ },
309
+ {
310
+ "source": "detected-stripe-restricted-api-key",
311
+ "title": "Stripe 제한 키",
312
+ "pattern": "rk_live_[0-9a-zA-Z]{24}"
313
+ },
314
+ {
315
+ "source": "detected-telegram-bot-api-key",
316
+ "title": "Telegram 봇 토큰",
317
+ "pattern": "\\d+:AA[0-9A-Za-z_-]{33}",
318
+ "not": "go\\.mod|v\\d+\\.\\d+\\.\\d+"
319
+ },
320
+ {
321
+ "source": "detected-twilio-api-key",
322
+ "title": "Twilio API 키",
323
+ "pattern": "SK[0-9a-fA-F]{32}"
324
+ },
325
+ {
326
+ "source": "detected-username-and-password-in-uri",
327
+ "title": "주소에 들어 있는 아이디 · 비밀번호",
328
+ "pattern": "[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"
329
+ }
330
+ ],
331
+ "rules": [
332
+ {
333
+ "id": "manifest.missing",
334
+ "level": "error",
335
+ "scope": "server",
336
+ "title": "metadata.json 없음"
337
+ },
338
+ {
339
+ "id": "manifest.invalid",
340
+ "level": "error",
341
+ "scope": "server",
342
+ "title": "metadata.json 형식 오류"
343
+ },
344
+ {
345
+ "id": "manifest.entry-missing",
346
+ "level": "error",
347
+ "scope": "server",
348
+ "title": "metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"
349
+ },
350
+ {
351
+ "id": "entry.missing",
352
+ "level": "error",
353
+ "scope": "server",
354
+ "title": "학생 화면 진입 파일 없음"
355
+ },
356
+ {
357
+ "id": "entry.nested",
358
+ "level": "error",
359
+ "scope": "server",
360
+ "title": "폴더째 묶은 zip (metadata.json이 최상위에 없음)"
361
+ },
362
+ {
363
+ "id": "input.not-zip",
364
+ "level": "error",
365
+ "scope": "server",
366
+ "title": "zip이 아닌 업로드 (HTML 파일 하나 등)"
367
+ },
368
+ {
369
+ "id": "limit.zip-size",
370
+ "level": "error",
371
+ "scope": "server",
372
+ "title": "zip 크기 한도 초과"
373
+ },
374
+ {
375
+ "id": "limit.file-count",
376
+ "level": "error",
377
+ "scope": "server",
378
+ "title": "파일 개수 한도 초과"
379
+ },
380
+ {
381
+ "id": "limit.unpacked-size",
382
+ "level": "error",
383
+ "scope": "server",
384
+ "title": "풀면 너무 큰 zip (압축 폭탄 의심)"
385
+ },
386
+ {
387
+ "id": "limit.near",
388
+ "level": "warn",
389
+ "scope": "client",
390
+ "title": "한도에 가까움"
391
+ },
392
+ {
393
+ "id": "path.unsafe",
394
+ "level": "error",
395
+ "scope": "server",
396
+ "title": "안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"
397
+ },
398
+ {
399
+ "id": "path.case-collision",
400
+ "level": "error",
401
+ "scope": "server",
402
+ "title": "대소문자만 다른 경로"
403
+ },
404
+ {
405
+ "id": "path.non-ascii",
406
+ "level": "warn",
407
+ "scope": "client",
408
+ "title": "공백·한글 등 ASCII 밖 문자가 든 경로"
409
+ },
410
+ {
411
+ "id": "file.extension",
412
+ "level": "error",
413
+ "scope": "server",
414
+ "title": "허용하지 않는 확장자"
415
+ },
416
+ {
417
+ "id": "file.secret",
418
+ "level": "error",
419
+ "scope": "server",
420
+ "title": "정답·비밀 파일 포함"
421
+ },
422
+ {
423
+ "id": "file.dev",
424
+ "level": "error",
425
+ "scope": "server",
426
+ "title": "개발용 폴더 포함"
427
+ },
428
+ {
429
+ "id": "file.junk",
430
+ "level": "warn",
431
+ "scope": "server",
432
+ "title": "운영체제가 만든 불필요한 파일"
433
+ },
434
+ {
435
+ "id": "file.large-image",
436
+ "level": "warn",
437
+ "scope": "client",
438
+ "title": "1MB 넘는 이미지"
439
+ },
440
+ {
441
+ "id": "ref.missing",
442
+ "level": "error",
443
+ "scope": "client",
444
+ "title": "참조한 파일이 없음"
445
+ },
446
+ {
447
+ "id": "ref.case-mismatch",
448
+ "level": "error",
449
+ "scope": "client",
450
+ "title": "참조 경로의 대소문자가 실제 파일과 다름"
451
+ },
452
+ {
453
+ "id": "ref.root-absolute",
454
+ "level": "error",
455
+ "scope": "client",
456
+ "title": "/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"
457
+ },
458
+ {
459
+ "id": "ref.external-script",
460
+ "level": "error",
461
+ "scope": "client",
462
+ "title": "외부 스크립트 (zip 안에 넣고 상대경로로)"
463
+ },
464
+ {
465
+ "id": "ref.external-request",
466
+ "level": "warn",
467
+ "scope": "client",
468
+ "title": "외부 리소스 요청 (글꼴·이미지 등이 막힐 수 있음)"
469
+ },
470
+ {
471
+ "id": "ref.insecure",
472
+ "level": "warn",
473
+ "scope": "client",
474
+ "title": "http:// 외부 리소스 (https 페이지에서 막힘)"
475
+ },
476
+ {
477
+ "id": "html.img-alt",
478
+ "level": "warn",
479
+ "scope": "client",
480
+ "title": "대체 텍스트 없는 이미지"
481
+ },
482
+ {
483
+ "id": "html.form",
484
+ "level": "warn",
485
+ "scope": "client",
486
+ "title": "form 제출 (sandbox에서 막힘, 버튼 click으로 처리)"
487
+ },
488
+ {
489
+ "id": "api.external-send",
490
+ "level": "error",
491
+ "scope": "client",
492
+ "title": "외부 주소로 요청 보냄"
493
+ },
494
+ {
495
+ "id": "api.parent-access",
496
+ "level": "warn",
497
+ "scope": "client",
498
+ "title": "부모 창 직접 접근"
499
+ },
500
+ {
501
+ "id": "api.cookie",
502
+ "level": "error",
503
+ "scope": "client",
504
+ "title": "쿠키 사용"
505
+ },
506
+ {
507
+ "id": "api.storage",
508
+ "level": "error",
509
+ "scope": "client",
510
+ "title": "브라우저 저장소 사용"
511
+ },
512
+ {
513
+ "id": "api.eval",
514
+ "level": "warn",
515
+ "scope": "client",
516
+ "title": "eval · new Function 사용"
517
+ },
518
+ {
519
+ "id": "api.dialog",
520
+ "level": "error",
521
+ "scope": "client",
522
+ "title": "alert · confirm · prompt 사용"
523
+ },
524
+ {
525
+ "id": "api.window-open",
526
+ "level": "error",
527
+ "scope": "client",
528
+ "title": "새 창 열기"
529
+ },
530
+ {
531
+ "id": "sec.secret",
532
+ "level": "error",
533
+ "scope": "server",
534
+ "title": "비밀 값 (키 · 토큰 · 비밀번호)"
535
+ },
536
+ {
537
+ "id": "sec.html-injection",
538
+ "level": "warn",
539
+ "scope": "client",
540
+ "title": "HTML 문자열 삽입"
541
+ },
542
+ {
543
+ "id": "sec.redirect",
544
+ "level": "warn",
545
+ "scope": "client",
546
+ "title": "주소를 값으로 바꿈"
547
+ },
548
+ {
549
+ "id": "sec.postmessage-wildcard",
550
+ "level": "warn",
551
+ "scope": "client",
552
+ "title": "postMessage 대상 *"
553
+ }
554
+ ]
555
+ }
@@ -0,0 +1,94 @@
1
+ // lib/cdk-mock.js 타입 (편집기 자동완성용)
2
+ export type Scope = 'learn' | 'edit';
3
+ export type Viewer = 'student' | 'instructor' | 'tutor';
4
+ export type Screen = 'learn' | 'instructor' | 'edit';
5
+
6
+ export declare const ErrorCode: Readonly<{
7
+ Init: 'init';
8
+ InvalidParam: 'invalid_param';
9
+ InvalidToken: 'invalid_token';
10
+ NotInitialized: 'not_initialized';
11
+ Unauthorized: 'unauthorized';
12
+ SessionExpired: 'session_expired';
13
+ PermissionDenied: 'permission_denied';
14
+ ReadOnlyMode: 'read_only_mode';
15
+ ScreenNotSupported: 'screen_not_supported';
16
+ ContentNotReady: 'content_not_ready';
17
+ InvalidInput: 'invalid_input';
18
+ RateLimited: 'rate_limited';
19
+ ExternalServiceError: 'external_service_error';
20
+ NavigationTimeout: 'navigation_timeout';
21
+ RequestFailed: 'request_failed';
22
+ }>;
23
+ export declare class EliceCDKError extends Error {
24
+ static code: typeof ErrorCode;
25
+ code: (typeof ErrorCode)[keyof typeof ErrorCode];
26
+ constructor(code: string, message: string, cause?: unknown);
27
+ }
28
+
29
+ /** submit 결과. manual · none(점수 없는 채점)이면 둘 다 null */
30
+ export interface SubmitResult {
31
+ isCorrect: boolean | null;
32
+ score: number | null;
33
+ }
34
+
35
+ export interface Submission extends SubmitResult {
36
+ id: string;
37
+ materialVersionId: string;
38
+ accountId: number;
39
+ createdAt: string;
40
+ answer: unknown;
41
+ }
42
+
43
+ export declare function gradeLocally(grading: unknown, answer: unknown): SubmitResult;
44
+
45
+ export interface Navigation {
46
+ previous(): void;
47
+ next(): void;
48
+ navigate(lecturePageId: number): void;
49
+ getHasPrevious(): Promise<boolean>;
50
+ getHasNext(): Promise<boolean>;
51
+ }
52
+
53
+ export declare class MockEliceCDK {
54
+ constructor(options?: {
55
+ onSessionExpired?: () => void;
56
+ scenario?: string;
57
+ grading?: unknown;
58
+ settings?: Record<string, unknown>;
59
+ loadJson?: (url: string) => Promise<unknown>;
60
+ delayMs?: number;
61
+ });
62
+ initialized: boolean;
63
+ isMock: true;
64
+ readonly account: { anonymousId: string; fullname: string | null } | null;
65
+ readonly scope: Scope | null;
66
+ readonly viewer: Viewer | null;
67
+ readonly screen: Screen | null;
68
+ readonly metadata: {
69
+ materialId: string;
70
+ lecturePageId: number | null;
71
+ courseId: number | null;
72
+ } | null;
73
+ readonly locale: string;
74
+ readonly isDraft: boolean;
75
+ readonly isSessionExpired: boolean;
76
+ readonly navigation: Navigation;
77
+ readonly material: {
78
+ description: unknown;
79
+ entries: Partial<Record<Screen, string>>;
80
+ settings: Record<string, unknown>;
81
+ } | null;
82
+ readonly result: {
83
+ score: number | null;
84
+ submitCount: number;
85
+ completedAt: string | null;
86
+ } | null;
87
+ readonly persistent: boolean;
88
+ init(options?: { hash?: string; pathname?: string }): Promise<this>;
89
+ submit(answer: unknown): Promise<SubmitResult>;
90
+ history(options?: { offset?: number; limit?: number }): Promise<Submission[]>;
91
+ saveSettings(settings: Record<string, unknown>): void;
92
+ dispose(): void;
93
+ reset(): void;
94
+ }