@gadicc/loom 0.0.0-oidc-bootstrap.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.
Files changed (342) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +6 -0
  3. package/README.md +448 -0
  4. package/THIRD_PARTY_NOTICES.md +25 -0
  5. package/db/drizzle-config.d.ts +20 -0
  6. package/db/drizzle-config.js +34 -0
  7. package/db/fixtures.d.ts +31 -0
  8. package/db/fixtures.js +52 -0
  9. package/db/neon.d.ts +3 -0
  10. package/db/neon.js +20 -0
  11. package/db/neonFull.d.ts +12 -0
  12. package/db/neonFull.js +33 -0
  13. package/db/package.json +3 -0
  14. package/db/testing.d.ts +26 -0
  15. package/db/testing.js +76 -0
  16. package/db/testing.test.ts +28 -0
  17. package/db/valibot.d.ts +23 -0
  18. package/db/valibot.js +8 -0
  19. package/esm/_dnt.polyfills.d.ts +149 -0
  20. package/esm/_dnt.polyfills.d.ts.map +1 -0
  21. package/esm/_dnt.polyfills.js +163 -0
  22. package/esm/_dnt.shims.d.ts +2 -0
  23. package/esm/_dnt.shims.d.ts.map +1 -0
  24. package/esm/_dnt.shims.js +57 -0
  25. package/esm/bin/loom.d.ts +2 -0
  26. package/esm/bin/loom.d.ts.map +1 -0
  27. package/esm/bin/loom.js +11 -0
  28. package/esm/mod.d.ts +9 -0
  29. package/esm/mod.d.ts.map +1 -0
  30. package/esm/mod.js +8 -0
  31. package/esm/package.json +3 -0
  32. package/esm/src/apiKeys/authorize.d.ts +4 -0
  33. package/esm/src/apiKeys/authorize.d.ts.map +1 -0
  34. package/esm/src/apiKeys/authorize.js +184 -0
  35. package/esm/src/apiKeys/country.d.ts +3 -0
  36. package/esm/src/apiKeys/country.d.ts.map +1 -0
  37. package/esm/src/apiKeys/country.js +7 -0
  38. package/esm/src/apiKeys/credentials.d.ts +4 -0
  39. package/esm/src/apiKeys/credentials.d.ts.map +1 -0
  40. package/esm/src/apiKeys/credentials.js +55 -0
  41. package/esm/src/apiKeys/fingerprint.d.ts +3 -0
  42. package/esm/src/apiKeys/fingerprint.d.ts.map +1 -0
  43. package/esm/src/apiKeys/fingerprint.js +5 -0
  44. package/esm/src/apiKeys/mod.d.ts +9 -0
  45. package/esm/src/apiKeys/mod.d.ts.map +1 -0
  46. package/esm/src/apiKeys/mod.js +8 -0
  47. package/esm/src/apiKeys/policy.d.ts +59 -0
  48. package/esm/src/apiKeys/policy.d.ts.map +1 -0
  49. package/esm/src/apiKeys/policy.js +88 -0
  50. package/esm/src/apiKeys/retention.d.ts +55 -0
  51. package/esm/src/apiKeys/retention.d.ts.map +1 -0
  52. package/esm/src/apiKeys/retention.js +65 -0
  53. package/esm/src/apiKeys/types.d.ts +175 -0
  54. package/esm/src/apiKeys/types.d.ts.map +1 -0
  55. package/esm/src/apiKeys/types.js +1 -0
  56. package/esm/src/cli/externalSkills.d.ts +39 -0
  57. package/esm/src/cli/externalSkills.d.ts.map +1 -0
  58. package/esm/src/cli/externalSkills.js +177 -0
  59. package/esm/src/cli/mod.d.ts +337 -0
  60. package/esm/src/cli/mod.d.ts.map +1 -0
  61. package/esm/src/cli/mod.js +9268 -0
  62. package/esm/src/cli/projectSkills.d.ts +102 -0
  63. package/esm/src/cli/projectSkills.d.ts.map +1 -0
  64. package/esm/src/cli/projectSkills.js +592 -0
  65. package/esm/src/files/client.d.ts +29 -0
  66. package/esm/src/files/client.d.ts.map +1 -0
  67. package/esm/src/files/client.js +41 -0
  68. package/esm/src/files/errors.d.ts +37 -0
  69. package/esm/src/files/errors.d.ts.map +1 -0
  70. package/esm/src/files/errors.js +66 -0
  71. package/esm/src/files/hash.d.ts +15 -0
  72. package/esm/src/files/hash.d.ts.map +1 -0
  73. package/esm/src/files/hash.js +82 -0
  74. package/esm/src/files/memory.d.ts +29 -0
  75. package/esm/src/files/memory.d.ts.map +1 -0
  76. package/esm/src/files/memory.js +109 -0
  77. package/esm/src/files/metadata.d.ts +10 -0
  78. package/esm/src/files/metadata.d.ts.map +1 -0
  79. package/esm/src/files/metadata.js +186 -0
  80. package/esm/src/files/mod.d.ts +10 -0
  81. package/esm/src/files/mod.d.ts.map +1 -0
  82. package/esm/src/files/mod.js +9 -0
  83. package/esm/src/files/s3.d.ts +29 -0
  84. package/esm/src/files/s3.d.ts.map +1 -0
  85. package/esm/src/files/s3.js +107 -0
  86. package/esm/src/files/service.d.ts +27 -0
  87. package/esm/src/files/service.d.ts.map +1 -0
  88. package/esm/src/files/service.js +136 -0
  89. package/esm/src/files/types.d.ts +134 -0
  90. package/esm/src/files/types.d.ts.map +1 -0
  91. package/esm/src/files/types.js +1 -0
  92. package/esm/src/jobs/catalog.d.ts +32 -0
  93. package/esm/src/jobs/catalog.d.ts.map +1 -0
  94. package/esm/src/jobs/catalog.js +208 -0
  95. package/esm/src/jobs/controller.d.ts +28 -0
  96. package/esm/src/jobs/controller.d.ts.map +1 -0
  97. package/esm/src/jobs/controller.js +95 -0
  98. package/esm/src/jobs/direct.d.ts +36 -0
  99. package/esm/src/jobs/direct.d.ts.map +1 -0
  100. package/esm/src/jobs/direct.js +122 -0
  101. package/esm/src/jobs/events.d.ts +15 -0
  102. package/esm/src/jobs/events.d.ts.map +1 -0
  103. package/esm/src/jobs/events.js +30 -0
  104. package/esm/src/jobs/format.d.ts +16 -0
  105. package/esm/src/jobs/format.d.ts.map +1 -0
  106. package/esm/src/jobs/format.js +183 -0
  107. package/esm/src/jobs/http.d.ts +22 -0
  108. package/esm/src/jobs/http.d.ts.map +1 -0
  109. package/esm/src/jobs/http.js +44 -0
  110. package/esm/src/jobs/log.d.ts +2 -0
  111. package/esm/src/jobs/log.d.ts.map +1 -0
  112. package/esm/src/jobs/log.js +10 -0
  113. package/esm/src/jobs/mod.d.ts +10 -0
  114. package/esm/src/jobs/mod.d.ts.map +1 -0
  115. package/esm/src/jobs/mod.js +9 -0
  116. package/esm/src/jobs/run.d.ts +20 -0
  117. package/esm/src/jobs/run.d.ts.map +1 -0
  118. package/esm/src/jobs/run.js +57 -0
  119. package/esm/src/jobs/types.d.ts +31 -0
  120. package/esm/src/jobs/types.d.ts.map +1 -0
  121. package/esm/src/jobs/types.js +1 -0
  122. package/esm/src/mui/apiKeys.d.ts +65 -0
  123. package/esm/src/mui/apiKeys.d.ts.map +1 -0
  124. package/esm/src/mui/apiKeys.js +301 -0
  125. package/esm/src/mui/apiKeysView.d.ts +48 -0
  126. package/esm/src/mui/apiKeysView.d.ts.map +1 -0
  127. package/esm/src/mui/apiKeysView.js +34 -0
  128. package/esm/src/mui/confirm.d.ts +12 -0
  129. package/esm/src/mui/confirm.d.ts.map +1 -0
  130. package/esm/src/mui/confirm.js +78 -0
  131. package/esm/src/mui/mod.d.ts +4 -0
  132. package/esm/src/mui/mod.d.ts.map +1 -0
  133. package/esm/src/mui/mod.js +2 -0
  134. package/esm/src/next/apiKeys/mod.d.ts +64 -0
  135. package/esm/src/next/apiKeys/mod.d.ts.map +1 -0
  136. package/esm/src/next/apiKeys/mod.js +217 -0
  137. package/esm/src/next/auth/config.d.ts +34 -0
  138. package/esm/src/next/auth/config.d.ts.map +1 -0
  139. package/esm/src/next/auth/config.js +103 -0
  140. package/esm/src/next/auth/mod.d.ts +3 -0
  141. package/esm/src/next/auth/mod.d.ts.map +1 -0
  142. package/esm/src/next/auth/mod.js +2 -0
  143. package/esm/src/next/auth/server.d.ts +28 -0
  144. package/esm/src/next/auth/server.d.ts.map +1 -0
  145. package/esm/src/next/auth/server.js +24 -0
  146. package/esm/src/next/files/mod.d.ts +3 -0
  147. package/esm/src/next/files/mod.d.ts.map +1 -0
  148. package/esm/src/next/files/mod.js +2 -0
  149. package/esm/src/next/files/route.d.ts +99 -0
  150. package/esm/src/next/files/route.d.ts.map +1 -0
  151. package/esm/src/next/files/route.js +349 -0
  152. package/esm/src/next/jobs/list.d.ts +25 -0
  153. package/esm/src/next/jobs/list.d.ts.map +1 -0
  154. package/esm/src/next/jobs/list.js +39 -0
  155. package/esm/src/next/jobs/mod.d.ts +6 -0
  156. package/esm/src/next/jobs/mod.d.ts.map +1 -0
  157. package/esm/src/next/jobs/mod.js +5 -0
  158. package/esm/src/next/jobs/paths.d.ts +14 -0
  159. package/esm/src/next/jobs/paths.d.ts.map +1 -0
  160. package/esm/src/next/jobs/paths.js +40 -0
  161. package/esm/src/next/jobs/route.d.ts +48 -0
  162. package/esm/src/next/jobs/route.d.ts.map +1 -0
  163. package/esm/src/next/jobs/route.js +101 -0
  164. package/esm/src/next/jobs/run.d.ts +51 -0
  165. package/esm/src/next/jobs/run.d.ts.map +1 -0
  166. package/esm/src/next/jobs/run.js +563 -0
  167. package/esm/src/next/jobs/stream.d.ts +3 -0
  168. package/esm/src/next/jobs/stream.d.ts.map +1 -0
  169. package/esm/src/next/jobs/stream.js +25 -0
  170. package/esm/src/next/pwa/mod.d.ts +104 -0
  171. package/esm/src/next/pwa/mod.d.ts.map +1 -0
  172. package/esm/src/next/pwa/mod.js +169 -0
  173. package/esm/src/next/pwa/worker.d.ts +27 -0
  174. package/esm/src/next/pwa/worker.d.ts.map +1 -0
  175. package/esm/src/next/pwa/worker.js +27 -0
  176. package/package.json +293 -0
  177. package/script/_dnt.polyfills.d.ts +149 -0
  178. package/script/_dnt.polyfills.d.ts.map +1 -0
  179. package/script/_dnt.polyfills.js +166 -0
  180. package/script/_dnt.shims.d.ts +2 -0
  181. package/script/_dnt.shims.d.ts.map +1 -0
  182. package/script/_dnt.shims.js +60 -0
  183. package/script/bin/loom.d.ts +2 -0
  184. package/script/bin/loom.d.ts.map +1 -0
  185. package/script/bin/loom.js +17 -0
  186. package/script/mod.d.ts +9 -0
  187. package/script/mod.d.ts.map +1 -0
  188. package/script/mod.js +24 -0
  189. package/script/package.json +3 -0
  190. package/script/src/apiKeys/authorize.d.ts +4 -0
  191. package/script/src/apiKeys/authorize.d.ts.map +1 -0
  192. package/script/src/apiKeys/authorize.js +187 -0
  193. package/script/src/apiKeys/country.d.ts +3 -0
  194. package/script/src/apiKeys/country.d.ts.map +1 -0
  195. package/script/src/apiKeys/country.js +10 -0
  196. package/script/src/apiKeys/credentials.d.ts +4 -0
  197. package/script/src/apiKeys/credentials.d.ts.map +1 -0
  198. package/script/src/apiKeys/credentials.js +58 -0
  199. package/script/src/apiKeys/fingerprint.d.ts +3 -0
  200. package/script/src/apiKeys/fingerprint.d.ts.map +1 -0
  201. package/script/src/apiKeys/fingerprint.js +8 -0
  202. package/script/src/apiKeys/mod.d.ts +9 -0
  203. package/script/src/apiKeys/mod.d.ts.map +1 -0
  204. package/script/src/apiKeys/mod.js +24 -0
  205. package/script/src/apiKeys/policy.d.ts +59 -0
  206. package/script/src/apiKeys/policy.d.ts.map +1 -0
  207. package/script/src/apiKeys/policy.js +92 -0
  208. package/script/src/apiKeys/retention.d.ts +55 -0
  209. package/script/src/apiKeys/retention.d.ts.map +1 -0
  210. package/script/src/apiKeys/retention.js +70 -0
  211. package/script/src/apiKeys/types.d.ts +175 -0
  212. package/script/src/apiKeys/types.d.ts.map +1 -0
  213. package/script/src/apiKeys/types.js +2 -0
  214. package/script/src/cli/externalSkills.d.ts +39 -0
  215. package/script/src/cli/externalSkills.d.ts.map +1 -0
  216. package/script/src/cli/externalSkills.js +181 -0
  217. package/script/src/cli/mod.d.ts +337 -0
  218. package/script/src/cli/mod.d.ts.map +1 -0
  219. package/script/src/cli/mod.js +9337 -0
  220. package/script/src/cli/projectSkills.d.ts +102 -0
  221. package/script/src/cli/projectSkills.d.ts.map +1 -0
  222. package/script/src/cli/projectSkills.js +606 -0
  223. package/script/src/files/client.d.ts +29 -0
  224. package/script/src/files/client.d.ts.map +1 -0
  225. package/script/src/files/client.js +45 -0
  226. package/script/src/files/errors.d.ts +37 -0
  227. package/script/src/files/errors.d.ts.map +1 -0
  228. package/script/src/files/errors.js +76 -0
  229. package/script/src/files/hash.d.ts +15 -0
  230. package/script/src/files/hash.d.ts.map +1 -0
  231. package/script/src/files/hash.js +89 -0
  232. package/script/src/files/memory.d.ts +29 -0
  233. package/script/src/files/memory.d.ts.map +1 -0
  234. package/script/src/files/memory.js +113 -0
  235. package/script/src/files/metadata.d.ts +10 -0
  236. package/script/src/files/metadata.d.ts.map +1 -0
  237. package/script/src/files/metadata.js +189 -0
  238. package/script/src/files/mod.d.ts +10 -0
  239. package/script/src/files/mod.d.ts.map +1 -0
  240. package/script/src/files/mod.js +25 -0
  241. package/script/src/files/s3.d.ts +29 -0
  242. package/script/src/files/s3.d.ts.map +1 -0
  243. package/script/src/files/s3.js +110 -0
  244. package/script/src/files/service.d.ts +27 -0
  245. package/script/src/files/service.d.ts.map +1 -0
  246. package/script/src/files/service.js +139 -0
  247. package/script/src/files/types.d.ts +134 -0
  248. package/script/src/files/types.d.ts.map +1 -0
  249. package/script/src/files/types.js +2 -0
  250. package/script/src/jobs/catalog.d.ts +32 -0
  251. package/script/src/jobs/catalog.d.ts.map +1 -0
  252. package/script/src/jobs/catalog.js +223 -0
  253. package/script/src/jobs/controller.d.ts +28 -0
  254. package/script/src/jobs/controller.d.ts.map +1 -0
  255. package/script/src/jobs/controller.js +100 -0
  256. package/script/src/jobs/direct.d.ts +36 -0
  257. package/script/src/jobs/direct.d.ts.map +1 -0
  258. package/script/src/jobs/direct.js +128 -0
  259. package/script/src/jobs/events.d.ts +15 -0
  260. package/script/src/jobs/events.d.ts.map +1 -0
  261. package/script/src/jobs/events.js +37 -0
  262. package/script/src/jobs/format.d.ts +16 -0
  263. package/script/src/jobs/format.d.ts.map +1 -0
  264. package/script/src/jobs/format.js +193 -0
  265. package/script/src/jobs/http.d.ts +22 -0
  266. package/script/src/jobs/http.d.ts.map +1 -0
  267. package/script/src/jobs/http.js +50 -0
  268. package/script/src/jobs/log.d.ts +2 -0
  269. package/script/src/jobs/log.d.ts.map +1 -0
  270. package/script/src/jobs/log.js +13 -0
  271. package/script/src/jobs/mod.d.ts +10 -0
  272. package/script/src/jobs/mod.d.ts.map +1 -0
  273. package/script/src/jobs/mod.js +25 -0
  274. package/script/src/jobs/run.d.ts +20 -0
  275. package/script/src/jobs/run.d.ts.map +1 -0
  276. package/script/src/jobs/run.js +61 -0
  277. package/script/src/jobs/types.d.ts +31 -0
  278. package/script/src/jobs/types.d.ts.map +1 -0
  279. package/script/src/jobs/types.js +2 -0
  280. package/script/src/mui/apiKeys.d.ts +65 -0
  281. package/script/src/mui/apiKeys.d.ts.map +1 -0
  282. package/script/src/mui/apiKeys.js +327 -0
  283. package/script/src/mui/apiKeysView.d.ts +48 -0
  284. package/script/src/mui/apiKeysView.d.ts.map +1 -0
  285. package/script/src/mui/apiKeysView.js +40 -0
  286. package/script/src/mui/confirm.d.ts +12 -0
  287. package/script/src/mui/confirm.d.ts.map +1 -0
  288. package/script/src/mui/confirm.js +85 -0
  289. package/script/src/mui/mod.d.ts +4 -0
  290. package/script/src/mui/mod.d.ts.map +1 -0
  291. package/script/src/mui/mod.js +19 -0
  292. package/script/src/next/apiKeys/mod.d.ts +64 -0
  293. package/script/src/next/apiKeys/mod.d.ts.map +1 -0
  294. package/script/src/next/apiKeys/mod.js +224 -0
  295. package/script/src/next/auth/config.d.ts +34 -0
  296. package/script/src/next/auth/config.d.ts.map +1 -0
  297. package/script/src/next/auth/config.js +142 -0
  298. package/script/src/next/auth/mod.d.ts +3 -0
  299. package/script/src/next/auth/mod.d.ts.map +1 -0
  300. package/script/src/next/auth/mod.js +18 -0
  301. package/script/src/next/auth/server.d.ts +28 -0
  302. package/script/src/next/auth/server.d.ts.map +1 -0
  303. package/script/src/next/auth/server.js +27 -0
  304. package/script/src/next/files/mod.d.ts +3 -0
  305. package/script/src/next/files/mod.d.ts.map +1 -0
  306. package/script/src/next/files/mod.js +18 -0
  307. package/script/src/next/files/route.d.ts +99 -0
  308. package/script/src/next/files/route.d.ts.map +1 -0
  309. package/script/src/next/files/route.js +353 -0
  310. package/script/src/next/jobs/list.d.ts +25 -0
  311. package/script/src/next/jobs/list.d.ts.map +1 -0
  312. package/script/src/next/jobs/list.js +48 -0
  313. package/script/src/next/jobs/mod.d.ts +6 -0
  314. package/script/src/next/jobs/mod.d.ts.map +1 -0
  315. package/script/src/next/jobs/mod.js +21 -0
  316. package/script/src/next/jobs/paths.d.ts +14 -0
  317. package/script/src/next/jobs/paths.d.ts.map +1 -0
  318. package/script/src/next/jobs/paths.js +47 -0
  319. package/script/src/next/jobs/route.d.ts +48 -0
  320. package/script/src/next/jobs/route.d.ts.map +1 -0
  321. package/script/src/next/jobs/route.js +105 -0
  322. package/script/src/next/jobs/run.d.ts +51 -0
  323. package/script/src/next/jobs/run.d.ts.map +1 -0
  324. package/script/src/next/jobs/run.js +570 -0
  325. package/script/src/next/jobs/stream.d.ts +3 -0
  326. package/script/src/next/jobs/stream.d.ts.map +1 -0
  327. package/script/src/next/jobs/stream.js +28 -0
  328. package/script/src/next/pwa/mod.d.ts +104 -0
  329. package/script/src/next/pwa/mod.d.ts.map +1 -0
  330. package/script/src/next/pwa/mod.js +192 -0
  331. package/script/src/next/pwa/worker.d.ts +27 -0
  332. package/script/src/next/pwa/worker.d.ts.map +1 -0
  333. package/script/src/next/pwa/worker.js +33 -0
  334. package/skills/loom/SKILL.md +200 -0
  335. package/skills/loom-api-keys/SKILL.md +123 -0
  336. package/skills/loom-auth/SKILL.md +70 -0
  337. package/skills/loom-db/SKILL.md +94 -0
  338. package/skills/loom-db/references/db-stack.md +39 -0
  339. package/skills/loom-files/SKILL.md +97 -0
  340. package/skills/loom-jobs/SKILL.md +148 -0
  341. package/skills/upgrade-deps/SKILL.md +165 -0
  342. package/skills/upgrade-deps/agents/openai.yaml +4 -0
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ApiKeyCreateDialog = ApiKeyCreateDialog;
21
+ exports.ApiKeySecretDialog = ApiKeySecretDialog;
22
+ exports.ApiKeysTable = ApiKeysTable;
23
+ exports.AdminApiKeysTable = AdminApiKeysTable;
24
+ exports.ApiKeyAuditTable = ApiKeyAuditTable;
25
+ exports.ApiKeysManager = ApiKeysManager;
26
+ require("../../_dnt.polyfills.js");
27
+ "use client";
28
+ const Alert_1 = __importDefault(require("@mui/material/Alert"));
29
+ const Box_1 = __importDefault(require("@mui/material/Box"));
30
+ const Button_1 = __importDefault(require("@mui/material/Button"));
31
+ const Checkbox_1 = __importDefault(require("@mui/material/Checkbox"));
32
+ const Chip_1 = __importDefault(require("@mui/material/Chip"));
33
+ const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgress"));
34
+ const Dialog_1 = __importDefault(require("@mui/material/Dialog"));
35
+ const DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
36
+ const DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
37
+ const DialogContentText_1 = __importDefault(require("@mui/material/DialogContentText"));
38
+ const DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
39
+ const FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
40
+ const Paper_1 = __importDefault(require("@mui/material/Paper"));
41
+ const Stack_1 = __importDefault(require("@mui/material/Stack"));
42
+ const Table_1 = __importDefault(require("@mui/material/Table"));
43
+ const TableBody_1 = __importDefault(require("@mui/material/TableBody"));
44
+ const TableCell_1 = __importDefault(require("@mui/material/TableCell"));
45
+ const TableContainer_1 = __importDefault(require("@mui/material/TableContainer"));
46
+ const TableHead_1 = __importDefault(require("@mui/material/TableHead"));
47
+ const TablePagination_1 = __importDefault(require("@mui/material/TablePagination"));
48
+ const TableRow_1 = __importDefault(require("@mui/material/TableRow"));
49
+ const TextField_1 = __importDefault(require("@mui/material/TextField"));
50
+ const Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
51
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
52
+ const react_1 = __importDefault(require("react"));
53
+ const apiKeysView_js_1 = require("./apiKeysView.js");
54
+ __exportStar(require("./apiKeysView.js"), exports);
55
+ function IpCountry(props) {
56
+ const flag = (0, apiKeysView_js_1.countryCodeToFlagEmoji)(props.countryCode);
57
+ if (!flag && !props.ipAddress)
58
+ return react_1.default.createElement(react_1.default.Fragment, null, "\u2014");
59
+ return (react_1.default.createElement(react_1.default.Fragment, null,
60
+ flag
61
+ ? (react_1.default.createElement(Box_1.default, { component: "span", role: "img", "aria-label": props.countryCode?.toUpperCase(), sx: { mr: props.ipAddress ? 0.75 : 0 } }, flag))
62
+ : null,
63
+ props.ipAddress));
64
+ }
65
+ function ApiKeyCreateDialog(props) {
66
+ const [name, setName] = react_1.default.useState("");
67
+ const [scopeIds, setScopeIds] = react_1.default.useState([]);
68
+ const [expiry, setExpiry] = react_1.default.useState("never");
69
+ const [customExpiry, setCustomExpiry] = react_1.default.useState("");
70
+ const [localError, setLocalError] = react_1.default.useState(null);
71
+ const [pending, startTransition] = react_1.default.useTransition();
72
+ const close = () => {
73
+ if (!pending)
74
+ props.onClose();
75
+ };
76
+ const submit = () => {
77
+ const trimmedName = name.trim();
78
+ if (!trimmedName) {
79
+ setLocalError("Enter a name for this key.");
80
+ return;
81
+ }
82
+ if (!scopeIds.length) {
83
+ setLocalError("Choose at least one scope.");
84
+ return;
85
+ }
86
+ let expiresAt = null;
87
+ if (expiry === "custom") {
88
+ const parsed = new Date(customExpiry);
89
+ if (!customExpiry || Number.isNaN(parsed.valueOf()) || parsed <= new Date()) {
90
+ setLocalError("Choose a future expiry date.");
91
+ return;
92
+ }
93
+ expiresAt = parsed.toISOString();
94
+ }
95
+ else if (expiry !== "never") {
96
+ expiresAt = new Date(Date.now() + Number(expiry) * 86_400_000)
97
+ .toISOString();
98
+ }
99
+ setLocalError(null);
100
+ startTransition(async () => {
101
+ try {
102
+ const result = await props.onCreate({
103
+ expiresAt,
104
+ name: trimmedName,
105
+ scopeIds,
106
+ });
107
+ props.onCreated(result);
108
+ setName("");
109
+ setScopeIds([]);
110
+ setExpiry("never");
111
+ props.onClose();
112
+ }
113
+ catch (error) {
114
+ setLocalError(error instanceof Error
115
+ ? error.message
116
+ : "The key could not be created.");
117
+ }
118
+ });
119
+ };
120
+ return (react_1.default.createElement(Dialog_1.default, { open: props.open, onClose: close, fullWidth: true, maxWidth: "sm", "aria-labelledby": "loom-api-key-create-title" },
121
+ react_1.default.createElement(DialogTitle_1.default, { id: "loom-api-key-create-title" }, "Create API key"),
122
+ react_1.default.createElement(DialogContent_1.default, null,
123
+ react_1.default.createElement(Stack_1.default, { spacing: 2, sx: { pt: 1 } },
124
+ react_1.default.createElement(TextField_1.default, { label: "Key name", value: name, required: true, autoFocus: true, onChange: (event) => setName(event.target.value), disabled: pending }),
125
+ react_1.default.createElement(Box_1.default, { component: "fieldset", sx: { border: 0, m: 0, p: 0 } },
126
+ react_1.default.createElement(Typography_1.default, { component: "legend", variant: "subtitle2" }, "Scopes"),
127
+ props.scopes.map((scope) => (react_1.default.createElement(Tooltip_1.default, { key: scope.id, title: scope.description ?? "", placement: "right" },
128
+ react_1.default.createElement(FormControlLabel_1.default, { control: react_1.default.createElement(Checkbox_1.default, { checked: scopeIds.includes(scope.id), onChange: (_, checked) => setScopeIds((current) => checked
129
+ ? [...current, scope.id]
130
+ : current.filter((id) => id !== scope.id)) }), disabled: pending || scope.disabled, label: scope.label }))))),
131
+ react_1.default.createElement(TextField_1.default, { select: true, label: "Expiry", value: expiry, onChange: (event) => setExpiry(event.target.value), disabled: pending, slotProps: { select: { native: true } } },
132
+ react_1.default.createElement("option", { value: "never" }, "Never"),
133
+ react_1.default.createElement("option", { value: "7" }, "7 days"),
134
+ react_1.default.createElement("option", { value: "30" }, "30 days"),
135
+ react_1.default.createElement("option", { value: "custom" }, "Custom date")),
136
+ expiry === "custom"
137
+ ? (react_1.default.createElement(TextField_1.default, { type: "datetime-local", label: "Expires at", value: customExpiry, onChange: (event) => setCustomExpiry(event.target.value), slotProps: { inputLabel: { shrink: true } }, disabled: pending }))
138
+ : null,
139
+ localError || props.error
140
+ ? react_1.default.createElement(Alert_1.default, { severity: "error" }, localError ?? props.error)
141
+ : null)),
142
+ react_1.default.createElement(DialogActions_1.default, null,
143
+ react_1.default.createElement(Button_1.default, { onClick: close, disabled: pending }, "Cancel"),
144
+ react_1.default.createElement(Button_1.default, { onClick: submit, variant: "contained", disabled: pending }, pending ? "Creating…" : "Create key"))));
145
+ }
146
+ function ApiKeySecretDialog(props) {
147
+ const [copied, setCopied] = react_1.default.useState(false);
148
+ react_1.default.useEffect(() => setCopied(false), [props.result]);
149
+ const copy = async () => {
150
+ if (!props.result)
151
+ return;
152
+ const clipboard = globalThis.navigator.clipboard;
153
+ if (!clipboard)
154
+ throw new Error("Clipboard access is unavailable.");
155
+ await clipboard.writeText(props.result.key);
156
+ setCopied(true);
157
+ };
158
+ return (react_1.default.createElement(Dialog_1.default, { open: props.open, onClose: props.onClose, fullWidth: true, maxWidth: "sm", "aria-labelledby": "loom-api-key-secret-title" },
159
+ react_1.default.createElement(DialogTitle_1.default, { id: "loom-api-key-secret-title" }, "Copy your API key now"),
160
+ react_1.default.createElement(DialogContent_1.default, null,
161
+ react_1.default.createElement(DialogContentText_1.default, null, "This secret is shown once and cannot be recovered after you close this dialog."),
162
+ react_1.default.createElement(TextField_1.default, { value: props.result?.key ?? "", fullWidth: true, margin: "normal", label: "API key", slotProps: {
163
+ htmlInput: { readOnly: true, "aria-label": "New API key" },
164
+ } }),
165
+ props.queryCredentialsEnabled
166
+ ? (react_1.default.createElement(Alert_1.default, { severity: "warning" }, "Query-parameter keys can appear in browser history, access logs, copied links, and referrers. Prefer an authorization header."))
167
+ : null,
168
+ copied
169
+ ? react_1.default.createElement(Alert_1.default, { severity: "success", sx: { mt: 2 } }, "Copied.")
170
+ : null),
171
+ react_1.default.createElement(DialogActions_1.default, null,
172
+ react_1.default.createElement(Button_1.default, { onClick: copy, disabled: !props.result }, "Copy key"),
173
+ react_1.default.createElement(Button_1.default, { onClick: props.onClose, variant: "contained" }, "I saved it"))));
174
+ }
175
+ function ScopeChips({ scopes }) {
176
+ return (react_1.default.createElement(Stack_1.default, { direction: "row", gap: 0.5, flexWrap: "wrap" }, scopes.map((scope) => react_1.default.createElement(Chip_1.default, { key: scope, size: "small", label: scope }))));
177
+ }
178
+ function ApiKeysTable(props) {
179
+ const [pendingId, setPendingId] = react_1.default.useState(null);
180
+ const revoke = async (row) => {
181
+ if (!props.onRevoke ||
182
+ !globalThis.confirm(`Revoke “${row.name}”? This cannot be undone.`))
183
+ return;
184
+ setPendingId(row.id);
185
+ try {
186
+ await props.onRevoke(row.id);
187
+ }
188
+ finally {
189
+ setPendingId(null);
190
+ }
191
+ };
192
+ const rename = async (row) => {
193
+ if (!props.onRename)
194
+ return;
195
+ const name = globalThis.prompt("New key name", row.name)?.trim();
196
+ if (!name || name === row.name)
197
+ return;
198
+ setPendingId(row.id);
199
+ try {
200
+ await props.onRename(row.id, name);
201
+ }
202
+ finally {
203
+ setPendingId(null);
204
+ }
205
+ };
206
+ if (props.loading) {
207
+ return (react_1.default.createElement(Box_1.default, { sx: { py: 6, textAlign: "center" } },
208
+ react_1.default.createElement(CircularProgress_1.default, { "aria-label": "Loading API keys" })));
209
+ }
210
+ if (!props.rows.length) {
211
+ return (react_1.default.createElement(Alert_1.default, { severity: "info" }, "No API keys yet. Create one when you are ready to connect an external tool."));
212
+ }
213
+ const actions = (row) => (react_1.default.createElement(Stack_1.default, { direction: "row", spacing: 1 },
214
+ react_1.default.createElement(Button_1.default, { size: "small", onClick: () => rename(row), disabled: !props.onRename || pendingId === row.id }, "Rename"),
215
+ react_1.default.createElement(Button_1.default, { size: "small", color: "error", onClick: () => revoke(row), disabled: !props.onRevoke || !row.enabled || pendingId === row.id }, "Revoke")));
216
+ return (react_1.default.createElement(react_1.default.Fragment, null,
217
+ react_1.default.createElement(TableContainer_1.default, { component: Paper_1.default, variant: "outlined", sx: { display: { xs: "none", md: "block" } } },
218
+ react_1.default.createElement(Table_1.default, { size: "small", "aria-label": props.admin ? "All user API keys" : "Your API keys" },
219
+ react_1.default.createElement(TableHead_1.default, null,
220
+ react_1.default.createElement(TableRow_1.default, null,
221
+ props.admin ? react_1.default.createElement(TableCell_1.default, null, "Owner") : null,
222
+ react_1.default.createElement(TableCell_1.default, null, "Name / start"),
223
+ react_1.default.createElement(TableCell_1.default, null, "Status"),
224
+ react_1.default.createElement(TableCell_1.default, null, "Scopes"),
225
+ react_1.default.createElement(TableCell_1.default, null, "Created"),
226
+ react_1.default.createElement(TableCell_1.default, null, "Expires"),
227
+ react_1.default.createElement(TableCell_1.default, null, "Last successful use"),
228
+ props.extraColumns?.map((column) => (react_1.default.createElement(TableCell_1.default, { key: column.id }, column.header))),
229
+ react_1.default.createElement(TableCell_1.default, { align: "right" }, "Actions"))),
230
+ react_1.default.createElement(TableBody_1.default, null, props.rows.map((row) => (react_1.default.createElement(TableRow_1.default, { key: row.id, hover: true },
231
+ props.admin
232
+ ? (react_1.default.createElement(TableCell_1.default, null,
233
+ react_1.default.createElement(Typography_1.default, { variant: "body2" }, row.ownerName ?? row.ownerId ?? "Unknown"),
234
+ react_1.default.createElement(Typography_1.default, { variant: "caption", color: "text.secondary" }, row.ownerEmail)))
235
+ : null,
236
+ react_1.default.createElement(TableCell_1.default, null,
237
+ react_1.default.createElement(Typography_1.default, { variant: "body2", fontWeight: 600 }, row.name),
238
+ react_1.default.createElement(Typography_1.default, { variant: "caption", color: "text.secondary" }, row.start ?? "No visible prefix")),
239
+ react_1.default.createElement(TableCell_1.default, null,
240
+ react_1.default.createElement(Chip_1.default, { size: "small", color: (0, apiKeysView_js_1.getApiKeyStatus)(row) === "Active"
241
+ ? "success"
242
+ : "default", label: (0, apiKeysView_js_1.getApiKeyStatus)(row) })),
243
+ react_1.default.createElement(TableCell_1.default, null,
244
+ react_1.default.createElement(ScopeChips, { scopes: row.scopes })),
245
+ react_1.default.createElement(TableCell_1.default, null, (0, apiKeysView_js_1.formatApiKeyDate)(row.createdAt)),
246
+ react_1.default.createElement(TableCell_1.default, null, (0, apiKeysView_js_1.formatApiKeyDate)(row.expiresAt)),
247
+ react_1.default.createElement(TableCell_1.default, null,
248
+ (0, apiKeysView_js_1.formatApiKeyDate)(row.lastUsedAt),
249
+ row.lastUsedScope
250
+ ? (react_1.default.createElement(Typography_1.default, { display: "block", variant: "caption" }, row.lastUsedScope))
251
+ : null,
252
+ row.lastUsedCountryCode || row.lastUsedIpAddress
253
+ ? (react_1.default.createElement(Typography_1.default, { display: "block", variant: "caption" },
254
+ react_1.default.createElement(IpCountry, { countryCode: row.lastUsedCountryCode, ipAddress: row.lastUsedIpAddress })))
255
+ : null),
256
+ props.extraColumns?.map((column) => (react_1.default.createElement(TableCell_1.default, { key: column.id }, column.render(row)))),
257
+ react_1.default.createElement(TableCell_1.default, { align: "right" }, actions(row)))))))),
258
+ react_1.default.createElement(Stack_1.default, { spacing: 1.5, sx: { display: { xs: "flex", md: "none" } } }, props.rows.map((row) => (react_1.default.createElement(Paper_1.default, { key: row.id, variant: "outlined", sx: { p: 2 } },
259
+ react_1.default.createElement(Stack_1.default, { spacing: 1 },
260
+ react_1.default.createElement(Stack_1.default, { direction: "row", justifyContent: "space-between" },
261
+ react_1.default.createElement(Box_1.default, null,
262
+ react_1.default.createElement(Typography_1.default, { fontWeight: 600 }, row.name),
263
+ react_1.default.createElement(Typography_1.default, { variant: "caption", color: "text.secondary" }, row.start)),
264
+ react_1.default.createElement(Chip_1.default, { size: "small", label: (0, apiKeysView_js_1.getApiKeyStatus)(row) })),
265
+ props.admin
266
+ ? (react_1.default.createElement(Typography_1.default, { variant: "body2" }, row.ownerName ?? row.ownerEmail ?? row.ownerId))
267
+ : null,
268
+ react_1.default.createElement(ScopeChips, { scopes: row.scopes }),
269
+ react_1.default.createElement(Typography_1.default, { variant: "caption" },
270
+ "Last successful use: ",
271
+ (0, apiKeysView_js_1.formatApiKeyDate)(row.lastUsedAt),
272
+ row.lastUsedScope ? ` · ${row.lastUsedScope}` : "",
273
+ row.lastUsedCountryCode || row.lastUsedIpAddress
274
+ ? (react_1.default.createElement(react_1.default.Fragment, null,
275
+ " · ",
276
+ react_1.default.createElement(IpCountry, { countryCode: row.lastUsedCountryCode, ipAddress: row.lastUsedIpAddress })))
277
+ : null),
278
+ actions(row))))))));
279
+ }
280
+ function AdminApiKeysTable(props) {
281
+ return react_1.default.createElement(ApiKeysTable, { ...props, admin: true });
282
+ }
283
+ function ApiKeyAuditTable(props) {
284
+ return (react_1.default.createElement(Paper_1.default, { variant: "outlined" },
285
+ react_1.default.createElement(TableContainer_1.default, null,
286
+ react_1.default.createElement(Table_1.default, { size: "small", "aria-label": "API-key audit history" },
287
+ react_1.default.createElement(TableHead_1.default, null,
288
+ react_1.default.createElement(TableRow_1.default, null,
289
+ react_1.default.createElement(TableCell_1.default, null, "Time"),
290
+ react_1.default.createElement(TableCell_1.default, null, "Scope"),
291
+ react_1.default.createElement(TableCell_1.default, null, "Operation"),
292
+ react_1.default.createElement(TableCell_1.default, null, "Transport"),
293
+ react_1.default.createElement(TableCell_1.default, null, "Client"),
294
+ react_1.default.createElement(TableCell_1.default, null, "Outcome"),
295
+ react_1.default.createElement(TableCell_1.default, null, "Context"))),
296
+ react_1.default.createElement(TableBody_1.default, null, props.loading
297
+ ? (react_1.default.createElement(TableRow_1.default, null,
298
+ react_1.default.createElement(TableCell_1.default, { colSpan: 7, align: "center" },
299
+ react_1.default.createElement(CircularProgress_1.default, { size: 24, "aria-label": "Loading audit history" }))))
300
+ : props.rows.map((row) => (react_1.default.createElement(TableRow_1.default, { key: row.id },
301
+ react_1.default.createElement(TableCell_1.default, null, (0, apiKeysView_js_1.formatApiKeyDate)(row.occurredAt)),
302
+ react_1.default.createElement(TableCell_1.default, null, row.scope),
303
+ react_1.default.createElement(TableCell_1.default, null, row.operation),
304
+ react_1.default.createElement(TableCell_1.default, null, row.transport ?? "—"),
305
+ react_1.default.createElement(TableCell_1.default, null,
306
+ react_1.default.createElement(Typography_1.default, { variant: "body2" },
307
+ react_1.default.createElement(IpCountry, { countryCode: row.countryCode, ipAddress: row.ipAddress })),
308
+ react_1.default.createElement(Typography_1.default, { variant: "caption", color: "text.secondary" }, row.userAgent ?? "")),
309
+ react_1.default.createElement(TableCell_1.default, null, [row.authorizationOutcome, row.operationOutcome].filter(Boolean).join(" / ")),
310
+ react_1.default.createElement(TableCell_1.default, null, [row.pageName, row.functionName, row.actionName].filter(Boolean).join(" · ") || "—"))))))),
311
+ react_1.default.createElement(TablePagination_1.default, { component: "div", count: props.count, page: props.page, rowsPerPage: props.rowsPerPage, rowsPerPageOptions: [props.rowsPerPage], onPageChange: (_event, page) => props.onPageChange(page) })));
312
+ }
313
+ function ApiKeysManager(props) {
314
+ const [createOpen, setCreateOpen] = react_1.default.useState(false);
315
+ const [secret, setSecret] = react_1.default.useState(null);
316
+ return (react_1.default.createElement(Stack_1.default, { spacing: 2 },
317
+ react_1.default.createElement(Stack_1.default, { direction: { xs: "column", sm: "row" }, justifyContent: "space-between", alignItems: { sm: "center" }, gap: 1 },
318
+ react_1.default.createElement(Box_1.default, null,
319
+ react_1.default.createElement(Typography_1.default, { variant: "h5", component: "h1" }, "API keys"),
320
+ react_1.default.createElement(Typography_1.default, { color: "text.secondary" }, "Create scoped credentials for tools you trust.")),
321
+ react_1.default.createElement(Button_1.default, { variant: "contained", onClick: () => setCreateOpen(true), disabled: !props.onCreate }, "Create API key")),
322
+ props.error ? react_1.default.createElement(Alert_1.default, { severity: "error" }, props.error) : null,
323
+ react_1.default.createElement(ApiKeysTable, { rows: props.rows, loading: props.loading, scopes: props.scopes, extraColumns: props.extraColumns, onRename: props.onRename, onRevoke: props.onRevoke }),
324
+ react_1.default.createElement(ApiKeyCreateDialog, { open: createOpen, onClose: () => setCreateOpen(false), scopes: props.scopes, error: props.error, onCreate: props.onCreate ??
325
+ (() => Promise.reject(new Error("Key creation is unavailable."))), onCreated: setSecret }),
326
+ react_1.default.createElement(ApiKeySecretDialog, { open: secret !== null, result: secret, queryCredentialsEnabled: props.queryCredentialsEnabled, onClose: () => setSecret(null) })));
327
+ }
@@ -0,0 +1,48 @@
1
+ export interface ApiKeyScopeDefinition {
2
+ description?: string;
3
+ disabled?: boolean;
4
+ id: string;
5
+ label: string;
6
+ permission: {
7
+ action: string;
8
+ resource: string;
9
+ };
10
+ }
11
+ export interface ApiKeyRow {
12
+ createdAt: string;
13
+ enabled: boolean;
14
+ expiresAt?: string | null;
15
+ id: string;
16
+ lastUsedAt?: string | null;
17
+ lastUsedCountryCode?: string | null;
18
+ lastUsedIpAddress?: string | null;
19
+ lastUsedScope?: string | null;
20
+ name: string;
21
+ ownerEmail?: string;
22
+ ownerId?: string;
23
+ ownerName?: string;
24
+ scopes: string[];
25
+ start?: string | null;
26
+ }
27
+ export interface ApiKeyAuditRow {
28
+ actionName?: string | null;
29
+ authorizationOutcome?: string | null;
30
+ countryCode?: string | null;
31
+ functionName?: string | null;
32
+ id: string;
33
+ ipAddress?: string | null;
34
+ occurredAt: string;
35
+ operation: string;
36
+ operationOutcome?: string | null;
37
+ pageName?: string | null;
38
+ scope: string;
39
+ transport?: string | null;
40
+ userAgent?: string | null;
41
+ }
42
+ /** Converts an ISO alpha-2 country code to its Unicode regional flag. */
43
+ export declare function countryCodeToFlagEmoji(countryCode?: string | null): string | null;
44
+ /** Formats ISO date values consistently while preserving an empty state. */
45
+ export declare function formatApiKeyDate(value?: string | null): string;
46
+ export declare function getApiKeyStatus(row: ApiKeyRow, now?: number): "Revoked" | "Expired" | "Active";
47
+ export declare function getApiKeyVisibleColumnIds(admin?: boolean): string[];
48
+ //# sourceMappingURL=apiKeysView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiKeysView.d.ts","sourceRoot":"","sources":["../../../src/src/mui/apiKeysView.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,iBASjE;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,UAIrD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,SAAa,oCAM/D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,UAAQ,YAWtD"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countryCodeToFlagEmoji = countryCodeToFlagEmoji;
4
+ exports.formatApiKeyDate = formatApiKeyDate;
5
+ exports.getApiKeyStatus = getApiKeyStatus;
6
+ exports.getApiKeyVisibleColumnIds = getApiKeyVisibleColumnIds;
7
+ /** Converts an ISO alpha-2 country code to its Unicode regional flag. */
8
+ function countryCodeToFlagEmoji(countryCode) {
9
+ const normalized = countryCode?.trim().toUpperCase();
10
+ if (!normalized || !/^[A-Z]{2}$/.test(normalized))
11
+ return null;
12
+ return String.fromCodePoint(...Array.from(normalized, (character) => 0x1f1e6 + character.charCodeAt(0) - 65));
13
+ }
14
+ /** Formats ISO date values consistently while preserving an empty state. */
15
+ function formatApiKeyDate(value) {
16
+ if (!value)
17
+ return "Never";
18
+ const date = new Date(value);
19
+ return Number.isNaN(date.valueOf()) ? value : date.toLocaleString();
20
+ }
21
+ function getApiKeyStatus(row, now = Date.now()) {
22
+ if (!row.enabled)
23
+ return "Revoked";
24
+ if (row.expiresAt && new Date(row.expiresAt).valueOf() <= now) {
25
+ return "Expired";
26
+ }
27
+ return "Active";
28
+ }
29
+ function getApiKeyVisibleColumnIds(admin = false) {
30
+ return [
31
+ ...(admin ? ["owner"] : []),
32
+ "name",
33
+ "status",
34
+ "scopes",
35
+ "created",
36
+ "expires",
37
+ "lastUsed",
38
+ "actions",
39
+ ];
40
+ }
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ConfirmOptions {
3
+ cancel?: ReactNode;
4
+ ok?: ReactNode;
5
+ text: ReactNode;
6
+ title?: ReactNode;
7
+ }
8
+ export declare function asyncConfirm(text: string): Promise<boolean>;
9
+ export declare function asyncConfirm(options: ConfirmOptions): Promise<boolean>;
10
+ export declare function ConfirmDialog(): any;
11
+ export default asyncConfirm;
12
+ //# sourceMappingURL=confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/src/mui/confirm.tsx"],"names":[],"mappings":"AAQA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AA4DD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7D,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAaxE,wBAAgB,aAAa,QA+C5B;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.asyncConfirm = asyncConfirm;
8
+ exports.ConfirmDialog = ConfirmDialog;
9
+ const Button_1 = __importDefault(require("@mui/material/Button"));
10
+ const Dialog_1 = __importDefault(require("@mui/material/Dialog"));
11
+ const DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
12
+ const DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
13
+ const DialogContentText_1 = __importDefault(require("@mui/material/DialogContentText"));
14
+ const DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
15
+ const react_1 = __importDefault(require("react"));
16
+ const listeners = new Set();
17
+ const queue = [];
18
+ let activeRequest = null;
19
+ function notify() {
20
+ for (const listener of listeners) {
21
+ listener(activeRequest);
22
+ }
23
+ }
24
+ function pumpQueue() {
25
+ if (!activeRequest) {
26
+ activeRequest = queue.shift() ?? null;
27
+ notify();
28
+ }
29
+ }
30
+ function finish(response) {
31
+ const request = activeRequest;
32
+ activeRequest = null;
33
+ notify();
34
+ request?.resolve(response);
35
+ pumpQueue();
36
+ }
37
+ function normalizeOptions(arg) {
38
+ if (typeof arg === "string") {
39
+ return { text: arg };
40
+ }
41
+ return arg;
42
+ }
43
+ function stringifyFallback(value) {
44
+ return typeof value === "string" ? value : "";
45
+ }
46
+ function fallbackConfirm(options) {
47
+ if (typeof globalThis.confirm !== "function") {
48
+ return false;
49
+ }
50
+ return globalThis.confirm(stringifyFallback(options.title) ||
51
+ stringifyFallback(options.text) ||
52
+ "Confirm this action?");
53
+ }
54
+ function asyncConfirm(arg) {
55
+ const options = normalizeOptions(arg);
56
+ if (listeners.size === 0) {
57
+ return Promise.resolve(fallbackConfirm(options));
58
+ }
59
+ return new Promise((resolve) => {
60
+ queue.push({ options, resolve });
61
+ pumpQueue();
62
+ });
63
+ }
64
+ function ConfirmDialog() {
65
+ const [request, setRequest] = react_1.default.useState(activeRequest);
66
+ react_1.default.useEffect(() => {
67
+ listeners.add(setRequest);
68
+ setRequest(activeRequest);
69
+ return () => {
70
+ listeners.delete(setRequest);
71
+ };
72
+ }, []);
73
+ const close = react_1.default.useCallback((response) => {
74
+ finish(response);
75
+ }, []);
76
+ const options = request?.options;
77
+ return (react_1.default.createElement(Dialog_1.default, { open: request !== null, onClose: () => close(false), "aria-labelledby": "loom-confirm-dialog-title", "aria-describedby": "loom-confirm-dialog-description", keepMounted: true },
78
+ options?.title && (react_1.default.createElement(DialogTitle_1.default, { id: "loom-confirm-dialog-title" }, options.title)),
79
+ react_1.default.createElement(DialogContent_1.default, null,
80
+ react_1.default.createElement(DialogContentText_1.default, { id: "loom-confirm-dialog-description" }, options?.text)),
81
+ react_1.default.createElement(DialogActions_1.default, null,
82
+ react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: () => close(false) }, options?.cancel ?? "Cancel"),
83
+ react_1.default.createElement(Button_1.default, { variant: "contained", onClick: () => close(true), autoFocus: true }, options?.ok ?? "OK"))));
84
+ }
85
+ exports.default = asyncConfirm;
@@ -0,0 +1,4 @@
1
+ import "../../_dnt.polyfills.js";
2
+ export * from "./apiKeys.js";
3
+ export * from "./confirm.js";
4
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/mui/mod.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("../../_dnt.polyfills.js");
18
+ __exportStar(require("./apiKeys.js"), exports);
19
+ __exportStar(require("./confirm.js"), exports);
@@ -0,0 +1,64 @@
1
+ import "../../../_dnt.polyfills.js";
2
+ import { type ApiKeyAuditRepository, type ApiKeyAuthorizationDescriptor, type ApiKeyAuthorizationResult, type ApiKeyCountryResolver, type ApiKeyCredentialOptions, type ApiKeyCredentialTransport, type ApiKeyPolicy, type ApiKeyPrincipal, type ApiKeyRequestAuditContext, type ApiKeyVerifier } from "../../apiKeys/mod.js";
3
+ export interface ApiKeyRequestDependencies {
4
+ audit: ApiKeyAuditRepository;
5
+ credentialOptions?: ApiKeyCredentialOptions;
6
+ policy: ApiKeyPolicy;
7
+ /** Optional offline resolver used to snapshot an IP's ISO country code. */
8
+ resolveCountryCode?: ApiKeyCountryResolver;
9
+ requestContext?: ApiKeyRequestAuditContext | ((request: Request) => ApiKeyRequestAuditContext | Promise<ApiKeyRequestAuditContext>);
10
+ verifier: ApiKeyVerifier;
11
+ }
12
+ export interface ApiKeyHandlerContext {
13
+ authorizationEventId: string;
14
+ key: {
15
+ id: string;
16
+ name?: string;
17
+ start?: string;
18
+ };
19
+ principal: ApiKeyPrincipal;
20
+ transport: ApiKeyCredentialTransport;
21
+ }
22
+ export type ApiKeyRouteHandler<TRouteContext = unknown> = (request: Request, authorization: ApiKeyHandlerContext, routeContext: TRouteContext) => Response | Promise<Response>;
23
+ export interface WithApiKeyAuthorizationOptions {
24
+ dependencies: ApiKeyRequestDependencies;
25
+ descriptor: ApiKeyAuthorizationDescriptor | ((request: Request) => ApiKeyAuthorizationDescriptor);
26
+ errorFormat?: "json" | "text";
27
+ }
28
+ /**
29
+ * Reads Vercel's platform-owned client IP and country headers.
30
+ * Only use this helper for requests that arrived through Vercel's network.
31
+ */
32
+ export declare function vercelApiKeyRequestContext(request: Request): ApiKeyRequestAuditContext;
33
+ /** Adapts a standard Request to the runtime-neutral API-key authorizer. */
34
+ export declare function authorizeApiKeyRequest(request: Request, descriptor: ApiKeyAuthorizationDescriptor, dependencies: ApiKeyRequestDependencies): Promise<ApiKeyAuthorizationResult>;
35
+ /** Records response creation and applies query-credential response policy. */
36
+ export declare function completeApiKeyAuthorizedResponse(options: {
37
+ authorization: ApiKeyHandlerContext;
38
+ dependencies: ApiKeyRequestDependencies;
39
+ descriptor: ApiKeyAuthorizationDescriptor;
40
+ request: Request;
41
+ /** Reuses context already resolved for authorization when available. */
42
+ requestContext?: ApiKeyRequestAuditContext;
43
+ response: Response;
44
+ startedAt?: number;
45
+ }): Promise<any>;
46
+ /** Wraps a route handler with authorization and response-creation auditing. */
47
+ export declare function withApiKeyAuthorization<TRouteContext = unknown>(options: WithApiKeyAuthorizationOptions, handler: ApiKeyRouteHandler<TRouteContext>): (request: Request, routeContext: TRouteContext) => Promise<any>;
48
+ export type SessionOrApiKeyAuthorization<TSession> = {
49
+ context: TSession;
50
+ kind: "session";
51
+ } | ({
52
+ kind: "api-key";
53
+ } & ApiKeyHandlerContext) | Response;
54
+ /** Tries the app's fresh session policy first, then explicit API-key auth. */
55
+ export declare function authorizeSessionOrApiKeyRequest<TSession>(options: {
56
+ apiKey: {
57
+ dependencies: ApiKeyRequestDependencies;
58
+ descriptor: ApiKeyAuthorizationDescriptor;
59
+ };
60
+ authorizeSession: (request: Request) => Promise<TSession | null>;
61
+ errorFormat?: "json" | "text";
62
+ request: Request;
63
+ }): Promise<SessionOrApiKeyAuthorization<TSession>>;
64
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/next/apiKeys/mod.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EAIpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;IAC5C,MAAM,EAAE,YAAY,CAAC;IACrB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;IAC3C,cAAc,CAAC,EACX,yBAAyB,GACzB,CACA,CAAC,OAAO,EAAE,OAAO,KACb,yBAAyB,GACzB,OAAO,CAAC,yBAAyB,CAAC,CACvC,CAAC;IACJ,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,yBAAyB,CAAC;CACtC;AAED,MAAM,MAAM,kBAAkB,CAAC,aAAa,GAAG,OAAO,IAAI,CACxD,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,aAAa,KACxB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAElC,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,yBAAyB,CAAC;IACxC,UAAU,EACN,6BAA6B,GAC7B,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,6BAA6B,CAAC,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAMD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,GACf,yBAAyB,CAO3B;AA6BD,2EAA2E;AAC3E,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,6BAA6B,EACzC,YAAY,EAAE,yBAAyB,sCAQxC;AAiGD,8EAA8E;AAC9E,wBAAsB,gCAAgC,CAAC,OAAO,EAAE;IAC9D,aAAa,EAAE,oBAAoB,CAAC;IACpC,YAAY,EAAE,yBAAyB,CAAC;IACxC,UAAU,EAAE,6BAA6B,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,gBAaA;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,aAAa,GAAG,OAAO,EAC7D,OAAO,EAAE,8BAA8B,EACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,IAGxC,SAAS,OAAO,EAChB,cAAc,aAAa,kBAoG9B;AAED,MAAM,MAAM,4BAA4B,CAAC,QAAQ,IAC7C;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GACtC,CAAC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,CAAC,GAC5C,QAAQ,CAAC;AAEb,8EAA8E;AAC9E,wBAAsB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE;IACvE,MAAM,EAAE;QACN,YAAY,EAAE,yBAAyB,CAAC;QACxC,UAAU,EAAE,6BAA6B,CAAC;KAC3C,CAAC;IACF,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAmBlD"}