@gadgetinc/ggt 2.3.0 → 3.0.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 (224) hide show
  1. package/README.md +387 -327
  2. package/dist/action-CF6zatIh.js +64 -0
  3. package/dist/action-CF6zatIh.js.map +1 -0
  4. package/dist/action-CrDCeX3F.js +8 -0
  5. package/dist/action-CrDCeX3F.js.map +1 -0
  6. package/dist/add-Basu3Gyf.js +1 -0
  7. package/dist/agent-plugin-CqgwTOk-.js +15 -0
  8. package/dist/agent-plugin-CqgwTOk-.js.map +1 -0
  9. package/dist/agent-plugin-DU9G5B1d.js +9 -0
  10. package/dist/agent-plugin-DU9G5B1d.js.map +1 -0
  11. package/dist/assert-Bu1E126Z.js +2 -0
  12. package/dist/assert-Bu1E126Z.js.map +1 -0
  13. package/dist/chunk-BjEoQXZ0.js +1 -0
  14. package/dist/collection-C2TCeYqY.js +2 -0
  15. package/dist/collection-C2TCeYqY.js.map +1 -0
  16. package/dist/collection-aM0fpch0.js +1 -0
  17. package/dist/command-2iNTc5dV.js +118 -0
  18. package/dist/command-2iNTc5dV.js.map +1 -0
  19. package/dist/completion-D96nxD5n.js +37 -0
  20. package/dist/completion-D96nxD5n.js.map +1 -0
  21. package/dist/configure-C8ge-2cK.js +15 -0
  22. package/dist/configure-C8ge-2cK.js.map +1 -0
  23. package/dist/debugger-BkYgApKn.js +22 -0
  24. package/dist/debugger-BkYgApKn.js.map +1 -0
  25. package/dist/defaults-B_eD7Pia.js +2 -0
  26. package/dist/defaults-B_eD7Pia.js.map +1 -0
  27. package/dist/deploy-Da6P2HXS.js +15 -0
  28. package/dist/deploy-Da6P2HXS.js.map +1 -0
  29. package/dist/dev-DWMSNcLl.js +32 -0
  30. package/dist/dev-DWMSNcLl.js.map +1 -0
  31. package/dist/dev-lock-BFanZSu1.js +10 -0
  32. package/dist/dev-lock-BFanZSu1.js.map +1 -0
  33. package/dist/directory-CNL03L6c.js +9 -0
  34. package/dist/directory-CNL03L6c.js.map +1 -0
  35. package/dist/env-DoWNvHzW.js +62 -0
  36. package/dist/env-DoWNvHzW.js.map +1 -0
  37. package/dist/esm-B25i6Etq.js +12 -0
  38. package/dist/esm-B25i6Etq.js.map +1 -0
  39. package/dist/esm-CJocZrdd.js +2 -0
  40. package/dist/esm-CJocZrdd.js.map +1 -0
  41. package/dist/eval-BceZMSd5.js +27 -0
  42. package/dist/eval-BceZMSd5.js.map +1 -0
  43. package/dist/execAsync-DrhcEHLd.js +2 -0
  44. package/dist/execAsync-DrhcEHLd.js.map +1 -0
  45. package/dist/filesync-De6asZeR.js +61 -0
  46. package/dist/filesync-De6asZeR.js.map +1 -0
  47. package/dist/getMachineId-bsd-Cch8Z6pV.js +2 -0
  48. package/dist/getMachineId-bsd-Cch8Z6pV.js.map +1 -0
  49. package/dist/getMachineId-darwin-kbQWK54o.js +3 -0
  50. package/dist/getMachineId-darwin-kbQWK54o.js.map +1 -0
  51. package/dist/getMachineId-linux-DdIel6zr.js +2 -0
  52. package/dist/getMachineId-linux-DdIel6zr.js.map +1 -0
  53. package/dist/getMachineId-unsupported-Bvmsh30k.js +2 -0
  54. package/dist/getMachineId-unsupported-Bvmsh30k.js.map +1 -0
  55. package/dist/getMachineId-win-BteHZe8j.js +2 -0
  56. package/dist/getMachineId-win-BteHZe8j.js.map +1 -0
  57. package/dist/ggt-B3HQjQRM.js +3 -0
  58. package/dist/ggt-B3HQjQRM.js.map +1 -0
  59. package/dist/handler-DZyG8Sel.js +4 -0
  60. package/dist/handler-DZyG8Sel.js.map +1 -0
  61. package/dist/http-CY3lPMkt.js +320 -0
  62. package/dist/http-CY3lPMkt.js.map +1 -0
  63. package/dist/indent-string-BVm-4tyL.js +2 -0
  64. package/dist/indent-string-BVm-4tyL.js.map +1 -0
  65. package/dist/list-lQKWZ6ZI.js +10 -0
  66. package/dist/list-lQKWZ6ZI.js.map +1 -0
  67. package/dist/login-Ce0tByNd.js +1 -0
  68. package/dist/logout-_sTWeaiQ.js +5 -0
  69. package/dist/logout-_sTWeaiQ.js.map +1 -0
  70. package/dist/logs-DbhJzz4M.js +9 -0
  71. package/dist/logs-DbhJzz4M.js.map +1 -0
  72. package/dist/main.js +2 -2
  73. package/dist/main.js.map +1 -7
  74. package/dist/model-CBiMKY0P.js +11 -0
  75. package/dist/model-CBiMKY0P.js.map +1 -0
  76. package/dist/ms-B7sMc0pR.js +2 -0
  77. package/dist/ms-B7sMc0pR.js.map +1 -0
  78. package/dist/open-CSsA4B-l.js +38 -0
  79. package/dist/open-CSsA4B-l.js.map +1 -0
  80. package/dist/p-map-DE0acmRv.js +2 -0
  81. package/dist/p-map-DE0acmRv.js.map +1 -0
  82. package/dist/problems-BMLsmxd4.js +11 -0
  83. package/dist/problems-BMLsmxd4.js.map +1 -0
  84. package/dist/prompt-C9nwJW0G.js +2 -0
  85. package/dist/prompt-C9nwJW0G.js.map +1 -0
  86. package/dist/pull-DpizmJGk.js +12 -0
  87. package/dist/pull-DpizmJGk.js.map +1 -0
  88. package/dist/push-67KBCw6c.js +12 -0
  89. package/dist/push-67KBCw6c.js.map +1 -0
  90. package/dist/root-D_UnUsp7.js +28 -0
  91. package/dist/root-D_UnUsp7.js.map +1 -0
  92. package/dist/select-Dey_sjjd.js +4 -0
  93. package/dist/select-Dey_sjjd.js.map +1 -0
  94. package/dist/session-BmzGF1t7.js +2 -0
  95. package/dist/session-BmzGF1t7.js.map +1 -0
  96. package/dist/spinner-BVmbgIil.js +8 -0
  97. package/dist/spinner-BVmbgIil.js.map +1 -0
  98. package/dist/src-DxCC1MV4.js +6 -0
  99. package/dist/src-DxCC1MV4.js.map +1 -0
  100. package/dist/status-P_RFQ7J0.js +13 -0
  101. package/dist/status-P_RFQ7J0.js.map +1 -0
  102. package/dist/subscribeToEnvironmentLogs-CUicaiw_.js +2 -0
  103. package/dist/subscribeToEnvironmentLogs-CUicaiw_.js.map +1 -0
  104. package/dist/sync-json-V52OzeCz.js +112 -0
  105. package/dist/sync-json-V52OzeCz.js.map +1 -0
  106. package/dist/table-MrBbxMay.js +11 -0
  107. package/dist/table-MrBbxMay.js.map +1 -0
  108. package/dist/update-CfxiL08e.js +12 -0
  109. package/dist/update-CfxiL08e.js.map +1 -0
  110. package/dist/update-iyhnL9-M.js +1 -0
  111. package/dist/var-ByWcufFt.js +59 -0
  112. package/dist/var-ByWcufFt.js.map +1 -0
  113. package/dist/version-B_9GB4u3.js +9 -0
  114. package/dist/version-B_9GB4u3.js.map +1 -0
  115. package/dist/whoami-BNcXIfz7.js +5 -0
  116. package/dist/whoami-BNcXIfz7.js.map +1 -0
  117. package/package.json +18 -22
  118. package/assets/favicon-128@4x.png +0 -0
  119. package/dist/add-7MLI3TCY.js +0 -82
  120. package/dist/add-7MLI3TCY.js.map +0 -7
  121. package/dist/agent-plugin-543K6WBH.js +0 -11
  122. package/dist/agent-plugin-543K6WBH.js.map +0 -7
  123. package/dist/chunk-2HJS3KFB.js +0 -2
  124. package/dist/chunk-2HJS3KFB.js.map +0 -7
  125. package/dist/chunk-3WKH3DJL.js +0 -2
  126. package/dist/chunk-3WKH3DJL.js.map +0 -7
  127. package/dist/chunk-577KP32Z.js +0 -8
  128. package/dist/chunk-577KP32Z.js.map +0 -7
  129. package/dist/chunk-6FVHOLT7.js +0 -28
  130. package/dist/chunk-6FVHOLT7.js.map +0 -7
  131. package/dist/chunk-72J7X5LR.js +0 -2
  132. package/dist/chunk-72J7X5LR.js.map +0 -7
  133. package/dist/chunk-7DYQUG5M.js +0 -2
  134. package/dist/chunk-7DYQUG5M.js.map +0 -7
  135. package/dist/chunk-ALSXPCRD.js +0 -118
  136. package/dist/chunk-ALSXPCRD.js.map +0 -7
  137. package/dist/chunk-CNNOPE5K.js +0 -69
  138. package/dist/chunk-CNNOPE5K.js.map +0 -7
  139. package/dist/chunk-ETKWDO4V.js +0 -2
  140. package/dist/chunk-ETKWDO4V.js.map +0 -7
  141. package/dist/chunk-F6BGQ4LG.js +0 -11
  142. package/dist/chunk-F6BGQ4LG.js.map +0 -7
  143. package/dist/chunk-FE5O5VX4.js +0 -2
  144. package/dist/chunk-FE5O5VX4.js.map +0 -7
  145. package/dist/chunk-GFQYFEEH.js +0 -2
  146. package/dist/chunk-GFQYFEEH.js.map +0 -7
  147. package/dist/chunk-GJGBTM5Y.js +0 -2
  148. package/dist/chunk-GJGBTM5Y.js.map +0 -7
  149. package/dist/chunk-GZTHIOXS.js +0 -2
  150. package/dist/chunk-GZTHIOXS.js.map +0 -7
  151. package/dist/chunk-IQSZEOYY.js +0 -283
  152. package/dist/chunk-IQSZEOYY.js.map +0 -7
  153. package/dist/chunk-J232VCIM.js +0 -2
  154. package/dist/chunk-J232VCIM.js.map +0 -7
  155. package/dist/chunk-KKIL22RY.js +0 -2
  156. package/dist/chunk-KKIL22RY.js.map +0 -7
  157. package/dist/chunk-L2XBSR7G.js +0 -2
  158. package/dist/chunk-L2XBSR7G.js.map +0 -7
  159. package/dist/chunk-N5FFICAP.js +0 -9
  160. package/dist/chunk-N5FFICAP.js.map +0 -7
  161. package/dist/chunk-TGCJ6TMW.js +0 -10
  162. package/dist/chunk-TGCJ6TMW.js.map +0 -7
  163. package/dist/chunk-ULJYEUQG.js +0 -113
  164. package/dist/chunk-ULJYEUQG.js.map +0 -7
  165. package/dist/chunk-UVVKKUYG.js +0 -10
  166. package/dist/chunk-UVVKKUYG.js.map +0 -7
  167. package/dist/chunk-WZ2PO6H2.js +0 -11
  168. package/dist/chunk-WZ2PO6H2.js.map +0 -7
  169. package/dist/chunk-X4XSYLCE.js +0 -12
  170. package/dist/chunk-X4XSYLCE.js.map +0 -7
  171. package/dist/chunk-ZYDMXS5R.js +0 -6
  172. package/dist/chunk-ZYDMXS5R.js.map +0 -7
  173. package/dist/configure-PYRXYNGZ.js +0 -12
  174. package/dist/configure-PYRXYNGZ.js.map +0 -7
  175. package/dist/debugger-VKLUEWIN.js +0 -41
  176. package/dist/debugger-VKLUEWIN.js.map +0 -7
  177. package/dist/deploy-JCREEGBA.js +0 -25
  178. package/dist/deploy-JCREEGBA.js.map +0 -7
  179. package/dist/dev-Y2GLI7EH.js +0 -59
  180. package/dist/dev-Y2GLI7EH.js.map +0 -7
  181. package/dist/env-5OPHX3MC.js +0 -135
  182. package/dist/env-5OPHX3MC.js.map +0 -7
  183. package/dist/esm-3JVXH7DT.js +0 -37
  184. package/dist/esm-3JVXH7DT.js.map +0 -7
  185. package/dist/eval-LZPZ6PBQ.js +0 -54
  186. package/dist/eval-LZPZ6PBQ.js.map +0 -7
  187. package/dist/getMachineId-bsd-QUXN4NKS.js +0 -2
  188. package/dist/getMachineId-bsd-QUXN4NKS.js.map +0 -7
  189. package/dist/getMachineId-darwin-TCXBAX22.js +0 -3
  190. package/dist/getMachineId-darwin-TCXBAX22.js.map +0 -7
  191. package/dist/getMachineId-linux-IJ3LYIOX.js +0 -2
  192. package/dist/getMachineId-linux-IJ3LYIOX.js.map +0 -7
  193. package/dist/getMachineId-unsupported-IKXBUCYY.js +0 -2
  194. package/dist/getMachineId-unsupported-IKXBUCYY.js.map +0 -7
  195. package/dist/getMachineId-win-6CX7VSFF.js +0 -2
  196. package/dist/getMachineId-win-6CX7VSFF.js.map +0 -7
  197. package/dist/ggt-KUAF6WUA.js +0 -45
  198. package/dist/ggt-KUAF6WUA.js.map +0 -7
  199. package/dist/list-IANT7SNF.js +0 -11
  200. package/dist/list-IANT7SNF.js.map +0 -7
  201. package/dist/login-TYRZLN5S.js +0 -2
  202. package/dist/login-TYRZLN5S.js.map +0 -7
  203. package/dist/logout-P75XYYZ6.js +0 -7
  204. package/dist/logout-P75XYYZ6.js.map +0 -7
  205. package/dist/logs-SBMD6JSR.js +0 -28
  206. package/dist/logs-SBMD6JSR.js.map +0 -7
  207. package/dist/open-JPAMII4K.js +0 -74
  208. package/dist/open-JPAMII4K.js.map +0 -7
  209. package/dist/problems-EZRSHLZT.js +0 -14
  210. package/dist/problems-EZRSHLZT.js.map +0 -7
  211. package/dist/pull-R3PMBVOT.js +0 -28
  212. package/dist/pull-R3PMBVOT.js.map +0 -7
  213. package/dist/push-5XEEESQQ.js +0 -2
  214. package/dist/push-5XEEESQQ.js.map +0 -7
  215. package/dist/status-RJN5ES6S.js +0 -14
  216. package/dist/status-RJN5ES6S.js.map +0 -7
  217. package/dist/update-X7YS3MNH.js +0 -2
  218. package/dist/update-X7YS3MNH.js.map +0 -7
  219. package/dist/var-PC6KQUPF.js +0 -159
  220. package/dist/var-PC6KQUPF.js.map +0 -7
  221. package/dist/version-GZJOU2CV.js +0 -11
  222. package/dist/version-GZJOU2CV.js.map +0 -7
  223. package/dist/whoami-GKPGPZ3B.js +0 -7
  224. package/dist/whoami-GKPGPZ3B.js.map +0 -7
