@superlayer/cli 1.0.67

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 (329) hide show
  1. package/LICENSE.md +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +67 -0
  4. package/bin/index.js +3 -0
  5. package/dist/auth/index.d.ts +4 -0
  6. package/dist/auth/index.d.ts.map +1 -0
  7. package/dist/auth/index.js +103 -0
  8. package/dist/auth/index.js.map +1 -0
  9. package/dist/commands/app/delete.d.ts +7 -0
  10. package/dist/commands/app/delete.d.ts.map +1 -0
  11. package/dist/commands/app/delete.js +57 -0
  12. package/dist/commands/app/delete.js.map +1 -0
  13. package/dist/commands/app/list.d.ts +6 -0
  14. package/dist/commands/app/list.d.ts.map +1 -0
  15. package/dist/commands/app/list.js +29 -0
  16. package/dist/commands/app/list.js.map +1 -0
  17. package/dist/commands/auth/client/add.d.ts +9 -0
  18. package/dist/commands/auth/client/add.d.ts.map +1 -0
  19. package/dist/commands/auth/client/add.js +409 -0
  20. package/dist/commands/auth/client/add.js.map +1 -0
  21. package/dist/commands/auth/client/delete.d.ts +11 -0
  22. package/dist/commands/auth/client/delete.d.ts.map +1 -0
  23. package/dist/commands/auth/client/delete.js +48 -0
  24. package/dist/commands/auth/client/delete.js.map +1 -0
  25. package/dist/commands/auth/client/list.d.ts +6 -0
  26. package/dist/commands/auth/client/list.d.ts.map +1 -0
  27. package/dist/commands/auth/client/list.js +38 -0
  28. package/dist/commands/auth/client/list.js.map +1 -0
  29. package/dist/commands/auth/client/shared.d.ts +70 -0
  30. package/dist/commands/auth/client/shared.d.ts.map +1 -0
  31. package/dist/commands/auth/client/shared.js +140 -0
  32. package/dist/commands/auth/client/shared.js.map +1 -0
  33. package/dist/commands/auth/client/update.d.ts +8 -0
  34. package/dist/commands/auth/client/update.d.ts.map +1 -0
  35. package/dist/commands/auth/client/update.js +445 -0
  36. package/dist/commands/auth/client/update.js.map +1 -0
  37. package/dist/commands/auth/email/pull.d.ts +24 -0
  38. package/dist/commands/auth/email/pull.d.ts.map +1 -0
  39. package/dist/commands/auth/email/pull.js +100 -0
  40. package/dist/commands/auth/email/pull.js.map +1 -0
  41. package/dist/commands/auth/email/push.d.ts +8 -0
  42. package/dist/commands/auth/email/push.d.ts.map +1 -0
  43. package/dist/commands/auth/email/push.js +58 -0
  44. package/dist/commands/auth/email/push.js.map +1 -0
  45. package/dist/commands/auth/email/resend.d.ts +3 -0
  46. package/dist/commands/auth/email/resend.d.ts.map +1 -0
  47. package/dist/commands/auth/email/resend.js +7 -0
  48. package/dist/commands/auth/email/resend.js.map +1 -0
  49. package/dist/commands/auth/email/reset.d.ts +5 -0
  50. package/dist/commands/auth/email/reset.d.ts.map +1 -0
  51. package/dist/commands/auth/email/reset.js +25 -0
  52. package/dist/commands/auth/email/reset.js.map +1 -0
  53. package/dist/commands/auth/email/status.d.ts +57 -0
  54. package/dist/commands/auth/email/status.d.ts.map +1 -0
  55. package/dist/commands/auth/email/status.js +96 -0
  56. package/dist/commands/auth/email/status.js.map +1 -0
  57. package/dist/commands/auth/email/verify.d.ts +5 -0
  58. package/dist/commands/auth/email/verify.d.ts.map +1 -0
  59. package/dist/commands/auth/email/verify.js +12 -0
  60. package/dist/commands/auth/email/verify.js.map +1 -0
  61. package/dist/commands/auth/origin/add.d.ts +12 -0
  62. package/dist/commands/auth/origin/add.d.ts.map +1 -0
  63. package/dist/commands/auth/origin/add.js +153 -0
  64. package/dist/commands/auth/origin/add.js.map +1 -0
  65. package/dist/commands/auth/origin/delete.d.ts +8 -0
  66. package/dist/commands/auth/origin/delete.d.ts.map +1 -0
  67. package/dist/commands/auth/origin/delete.js +38 -0
  68. package/dist/commands/auth/origin/delete.js.map +1 -0
  69. package/dist/commands/auth/origin/list.d.ts +9 -0
  70. package/dist/commands/auth/origin/list.d.ts.map +1 -0
  71. package/dist/commands/auth/origin/list.js +52 -0
  72. package/dist/commands/auth/origin/list.js.map +1 -0
  73. package/dist/commands/backup/download.d.ts +10 -0
  74. package/dist/commands/backup/download.d.ts.map +1 -0
  75. package/dist/commands/backup/download.js +174 -0
  76. package/dist/commands/backup/download.js.map +1 -0
  77. package/dist/commands/backup/list.d.ts +11 -0
  78. package/dist/commands/backup/list.d.ts.map +1 -0
  79. package/dist/commands/backup/list.js +74 -0
  80. package/dist/commands/backup/list.js.map +1 -0
  81. package/dist/commands/claim.d.ts +6 -0
  82. package/dist/commands/claim.d.ts.map +1 -0
  83. package/dist/commands/claim.js +22 -0
  84. package/dist/commands/claim.js.map +1 -0
  85. package/dist/commands/explorer.d.ts +6 -0
  86. package/dist/commands/explorer.d.ts.map +1 -0
  87. package/dist/commands/explorer.js +13 -0
  88. package/dist/commands/explorer.js.map +1 -0
  89. package/dist/commands/info.d.ts +9 -0
  90. package/dist/commands/info.d.ts.map +1 -0
  91. package/dist/commands/info.js +41 -0
  92. package/dist/commands/info.js.map +1 -0
  93. package/dist/commands/init.d.ts +5 -0
  94. package/dist/commands/init.d.ts.map +1 -0
  95. package/dist/commands/init.js +41 -0
  96. package/dist/commands/init.js.map +1 -0
  97. package/dist/commands/initWithoutFiles.d.ts +6 -0
  98. package/dist/commands/initWithoutFiles.d.ts.map +1 -0
  99. package/dist/commands/initWithoutFiles.js +64 -0
  100. package/dist/commands/initWithoutFiles.js.map +1 -0
  101. package/dist/commands/login.d.ts +9 -0
  102. package/dist/commands/login.d.ts.map +1 -0
  103. package/dist/commands/login.js +44 -0
  104. package/dist/commands/login.js.map +1 -0
  105. package/dist/commands/logout.d.ts +3 -0
  106. package/dist/commands/logout.d.ts.map +1 -0
  107. package/dist/commands/logout.js +14 -0
  108. package/dist/commands/logout.js.map +1 -0
  109. package/dist/commands/pull.d.ts +5 -0
  110. package/dist/commands/pull.d.ts.map +1 -0
  111. package/dist/commands/pull.js +15 -0
  112. package/dist/commands/pull.js.map +1 -0
  113. package/dist/commands/push.d.ts +6 -0
  114. package/dist/commands/push.d.ts.map +1 -0
  115. package/dist/commands/push.js +20 -0
  116. package/dist/commands/push.js.map +1 -0
  117. package/dist/commands/query.d.ts +7 -0
  118. package/dist/commands/query.d.ts.map +1 -0
  119. package/dist/commands/query.js +52 -0
  120. package/dist/commands/query.js.map +1 -0
  121. package/dist/commands/webhooks/add.d.ts +9 -0
  122. package/dist/commands/webhooks/add.d.ts.map +1 -0
  123. package/dist/commands/webhooks/add.js +75 -0
  124. package/dist/commands/webhooks/add.js.map +1 -0
  125. package/dist/commands/webhooks/delete.d.ts +6 -0
  126. package/dist/commands/webhooks/delete.d.ts.map +1 -0
  127. package/dist/commands/webhooks/delete.js +17 -0
  128. package/dist/commands/webhooks/delete.js.map +1 -0
  129. package/dist/commands/webhooks/disable.d.ts +7 -0
  130. package/dist/commands/webhooks/disable.d.ts.map +1 -0
  131. package/dist/commands/webhooks/disable.js +18 -0
  132. package/dist/commands/webhooks/disable.js.map +1 -0
  133. package/dist/commands/webhooks/enable.d.ts +6 -0
  134. package/dist/commands/webhooks/enable.d.ts.map +1 -0
  135. package/dist/commands/webhooks/enable.js +18 -0
  136. package/dist/commands/webhooks/enable.js.map +1 -0
  137. package/dist/commands/webhooks/events/list.d.ts +7 -0
  138. package/dist/commands/webhooks/events/list.d.ts.map +1 -0
  139. package/dist/commands/webhooks/events/list.js +31 -0
  140. package/dist/commands/webhooks/events/list.js.map +1 -0
  141. package/dist/commands/webhooks/events/payload.d.ts +8 -0
  142. package/dist/commands/webhooks/events/payload.d.ts.map +1 -0
  143. package/dist/commands/webhooks/events/payload.js +39 -0
  144. package/dist/commands/webhooks/events/payload.js.map +1 -0
  145. package/dist/commands/webhooks/events/resend.d.ts +8 -0
  146. package/dist/commands/webhooks/events/resend.d.ts.map +1 -0
  147. package/dist/commands/webhooks/events/resend.js +43 -0
  148. package/dist/commands/webhooks/events/resend.js.map +1 -0
  149. package/dist/commands/webhooks/list.d.ts +8 -0
  150. package/dist/commands/webhooks/list.d.ts.map +1 -0
  151. package/dist/commands/webhooks/list.js +29 -0
  152. package/dist/commands/webhooks/list.js.map +1 -0
  153. package/dist/commands/webhooks/shared.d.ts +40 -0
  154. package/dist/commands/webhooks/shared.d.ts.map +1 -0
  155. package/dist/commands/webhooks/shared.js +248 -0
  156. package/dist/commands/webhooks/shared.js.map +1 -0
  157. package/dist/commands/webhooks/update.d.ts +10 -0
  158. package/dist/commands/webhooks/update.d.ts.map +1 -0
  159. package/dist/commands/webhooks/update.js +189 -0
  160. package/dist/commands/webhooks/update.js.map +1 -0
  161. package/dist/context/authToken.d.ts +29 -0
  162. package/dist/context/authToken.d.ts.map +1 -0
  163. package/dist/context/authToken.js +73 -0
  164. package/dist/context/authToken.js.map +1 -0
  165. package/dist/context/currentApp.d.ts +38 -0
  166. package/dist/context/currentApp.d.ts.map +1 -0
  167. package/dist/context/currentApp.js +222 -0
  168. package/dist/context/currentApp.js.map +1 -0
  169. package/dist/context/globalOpts.d.ts +11 -0
  170. package/dist/context/globalOpts.d.ts.map +1 -0
  171. package/dist/context/globalOpts.js +13 -0
  172. package/dist/context/globalOpts.js.map +1 -0
  173. package/dist/context/platformApi.d.ts +19 -0
  174. package/dist/context/platformApi.d.ts.map +1 -0
  175. package/dist/context/platformApi.js +24 -0
  176. package/dist/context/platformApi.js.map +1 -0
  177. package/dist/context/projectInfo.d.ts +30 -0
  178. package/dist/context/projectInfo.d.ts.map +1 -0
  179. package/dist/context/projectInfo.js +152 -0
  180. package/dist/context/projectInfo.js.map +1 -0
  181. package/dist/errors.d.ts +10 -0
  182. package/dist/errors.d.ts.map +1 -0
  183. package/dist/errors.js +6 -0
  184. package/dist/errors.js.map +1 -0
  185. package/dist/index.d.ts +159 -0
  186. package/dist/index.d.ts.map +1 -0
  187. package/dist/index.js +714 -0
  188. package/dist/index.js.map +1 -0
  189. package/dist/layer.d.ts +25 -0
  190. package/dist/layer.d.ts.map +1 -0
  191. package/dist/layer.js +119 -0
  192. package/dist/layer.js.map +1 -0
  193. package/dist/lib/args.d.ts +212 -0
  194. package/dist/lib/args.d.ts.map +1 -0
  195. package/dist/lib/args.js +313 -0
  196. package/dist/lib/args.js.map +1 -0
  197. package/dist/lib/backupDownload.d.ts +21 -0
  198. package/dist/lib/backupDownload.d.ts.map +1 -0
  199. package/dist/lib/backupDownload.js +151 -0
  200. package/dist/lib/backupDownload.js.map +1 -0
  201. package/dist/lib/backups.d.ts +12 -0
  202. package/dist/lib/backups.d.ts.map +1 -0
  203. package/dist/lib/backups.js +26 -0
  204. package/dist/lib/backups.js.map +1 -0
  205. package/dist/lib/config.d.ts +6 -0
  206. package/dist/lib/config.d.ts.map +1 -0
  207. package/dist/lib/config.js +39 -0
  208. package/dist/lib/config.js.map +1 -0
  209. package/dist/lib/createApp.d.ts +12 -0
  210. package/dist/lib/createApp.d.ts.map +1 -0
  211. package/dist/lib/createApp.js +15 -0
  212. package/dist/lib/createApp.js.map +1 -0
  213. package/dist/lib/email.d.ts +47 -0
  214. package/dist/lib/email.d.ts.map +1 -0
  215. package/dist/lib/email.js +71 -0
  216. package/dist/lib/email.js.map +1 -0
  217. package/dist/lib/handleEnv.d.ts +7 -0
  218. package/dist/lib/handleEnv.d.ts.map +1 -0
  219. package/dist/lib/handleEnv.js +99 -0
  220. package/dist/lib/handleEnv.js.map +1 -0
  221. package/dist/lib/http.d.ts +30 -0
  222. package/dist/lib/http.d.ts.map +1 -0
  223. package/dist/lib/http.js +55 -0
  224. package/dist/lib/http.js.map +1 -0
  225. package/dist/lib/login.d.ts +12 -0
  226. package/dist/lib/login.d.ts.map +1 -0
  227. package/dist/lib/login.js +38 -0
  228. package/dist/lib/login.js.map +1 -0
  229. package/dist/lib/oauth.d.ts +306 -0
  230. package/dist/lib/oauth.d.ts.map +1 -0
  231. package/dist/lib/oauth.js +195 -0
  232. package/dist/lib/oauth.js.map +1 -0
  233. package/dist/lib/platformApi.d.ts +5 -0
  234. package/dist/lib/platformApi.d.ts.map +1 -0
  235. package/dist/lib/platformApi.js +11 -0
  236. package/dist/lib/platformApi.js.map +1 -0
  237. package/dist/lib/pullPerms.d.ts +7 -0
  238. package/dist/lib/pullPerms.d.ts.map +1 -0
  239. package/dist/lib/pullPerms.js +41 -0
  240. package/dist/lib/pullPerms.js.map +1 -0
  241. package/dist/lib/pullSchema.d.ts +12 -0
  242. package/dist/lib/pullSchema.d.ts.map +1 -0
  243. package/dist/lib/pullSchema.js +62 -0
  244. package/dist/lib/pullSchema.js.map +1 -0
  245. package/dist/lib/pushPerms.d.ts +13 -0
  246. package/dist/lib/pushPerms.d.ts.map +1 -0
  247. package/dist/lib/pushPerms.js +54 -0
  248. package/dist/lib/pushPerms.js.map +1 -0
  249. package/dist/lib/pushSchema.d.ts +53 -0
  250. package/dist/lib/pushSchema.d.ts.map +1 -0
  251. package/dist/lib/pushSchema.js +165 -0
  252. package/dist/lib/pushSchema.js.map +1 -0
  253. package/dist/lib/ui.d.ts +18 -0
  254. package/dist/lib/ui.d.ts.map +1 -0
  255. package/dist/lib/ui.js +32 -0
  256. package/dist/lib/ui.js.map +1 -0
  257. package/dist/lib/webhooks.d.ts +27 -0
  258. package/dist/lib/webhooks.d.ts.map +1 -0
  259. package/dist/lib/webhooks.js +95 -0
  260. package/dist/lib/webhooks.js.map +1 -0
  261. package/dist/logging.d.ts +5 -0
  262. package/dist/logging.d.ts.map +1 -0
  263. package/dist/logging.js +25 -0
  264. package/dist/logging.js.map +1 -0
  265. package/dist/old.d.ts +17 -0
  266. package/dist/old.d.ts.map +1 -0
  267. package/dist/old.js +410 -0
  268. package/dist/old.js.map +1 -0
  269. package/dist/program.d.ts +3 -0
  270. package/dist/program.d.ts.map +1 -0
  271. package/dist/program.js +3 -0
  272. package/dist/program.js.map +1 -0
  273. package/dist/renderSchemaPlan.d.ts +19 -0
  274. package/dist/renderSchemaPlan.d.ts.map +1 -0
  275. package/dist/renderSchemaPlan.js +220 -0
  276. package/dist/renderSchemaPlan.js.map +1 -0
  277. package/dist/ui/index.d.ts +292 -0
  278. package/dist/ui/index.d.ts.map +1 -0
  279. package/dist/ui/index.js +1296 -0
  280. package/dist/ui/index.js.map +1 -0
  281. package/dist/ui/lib.d.ts +124 -0
  282. package/dist/ui/lib.d.ts.map +1 -0
  283. package/dist/ui/lib.js +333 -0
  284. package/dist/ui/lib.js.map +1 -0
  285. package/dist/util/findConfigCandidates.d.ts +13 -0
  286. package/dist/util/findConfigCandidates.d.ts.map +1 -0
  287. package/dist/util/findConfigCandidates.js +211 -0
  288. package/dist/util/findConfigCandidates.js.map +1 -0
  289. package/dist/util/fs.d.ts +4 -0
  290. package/dist/util/fs.d.ts.map +1 -0
  291. package/dist/util/fs.js +22 -0
  292. package/dist/util/fs.js.map +1 -0
  293. package/dist/util/getAppName.d.ts +5 -0
  294. package/dist/util/getAppName.d.ts.map +1 -0
  295. package/dist/util/getAppName.js +14 -0
  296. package/dist/util/getAppName.js.map +1 -0
  297. package/dist/util/instantConfig.d.ts +9 -0
  298. package/dist/util/instantConfig.d.ts.map +1 -0
  299. package/dist/util/instantConfig.js +13 -0
  300. package/dist/util/instantConfig.js.map +1 -0
  301. package/dist/util/isHeadlessEnvironment.d.ts +4 -0
  302. package/dist/util/isHeadlessEnvironment.d.ts.map +1 -0
  303. package/dist/util/isHeadlessEnvironment.js +11 -0
  304. package/dist/util/isHeadlessEnvironment.js.map +1 -0
  305. package/dist/util/loadConfig.d.ts +3 -0
  306. package/dist/util/loadConfig.d.ts.map +1 -0
  307. package/dist/util/loadConfig.js +72 -0
  308. package/dist/util/loadConfig.js.map +1 -0
  309. package/dist/util/loadEnv.d.ts +2 -0
  310. package/dist/util/loadEnv.d.ts.map +1 -0
  311. package/dist/util/loadEnv.js +10 -0
  312. package/dist/util/loadEnv.js.map +1 -0
  313. package/dist/util/mergeSchema.d.ts +10 -0
  314. package/dist/util/mergeSchema.d.ts.map +1 -0
  315. package/dist/util/mergeSchema.js +338 -0
  316. package/dist/util/mergeSchema.js.map +1 -0
  317. package/dist/util/projectDir.d.ts +7 -0
  318. package/dist/util/projectDir.d.ts.map +1 -0
  319. package/dist/util/projectDir.js +43 -0
  320. package/dist/util/projectDir.js.map +1 -0
  321. package/dist/util/renamePrompt.d.ts +15 -0
  322. package/dist/util/renamePrompt.d.ts.map +1 -0
  323. package/dist/util/renamePrompt.js +57 -0
  324. package/dist/util/renamePrompt.js.map +1 -0
  325. package/dist/version.d.ts +3 -0
  326. package/dist/version.d.ts.map +1 -0
  327. package/dist/version.js +3 -0
  328. package/dist/version.js.map +1 -0
  329. package/package.json +96 -0
@@ -0,0 +1,74 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import { formatFileSize } from '@superlayer/platform';
4
+ import { useBackupsManager } from "../../lib/backups.js";
5
+ export const formatBackupDate = (date) => `${date.toISOString().replace('T', ' ').slice(0, 16)} UTC`;
6
+ // Backup descriptions are user-controlled text headed for the terminal;
7
+ // strip control characters so a crafted value can't inject escape sequences.
8
+ export const stripControlChars = (s) => s.replace(/\p{Cc}/gu, '');
9
+ // Relative times in both directions: "3 hours ago", "6 days from now".
10
+ export const relativeTime = (date) => {
11
+ const diffMs = date.getTime() - Date.now();
12
+ const abs = Math.abs(diffMs);
13
+ if (abs < 60_000)
14
+ return diffMs <= 0 ? 'just now' : 'now';
15
+ const minutes = Math.round(abs / 60_000);
16
+ const hours = Math.round(abs / 3_600_000);
17
+ const days = Math.round(abs / 86_400_000);
18
+ const [count, unit] = minutes < 60
19
+ ? [minutes, 'minute']
20
+ : hours < 24
21
+ ? [hours, 'hour']
22
+ : [days, 'day'];
23
+ const label = `${count} ${unit}${count === 1 ? '' : 's'}`;
24
+ return diffMs < 0 ? `${label} ago` : `${label} from now`;
25
+ };
26
+ // One aligned row per backup, newest first: id first, relative times.
27
+ // `--json` carries the precise values.
28
+ export const renderBackupsTable = (backups) => Effect.gen(function* () {
29
+ const header = [
30
+ 'ID',
31
+ 'CREATED AT',
32
+ 'DB SIZE',
33
+ 'STORAGE',
34
+ 'EXPIRES AT',
35
+ 'DESCRIPTION',
36
+ ];
37
+ const rows = backups.map((backup) => [
38
+ backup.id,
39
+ relativeTime(backup.backupAt),
40
+ backup.dbSize != null ? formatFileSize(backup.dbSize) : '-',
41
+ backup.filesSize != null ? formatFileSize(backup.filesSize) : '-',
42
+ backup.expiresAt
43
+ ? backup.expiresAt.getTime() <= Date.now()
44
+ ? 'expired'
45
+ : relativeTime(backup.expiresAt)
46
+ : '-',
47
+ backup.description ? stripControlChars(backup.description) : '',
48
+ ]);
49
+ const widths = header.map((h, i) => Math.max(h.length, ...rows.map((row) => row[i].length)));
50
+ const line = (cells) => cells
51
+ .map((cell, i) => cell.padEnd(widths[i]))
52
+ .join(' ')
53
+ .trimEnd();
54
+ yield* Effect.log(chalk.dim(line(header)));
55
+ yield* Effect.log(chalk.dim(widths.map((w) => '-'.repeat(w)).join(' ')));
56
+ for (const row of rows) {
57
+ yield* Effect.log(line(row));
58
+ }
59
+ });
60
+ export const backupListCmd = Effect.fn(function* (opts) {
61
+ const backups = yield* useBackupsManager((m) => m.list(), 'Error listing backups');
62
+ if (opts.json) {
63
+ yield* Effect.log(JSON.stringify(backups, null, 2));
64
+ return;
65
+ }
66
+ if (backups.length === 0) {
67
+ yield* Effect.log('No backups yet.');
68
+ return;
69
+ }
70
+ // The server returns newest first; sort anyway so the table can't lie.
71
+ const sorted = [...backups].sort((a, b) => b.backupAt.getTime() - a.backupAt.getTime());
72
+ yield* renderBackupsTable(sorted);
73
+ });
74
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/backup/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAkB,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAE,EAAE,CAC7C,GAAG,IAAI,CAAC,WA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C;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,uEAAuE;IACvE,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CACtD,CAAC;IACF,KAAK,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport { formatFileSize, type AppBackup } from '@superlayer/platform';\nimport type { backupListDef, OptsFromCommand } from '../../index.ts';\nimport { useBackupsManager } from '../../lib/backups.ts';\n\nexport const formatBackupDate = (date: Date) =>\n `${date.toISOString().replace('T', ' ').slice(0, 16)} UTC`;\n\n// Backup descriptions are user-controlled text headed for the terminal;\n// strip control characters so a crafted value can't inject escape sequences.\nexport const stripControlChars = (s: string) => s.replace(/\\p{Cc}/gu, '');\n\n// Relative times in both directions: \"3 hours ago\", \"6 days from now\".\nexport const relativeTime = (date: Date): string => {\n const diffMs = date.getTime() - Date.now();\n const abs = Math.abs(diffMs);\n if (abs < 60_000) return diffMs <= 0 ? 'just now' : 'now';\n const minutes = Math.round(abs / 60_000);\n const hours = Math.round(abs / 3_600_000);\n const days = Math.round(abs / 86_400_000);\n const [count, unit] =\n minutes < 60\n ? [minutes, 'minute']\n : hours < 24\n ? [hours, 'hour']\n : [days, 'day'];\n const label = `${count} ${unit}${count === 1 ? '' : 's'}`;\n return diffMs < 0 ? `${label} ago` : `${label} from now`;\n};\n\n// One aligned row per backup, newest first: id first, relative times.\n// `--json` carries the precise values.\nexport const renderBackupsTable = (backups: AppBackup[]) =>\n Effect.gen(function* () {\n const header = [\n 'ID',\n 'CREATED AT',\n 'DB SIZE',\n 'STORAGE',\n 'EXPIRES AT',\n 'DESCRIPTION',\n ];\n const rows = backups.map((backup) => [\n backup.id,\n relativeTime(backup.backupAt),\n backup.dbSize != null ? formatFileSize(backup.dbSize) : '-',\n backup.filesSize != null ? formatFileSize(backup.filesSize) : '-',\n backup.expiresAt\n ? backup.expiresAt.getTime() <= Date.now()\n ? 'expired'\n : relativeTime(backup.expiresAt)\n : '-',\n backup.description ? stripControlChars(backup.description) : '',\n ]);\n const widths = header.map((h, i) =>\n Math.max(h.length, ...rows.map((row) => row[i].length)),\n );\n const line = (cells: string[]) =>\n cells\n .map((cell, i) => cell.padEnd(widths[i]))\n .join(' ')\n .trimEnd();\n yield* Effect.log(chalk.dim(line(header)));\n yield* Effect.log(chalk.dim(widths.map((w) => '-'.repeat(w)).join(' ')));\n for (const row of rows) {\n yield* Effect.log(line(row));\n }\n });\n\nexport const backupListCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof backupListDef>,\n) {\n const backups = yield* useBackupsManager(\n (m) => m.list(),\n 'Error listing backups',\n );\n\n if (opts.json) {\n yield* Effect.log(JSON.stringify(backups, null, 2));\n return;\n }\n\n if (backups.length === 0) {\n yield* Effect.log('No backups yet.');\n return;\n }\n\n // The server returns newest first; sort anyway so the table can't lie.\n const sorted = [...backups].sort(\n (a, b) => b.backupAt.getTime() - a.backupAt.getTime(),\n );\n yield* renderBackupsTable(sorted);\n});\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ import { CurrentApp } from '../context/currentApp.ts';
3
+ import { BadArgsError } from '../errors.ts';
4
+ import { InstantHttpAuthed } from '../lib/http.ts';
5
+ export declare const claimCommand: Effect.Effect<undefined, BadArgsError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpBody").HttpBodyError, InstantHttpAuthed | CurrentApp>;
6
+ //# sourceMappingURL=claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../src/commands/claim.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,YAAY,4QAuBvB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { HttpClient, HttpClientRequest } from '@effect/platform';
2
+ import chalk from 'chalk';
3
+ import { Effect } from 'effect';
4
+ import { CurrentApp } from "../context/currentApp.js";
5
+ import { BadArgsError } from "../errors.js";
6
+ import { InstantHttpAuthed } from "../lib/http.js";
7
+ export const claimCommand = Effect.gen(function* () {
8
+ const { appId, adminToken } = yield* CurrentApp;
9
+ yield* Effect.log(`Found app: ${appId}`);
10
+ const http = yield* InstantHttpAuthed;
11
+ if (!adminToken) {
12
+ return yield* BadArgsError.make({ message: 'Missing app admin token' });
13
+ }
14
+ yield* http
15
+ .pipe(HttpClient.mapRequestInputEffect(HttpClientRequest.bodyJson({
16
+ app_id: appId,
17
+ token: adminToken,
18
+ })))
19
+ .post(`/dash/apps/ephemeral/${appId}/claim`);
20
+ yield* Effect.log(chalk.green('App claimed!'));
21
+ });
22
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/commands/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC9C,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IAEhD,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;IAEzC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC;IAEtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,CAAC,IAAI;SACR,IAAI,CACH,UAAU,CAAC,qBAAqB,CAC9B,iBAAiB,CAAC,QAAQ,CAAC;QACzB,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,UAAU;KAClB,CAAC,CACH,CACF;SACA,IAAI,CAAC,wBAAwB,KAAK,QAAQ,CAAC,CAAC;IAE/C,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC","sourcesContent":["import { HttpClient, HttpClientRequest } from '@effect/platform';\nimport chalk from 'chalk';\nimport { Effect } from 'effect';\nimport { CurrentApp } from '../context/currentApp.ts';\nimport { BadArgsError } from '../errors.ts';\nimport { InstantHttpAuthed } from '../lib/http.ts';\n\nexport const claimCommand = Effect.gen(function* () {\n const { appId, adminToken } = yield* CurrentApp;\n\n yield* Effect.log(`Found app: ${appId}`);\n\n const http = yield* InstantHttpAuthed;\n\n if (!adminToken) {\n return yield* BadArgsError.make({ message: 'Missing app admin token' });\n }\n\n yield* http\n .pipe(\n HttpClient.mapRequestInputEffect(\n HttpClientRequest.bodyJson({\n app_id: appId,\n token: adminToken,\n }),\n ),\n )\n .post(`/dash/apps/ephemeral/${appId}/claim`);\n\n yield* Effect.log(chalk.green('App claimed!'));\n});\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ import { explorerDef } from '../index.ts';
3
+ import type { OptsFromCommand } from '../index.ts';
4
+ import { CurrentApp } from '../context/currentApp.ts';
5
+ export declare const explorerCmd: (_opts: OptsFromCommand<typeof explorerDef>) => Effect.Effect<void, import("../errors.ts").BadArgsError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError, CurrentApp>;
6
+ //# sourceMappingURL=explorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explorer.d.ts","sourceRoot":"","sources":["../../src/commands/explorer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,eAAO,MAAM,WAAW,GAAI,OAAO,eAAe,CAAC,OAAO,WAAW,CAAC,8JAalE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Effect } from 'effect';
2
+ import openInBrowser from 'open';
3
+ import { explorerDef } from "../index.js";
4
+ import { CurrentApp } from "../context/currentApp.js";
5
+ import { getDashUrl } from "../lib/http.js";
6
+ export const explorerCmd = (_opts) => Effect.gen(function* () {
7
+ const { appId } = yield* CurrentApp;
8
+ const dashUrl = yield* getDashUrl;
9
+ yield* Effect.log('Opening Explorer...');
10
+ const url = `${dashUrl}/dash?s=main&app=${appId}&t=explorer`;
11
+ yield* Effect.tryPromise(() => openInBrowser(url)).pipe(Effect.catchAll(() => Effect.log(`Failed to open Explorer in browser\nOpen Explorer manually:\n${url}`)));
12
+ });
13
+ //# sourceMappingURL=explorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explorer.js","sourceRoot":"","sources":["../../src/commands/explorer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,aAAa,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAA0C,EAAE,EAAE,CACxE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IACpC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IAClC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,GAAG,OAAO,oBAAoB,KAAK,aAAa,CAAC;IAC7D,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACrD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CACnB,MAAM,CAAC,GAAG,CACR,gEAAgE,GAAG,EAAE,CACtE,CACF,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport openInBrowser from 'open';\nimport { explorerDef } from '../index.ts';\nimport type { OptsFromCommand } from '../index.ts';\nimport { CurrentApp } from '../context/currentApp.ts';\nimport { getDashUrl } from '../lib/http.ts';\n\nexport const explorerCmd = (_opts: OptsFromCommand<typeof explorerDef>) =>\n Effect.gen(function* () {\n const { appId } = yield* CurrentApp;\n const dashUrl = yield* getDashUrl;\n yield* Effect.log('Opening Explorer...');\n const url = `${dashUrl}/dash?s=main&app=${appId}&t=explorer`;\n yield* Effect.tryPromise(() => openInBrowser(url)).pipe(\n Effect.catchAll(() =>\n Effect.log(\n `Failed to open Explorer in browser\\nOpen Explorer manually:\\n${url}`,\n ),\n ),\n );\n });\n"]}
@@ -0,0 +1,9 @@
1
+ import { Effect, Schema } from 'effect';
2
+ export declare const DashAppResponse: Schema.Struct<{
3
+ app: Schema.Struct<{
4
+ id: typeof Schema.String;
5
+ title: typeof Schema.String;
6
+ }>;
7
+ }>;
8
+ export declare const infoCommand: () => Effect.Effect<void, Error | import("effect/ConfigError").ConfigError | import("effect/ParseResult").ParseError | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError, never>;
9
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAahD,eAAO,MAAM,eAAe;;;;;EAK1B,CAAC;AAEH,eAAO,MAAM,WAAW,mPAmCpB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { HttpClientResponse } from '@effect/platform';
2
+ import { Effect, Schema, Option } from 'effect';
3
+ import { getBaseUrl, InstantHttpAuthed } from "../lib/http.js";
4
+ import { version } from '@superlayer/version';
5
+ import { CurrentApp } from "../context/currentApp.js";
6
+ const DashMeResponse = Schema.Struct({
7
+ user: Schema.Struct({
8
+ id: Schema.String,
9
+ email: Schema.String,
10
+ created_at: Schema.String,
11
+ }),
12
+ });
13
+ export const DashAppResponse = Schema.Struct({
14
+ app: Schema.Struct({
15
+ id: Schema.String,
16
+ title: Schema.String,
17
+ }),
18
+ });
19
+ export const infoCommand = () => Effect.gen(function* () {
20
+ const baseUrl = yield* getBaseUrl;
21
+ const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe(Effect.map(Option.getOrNull));
22
+ const maybeApp = yield* Effect.serviceOption(CurrentApp);
23
+ yield* Effect.log('CLI Version:', version);
24
+ // If logged in..
25
+ if (authedHttp) {
26
+ const meData = yield* authedHttp.get('/dash/me').pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(DashMeResponse)), Effect.mapError((e) => new Error(`Couldn't get user information (${baseUrl}).`, {
27
+ cause: e,
28
+ })));
29
+ yield* Effect.log(`Logged in as ${meData.user.email}`);
30
+ }
31
+ else {
32
+ yield* Effect.log('Not logged in.');
33
+ }
34
+ if (Option.isSome(maybeApp) && authedHttp) {
35
+ const appInfo = yield* authedHttp
36
+ .get(`/dash/apps/${maybeApp.value.appId}`)
37
+ .pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)));
38
+ yield* Effect.log(`App: ${appInfo.app.title} (${appInfo.app.id})`);
39
+ }
40
+ });
41
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAClB,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,KAAK,EAAE,MAAM,CAAC,MAAM;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM;KAC1B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,MAAM,CAAC,MAA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MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,UAAU;aAC9B,GAAG,CAAC,cAAc,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;aACzC,IAAI,CACH,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CACnE,CAAC;QAEJ,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACrE,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { HttpClientResponse } from '@effect/platform';\nimport { Effect, Schema, Option } from 'effect';\nimport { getBaseUrl, InstantHttpAuthed } from '../lib/http.ts';\nimport { version } from '@superlayer/version';\nimport { CurrentApp } from '../context/currentApp.ts';\n\nconst DashMeResponse = Schema.Struct({\n user: Schema.Struct({\n id: Schema.String,\n email: Schema.String,\n created_at: Schema.String,\n }),\n});\n\nexport const DashAppResponse = Schema.Struct({\n app: Schema.Struct({\n id: Schema.String,\n title: Schema.String,\n }),\n});\n\nexport const infoCommand = () =>\n Effect.gen(function* () {\n const baseUrl = yield* getBaseUrl;\n const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe(\n Effect.map(Option.getOrNull),\n );\n const maybeApp = yield* Effect.serviceOption(CurrentApp);\n\n yield* Effect.log('CLI Version:', version);\n // If logged in..\n if (authedHttp) {\n const meData = yield* authedHttp.get('/dash/me').pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(DashMeResponse)),\n Effect.mapError(\n (e) =>\n new Error(`Couldn't get user information (${baseUrl}).`, {\n cause: e,\n }),\n ),\n );\n\n yield* Effect.log(`Logged in as ${meData.user.email}`);\n } else {\n yield* Effect.log('Not logged in.');\n }\n\n if (Option.isSome(maybeApp) && authedHttp) {\n const appInfo = yield* authedHttp\n .get(`/dash/apps/${maybeApp.value.appId}`)\n .pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(DashAppResponse)),\n );\n\n yield* Effect.log(`App: ${appInfo.app.title} (${appInfo.app.id})`);\n }\n });\n"]}
@@ -0,0 +1,5 @@
1
+ import { Effect } from 'effect';
2
+ import { initDef } from '../index.ts';
3
+ import type { OptsFromCommand } from '../index.ts';
4
+ export declare const initCommand: (_options: OptsFromCommand<typeof initDef>) => Effect.Effect<void, import("../errors.ts").BadArgsError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("effect/ParseResult").ParseError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError | import("@effect/platform/Error").PlatformError | import("@effect/platform/HttpBody").HttpBodyError | import("../lib/pushSchema.ts").ReadSchemaFileError | import("../lib/pushSchema.ts").SchemaDiffError | import("../lib/pushSchema.ts").GetSchemaError | import("../lib/pushSchema.ts").SchemaValidationError | import("../lib/pushSchema.ts").WaitForJobsError | import("../lib/pushSchema.ts").CancelSchemaError | import("../util/mergeSchema.ts").MergeSchemaError | import("../lib/pushPerms.ts").NoPermsFileError, import("../context/globalOpts.ts").GlobalOpts | import("../context/projectInfo.ts").ProjectInfo | import("../context/authToken.ts").AuthToken | import("../lib/http.ts").InstantHttpAuthed | import("@effect/platform/FileSystem").FileSystem | import("@effect/platform/Path").Path | import("../context/currentApp.ts").CurrentApp>;
5
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQnD,eAAO,MAAM,WAAW,GAAI,UAAU,eAAe,CAAC,OAAO,OAAO,CAAC,ysCAiDjE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Effect, Option } from 'effect';
2
+ import { initDef } from "../index.js";
3
+ import { readLocalPermsFile, readLocalSchemaFile } from '../old.js';
4
+ import { pullSchema } from "../lib/pullSchema.js";
5
+ import { pullPerms } from "../lib/pullPerms.js";
6
+ import { promptOk } from "../lib/ui.js";
7
+ import { pushSchema } from "../lib/pushSchema.js";
8
+ import { pushPerms } from "../lib/pushPerms.js";
9
+ export const initCommand = (_options) => Effect.gen(function* () {
10
+ yield* Effect.matchEffect(Effect.tryPromise(readLocalSchemaFile).pipe(
11
+ // Throws NoSuchElementException if no file found
12
+ Effect.flatMap(Option.fromNullable)), {
13
+ onFailure: () => pullSchema({ experimentalTypePreservation: false }),
14
+ onSuccess: () => Effect.gen(function* () {
15
+ const doSchemaPush = yield* promptOk({
16
+ promptText: '\nFound local schema. Push it to the new app?',
17
+ defaultValue: false,
18
+ inline: true,
19
+ }, true);
20
+ if (doSchemaPush) {
21
+ yield* pushSchema();
22
+ }
23
+ }),
24
+ });
25
+ yield* Effect.matchEffect(Effect.tryPromise(readLocalPermsFile).pipe(
26
+ // Throws NoSuchElementException if no file found
27
+ Effect.flatMap(Option.fromNullable)), {
28
+ onFailure: () => pullPerms,
29
+ onSuccess: () => Effect.gen(function* () {
30
+ const doPermsPush = yield* promptOk({
31
+ promptText: '\nFound local perms. Push it to the new app?',
32
+ defaultValue: false,
33
+ inline: true,
34
+ }, true);
35
+ if (doPermsPush) {
36
+ yield* pushPerms;
37
+ }
38
+ }),
39
+ });
40
+ });
41
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpE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GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,QAAQ,CACjC;gBACE,UAAU,EAAE,8CAA8C;gBAC1D,YAAY,EAAE,KAAK;gBACnB,MAAM,EAAE,IAAI;aACb,EACD,IAAI,CACL,CAAC;YACF,IAAI,WAAW,EAAE,CAAC;gBAChB,KAAK,CAAC,CAAC,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,CAAC;KACL,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { Effect, Option } from 'effect';\nimport { initDef } from '../index.ts';\nimport type { OptsFromCommand } from '../index.ts';\nimport { readLocalPermsFile, readLocalSchemaFile } from '../old.js';\nimport { pullSchema } from '../lib/pullSchema.ts';\nimport { pullPerms } from '../lib/pullPerms.ts';\nimport { promptOk } from '../lib/ui.ts';\nimport { pushSchema } from '../lib/pushSchema.ts';\nimport { pushPerms } from '../lib/pushPerms.ts';\n\nexport const initCommand = (_options: OptsFromCommand<typeof initDef>) =>\n Effect.gen(function* () {\n yield* Effect.matchEffect(\n Effect.tryPromise(readLocalSchemaFile).pipe(\n // Throws NoSuchElementException if no file found\n Effect.flatMap(Option.fromNullable),\n ),\n {\n onFailure: () => pullSchema({ experimentalTypePreservation: false }),\n onSuccess: () =>\n Effect.gen(function* () {\n const doSchemaPush = yield* promptOk(\n {\n promptText: '\\nFound local schema. Push it to the new app?',\n defaultValue: false,\n inline: true,\n },\n true,\n );\n if (doSchemaPush) {\n yield* pushSchema();\n }\n }),\n },\n );\n\n yield* Effect.matchEffect(\n Effect.tryPromise(readLocalPermsFile).pipe(\n // Throws NoSuchElementException if no file found\n Effect.flatMap(Option.fromNullable),\n ),\n {\n onFailure: () => pullPerms,\n onSuccess: () =>\n Effect.gen(function* () {\n const doPermsPush = yield* promptOk(\n {\n promptText: '\\nFound local perms. Push it to the new app?',\n defaultValue: false,\n inline: true,\n },\n true,\n );\n if (doPermsPush) {\n yield* pushPerms;\n }\n }),\n },\n );\n });\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ import { PlatformApi } from '../context/platformApi.ts';
3
+ import { initWithoutFilesDef } from '../index.ts';
4
+ import type { OptsFromCommand } from '../index.ts';
5
+ export declare const initWithoutFilesCommand: (opts: OptsFromCommand<typeof initWithoutFilesDef>) => Effect.Effect<undefined, never, PlatformApi>;
6
+ //# sourceMappingURL=initWithoutFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initWithoutFiles.d.ts","sourceRoot":"","sources":["../../src/commands/initWithoutFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,eAAO,MAAM,uBAAuB,GAClC,MAAM,eAAe,CAAC,OAAO,mBAAmB,CAAC,iDA+FhD,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { Effect } from 'effect';
2
+ import { PlatformApi } from "../context/platformApi.js";
3
+ import { BadArgsError } from "../errors.js";
4
+ import { initWithoutFilesDef } from "../index.js";
5
+ import { createApp } from "../lib/createApp.js";
6
+ import { AuthLayerLive } from "../layer.js";
7
+ import chalk from 'chalk';
8
+ import { NotAuthedError } from "../context/authToken.js";
9
+ export const initWithoutFilesCommand = (opts) => Effect.gen(function* () {
10
+ if (!opts?.title) {
11
+ return yield* BadArgsError.make({
12
+ message: 'Title is required for creating a new app without local files.',
13
+ });
14
+ }
15
+ if (opts.title.startsWith('-')) {
16
+ return yield* BadArgsError.make({
17
+ message: `Invalid title: "${opts.title}". Title cannot be a flag.`,
18
+ });
19
+ }
20
+ if (opts?.temp && opts?.orgId) {
21
+ return yield* BadArgsError.make({
22
+ message: 'Cannot use --temp and --org-id flags together.',
23
+ });
24
+ }
25
+ if (opts.temp) {
26
+ const platform = yield* PlatformApi;
27
+ const app = yield* platform.use((api) => api.createTemporaryApp({
28
+ title: opts.title,
29
+ }));
30
+ console.error(`${chalk.green('Successfully created new app!')}\n`);
31
+ yield* Effect.log(JSON.stringify({
32
+ app: {
33
+ appId: app.app.id,
34
+ adminToken: app.app.adminToken,
35
+ },
36
+ error: null,
37
+ }, null, 2));
38
+ return;
39
+ }
40
+ const app = yield* createApp(opts.title, opts.orgId).pipe(Effect.provide(AuthLayerLive({
41
+ allowAdminToken: false,
42
+ coerce: false,
43
+ })));
44
+ // Using console.error so the output is part of error channel and not picked up by jq
45
+ console.error(`${chalk.green('Successfully created new app!')}\n`);
46
+ yield* Effect.log(JSON.stringify({
47
+ app: {
48
+ appId: app.app.id,
49
+ adminToken: app.app['admin-token'],
50
+ },
51
+ error: null,
52
+ }, null, 2));
53
+ }).pipe(Effect.catchTag('NotAuthedError', (e) => NotAuthedError.make({
54
+ message: 'Please log in first with `superlayer login` before running this command.',
55
+ })), Effect.catchAll((e) => Effect.gen(function* () {
56
+ yield* Effect.log(JSON.stringify({
57
+ app: null,
58
+ error: {
59
+ message: e.message,
60
+ },
61
+ }, null, 2));
62
+ process.exit(1);
63
+ })));
64
+ //# sourceMappingURL=initWithoutFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initWithoutFiles.js","sourceRoot":"","sources":["../../src/commands/initWithoutFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,O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CAAC,CAAC,CACH,CACF,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport { PlatformApi } from '../context/platformApi.ts';\nimport { BadArgsError } from '../errors.ts';\nimport { initWithoutFilesDef } from '../index.ts';\nimport type { OptsFromCommand } from '../index.ts';\nimport { createApp } from '../lib/createApp.ts';\nimport { AuthLayerLive } from '../layer.ts';\nimport chalk from 'chalk';\nimport { NotAuthedError } from '../context/authToken.ts';\n\nexport const initWithoutFilesCommand = (\n opts: OptsFromCommand<typeof initWithoutFilesDef>,\n) =>\n Effect.gen(function* () {\n if (!opts?.title) {\n return yield* BadArgsError.make({\n message:\n 'Title is required for creating a new app without local files.',\n });\n }\n\n if (opts.title.startsWith('-')) {\n return yield* BadArgsError.make({\n message: `Invalid title: \"${opts.title}\". Title cannot be a flag.`,\n });\n }\n\n if (opts?.temp && opts?.orgId) {\n return yield* BadArgsError.make({\n message: 'Cannot use --temp and --org-id flags together.',\n });\n }\n\n if (opts.temp) {\n const platform = yield* PlatformApi;\n const app = yield* platform.use((api) =>\n api.createTemporaryApp({\n title: opts.title!,\n }),\n );\n\n console.error(`${chalk.green('Successfully created new app!')}\\n`);\n yield* Effect.log(\n JSON.stringify(\n {\n app: {\n appId: app.app.id,\n adminToken: app.app.adminToken,\n },\n error: null,\n },\n null,\n 2,\n ),\n );\n\n return;\n }\n\n const app = yield* createApp(opts.title, opts.orgId).pipe(\n Effect.provide(\n AuthLayerLive({\n allowAdminToken: false,\n coerce: false,\n }),\n ),\n );\n // Using console.error so the output is part of error channel and not picked up by jq\n console.error(`${chalk.green('Successfully created new app!')}\\n`);\n yield* Effect.log(\n JSON.stringify(\n {\n app: {\n appId: app.app.id,\n adminToken: app.app['admin-token'],\n },\n error: null,\n },\n null,\n 2,\n ),\n );\n }).pipe(\n Effect.catchTag('NotAuthedError', (e) =>\n NotAuthedError.make({\n message:\n 'Please log in first with `superlayer login` before running this command.',\n }),\n ),\n Effect.catchAll((e) =>\n Effect.gen(function* () {\n yield* Effect.log(\n JSON.stringify(\n {\n app: null,\n error: {\n message: e.message,\n },\n },\n null,\n 2,\n ),\n );\n process.exit(1);\n }),\n ),\n );\n"]}
@@ -0,0 +1,9 @@
1
+ import { Effect } from 'effect';
2
+ export declare const loginCommand: (opts: {
3
+ print?: true | undefined;
4
+ headless?: true | undefined;
5
+ }) => Effect.Effect<{
6
+ authToken: string;
7
+ source: "file";
8
+ }, import("../errors.ts").BadArgsError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("effect/ParseResult").ParseError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError, import("../context/globalOpts.ts").GlobalOpts | import("../lib/http.ts").InstantHttp>;
9
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAgBhC,eAAO,MAAM,YAAY;;;;;;ucA4CvB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import openInBrowser from 'open';
4
+ import { loginDef } from "../index.js";
5
+ import { getDashUrl } from "../lib/config.js";
6
+ import { getLoginTicketAndSecret, saveConfigAuthToken, waitForAuthToken, } from "../lib/login.js";
7
+ import { promptOk } from "../lib/ui.js";
8
+ import { isHeadlessEnvironment } from "../util/isHeadlessEnvironment.js";
9
+ const loginUrlMessage = (url) => `Open this URL in a browser to log in:\n ${url}\n`;
10
+ export const loginCommand = Effect.fn(function* (opts) {
11
+ yield* Effect.log("Let's log you in!");
12
+ const loginInfo = yield* getLoginTicketAndSecret;
13
+ const { secret, ticket } = loginInfo;
14
+ const dashOrigin = yield* getDashUrl;
15
+ const loginUrl = `${dashOrigin}/dash?ticket=${ticket}`;
16
+ yield* Effect.log();
17
+ if (isHeadlessEnvironment(opts)) {
18
+ yield* Effect.log(loginUrlMessage(loginUrl));
19
+ }
20
+ else {
21
+ const ok = yield* promptOk({
22
+ promptText: 'This will open your Instant dashboard in your browser, OK to proceed?',
23
+ }, true);
24
+ if (!ok) {
25
+ process.exit(0);
26
+ }
27
+ yield* Effect.tryPromise(() => openInBrowser(loginUrl)).pipe(Effect.catchAll(() => Effect.log(loginUrlMessage(loginUrl))));
28
+ }
29
+ yield* Effect.log('Waiting for authentication...');
30
+ const result = yield* waitForAuthToken(secret);
31
+ const { token, email } = result;
32
+ if (opts.print) {
33
+ yield* Effect.log(chalk.red('[Do not share] Your Instant auth token:', token));
34
+ }
35
+ else {
36
+ yield* saveConfigAuthToken(token);
37
+ yield* Effect.log(chalk.green(`Successfully logged in as ${email}!`));
38
+ }
39
+ return {
40
+ authToken: token,
41
+ source: 'file',
42
+ };
43
+ });
44
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,aAAa,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CACtC,2CAA2C,GAAG,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAC7C,IAAsC;IAEtC,KAAK,CAA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GAAG,CACf,KAAK,CAAC,GAAG,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAC5D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,KAAK,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,MAAe;KACxB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport openInBrowser from 'open';\nimport { loginDef } from '../index.ts';\nimport type { OptsFromCommand } from '../index.ts';\nimport { getDashUrl } from '../lib/config.ts';\nimport {\n getLoginTicketAndSecret,\n saveConfigAuthToken,\n waitForAuthToken,\n} from '../lib/login.ts';\nimport { promptOk } from '../lib/ui.ts';\nimport { isHeadlessEnvironment } from '../util/isHeadlessEnvironment.ts';\n\nconst loginUrlMessage = (url: string) =>\n `Open this URL in a browser to log in:\\n ${url}\\n`;\n\nexport const loginCommand = Effect.fn(function* (\n opts: OptsFromCommand<typeof loginDef>,\n) {\n yield* Effect.log(\"Let's log you in!\");\n\n const loginInfo = yield* getLoginTicketAndSecret;\n const { secret, ticket } = loginInfo;\n const dashOrigin = yield* getDashUrl;\n const loginUrl = `${dashOrigin}/dash?ticket=${ticket}`;\n yield* Effect.log();\n if (isHeadlessEnvironment(opts)) {\n yield* Effect.log(loginUrlMessage(loginUrl));\n } else {\n const ok = yield* promptOk(\n {\n promptText:\n 'This will open your Instant dashboard in your browser, OK to proceed?',\n },\n true,\n );\n if (!ok) {\n process.exit(0);\n }\n yield* Effect.tryPromise(() => openInBrowser(loginUrl)).pipe(\n Effect.catchAll(() => Effect.log(loginUrlMessage(loginUrl))),\n );\n }\n\n yield* Effect.log('Waiting for authentication...');\n\n const result = yield* waitForAuthToken(secret);\n const { token, email } = result;\n if (opts.print) {\n yield* Effect.log(\n chalk.red('[Do not share] Your Instant auth token:', token),\n );\n } else {\n yield* saveConfigAuthToken(token);\n yield* Effect.log(chalk.green(`Successfully logged in as ${email}!`));\n }\n return {\n authToken: token,\n source: 'file' as const,\n };\n});\n"]}
@@ -0,0 +1,3 @@
1
+ import { Effect } from 'effect';
2
+ export declare const logoutCommand: () => Effect.Effect<void, import("../errors.ts").BadArgsError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError, never>;
3
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,aAAa,4JAgBxB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Effect } from 'effect';
2
+ import chalk from 'chalk';
3
+ import { removeAuthToken } from "../auth/index.js";
4
+ import { getBaseUrl } from "../lib/config.js";
5
+ export const logoutCommand = Effect.fn(function* () {
6
+ const apiURI = yield* getBaseUrl;
7
+ yield* Effect.tryPromise(() => removeAuthToken(apiURI)).pipe(Effect.matchEffect({
8
+ onFailure: (error) => Effect.logError(chalk.red(`Failed to logout: ${error.message}`)),
9
+ onSuccess: (removed) => Effect.log(chalk.green(removed
10
+ ? 'Successfully logged out from Instant!'
11
+ : 'You were already logged out!')),
12
+ }));
13
+ });
14
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IACjC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAC1D,MAAM,CAAC,WAAW,CAAC;QACjB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CACnB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAClE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CACrB,MAAM,CAAC,GAAG,CACR,KAAK,CAAC,KAAK,CACT,OAAO;YACL,CAAC,CAAC,uCAAuC;YACzC,CAAC,CAAC,8BAA8B,CACnC,CACF;KACJ,CAAC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport chalk from 'chalk';\nimport { removeAuthToken } from '../auth/index.ts';\nimport { getBaseUrl } from '../lib/config.ts';\n\nexport const logoutCommand = Effect.fn(function* () {\n const apiURI = yield* getBaseUrl;\n yield* Effect.tryPromise(() => removeAuthToken(apiURI)).pipe(\n Effect.matchEffect({\n onFailure: (error) =>\n Effect.logError(chalk.red(`Failed to logout: ${error.message}`)),\n onSuccess: (removed) =>\n Effect.log(\n chalk.green(\n removed\n ? 'Successfully logged out from Instant!'\n : 'You were already logged out!',\n ),\n ),\n }),\n );\n});\n"]}
@@ -0,0 +1,5 @@
1
+ import { Effect } from 'effect';
2
+ import type { OptsFromCommand, pullDef } from '../index.ts';
3
+ export type SchemaPermsOrBoth = 'schema' | 'perms' | 'all';
4
+ export declare const pullCommand: (arg: SchemaPermsOrBoth, opts: OptsFromCommand<typeof pullDef>) => Effect.Effect<void, import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError | import("@effect/platform/Error").PlatformError | import("../lib/pushSchema.ts").ReadSchemaFileError | import("../util/mergeSchema.ts").MergeSchemaError, import("../context/globalOpts.ts").GlobalOpts | import("../context/projectInfo.ts").ProjectInfo | import("../lib/http.ts").InstantHttpAuthed | import("@effect/platform/FileSystem").FileSystem | import("@effect/platform/Path").Path | import("../context/currentApp.ts").CurrentApp>;
5
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI5D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE3D,eAAO,MAAM,WAAW,GACtB,KAAK,iBAAiB,EACtB,MAAM,eAAe,CAAC,OAAO,OAAO,CAAC,wuBAYnC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Effect } from 'effect';
2
+ import { pullSchema } from "../lib/pullSchema.js";
3
+ import { pullPerms } from "../lib/pullPerms.js";
4
+ export const pullCommand = (arg, opts) => Effect.gen(function* () {
5
+ arg ||= 'all';
6
+ if (arg === 'schema' || arg === 'all') {
7
+ yield* pullSchema({
8
+ experimentalTypePreservation: opts.experimentalTypePreservation,
9
+ });
10
+ }
11
+ if (arg === 'perms' || arg === 'all') {
12
+ yield* pullPerms;
13
+ }
14
+ });
15
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAsB,EACtB,IAAqC,EACrC,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,GAAG,KAAK,KAAK,CAAC;IACd,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACtC,KAAK,CAAC,CAAC,UAAU,CAAC;YAChB,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;SAChE,CAAC,CAAC;IACL,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,CAAC,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport type { OptsFromCommand, pullDef } from '../index.ts';\nimport { pullSchema } from '../lib/pullSchema.ts';\nimport { pullPerms } from '../lib/pullPerms.ts';\n\nexport type SchemaPermsOrBoth = 'schema' | 'perms' | 'all';\n\nexport const pullCommand = (\n arg: SchemaPermsOrBoth,\n opts: OptsFromCommand<typeof pullDef>,\n) =>\n Effect.gen(function* () {\n arg ||= 'all';\n if (arg === 'schema' || arg === 'all') {\n yield* pullSchema({\n experimentalTypePreservation: opts.experimentalTypePreservation,\n });\n }\n if (arg === 'perms' || arg === 'all') {\n yield* pullPerms;\n }\n });\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ import { BadArgsError } from '../errors.ts';
3
+ import { pushDef } from '../index.ts';
4
+ import type { OptsFromCommand } from '../index.ts';
5
+ export declare const pushCommand: (arg: string | undefined, opts: OptsFromCommand<typeof pushDef>) => Effect.Effect<undefined, BadArgsError | import("effect/Cause").UnknownException | import("effect/ConfigError").ConfigError | import("effect/ParseResult").ParseError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError | import("@effect/platform/HttpBody").HttpBodyError | import("../lib/pushSchema.ts").ReadSchemaFileError | import("../lib/pushSchema.ts").SchemaDiffError | import("../lib/pushSchema.ts").GetSchemaError | import("../lib/pushSchema.ts").SchemaValidationError | import("../lib/pushSchema.ts").WaitForJobsError | import("../lib/pushSchema.ts").CancelSchemaError | import("../lib/pushPerms.ts").NoPermsFileError, import("../context/globalOpts.ts").GlobalOpts | import("../context/authToken.ts").AuthToken | import("../lib/http.ts").InstantHttpAuthed | import("../context/currentApp.ts").CurrentApp>;
6
+ //# sourceMappingURL=push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,eAAO,MAAM,WAAW,GACtB,KAAK,MAAM,GAAG,SAAS,EACvB,MAAM,eAAe,CAAC,OAAO,OAAO,CAAC,s8BAenC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Effect } from 'effect';
2
+ import { BadArgsError } from "../errors.js";
3
+ import { pushDef } from "../index.js";
4
+ import { pushPerms } from "../lib/pushPerms.js";
5
+ import { pushSchema } from "../lib/pushSchema.js";
6
+ export const pushCommand = (arg, opts) => Effect.gen(function* () {
7
+ arg ||= 'all';
8
+ if (arg !== 'schema' && arg !== 'perms' && arg !== 'all') {
9
+ return yield* new BadArgsError({
10
+ message: `Invalid argument: ${arg}. Expected one of schema, perms, or all`,
11
+ });
12
+ }
13
+ if (arg === 'schema' || arg === 'all') {
14
+ yield* pushSchema(opts.rename);
15
+ }
16
+ if (arg === 'perms' || arg === 'all') {
17
+ yield* pushPerms;
18
+ }
19
+ });
20
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAuB,EACvB,IAAqC,EACrC,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,GAAG,KAAK,KAAK,CAAC;IACd,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC;YAC7B,OAAO,EAAE,qBAAqB,GAAG,yCAAyC;SAC3E,CAAC,CAAC;IACL,CAAC;IACD,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACtC,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,CAAC,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport { BadArgsError } from '../errors.ts';\nimport { pushDef } from '../index.ts';\nimport type { OptsFromCommand } from '../index.ts';\nimport { pushPerms } from '../lib/pushPerms.ts';\nimport { pushSchema } from '../lib/pushSchema.ts';\n\nexport const pushCommand = (\n arg: string | undefined,\n opts: OptsFromCommand<typeof pushDef>,\n) =>\n Effect.gen(function* () {\n arg ||= 'all';\n if (arg !== 'schema' && arg !== 'perms' && arg !== 'all') {\n return yield* new BadArgsError({\n message: `Invalid argument: ${arg}. Expected one of schema, perms, or all`,\n });\n }\n if (arg === 'schema' || arg === 'all') {\n yield* pushSchema(opts.rename);\n }\n if (arg === 'perms' || arg === 'all') {\n yield* pushPerms;\n }\n });\n"]}
@@ -0,0 +1,7 @@
1
+ import { Effect } from 'effect';
2
+ import { queryDef } from '../index.ts';
3
+ import type { OptsFromCommand } from '../index.ts';
4
+ import { BadArgsError } from '../errors.ts';
5
+ import { HttpBody } from '@effect/platform';
6
+ export declare const queryCmd: (arg: string, opts: OptsFromCommand<typeof queryDef>) => Effect.Effect<undefined, BadArgsError | import("../lib/ui.ts").UIError | import("effect/Cause").UnknownException | import("../context/projectInfo.ts").ProjectInfoError | import("effect/ConfigError").ConfigError | import("effect/ParseResult").ParseError | import("../lib/http.ts").InstantHttpError | import("effect/Cause").TimeoutException | import("@effect/platform/HttpClientError").RequestError | import("@effect/platform/HttpClientError").ResponseError | import("../context/authToken.ts").NotAuthedError | import("@effect/platform/Error").PlatformError | import("../context/platformApi.ts").PlatformApiError | import("../context/currentApp.ts").CurrentAppContextError | import("../context/currentApp.ts").AppNotFoundError | HttpBody.HttpBodyError, never>;
7
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC,OAAO,QAAQ,CAAC,0vBAkDzE,CAAC"}