@@ -1,54 +0,0 @@
1
- import{m as N,p as O,q as I,u as C}from"./chunk-ULJYEUQG.js";import{c as g}from"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import{B as R,K as S,da as x}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{K as D,ha as w,ma as $,ra as l,ta as P}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a as m,b as A,f as U,h as j}from"./chunk-7DYQUG5M.js";j();var b=U(D(),1);import{createRequire as _}from"node:module";import M from"node:path";import{inspect as J}from"node:util";import G from"node:vm";var se={...O,"--allow-writes":{type:Boolean,alias:"-w"}},ae=m(()=>l`
2
- Evaluates a JavaScript snippet against a Gadget app's API client.
3
-
4
- The snippet receives an {bold api} variable (a pre-constructed Gadget API client
5
- authenticated as the developer). Results are formatted like Node.js REPL output.
6
- Writes are disallowed by default; use {bold --allow-writes} to enable them.
7
-
8
- {gray Usage}
9
- $ ggt eval [options] <snippet>
10
-
11
- {gray Options}
12
- -a, --app <app_name> Selects a specific app. Defaults to the app synced to the current directory, if there is one.
13
- -e, --env <env_name> Selects a specific environment. Defaults to the environment synced to the current directory, if there is one.
14
- -w, --allow-writes Allow write operations (default is read-only)
15
- --json Output result as JSON instead of Node.js inspect format (root flag)
16
-
17
- {gray Examples}
18
- $ ggt eval 'api.user.findMany()'
19
- $ ggt eval --app my-app --env staging 'api.user.findFirst()'
20
- $ ggt eval -a my-app -w 'api.user.delete("123")'
21
- `,"usage"),ce=m(async(e,a)=>{let i=a._[0];if(!i)throw new g(l`
22
- Missing required snippet argument.
23
-
24
- {gray Usage}
25
- $ ggt eval [options] <snippet>
26
-
27
- {gray Example}
28
- $ ggt eval --app my-app 'api.user.findMany()'
29
- `);let t=await C(process.cwd()),r=await I.load(e,{command:"eval",args:a,directory:t}),y=r.application,o=r.environment,c=r.syncJsonState?.environments[o.name]?.filesVersion,{client:h,fn:u}=await B(e,a,i,y,o,c),k=m(async()=>{try{return await u(h,A)}catch(n){if((n instanceof Error?n.message:String(n)).includes("GGT_ENVIRONMENT_PAUSED"))return e.log.info("environment is paused, unpausing and retrying",{environment:o.name}),await V(e,o),await u(h,A);throw n}},"execSnippet"),p;try{p=await k()}catch(n){e.log.debug("snippet execution error",{error:n});let d=n instanceof Error?n.message:String(n);if(w.logFormat==="json"){$.writeStdout(JSON.stringify({error:d})+`
30
- `),process.exitCode=1;return}throw new g(l`
31
- Error executing snippet:
32
-
33
- ${d}
34
- `)}p!==void 0&&(w.logFormat==="json"?$.writeStdout(JSON.stringify(p)+`
35
- `):P(J(p,{depth:null,colors:$.isInteractive})))},"run"),V=m(async(e,a)=>{let i=new N(e,a);try{let{unpauseEnvironment:t}=await i.mutate({mutation:R});t.success&&!t.alreadyActive&&e.log.info("unpaused environment",{environment:a.name})}finally{await i.dispose()}},"unpauseEnvironment"),B=m(async(e,a,i,t,r,y)=>{let o,c=y?M.join(w.cacheDir,"client-bundles",`${t.slug}--${r.name}--${y}.js`):void 0;if(c)try{o=await b.default.readFile(c,"utf8"),e.log.debug("loaded client source from cache",{cachePath:c})}catch{}if(!o){let s=`https://${t.slug}--${r.name}.${w.domains.app}/api/client/node.js`;e.log.debug("fetching client source",{clientUrl:s});try{o=await x({context:{ctx:e},url:s,headers:S(e),resolveBodyOnly:!0})}catch(f){throw e.log.error("failed to fetch client source",{error:f}),new g(l`
36
- Failed to fetch the API client for ${t.slug} (${r.name}).
37
-
38
- Ensure the app and environment exist and are accessible.
39
- `)}if(c)try{await b.default.outputFile(c,o),e.log.debug("cached client source",{cachePath:c})}catch{}}let h=_(import.meta.url),u={exports:{}};G.runInThisContext(`(function(exports, require, module) {
40
- ${o}
41
- })`,{filename:`${t.slug}--${r.name}-client.cjs`})(u.exports,h,u);let p=u.exports.Client;if(!p)throw new g(l`
42
- Failed to load the API client for ${t.slug} (${r.name}).
43
-
44
- The client bundle did not export a Client constructor.
45
- `);let n=new p({authenticationMode:{custom:{async processFetch(s,f){let v=f.headers??={},q=S(e);for(let[F,T]of Object.entries(q))v[F]=T;v["x-gadget-client"]="graphql-playground",v["x-gadget-environment"]=r.name,a["--allow-writes"]||(v["x-gadget-developer-readonly"]="true")},async processTransactionConnectionParams(s){let f=s.auth??={};f.useAppDeveloperSession=!0}}}}),d=Object.getPrototypeOf(async function(){}).constructor,E;try{E=new d("api","require",`return (
46
- ${i}
47
- )`)}catch{try{E=new d("api","require",i)}catch(s){throw new g(l`
48
- Syntax error in snippet:
49
-
50
- ${i}
51
-
52
- ${s instanceof Error?s.message:String(s)}
53
- `)}}return{client:n,fn:E}},"loadClient");export{se as args,ce as run,ae as usage};
54
- //# sourceMappingURL=eval-LZPZ6PBQ.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/eval.ts"],
4
- "sourcesContent": ["import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { inspect } from \"node:util\";\nimport vm from \"node:vm\";\n\nimport fs from \"fs-extra\";\n\nimport type { Application, Environment } from \"../services/app/app.js\";\nimport { Edit } from \"../services/app/edit/edit.js\";\nimport { UNPAUSE_ENVIRONMENT_MUTATION } from \"../services/app/edit/operation.js\";\nimport { AppIdentity, AppIdentityArgs } from \"../services/command/app-identity.js\";\nimport { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport type { Context } from \"../services/command/context.js\";\nimport { config } from \"../services/config/config.js\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { loadAuthHeaders } from \"../services/http/auth.js\";\nimport { http } from \"../services/http/http.js\";\nimport { output } from \"../services/output/output.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport const args = {\n ...AppIdentityArgs,\n \"--allow-writes\": { type: Boolean, alias: \"-w\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = () => {\n return sprint`\n Evaluates a JavaScript snippet against a Gadget app's API client.\n\n The snippet receives an {bold api} variable (a pre-constructed Gadget API client\n authenticated as the developer). Results are formatted like Node.js REPL output.\n Writes are disallowed by default; use {bold --allow-writes} to enable them.\n\n {gray Usage}\n $ ggt eval [options] <snippet>\n\n {gray Options}\n -a, --app <app_name> Selects a specific app. Defaults to the app synced to the current directory, if there is one.\n -e, --env <env_name> Selects a specific environment. Defaults to the environment synced to the current directory, if there is one.\n -w, --allow-writes Allow write operations (default is read-only)\n --json Output result as JSON instead of Node.js inspect format (root flag)\n\n {gray Examples}\n $ ggt eval 'api.user.findMany()'\n $ ggt eval --app my-app --env staging 'api.user.findFirst()'\n $ ggt eval -a my-app -w 'api.user.delete(\"123\")'\n `;\n};\n\nexport const run: Run<typeof args> = async (ctx, args) => {\n const snippet = args._[0];\n if (!snippet) {\n throw new ArgError(sprint`\n Missing required snippet argument.\n\n {gray Usage}\n $ ggt eval [options] <snippet>\n\n {gray Example}\n $ ggt eval --app my-app 'api.user.findMany()'\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"eval\", args, directory });\n\n const application = appIdentity.application;\n const environment = appIdentity.environment;\n const filesVersion = appIdentity.syncJsonState?.environments[environment.name]?.filesVersion;\n\n const { client, fn } = await loadClient(ctx, args, snippet, application, environment, filesVersion);\n\n const execSnippet = async (): Promise<unknown> => {\n try {\n return await fn(client, require);\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n if (message.includes(\"GGT_ENVIRONMENT_PAUSED\")) {\n ctx.log.info(\"environment is paused, unpausing and retrying\", { environment: environment.name });\n await unpauseEnvironment(ctx, environment);\n return await fn(client, require);\n }\n throw error;\n }\n };\n\n let result: unknown;\n try {\n result = await execSnippet();\n } catch (error: unknown) {\n ctx.log.debug(\"snippet execution error\", { error });\n const message = error instanceof Error ? error.message : String(error);\n if (config.logFormat === \"json\") {\n output.writeStdout(JSON.stringify({ error: message }) + \"\\n\");\n process.exitCode = 1;\n return;\n }\n throw new ArgError(sprint`\n Error executing snippet:\n\n ${message}\n `);\n }\n\n if (result !== undefined) {\n if (config.logFormat === \"json\") {\n output.writeStdout(JSON.stringify(result) + \"\\n\");\n } else {\n println(inspect(result, { depth: null, colors: output.isInteractive }));\n }\n }\n};\n\nconst unpauseEnvironment = async (ctx: Context, environment: Environment): Promise<void> => {\n const edit = new Edit(ctx, environment);\n try {\n const { unpauseEnvironment } = await edit.mutate({ mutation: UNPAUSE_ENVIRONMENT_MUTATION });\n if (unpauseEnvironment.success && !unpauseEnvironment.alreadyActive) {\n ctx.log.info(\"unpaused environment\", { environment: environment.name });\n }\n } finally {\n await edit.dispose();\n }\n};\n\nconst loadClient = async (\n ctx: Context,\n args: { \"--allow-writes\"?: boolean },\n snippet: string,\n application: Application,\n environment: Environment,\n filesVersion?: string,\n): Promise<{ client: Record<string, unknown>; fn: (...args: unknown[]) => Promise<unknown> }> => {\n let clientSource: string | undefined;\n\n // Try to read from disk cache if we have a filesVersion\n const cachePath = filesVersion\n ? path.join(config.cacheDir, \"client-bundles\", `${application.slug}--${environment.name}--${filesVersion}.js`)\n : undefined;\n\n if (cachePath) {\n try {\n clientSource = await fs.readFile(cachePath, \"utf8\");\n ctx.log.debug(\"loaded client source from cache\", { cachePath });\n } catch {\n // cache miss, will fetch from server\n }\n }\n\n // Fetch from server if not cached\n if (!clientSource) {\n const clientUrl = `https://${application.slug}--${environment.name}.${config.domains.app}/api/client/node.js`;\n ctx.log.debug(\"fetching client source\", { clientUrl });\n\n try {\n clientSource = await http({\n context: { ctx },\n url: clientUrl,\n headers: loadAuthHeaders(ctx),\n resolveBodyOnly: true,\n });\n } catch (error: unknown) {\n ctx.log.error(\"failed to fetch client source\", { error });\n throw new ArgError(sprint`\n Failed to fetch the API client for ${application.slug} (${environment.name}).\n\n Ensure the app and environment exist and are accessible.\n `);\n }\n\n // Write to cache if we have a filesVersion\n if (cachePath) {\n try {\n await fs.outputFile(cachePath, clientSource);\n ctx.log.debug(\"cached client source\", { cachePath });\n } catch {\n // cache write failure is non-fatal\n }\n }\n }\n\n // Load the client module in-memory using vm.runInThisContext\n // This avoids writing a temp file while preserving object identity\n // (unlike vm.createContext which creates a separate realm)\n const require = createRequire(import.meta.url);\n const moduleObj = { exports: {} as Record<string, unknown> };\n const wrapped = vm.runInThisContext(`(function(exports, require, module) {\\n${clientSource}\\n})`, {\n filename: `${application.slug}--${environment.name}-client.cjs`,\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n wrapped(moduleObj.exports, require, moduleObj);\n const Client = moduleObj.exports[\"Client\"] as (new (options: Record<string, unknown>) => Record<string, unknown>) | undefined;\n\n if (!Client) {\n throw new ArgError(sprint`\n Failed to load the API client for ${application.slug} (${environment.name}).\n\n The client bundle did not export a Client constructor.\n `);\n }\n\n // Construct the client instance with developer auth\n const client = new Client({\n authenticationMode: {\n custom: {\n async processFetch(_url: string, init: Record<string, Record<string, string> | undefined>) {\n const headers = (init[\"headers\"] ??= {});\n const authHeaders = loadAuthHeaders(ctx);\n for (const [key, value] of Object.entries(authHeaders)) {\n headers[key] = value;\n }\n // Tell the Gadget server to authenticate this request as the developer\n headers[\"x-gadget-client\"] = \"graphql-playground\";\n headers[\"x-gadget-environment\"] = environment.name;\n if (!args[\"--allow-writes\"]) {\n headers[\"x-gadget-developer-readonly\"] = \"true\";\n }\n },\n async processTransactionConnectionParams(params: Record<string, Record<string, boolean> | undefined>) {\n const auth = (params[\"auth\"] ??= {});\n auth[\"useAppDeveloperSession\"] = true;\n },\n },\n },\n });\n\n // Parse the snippet into an executable function\n // eslint-disable-next-line no-empty-function, @typescript-eslint/no-unsafe-call\n const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;\n\n let fn: (...args: unknown[]) => Promise<unknown>;\n try {\n // Try as expression first (e.g. 'api.user.findMany()')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n fn = new AsyncFunction(\"api\", \"require\", `return (\\n${snippet}\\n)`) as typeof fn;\n } catch {\n try {\n // Fall back to statement (e.g. 'const users = await api.user.findMany(); return users.length')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n fn = new AsyncFunction(\"api\", \"require\", snippet) as typeof fn;\n } catch (error: unknown) {\n throw new ArgError(sprint`\n Syntax error in snippet:\n\n ${snippet}\n\n ${error instanceof Error ? error.message : String(error)}\n `);\n }\n }\n\n return { client, fn };\n};\n"],
5
- "mappings": "ycAAAA,IAKA,IAAAC,EAAe,SALf,OAAS,iBAAAC,MAAqB,cAC9B,OAAOC,MAAU,YACjB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAQ,UAmBR,IAAMC,GAAO,CAClB,GAAGC,EACH,iBAAkB,CAAE,KAAM,QAAS,MAAO,IAAK,CACjD,EAEaC,GAAeC,EAAA,IACnBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADmB,SAwBfC,GAAwBF,EAAA,MAAOG,EAAKN,IAAS,CACxD,IAAMO,EAAUP,EAAK,EAAE,CAAC,EACxB,GAAI,CAACO,EACH,MAAM,IAAIC,EAASJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AGFU,EAAK,IAAImC,EAAc,MAAO,UAAW7C,CAAO,CAClD,OAASc,EAAgB,CACvB,MAAM,IAAIb,EAASJ;AAAA;AAAA;AAAA,YAGbG,CAAO;AAAA;AAAA,UAETc,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC;AAAA,OACzD,CACH,CACF,CAEA,MAAO,CAAE,OAAAL,EAAQ,GAAAC,CAAG,CACtB,EA/HmB",
6
- "names": ["init_cjs", "import_fs_extra", "createRequire", "path", "inspect", "vm", "args", "AppIdentityArgs", "usage", "__name", "sprint", "run", "ctx", "snippet", "ArgError", "directory", "loadSyncJsonDirectory", "appIdentity", "AppIdentity", "application", "environment", "filesVersion", "client", "fn", "loadClient", "execSnippet", "__require", "error", "unpauseEnvironment", "result", "message", "config", "output", "println", "inspect", "edit", "Edit", "UNPAUSE_ENVIRONMENT_MUTATION", "clientSource", "cachePath", "path", "fs", "clientUrl", "http", "loadAuthHeaders", "require", "createRequire", "moduleObj", "vm", "Client", "_url", "init", "headers", "authHeaders", "key", "value", "params", "auth", "AsyncFunction"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as o}from"./chunk-GJGBTM5Y.js";import{m as d,n as a}from"./chunk-J232VCIM.js";import{a as r,b as c,d as s,g as u,h as i}from"./chunk-7DYQUG5M.js";var m=s(t=>{i();Object.defineProperty(t,"__esModule",{value:!0});t.getMachineId=void 0;var g=c("fs"),h=o(),n=(a(),u(d));async function l(){try{return(await g.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){n.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,h.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){n.diag.debug(`error reading machine id: ${e}`)}}r(l,"getMachineId");t.getMachineId=l});export default m();
2
- //# sourceMappingURL=getMachineId-bsd-QUXN4NKS.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../node_modules/.pnpm/@opentelemetry+resources@2.5.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-bsd.ts"],
4
- "sourcesContent": ["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { promises as fs } from 'fs';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n try {\n const result = await execAsync('kenv -q smbios.system.uuid');\n return result.stdout.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],
5
- "mappings": "kPAgBA,IAAAA,EAAA,EAAA,IAAA,EACAC,EAAA,IACAC,EAAA,WAEO,eAAeC,GAAY,CAChC,GAAI,CAEF,OADe,MAAMH,EAAA,SAAG,SAAS,cAAe,CAAE,SAAU,MAAM,CAAE,GACtD,KAAI,QACX,EAAG,CACVE,EAAA,KAAK,MAAM,6BAA6B,CAAC,EAAE,EAG7C,GAAI,CAEF,OADe,QAAMD,EAAA,WAAU,4BAA4B,GAC7C,OAAO,KAAI,QAClB,EAAG,CACVC,EAAA,KAAK,MAAM,6BAA6B,CAAC,EAAE,EAI/C,CAhBsBE,EAAAD,EAAA,gBAAtBE,EAAA,aAAAF",
6
- "names": ["fs_1", "execAsync_1", "api_1", "getMachineId", "__name", "exports"]
7
- }
@@ -1,3 +0,0 @@
1
- import{a as l}from"./chunk-GJGBTM5Y.js";import{m as a,n as o}from"./chunk-J232VCIM.js";import{a as r,d as s,g as u,h as c}from"./chunk-7DYQUG5M.js";var p=s(e=>{c();Object.defineProperty(e,"__esModule",{value:!0});e.getMachineId=void 0;var f=l(),g=(o(),u(a));async function h(){try{let i=(await(0,f.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
2
- `).find(d=>d.includes("IOPlatformUUID"));if(!i)return;let n=i.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){g.diag.debug(`error reading machine id: ${t}`)}}r(h,"getMachineId");e.getMachineId=h});export default p();
3
- //# sourceMappingURL=getMachineId-darwin-TCXBAX22.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../node_modules/.pnpm/@opentelemetry+resources@2.5.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-darwin.ts"],
4
- "sourcesContent": ["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await execAsync('ioreg -rd1 -c \"IOPlatformExpertDevice\"');\n\n const idLine = result.stdout\n .split('\\n')\n .find(line => line.includes('IOPlatformUUID'));\n\n if (!idLine) {\n return undefined;\n }\n\n const parts = idLine.split('\" = \"');\n if (parts.length === 2) {\n return parts[1].slice(0, -1);\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],
5
- "mappings": "2OAgBA,IAAAA,EAAA,IACAC,EAAA,WAEO,eAAeC,GAAY,CAChC,GAAI,CAGF,IAAMC,GAFS,QAAMH,EAAA,WAAU,wCAAwC,GAEjD,OACnB,MAAM;CAAI,EACV,KAAKI,GAAQA,EAAK,SAAS,gBAAgB,CAAC,EAE/C,GAAI,CAACD,EACH,OAGF,IAAME,EAAQF,EAAO,MAAM,OAAO,EAClC,GAAIE,EAAM,SAAW,EACnB,OAAOA,EAAM,CAAC,EAAE,MAAM,EAAG,EAAE,QAEtBC,EAAG,CACVL,EAAA,KAAK,MAAM,6BAA6BK,CAAC,EAAE,EAI/C,CArBsBC,EAAAL,EAAA,gBAAtBM,EAAA,aAAAN",
6
- "names": ["execAsync_1", "api_1", "getMachineId", "idLine", "line", "parts", "e", "__name", "exports"]
7
- }
@@ -1,2 +0,0 @@
1
- import{m as u,n as o}from"./chunk-J232VCIM.js";import{a as i,b as a,d,g as s,h as r}from"./chunk-7DYQUG5M.js";var l=d(e=>{r();Object.defineProperty(e,"__esModule",{value:!0});e.getMachineId=void 0;var h=a("fs"),f=(o(),s(u));async function g(){let n=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let c of n)try{return(await h.promises.readFile(c,{encoding:"utf8"})).trim()}catch(t){f.diag.debug(`error reading machine id: ${t}`)}}i(g,"getMachineId");e.getMachineId=g});export default l();
2
- //# sourceMappingURL=getMachineId-linux-IJ3LYIOX.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../node_modules/.pnpm/@opentelemetry+resources@2.5.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-linux.ts"],
4
- "sourcesContent": ["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { promises as fs } from 'fs';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];\n\n for (const path of paths) {\n try {\n const result = await fs.readFile(path, { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n }\n\n return undefined;\n}\n"],
5
- "mappings": "qMAeA,IAAAA,EAAA,EAAA,IAAA,EACAC,EAAA,WAEO,eAAeC,GAAY,CAChC,IAAMC,EAAQ,CAAC,kBAAmB,0BAA0B,EAE5D,QAAWC,KAAQD,EACjB,GAAI,CAEF,OADe,MAAMH,EAAA,SAAG,SAASI,EAAM,CAAE,SAAU,MAAM,CAAE,GAC7C,KAAI,QACXC,EAAG,CACVJ,EAAA,KAAK,MAAM,6BAA6BI,CAAC,EAAE,EAKjD,CAbsBC,EAAAJ,EAAA,gBAAtBK,EAAA,aAAAL",
6
- "names": ["fs_1", "api_1", "getMachineId", "paths", "path", "e", "__name", "exports"]
7
- }
@@ -1,2 +0,0 @@
1
- import{m as u,n as r}from"./chunk-J232VCIM.js";import{a as d,d as t,g as i,h as n}from"./chunk-7DYQUG5M.js";var o=t(e=>{n();Object.defineProperty(e,"__esModule",{value:!0});e.getMachineId=void 0;var a=(r(),i(u));async function c(){a.diag.debug("could not read machine-id: unsupported platform")}d(c,"getMachineId");e.getMachineId=c});export default o();
2
- //# sourceMappingURL=getMachineId-unsupported-IKXBUCYY.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../node_modules/.pnpm/@opentelemetry+resources@2.5.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-unsupported.ts"],
4
- "sourcesContent": ["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n diag.debug('could not read machine-id: unsupported platform');\n return undefined;\n}\n"],
5
- "mappings": "mMAgBA,IAAAA,EAAA,WAEO,eAAeC,GAAY,CAChCD,EAAA,KAAK,MAAM,iDAAiD,CAE9D,CAHsBE,EAAAD,EAAA,gBAAtBE,EAAA,aAAAF",
6
- "names": ["api_1", "getMachineId", "__name", "exports"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as y}from"./chunk-GJGBTM5Y.js";import{m as g,n as h}from"./chunk-J232VCIM.js";import{a as n,b as d,d as o,g as u,h as c}from"./chunk-7DYQUG5M.js";var p=o(e=>{c();Object.defineProperty(e,"__esModule",{value:!0});e.getMachineId=void 0;var s=d("process"),E=y(),_=(h(),u(g));async function l(){let a="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",t="%windir%\\System32\\REG.exe";s.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in s.env&&(t="%windir%\\sysnative\\cmd.exe /c "+t);try{let r=(await(0,E.execAsync)(`${t} ${a}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(i){_.diag.debug(`error reading machine id: ${i}`)}}n(l,"getMachineId");e.getMachineId=l});export default p();
2
- //# sourceMappingURL=getMachineId-win-6CX7VSFF.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../node_modules/.pnpm/@opentelemetry+resources@2.5.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/src/detectors/platform/node/machine-id/getMachineId-win.ts"],
4
- "sourcesContent": ["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as process from 'process';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const args =\n 'QUERY HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Cryptography /v MachineGuid';\n let command = '%windir%\\\\System32\\\\REG.exe';\n if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {\n command = '%windir%\\\\sysnative\\\\cmd.exe /c ' + command;\n }\n\n try {\n const result = await execAsync(`${command} ${args}`);\n const parts = result.stdout.split('REG_SZ');\n if (parts.length === 2) {\n return parts[1].trim();\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"],
5
- "mappings": "kPAgBA,IAAAA,EAAA,EAAA,SAAA,EACAC,EAAA,IACAC,EAAA,WAEO,eAAeC,GAAY,CAChC,IAAMC,EACJ,6EACEC,EAAU,8BACVL,EAAQ,OAAS,QAAU,2BAA4BA,EAAQ,MACjEK,EAAU,mCAAqCA,GAGjD,GAAI,CAEF,IAAMC,GADS,QAAML,EAAA,WAAU,GAAGI,CAAO,IAAID,CAAI,EAAE,GAC9B,OAAO,MAAM,QAAQ,EAC1C,GAAIE,EAAM,SAAW,EACnB,OAAOA,EAAM,CAAC,EAAE,KAAI,QAEfC,EAAG,CACVL,EAAA,KAAK,MAAM,6BAA6BK,CAAC,EAAE,EAI/C,CAnBsBC,EAAAL,EAAA,gBAAtBM,EAAA,aAAAN",
6
- "names": ["process", "execAsync_1", "api_1", "getMachineId", "args", "command", "parts", "e", "__name", "exports"]
7
- }
@@ -1,45 +0,0 @@
1
- import{b as R}from"./chunk-N5FFICAP.js";import{b as w}from"./chunk-FE5O5VX4.js";import"./chunk-3WKH3DJL.js";import"./chunk-TGCJ6TMW.js";import"./chunk-L2XBSR7G.js";import{a as N,b as A}from"./chunk-577KP32Z.js";import{a as B,b as m,d as T,e as J,f as E}from"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import{c as S,ca as b,d as l,e as h,n as O}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{b as f,f as y,ga as d,ma as g,ra as v,ta as i}from"./chunk-ALSXPCRD.js";import{a as D}from"./chunk-GFQYFEEH.js";import{a as n,f as u,h as s}from"./chunk-7DYQUG5M.js";s();var M=u(D(),1);s();var G=u(B(),1);var x={"-h":{type:Boolean},"--help":{type:Boolean},"--verbose":{type:G.default.COUNT,alias:["-v","--debug"]},"--telemetry":{type:Boolean},"--json":{type:Boolean}},P=n(()=>v`
2
- The command-line interface for Gadget.
3
-
4
- {gray Usage}
5
- ggt [COMMAND]
6
-
7
- {gray Commands}
8
- dev Start developing your application
9
- deploy Deploy your environment to production
10
- status Show your local and environment's file changes
11
- push Push your local files to your environment
12
- pull Pull your environment's files to your local computer
13
- var Manage environment variables
14
- env Manage environments
15
- add Add models, fields, actions, routes and environments to your app
16
- open Open a Gadget location in your browser
17
- list List your available applications
18
- login Log in to your account
19
- logout Log out of your account
20
- logs Stream your environment's logs
21
- debugger Connect to the debugger for your environment
22
- whoami Print the currently logged in account
23
- configure Configure default execution options
24
- agent-plugin Install Gadget agent plugins (AGENTS.md + skills)
25
- version Print this version of ggt
26
-
27
- {gray Flags}
28
- -h, --help Print how to use a command
29
- -v, --verbose Print more verbose output
30
- --telemetry Enable telemetry
31
-
32
- {gray Agent plugins}
33
- Install AGENTS.md and Gadget agent skills for your coding agent:
34
- {cyanBright ggt agent-plugin install}
35
-
36
- Run "ggt [COMMAND] -h" for more information about a specific command.
37
- `,"usage"),C=n(async(r,o)=>{let t=r.child({name:"root"});if(o["--json"]&&(process.env.GGT_LOG_FORMAT="json"),o["--verbose"]&&(process.env.GGT_LOG_LEVEL=d(o["--verbose"]).toString()),await R(t)){let{warnIfUpdateAvailable:p}=await import("./update-X7YS3MNH.js");await p(t)}let e=o._.shift();if(y(e)&&(i(P(t)),process.exit(0)),e={envs:"env",problem:"problems",log:"logs"}[e]??e,!J(e)){let[p]=O(e,T);i`
38
- Unknown command {yellow ${e}}
39
-
40
- Did you mean {blueBright ${p}}?
41
-
42
- Run {gray ggt --help} for usage
43
- `,process.exit(1)}let a=await E(e);S({command:e}),(o["-h"]??o["--help"])&&((!a.parseOptions?.permissive||o._.length===0)&&(i(a.usage(t)),process.exit(0)),o._.push("-h"));try{await a.run(t.child({name:e}),m(a.args??{},{...a.parseOptions,argv:o._}))}catch(p){await l(t,p)}},"run");s();var j=n(function(){return String(this)},"bigintToJSON"),L=n(function(){return Object.fromEntries(this)},"mapToJSON"),U=n(function(){return Array.from(this)},"setToJSON"),I=n(()=>{Object.prototype.hasOwnProperty.call(BigInt,"toJSON")||(BigInt.prototype.toJSON=j),Object.prototype.hasOwnProperty.call(Map,"toJSON")||(Map.prototype.toJSON=L),Object.prototype.hasOwnProperty.call(Set,"toJSON")||(Set.prototype.toJSON=U)},"installJsonExtensions");var co=n(async(r=b.init({name:"ggt"}))=>{if(process.env.GADGET_EDITOR_TERMINAL_SESSION_ID)return i("Running ggt in the Gadget editor's terminal is not supported."),process.exit(1);try{let o=m(x,{argv:process.argv.slice(2),permissive:!0}),t=await w(r,!0);o["--telemetry"]??=t.telemetry,o["--json"]??=t.json,I(),await h(r,o),V(r),await C(r,o)}catch(o){await l(r,o)}},"ggt"),V=n(r=>{let o=!1;for(let t of["SIGINT","SIGTERM"])process.on(t,async()=>{if(o)return;o=!0,r.log.trace("received signal",{signal:t}),setTimeout(()=>{process.once(t,()=>{i(" Exiting immediately"),process.exit(1)})},(0,M.default)("100ms")).unref(),g.writeStdout(`
44
- `),N(),g.persistFooter();let e=A({successSymbol:"\u{1F44B}",content:`Stopping ${f.gray("Press Ctrl+C again to force")}`});try{r.abort(),await r.done,e.succeed("Goodbye!")}catch(c){e.fail(),await l(r,c)}})},"installSignalHandler");export{co as ggt};
45
- //# sourceMappingURL=ggt-KUAF6WUA.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/ggt.ts", "../src/commands/root.ts", "../src/services/util/json.ts"],
4
- "sourcesContent": ["import chalk from \"chalk\";\nimport ms from \"ms\";\n\nimport * as root from \"./commands/root.js\";\nimport { parseArgs } from \"./services/command/arg.js\";\nimport { Context } from \"./services/command/context.js\";\nimport { loadDefaultsConfig } from \"./services/config/defaults.js\";\nimport { output } from \"./services/output/output.js\";\nimport { println } from \"./services/output/print.js\";\nimport { installErrorHandlers, reportErrorAndExit } from \"./services/output/report.js\";\nimport { clearAllSpinners, spin } from \"./services/output/spinner.js\";\nimport { installJsonExtensions } from \"./services/util/json.js\";\n\nexport const ggt = async (ctx = Context.init({ name: \"ggt\" })): Promise<void> => {\n if (process.env[\"GADGET_EDITOR_TERMINAL_SESSION_ID\"]) {\n println(\"Running ggt in the Gadget editor's terminal is not supported.\");\n return process.exit(1);\n }\n\n try {\n const rootArgs = parseArgs(root.args, { argv: process.argv.slice(2), permissive: true });\n\n const configData = await loadDefaultsConfig(ctx, true);\n /* If the related arg is specified by the user, then ignore whatever the default is. */\n rootArgs[\"--telemetry\"] ??= configData.telemetry;\n rootArgs[\"--json\"] ??= configData.json;\n\n installJsonExtensions();\n await installErrorHandlers(ctx, rootArgs);\n installSignalHandler(ctx);\n\n await root.run(ctx, rootArgs);\n } catch (error) {\n await reportErrorAndExit(ctx, error);\n }\n};\n\nconst installSignalHandler = (ctx: Context): void => {\n let stopping = false;\n\n for (const signal of [\"SIGINT\", \"SIGTERM\"] as const) {\n // oxlint-disable-next-line no-misused-promises\n process.on(signal, async () => {\n if (stopping) {\n return;\n }\n\n stopping = true;\n ctx.log.trace(\"received signal\", { signal });\n\n setTimeout(() => {\n // when ggt is run with npx, and the user presses ctrl+c, ggt\n // receives SIGINT twice in quick succession. in order to\n // prevent the second SIGINT from triggering the force exit\n // listener, we wait a bit in this setTimeout before adding it\n process.once(signal, () => {\n println(\" Exiting immediately\");\n process.exit(1);\n });\n }, ms(\"100ms\")).unref();\n\n // ctrl+c was pressed, so we need to clear the line\n output.writeStdout(\"\\n\");\n\n // if there was any sticky text, it needs to be persisted now\n clearAllSpinners();\n output.persistFooter();\n\n const spinner = spin({\n successSymbol: \"\uD83D\uDC4B\",\n content: `Stopping ${chalk.gray(\"Press Ctrl+C again to force\")}`,\n });\n\n try {\n ctx.abort();\n await ctx.done;\n spinner.succeed(\"Goodbye!\");\n } catch (error) {\n spinner.fail();\n await reportErrorAndExit(ctx, error);\n }\n });\n }\n};\n", "import arg from \"arg\";\n\nimport { parseArgs, type ArgsDefinition, type ArgsDefinitionResult } from \"../services/command/arg.js\";\nimport { Commands, importCommand, isCommand, type Run, type Usage } from \"../services/command/command.js\";\nimport { verbosityToLevel } from \"../services/output/log/level.js\";\nimport { println } from \"../services/output/print.js\";\nimport { reportErrorAndExit } from \"../services/output/report.js\";\nimport { setSentryTags } from \"../services/output/sentry.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { shouldCheckForUpdate } from \"../services/output/update.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNil } from \"../services/util/is.js\";\n\nexport type RootArgs = typeof args;\nexport type RootArgsResult = ArgsDefinitionResult<RootArgs>;\n\nexport const args = {\n \"-h\": { type: Boolean },\n \"--help\": { type: Boolean },\n \"--verbose\": { type: arg.COUNT, alias: [\"-v\", \"--debug\"] },\n \"--telemetry\": { type: Boolean },\n \"--json\": { type: Boolean },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = () => {\n return sprint`\n The command-line interface for Gadget.\n\n {gray Usage}\n ggt [COMMAND]\n\n {gray Commands}\n dev Start developing your application\n deploy Deploy your environment to production\n status Show your local and environment's file changes\n push Push your local files to your environment\n pull Pull your environment's files to your local computer\n var Manage environment variables\n env Manage environments\n add Add models, fields, actions, routes and environments to your app\n open Open a Gadget location in your browser\n list List your available applications\n login Log in to your account\n logout Log out of your account\n logs Stream your environment's logs\n debugger Connect to the debugger for your environment\n whoami Print the currently logged in account\n configure Configure default execution options\n agent-plugin Install Gadget agent plugins (AGENTS.md + skills)\n version Print this version of ggt\n\n {gray Flags}\n -h, --help Print how to use a command\n -v, --verbose Print more verbose output\n --telemetry Enable telemetry\n\n {gray Agent plugins}\n Install AGENTS.md and Gadget agent skills for your coding agent:\n {cyanBright ggt agent-plugin install}\n\n Run \"ggt [COMMAND] -h\" for more information about a specific command.\n `;\n};\n\nexport const run: Run<RootArgs> = async (parent, args): Promise<void> => {\n const ctx = parent.child({ name: \"root\" });\n\n if (args[\"--json\"]) {\n process.env[\"GGT_LOG_FORMAT\"] = \"json\";\n }\n\n if (args[\"--verbose\"]) {\n process.env[\"GGT_LOG_LEVEL\"] = verbosityToLevel(args[\"--verbose\"]).toString();\n }\n\n if (await shouldCheckForUpdate(ctx)) {\n const { warnIfUpdateAvailable } = await import(\"../services/output/update.js\");\n await warnIfUpdateAvailable(ctx);\n }\n\n let commandName = args._.shift();\n if (isNil(commandName)) {\n println(usage(ctx));\n process.exit(0);\n }\n\n // resolve command aliases\n const commandAliases: Record<string, string> = { envs: \"env\", problem: \"problems\", log: \"logs\" };\n commandName = commandAliases[commandName] ?? commandName;\n\n if (!isCommand(commandName)) {\n const [closest] = sortBySimilar(commandName, Commands);\n println`\n Unknown command {yellow ${commandName}}\n\n Did you mean {blueBright ${closest}}?\n\n Run {gray ggt --help} for usage\n `;\n process.exit(1);\n }\n\n const command = await importCommand(commandName);\n setSentryTags({ command: commandName });\n\n if (args[\"-h\"] ?? args[\"--help\"]) {\n if (!command.parseOptions?.permissive || args._.length === 0) {\n println(command.usage(ctx));\n process.exit(0);\n }\n // pass -h through to the command's run function for subcommand-level help\n args._.push(\"-h\");\n }\n\n try {\n await command.run(ctx.child({ name: commandName }), parseArgs(command.args ?? {}, { ...command.parseOptions, argv: args._ }));\n } catch (error) {\n await reportErrorAndExit(ctx, error);\n }\n};\n", "// oxlint-disable consistent-type-definitions\ndeclare global {\n interface BigInt {\n toJSON?(): string;\n }\n interface Map<K, V> {\n toJSON?(): Record<string, V>;\n }\n interface Set<T> {\n toJSON?(): T[];\n }\n}\n\nconst bigintToJSON = function (this: bigint): string {\n return String(this);\n};\n\nconst mapToJSON = function <K, V>(this: Map<K, V>): Record<string, V> {\n // oxlint-disable-next-line no-unsafe-return\n return Object.fromEntries(this);\n};\n\nconst setToJSON = function <T>(this: Set<T>): T[] {\n return Array.from(this);\n};\n\nexport const installJsonExtensions = (): void => {\n if (!Object.prototype.hasOwnProperty.call(BigInt, \"toJSON\")) {\n BigInt.prototype.toJSON = bigintToJSON;\n }\n\n if (!Object.prototype.hasOwnProperty.call(Map, \"toJSON\")) {\n Map.prototype.toJSON = mapToJSON;\n }\n\n if (!Object.prototype.hasOwnProperty.call(Set, \"toJSON\")) {\n Set.prototype.toJSON = setToJSON;\n }\n};\n\nexport const uninstallJsonExtensions = (): void => {\n if (BigInt.prototype.toJSON === bigintToJSON) {\n delete BigInt.prototype.toJSON;\n }\n\n if (Map.prototype.toJSON === mapToJSON) {\n delete Map.prototype.toJSON;\n }\n\n if (Set.prototype.toJSON === setToJSON) {\n delete Set.prototype.toJSON;\n }\n};\n"],
5
- "mappings": "ynBAAAA,IACA,IAAAC,EAAe,SCDfC,IAAA,IAAAC,EAAgB,SAgBT,IAAMC,EAAO,CAClB,KAAM,CAAE,KAAM,OAAQ,EACtB,SAAU,CAAE,KAAM,OAAQ,EAC1B,YAAa,CAAE,KAAM,EAAAC,QAAI,MAAO,MAAO,CAAC,KAAM,SAAS,CAAE,EACzD,cAAe,CAAE,KAAM,OAAQ,EAC/B,SAAU,CAAE,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xCO,EAAqBV,CAAG,EAExB,MAAWW,EAAIX,EAAKG,CAAQ,CAC9B,OAASS,EAAO,CACd,MAAMC,EAAmBb,EAAKY,CAAK,CACrC,CACF,EAtBmB,OAwBbF,EAAuBX,EAACC,GAAuB,CACnD,IAAIc,EAAW,GAEf,QAAWC,IAAU,CAAC,SAAU,SAAS,EAEvC,QAAQ,GAAGA,EAAQ,SAAY,CAC7B,GAAID,EACF,OAGFA,EAAW,GACXd,EAAI,IAAI,MAAM,kBAAmB,CAAE,OAAAe,CAAO,CAAC,EAE3C,WAAW,IAAM,CAKf,QAAQ,KAAKA,EAAQ,IAAM,CACzBb,EAAQ,sBAAsB,EAC9B,QAAQ,KAAK,CAAC,CAChB,CAAC,CACH,KAAG,EAAAc,SAAG,OAAO,CAAC,EAAE,MAAM,EAGtBC,EAAO,YAAY;AAAA,CAAI,EAGvBC,EAAiB,EACjBD,EAAO,cAAc,EAErB,IAAME,EAAUC,EAAK,CACnB,cAAe,YACf,QAAS,YAAYC,EAAM,KAAK,6BAA6B,CAAC,EAChE,CAAC,EAED,GAAI,CACFrB,EAAI,MAAM,EACV,MAAMA,EAAI,KACVmB,EAAQ,QAAQ,UAAU,CAC5B,OAASP,EAAO,CACdO,EAAQ,KAAK,EACb,MAAMN,EAAmBb,EAAKY,CAAK,CACrC,CACF,CAAC,CAEL,EA9C6B",
6
- "names": ["init_cjs", "import_ms", "init_cjs", "import_arg", "args", "arg", "usage", "__name", "sprint", "run", "parent", "ctx", "verbosityToLevel", "shouldCheckForUpdate", "warnIfUpdateAvailable", "commandName", "isNil", "println", "isCommand", "closest", "sortBySimilar", "Commands", "command", "importCommand", "setSentryTags", "parseArgs", "error", "reportErrorAndExit", "init_cjs", "bigintToJSON", "__name", "mapToJSON", "setToJSON", "installJsonExtensions", "ggt", "__name", "ctx", "Context", "println", "rootArgs", "parseArgs", "args", "configData", "loadDefaultsConfig", "installJsonExtensions", "installErrorHandlers", "installSignalHandler", "run", "error", "reportErrorAndExit", "stopping", "signal", "ms", "output", "clearAllSpinners", "spinner", "spin", "source_default"]
7
- }
@@ -1,11 +0,0 @@
1
- import{b as g}from"./chunk-WZ2PO6H2.js";import{T as u,W as c,X as f}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{ma as m,ra as i,sa as l,ta as o}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a,h as p}from"./chunk-7DYQUG5M.js";p();var U=a(()=>i`
2
- List the apps available to the currently logged-in user.
3
-
4
- {bold Usage}
5
- ggt list
6
- `,"usage"),j=a(async s=>{await u(s,"list");let e=await c(s);if(e.length===0){o`
7
- It doesn't look like you have any applications.
8
-
9
- Visit https://gadget.new to create one!
10
- `;return}if(m.isInteractive)for(let[r,t]of f(e))o(i`{grey ${r}}`),g({json:t,headers:["Name","Domain"],rows:t.map(n=>[n.slug,n.primaryDomain])}),o("");else{let r="";for(let t of e)r+=l`${t.slug}\t${t.primaryDomain}`;o({json:e,content:r})}},"run");export{j as run,U as usage};
11
- //# sourceMappingURL=list-IANT7SNF.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/list.ts"],
4
- "sourcesContent": ["import { getApplications, groupByTeam } from \"../services/app/app.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { output } from \"../services/output/output.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint, sprintln } from \"../services/output/sprint.js\";\nimport { printTable } from \"../services/output/table.js\";\nimport { getUserOrLogin } from \"../services/user/user.js\";\n\nexport const usage: Usage = () => sprint`\n List the apps available to the currently logged-in user.\n\n {bold Usage}\n ggt list\n`;\n\nexport const run: Run = async (ctx) => {\n await getUserOrLogin(ctx, \"list\");\n\n const availableApps = await getApplications(ctx);\n if (availableApps.length === 0) {\n println`\n It doesn't look like you have any applications.\n\n Visit https://gadget.new to create one!\n `;\n return;\n }\n\n if (output.isInteractive) {\n for (const [teamName, apps] of groupByTeam(availableApps)) {\n println(sprint`{grey ${teamName}}`);\n printTable({\n json: apps,\n headers: [\"Name\", \"Domain\"],\n rows: apps.map((app) => [app.slug, app.primaryDomain]),\n });\n println(\"\");\n }\n } else {\n let simpleOutput = \"\";\n for (const app of availableApps) {\n simpleOutput += sprintln`${app.slug}\\t${app.primaryDomain}`;\n }\n\n println({ json: availableApps, content: simpleOutput });\n }\n};\n"],
5
- "mappings": "yTAAAA,IAQO,IAAMC,EAAeC,EAAA,IAAMC;AAAA;AAAA;AAAA;AAAA;AAAA,EAAN,SAOfC,EAAWF,EAAA,MAAOG,GAAQ,CACrC,MAAMC,EAAeD,EAAK,MAAM,EAEhC,IAAME,EAAgB,MAAMC,EAAgBH,CAAG,EAC/C,GAAIE,EAAc,SAAW,EAAG,CAC9BE;AAAA;AAAA;AAAA;AAAA,MAKA,MACF,CAEA,GAAIC,EAAO,cACT,OAAW,CAACC,EAAUC,CAAI,IAAKC,EAAYN,CAAa,EACtDE,EAAQN,UAAeQ,CAAQ,GAAG,EAClCG,EAAW,CACT,KAAMF,EACN,QAAS,CAAC,OAAQ,QAAQ,EAC1B,KAAMA,EAAK,IAAKG,GAAQ,CAACA,EAAI,KAAMA,EAAI,aAAa,CAAC,CACvD,CAAC,EACDN,EAAQ,EAAE,MAEP,CACL,IAAIO,EAAe,GACnB,QAAWD,KAAOR,EAChBS,GAAgBC,IAAWF,EAAI,IAAI,KAAKA,EAAI,aAAa,GAG3DN,EAAQ,CAAE,KAAMF,EAAe,QAASS,CAAa,CAAC,CACxD,CACF,EA/BwB",
6
- "names": ["init_cjs", "usage", "__name", "sprint", "run", "ctx", "getUserOrLogin", "availableApps", "getApplications", "println", "output", "teamName", "apps", "groupByTeam", "printTable", "app", "simpleOutput", "sprintln"]
7
- }
@@ -1,2 +0,0 @@
1
- import{O as a,P as b,Q as c}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import"./chunk-7DYQUG5M.js";export{c as login,b as run,a as usage};
2
- //# sourceMappingURL=login-TYRZLN5S.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- import{a as s,b as i}from"./chunk-GZTHIOXS.js";import"./chunk-X4XSYLCE.js";import{ra as r,ta as e}from"./chunk-ALSXPCRD.js";import{a as o,h as t}from"./chunk-7DYQUG5M.js";t();var p=o(()=>r`
2
- Log out of your account.
3
-
4
- {bold Usage}
5
- ggt logout
6
- `,"usage"),d=o(n=>{s(n)?(i(n,void 0),e("Goodbye")):e("You are not logged in")},"run");export{d as run,p as usage};
7
- //# sourceMappingURL=logout-P75XYYZ6.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/logout.ts"],
4
- "sourcesContent": ["import type { Run, Usage } from \"../services/command/command.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { readSession, writeSession } from \"../services/user/session.js\";\n\nexport const usage: Usage = () => sprint`\n Log out of your account.\n\n {bold Usage}\n ggt logout\n`;\n\nexport const run: Run = (ctx) => {\n const token = readSession(ctx);\n if (token) {\n writeSession(ctx, undefined);\n println(\"Goodbye\");\n } else {\n println(\"You are not logged in\");\n }\n};\n"],
5
- "mappings": "2KAAAA,IAKO,IAAMC,EAAeC,EAAA,IAAMC;AAAA;AAAA;AAAA;AAAA;AAAA,EAAN,SAOfC,EAAWF,EAACG,GAAQ,CACjBC,EAAYD,CAAG,GAE3BE,EAAaF,EAAK,MAAS,EAC3BG,EAAQ,SAAS,GAEjBA,EAAQ,uBAAuB,CAEnC,EARwB",
6
- "names": ["init_cjs", "usage", "__name", "sprint", "run", "ctx", "readSession", "writeSession", "println"]
7
- }
@@ -1,28 +0,0 @@
1
- import{a as m}from"./chunk-ETKWDO4V.js";import{p as a,q as p,u as l}from"./chunk-ULJYEUQG.js";import{c as i}from"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import{$ as g}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{ra as n}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a as t,h as s}from"./chunk-7DYQUG5M.js";s();var b={...a,...g},D=t(o=>n`
2
- Streams the logs for an application to.
3
-
4
- {gray Usage}
5
- ggt logs [options]
6
-
7
- {gray Options}
8
- -ll, --log-level <level> Sets the log level for incoming application logs (default: info)
9
- --my-logs Only outputs user sourced logs and exclude logs from the Gadget framework
10
- --json Output logs in JSON format
11
- -a, --app <app_name> Selects the app to pull your environment changes from. Defaults to the app synced to the current directory, if there is one.
12
- -e, --env, --from <env_name> Selects the environment to pull changes from. Defaults to the environment synced to the current directory, if there is one.
13
-
14
- {gray Examples}
15
- Stream all user logs from your development environment
16
- {cyanBright $ ggt logs --env development --my-logs}
17
-
18
- Stream all logs from your production environment in JSON format
19
- {cyanBright $ ggt logs --env production --json}
20
- `,"usage"),w=t(async(o,e)=>{if(e._.length>0)throw new i(n`
21
- "ggt logs" does not take any positional arguments.
22
-
23
- If you are trying to print logs for an app in specific directory,
24
- you must "cd" to that directory and then run "ggt logs".
25
-
26
- Run "ggt logs -h" for more information.
27
- `);let c=await l(process.cwd()),u=await p.load(o,{command:"pull",args:e,directory:c}),f=m(u.edit,e,{onError:t(r=>{o.abort(r)},"onError")});o.onAbort(r=>{o.log.info("stopping",{reason:r}),f.unsubscribe()})},"run");export{b as args,w as run,D as usage};
28
- //# sourceMappingURL=logs-SBMD6JSR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/logs.ts"],
4
- "sourcesContent": ["import { AppIdentity, AppIdentityArgs } from \"../services/command/app-identity.js\";\nimport { ArgError, type ArgsDefinition, type ArgsDefinitionResult } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { subscribeToEnvironmentLogs } from \"../services/logs/subscribeToEnvironmentLogs.js\";\nimport { LoggingArgs } from \"../services/output/log/structured.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type LogsArgs = typeof args;\nexport type LogsArgsResult = ArgsDefinitionResult<LogsArgs>;\n\nexport const args = {\n ...AppIdentityArgs,\n ...LoggingArgs,\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n Streams the logs for an application to.\n\n {gray Usage}\n ggt logs [options]\n\n {gray Options}\n -ll, --log-level <level> Sets the log level for incoming application logs (default: info)\n --my-logs Only outputs user sourced logs and exclude logs from the Gadget framework\n --json Output logs in JSON format\n -a, --app <app_name> Selects the app to pull your environment changes from. Defaults to the app synced to the current directory, if there is one.\n -e, --env, --from <env_name> Selects the environment to pull changes from. Defaults to the environment synced to the current directory, if there is one.\n\n {gray Examples}\n Stream all user logs from your development environment\n {cyanBright $ ggt logs --env development --my-logs}\n\n Stream all logs from your production environment in JSON format\n {cyanBright $ ggt logs --env production --json}\n `;\n};\n\nexport const run: Run<LogsArgs> = async (ctx, args) => {\n if (args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt logs\" does not take any positional arguments.\n\n If you are trying to print logs for an app in specific directory,\n you must \"cd\" to that directory and then run \"ggt logs\".\n\n Run \"ggt logs -h\" for more information.\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"pull\", args, directory });\n\n const logsSubscription = subscribeToEnvironmentLogs(appIdentity.edit, args, {\n onError: (error) => {\n ctx.abort(error);\n },\n });\n\n ctx.onAbort((reason) => {\n ctx.log.info(\"stopping\", { reason });\n logsSubscription.unsubscribe();\n });\n};\n"],
5
- "mappings": "8aAAAA,IAWO,IAAMC,EAAO,CAClB,GAAGC,EACH,GAAGC,CACL,EAEaC,EAAeC,EAACC,GACpBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADmB,SAuBfC,EAAqBH,EAAA,MAAOI,EAAKR,IAAS,CACrD,GAAIA,EAAK,EAAE,OAAS,EAClB,MAAM,IAAIS,EAASH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAOlB,EAGH,IAAMI,EAAY,MAAMC,EAAsB,QAAQ,IAAI,CAAC,EACrDC,EAAc,MAAMC,EAAY,KAAKL,EAAK,CAAE,QAAS,OAAQ,KAAAR,EAAM,UAAAU,CAAU,CAAC,EAE9EI,EAAmBC,EAA2BH,EAAY,KAAMZ,EAAM,CAC1E,QAASI,EAACY,GAAU,CAClBR,EAAI,MAAMQ,CAAK,CACjB,EAFS,UAGX,CAAC,EAEDR,EAAI,QAASS,GAAW,CACtBT,EAAI,IAAI,KAAK,WAAY,CAAE,OAAAS,CAAO,CAAC,EACnCH,EAAiB,YAAY,CAC/B,CAAC,CACH,EAzBkC",
6
- "names": ["init_cjs", "args", "AppIdentityArgs", "LoggingArgs", "usage", "__name", "_ctx", "sprint", "run", "ctx", "ArgError", "directory", "loadSyncJsonDirectory", "appIdentity", "AppIdentity", "logsSubscription", "subscribeToEnvironmentLogs", "error", "reason"]
7
- }
@@ -1,74 +0,0 @@
1
- import{p as v,q as u,u as $}from"./chunk-ULJYEUQG.js";import{c as p}from"./chunk-2HJS3KFB.js";import{a as w}from"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import{N as r,Y as f,n as g}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{q as y,ra as a,ta as s}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a as d,h}from"./chunk-7DYQUG5M.js";h();var U={...v,"--show-all":{type:Boolean}},N=d(m=>a`
2
- This command opens a specific Gadget page in your browser, allowing you to directly access
3
- various parts of your application's interface such as logs, permissions, data views, or
4
- schemas.
5
-
6
- {gray Usage}
7
- ggt open [LOCATION] [model_name] [--show-all] [options]
8
-
9
- LOCATION: specifies the part of Gadget to open, by default it'll open the apps home page:
10
-
11
- + logs Opens logs
12
- + permissions Opens permissions
13
- + data Opens data editor for a specific model
14
- + schema Opens schema editor for a specific model
15
-
16
- {gray Options}
17
- -a, --app <app_name> Selects the application to open in your browser. Defaults to the app synced to the current directory, if there is one.
18
- -e, --env <env_name> Selects the environment to open in your browser. Defaults to the environment synced to the current directory, if there is one.
19
- --show-all Shows all schema, or data options by listing your available models
20
-
21
- {gray Examples}
22
- Opens editor home
23
- {cyanBright $ ggt open}
24
-
25
- Opens logs
26
- {cyanBright $ ggt open logs}
27
-
28
- Opens permissions
29
- {cyanBright $ ggt open permissions}
30
-
31
- Opens data editor for the 'post' model
32
- {cyanBright $ ggt open data post}
33
-
34
- Opens schema for 'post' model
35
- {cyanBright $ ggt open schema post}
36
-
37
- Shows all models available in the data editor
38
- {cyanBright $ ggt open data -show-all}
39
-
40
- Shows all models available in the schema viewer
41
- {cyanBright $ ggt open schema --show-all}
42
-
43
- Opens data editor for 'post' model of app 'myBlog' in the 'staging' environment
44
- {cyanBright $ ggt open data post --app myBlog --env staging}
45
- `,"usage"),T=d(async(m,i)=>{let B=await $(process.cwd()),e=await u.load(m,{command:"open",args:i,directory:B}),t=i._[0];if(!t){await r(`https://${e.environment.application.primaryDomain}/edit/${e.environment.name}`),s`
46
- Opened editor for environment {cyanBright ${e.environment.name}}.
47
- `;return}if(!O.includes(t)){let[o]=g(t,O);throw new p(a`
48
- Unknown location {yellow ${t}}
49
-
50
- Did you mean {blueBright ${o}}?
51
-
52
- Run "ggt open --help" for usage
53
- `)}switch(t){case"logs":{await r(`https://${e.environment.application.primaryDomain}/edit/${e.environment.name}/logs`),s`
54
- Opened log viewer for environment {cyanBright ${e.environment.name}}.
55
- `;break}case"permissions":{await r(`https://${e.environment.application.primaryDomain}/edit/${e.environment.name}/settings/permissions`),s`
56
- Opened permissions settings for environment {cyanBright ${e.environment.name}}.
57
- `;break}case"data":case"schema":{let o=i._[0],l=(await f(m,e.environment)).map(c=>c.apiIdentifier),n=i._[1];if(!n)if(i["--show-all"])n=await w({choices:l,content:"Which model do you wish to open?"});else throw new p(a`
58
- "ggt open ${o}" requires a model to be specified.
59
-
60
- Run with "--show-all" to choose from available models.
61
-
62
- ggt open ${o} --show-all
63
- `);if(!l.includes(n)){let[c]=g(n,l);throw new p(a`
64
- Unknown model {yellow ${n}}
65
-
66
- Did you mean {blueBright ${c}}?
67
-
68
- Run with "--show-all" to choose from available models.
69
-
70
- ggt open ${o} --show-all
71
- `)}await r(`https://${e.environment.application.primaryDomain}/edit/${e.environment.name}/model/${n}/${o}`),s`
72
- Opened ${o} viewer for environment {cyanBright ${e.environment.name}} for model {cyanBright ${n}}.
73
- `;break}default:y(t)}},"run"),O=["logs","permissions","data","schema"];export{U as args,T as run,N as usage};
74
- //# sourceMappingURL=open-JPAMII4K.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/open.ts"],
4
- "sourcesContent": ["import open from \"open\";\n\nimport { getModels } from \"../services/app/app.js\";\nimport { AppIdentity, AppIdentityArgs } from \"../services/command/app-identity.js\";\nimport { ArgError } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { select } from \"../services/output/select.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNever } from \"../services/util/is.js\";\n\nexport type OpenArgs = typeof args;\n\nexport const args = {\n ...AppIdentityArgs,\n \"--show-all\": { type: Boolean },\n};\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n This command opens a specific Gadget page in your browser, allowing you to directly access\n various parts of your application's interface such as logs, permissions, data views, or\n schemas.\n\n {gray Usage}\n ggt open [LOCATION] [model_name] [--show-all] [options]\n\n LOCATION: specifies the part of Gadget to open, by default it'll open the apps home page:\n\n + logs Opens logs\n + permissions Opens permissions\n + data Opens data editor for a specific model\n + schema Opens schema editor for a specific model\n\n {gray Options}\n -a, --app <app_name> Selects the application to open in your browser. Defaults to the app synced to the current directory, if there is one.\n -e, --env <env_name> Selects the environment to open in your browser. Defaults to the environment synced to the current directory, if there is one.\n --show-all Shows all schema, or data options by listing your available models\n\n {gray Examples}\n Opens editor home\n {cyanBright $ ggt open}\n\n Opens logs\n {cyanBright $ ggt open logs}\n\n Opens permissions\n {cyanBright $ ggt open permissions}\n\n Opens data editor for the 'post' model\n {cyanBright $ ggt open data post}\n\n Opens schema for 'post' model\n {cyanBright $ ggt open schema post}\n\n Shows all models available in the data editor\n {cyanBright $ ggt open data -show-all}\n\n Shows all models available in the schema viewer\n {cyanBright $ ggt open schema --show-all}\n\n Opens data editor for 'post' model of app 'myBlog' in the 'staging' environment\n {cyanBright $ ggt open data post --app myBlog --env staging}\n `;\n};\n\nexport const run: Run<OpenArgs> = async (ctx, args) => {\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"open\", args, directory });\n\n const location = args._[0] as Location | undefined;\n if (!location) {\n await open(`https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}`);\n println`\n Opened editor for environment {cyanBright ${appIdentity.environment.name}}.\n `;\n return;\n }\n\n if (!Locations.includes(location)) {\n const [closest] = sortBySimilar(location, Locations);\n throw new ArgError(sprint`\n Unknown location {yellow ${location}}\n\n Did you mean {blueBright ${closest}}?\n\n Run \"ggt open --help\" for usage\n `);\n }\n\n switch (location) {\n case \"logs\": {\n await open(`https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/logs`);\n println`\n Opened log viewer for environment {cyanBright ${appIdentity.environment.name}}.\n `;\n break;\n }\n case \"permissions\": {\n await open(`https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/settings/permissions`);\n println`\n Opened permissions settings for environment {cyanBright ${appIdentity.environment.name}}.\n `;\n break;\n }\n case \"data\":\n case \"schema\": {\n const view = args._[0];\n const remoteModelApiIdentifiers = (await getModels(ctx, appIdentity.environment)).map((e) => e.apiIdentifier);\n\n let modelApiIdentifier = args._[1];\n if (!modelApiIdentifier) {\n if (args[\"--show-all\"]) {\n modelApiIdentifier = await select({ choices: remoteModelApiIdentifiers, content: \"Which model do you wish to open?\" });\n } else {\n throw new ArgError(sprint`\n \"ggt open ${view}\" requires a model to be specified.\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${view} --show-all\n `);\n }\n }\n\n if (!remoteModelApiIdentifiers.includes(modelApiIdentifier)) {\n const [closest] = sortBySimilar(modelApiIdentifier, remoteModelApiIdentifiers);\n throw new ArgError(sprint`\n Unknown model {yellow ${modelApiIdentifier}}\n\n Did you mean {blueBright ${closest}}?\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${view} --show-all\n `);\n }\n\n await open(\n `https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/model/${modelApiIdentifier}/${view}`,\n );\n println`\n Opened ${view} viewer for environment {cyanBright ${appIdentity.environment.name}} for model {cyanBright ${modelApiIdentifier}}.\n `;\n break;\n }\n default:\n isNever(location);\n }\n};\n\nconst Locations = [\"logs\", \"permissions\", \"data\", \"schema\"] as const;\n\ntype Location = (typeof Locations)[number];\n"],
5
- "mappings": "0aAAAA,IAeO,IAAMC,EAAO,CAClB,GAAGC,EACH,aAAc,CAAE,KAAM,OAAQ,CAChC,EAEaC,EAAeC,EAACC,GACpBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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B,EAAK,EAAE,CAAC,EACjC,GAAI,CAACuB,EACH,GAAIvB,EAAK,YAAY,EACnBuB,EAAqB,MAAMC,EAAO,CAAE,QAASJ,EAA2B,QAAS,kCAAmC,CAAC,MAErH,OAAM,IAAIF,EAASb;AAAA,wBACLc,CAAI;AAAA;AAAA;AAAA;AAAA,yBAIHA,CAAI;AAAA,WAClB,EAIL,GAAI,CAACC,EAA0B,SAASG,CAAkB,EAAG,CAC3D,GAAM,CAACP,CAAO,EAAIC,EAAcM,EAAoBH,CAAyB,EAC7E,MAAM,IAAIF,EAASb;AAAA,kCACOkB,CAAkB;AAAA;AAAA,qCAEfP,CAAO;AAAA;AAAA;AAAA;AAAA,uBAIrBG,CAAI;AAAA,SAClB,CACH,CAEA,MAAMN,EACJ,WAAWH,EAAY,YAAY,YAAY,aAAa,SAASA,EAAY,YAAY,IAAI,UAAUa,CAAkB,IAAIJ,CAAI,EACvI,EACAL;AAAA,iBACWK,CAAI,uCAAuCT,EAAY,YAAY,IAAI,2BAA2Ba,CAAkB;AAAA,QAE/H,KACF,CACA,QACEE,EAAQb,CAAQ,CACpB,CACF,EAnFkC,OAqF5BG,EAAY,CAAC,OAAQ,cAAe,OAAQ,QAAQ",
6
- "names": ["init_cjs", "args", "AppIdentityArgs", "usage", "__name", "_ctx", "sprint", "run", "ctx", "directory", "loadSyncJsonDirectory", "appIdentity", "AppIdentity", "location", "open_default", "println", "Locations", "closest", "sortBySimilar", "ArgError", "view", "remoteModelApiIdentifiers", "getModels", "e", "modelApiIdentifier", "select", "isNever"]
7
- }
@@ -1,14 +0,0 @@
1
- import{c as a,d as l,p as g,q as u,u as y}from"./chunk-ULJYEUQG.js";import{c as p}from"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import{D as m}from"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{ra as o,ta as e}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a as r,h as i}from"./chunk-7DYQUG5M.js";i();var R=g,S=r(()=>o`
2
- Shows any problems (errors, warnings) found in your Gadget application.
3
-
4
- {gray Usage}
5
- ggt problems
6
- `,"usage"),U=r(async(c,t)=>{if(t._.length>0)throw new p(o`
7
- "ggt problems" does not take any positional arguments.
8
-
9
- If you are trying to see the problems of a specific directory,
10
- you must "cd" to that directory and then run "ggt problems".
11
-
12
- Run "ggt problems -h" for more information.
13
- `);let d=await y(process.cwd()),s=await u.load(c,{command:"problems",args:t,directory:d}),{publishIssues:n}=await s.edit.query({query:m});n.length===0?e({ensureEmptyLineAbove:!0,content:o`{green No problems found.}`}):(e({ensureEmptyLineAbove:!0,content:o`{bold.yellow !} {bold Problems found in your app}`}),a({problems:l(n)})),await s.edit.dispose()},"run");export{R as args,U as run,S as usage};
14
- //# sourceMappingURL=problems-EZRSHLZT.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/problems.ts"],
4
- "sourcesContent": ["import { PUBLISH_ISSUES_QUERY } from \"../services/app/edit/operation.js\";\nimport { AppIdentity, AppIdentityArgs } from \"../services/command/app-identity.js\";\nimport { ArgError, type ArgsDefinitionResult } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { printProblems, publishIssuesToProblems } from \"../services/output/problems.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type ProblemsArgs = typeof args;\nexport type ProblemsArgsResult = ArgsDefinitionResult<ProblemsArgs>;\n\nexport const args = AppIdentityArgs;\n\nexport const usage: Usage = () => {\n return sprint`\n Shows any problems (errors, warnings) found in your Gadget application.\n\n {gray Usage}\n ggt problems\n `;\n};\n\nexport const run: Run<ProblemsArgs> = async (ctx, args) => {\n if (args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt problems\" does not take any positional arguments.\n\n If you are trying to see the problems of a specific directory,\n you must \"cd\" to that directory and then run \"ggt problems\".\n\n Run \"ggt problems -h\" for more information.\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"problems\", args, directory });\n\n const { publishIssues } = await appIdentity.edit.query({ query: PUBLISH_ISSUES_QUERY });\n\n if (publishIssues.length === 0) {\n println({ ensureEmptyLineAbove: true, content: sprint`{green No problems found.}` });\n } else {\n println({ ensureEmptyLineAbove: true, content: sprint`{bold.yellow !} {bold Problems found in your app}` });\n printProblems({ problems: publishIssuesToProblems(publishIssues) });\n }\n\n await appIdentity.edit.dispose();\n};\n"],
5
- "mappings": "4ZAAAA,IAYO,IAAMC,EAAOC,EAEPC,EAAeC,EAAA,IACnBC;AAAA;AAAA;AAAA;AAAA;AAAA,IADmB,SASfC,EAAyBF,EAAA,MAAOG,EAAKN,IAAS,CACzD,GAAIA,EAAK,EAAE,OAAS,EAClB,MAAM,IAAIO,EAASH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAOlB,EAGH,IAAMI,EAAY,MAAMC,EAAsB,QAAQ,IAAI,CAAC,EACrDC,EAAc,MAAMC,EAAY,KAAKL,EAAK,CAAE,QAAS,WAAY,KAAAN,EAAM,UAAAQ,CAAU,CAAC,EAElF,CAAE,cAAAI,CAAc,EAAI,MAAMF,EAAY,KAAK,MAAM,CAAE,MAAOG,CAAqB,CAAC,EAElFD,EAAc,SAAW,EAC3BE,EAAQ,CAAE,qBAAsB,GAAM,QAASV,6BAAmC,CAAC,GAEnFU,EAAQ,CAAE,qBAAsB,GAAM,QAASV,oDAA0D,CAAC,EAC1GW,EAAc,CAAE,SAAUC,EAAwBJ,CAAa,CAAE,CAAC,GAGpE,MAAMF,EAAY,KAAK,QAAQ,CACjC,EAzBsC",
6
- "names": ["init_cjs", "args", "AppIdentityArgs", "usage", "__name", "sprint", "run", "ctx", "ArgError", "directory", "loadSyncJsonDirectory", "appIdentity", "AppIdentity", "publishIssues", "PUBLISH_ISSUES_QUERY", "println", "printProblems", "publishIssuesToProblems"]
7
- }
@@ -1,28 +0,0 @@
1
- import{j as m}from"./chunk-CNNOPE5K.js";import"./chunk-L2XBSR7G.js";import"./chunk-577KP32Z.js";import"./chunk-WZ2PO6H2.js";import{s as c,t as p,u as y}from"./chunk-ULJYEUQG.js";import{c as l}from"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import{ra as s,ta as i}from"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import{a as r,h as a}from"./chunk-7DYQUG5M.js";a();var A={...c,"--env":{type:String,alias:["-e","--environment","--from"]},"--force":{type:Boolean,alias:"-f"}},P=r(e=>s`
2
- Pulls your environment files to your local directory.
3
-
4
- This command first tracks changes in your local directory since the last sync. If changes are
5
- detected, you will be prompted to discard them or abort the pull.
6
-
7
- {gray Usage}
8
- ggt pull [options]
9
-
10
- {gray Options}
11
- -a, --app <app_name> Selects the app to pull your environment changes from. Defaults to the app synced to the current directory, if there is one.
12
- -e, --env, --from <env_name> Selects the environment to pull changes from. Defaults to the environment synced to the current directory, if there is one.
13
- --force Forces a pull by discarding any changes made on your local directory since last sync
14
- --allow-different-directory Pulls changes from any environment directory, even if the directory hasn't been synced before
15
- --allow-different-app Pulls changes to a different app using --app command, instead of the most recently synced one in the current directory
16
-
17
- {gray Examples}
18
- Pull all development environment changes by discarding any changes made locally
19
- {cyanBright $ ggt pull --env development --force}
20
- `,"usage"),b=r(async(e,t)=>{if(t._.length>0)throw new l(s`
21
- "ggt pull" does not take any positional arguments.
22
-
23
- If you are trying to pull changes to a specific directory,
24
- you must "cd" to that directory and then run "ggt pull".
25
-
26
- Run "ggt pull -h" for more information.
27
- `);let u=await y(process.cwd()),d=await p.loadOrAskAndInit(e,{command:"pull",args:t,directory:u}),o=new m(d),n=await o.hashes(e);if(n.environmentChangesToPull.size===0){i({ensureEmptyLineAbove:!0,content:"Nothing to pull."});return}n.localChangesToPush.size>0&&await o.print(e,{hashes:n}),await o.pull(e,{hashes:n,force:t["--force"]})},"run");export{A as args,b as run,P as usage};
28
- //# sourceMappingURL=pull-R3PMBVOT.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/commands/pull.ts"],
4
- "sourcesContent": ["import { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type PullArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--env\": { type: String, alias: [\"-e\", \"--environment\", \"--from\"] },\n \"--force\": { type: Boolean, alias: \"-f\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n Pulls your environment files to your local directory.\n\n This command first tracks changes in your local directory since the last sync. If changes are\n detected, you will be prompted to discard them or abort the pull.\n\n {gray Usage}\n ggt pull [options]\n\n {gray Options}\n -a, --app <app_name> Selects the app to pull your environment changes from. Defaults to the app synced to the current directory, if there is one.\n -e, --env, --from <env_name> Selects the environment to pull changes from. Defaults to the environment synced to the current directory, if there is one.\n --force Forces a pull by discarding any changes made on your local directory since last sync\n --allow-different-directory Pulls changes from any environment directory, even if the directory hasn't been synced before\n --allow-different-app Pulls changes to a different app using --app command, instead of the most recently synced one in the current directory\n\n {gray Examples}\n Pull all development environment changes by discarding any changes made locally\n {cyanBright $ ggt pull --env development --force}\n `;\n};\n\nexport const run: Run<PullArgs> = async (ctx, args) => {\n if (args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt pull\" does not take any positional arguments.\n\n If you are trying to pull changes to a specific directory,\n you must \"cd\" to that directory and then run \"ggt pull\".\n\n Run \"ggt pull -h\" for more information.\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.loadOrAskAndInit(ctx, { command: \"pull\", args, directory });\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n\n if (hashes.environmentChangesToPull.size === 0) {\n println({ ensureEmptyLineAbove: true, content: \"Nothing to pull.\" });\n return;\n }\n\n if (hashes.localChangesToPush.size > 0) {\n // show them the local changes they will discard\n await filesync.print(ctx, { hashes });\n }\n\n await filesync.pull(ctx, { hashes, force: args[\"--force\"] });\n};\n"],
5
- "mappings": "8fAAAA,IASO,IAAMC,EAAO,CAClB,GAAGC,EACH,QAAS,CAAE,KAAM,OAAQ,MAAO,CAAC,KAAM,gBAAiB,QAAQ,CAAE,EAClE,UAAW,CAAE,KAAM,QAAS,MAAO,IAAK,CAC1C,EAEaC,EAAeC,EAACC,GACpBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADmB,SAuBfC,EAAqBH,EAAA,MAAOI,EAAKP,IAAS,CACrD,GAAIA,EAAK,EAAE,OAAS,EAClB,MAAM,IAAIQ,EAASH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAOlB,EAGH,IAAMI,EAAY,MAAMC,EAAsB,QAAQ,IAAI,CAAC,EACrDC,EAAW,MAAMC,EAAS,iBAAiBL,EAAK,CAAE,QAAS,OAAQ,KAAAP,EAAM,UAAAS,CAAU,CAAC,EACpFI,EAAW,IAAIC,EAASH,CAAQ,EAChCI,EAAS,MAAMF,EAAS,OAAON,CAAG,EAExC,GAAIQ,EAAO,yBAAyB,OAAS,EAAG,CAC9CC,EAAQ,CAAE,qBAAsB,GAAM,QAAS,kBAAmB,CAAC,EACnE,MACF,CAEID,EAAO,mBAAmB,KAAO,GAEnC,MAAMF,EAAS,MAAMN,EAAK,CAAE,OAAAQ,CAAO,CAAC,EAGtC,MAAMF,EAAS,KAAKN,EAAK,CAAE,OAAAQ,EAAQ,MAAOf,EAAK,SAAS,CAAE,CAAC,CAC7D,EA5BkC",
6
- "names": ["init_cjs", "args", "SyncJsonArgs", "usage", "__name", "_ctx", "sprint", "run", "ctx", "ArgError", "directory", "loadSyncJsonDirectory", "syncJson", "SyncJson", "filesync", "FileSync", "hashes", "println"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a,b,c}from"./chunk-6FVHOLT7.js";import"./chunk-CNNOPE5K.js";import"./chunk-L2XBSR7G.js";import"./chunk-577KP32Z.js";import"./chunk-WZ2PO6H2.js";import"./chunk-ULJYEUQG.js";import"./chunk-2HJS3KFB.js";import"./chunk-F6BGQ4LG.js";import"./chunk-ZYDMXS5R.js";import"./chunk-IQSZEOYY.js";import"./chunk-GZTHIOXS.js";import"./chunk-72J7X5LR.js";import"./chunk-X4XSYLCE.js";import"./chunk-ALSXPCRD.js";import"./chunk-GFQYFEEH.js";import"./chunk-7DYQUG5M.js";export{a as args,c as run,b as usage};
2
- //# sourceMappingURL=push-5XEEESQQ.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }