@gadgetinc/ggt 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +139 -76
  2. package/bin/dev.js +4 -7
  3. package/lib/__generated__/graphql.js.map +1 -1
  4. package/lib/commands/deploy.js +232 -0
  5. package/lib/commands/deploy.js.map +1 -0
  6. package/lib/commands/list.js +20 -16
  7. package/lib/commands/list.js.map +1 -1
  8. package/lib/commands/login.js +22 -20
  9. package/lib/commands/login.js.map +1 -1
  10. package/lib/commands/logout.js +13 -9
  11. package/lib/commands/logout.js.map +1 -1
  12. package/lib/commands/root.js +89 -56
  13. package/lib/commands/root.js.map +1 -1
  14. package/lib/commands/sync.js +253 -496
  15. package/lib/commands/sync.js.map +1 -1
  16. package/lib/commands/version.js +21 -0
  17. package/lib/commands/version.js.map +1 -0
  18. package/lib/commands/whoami.js +15 -11
  19. package/lib/commands/whoami.js.map +1 -1
  20. package/lib/main.js +4 -10
  21. package/lib/main.js.map +1 -1
  22. package/lib/services/{app.js → app/app.js} +8 -3
  23. package/lib/services/app/app.js.map +1 -0
  24. package/lib/services/app/arg.js +28 -0
  25. package/lib/services/app/arg.js.map +1 -0
  26. package/lib/services/app/edit-graphql.js +389 -0
  27. package/lib/services/app/edit-graphql.js.map +1 -0
  28. package/lib/services/command/arg.js +53 -0
  29. package/lib/services/command/arg.js.map +1 -0
  30. package/lib/services/command/command.js +27 -0
  31. package/lib/services/command/command.js.map +1 -0
  32. package/lib/services/command/context.js +60 -0
  33. package/lib/services/command/context.js.map +1 -0
  34. package/lib/services/{config.js → config/config.js} +29 -31
  35. package/lib/services/config/config.js.map +1 -0
  36. package/lib/services/config/env.js +22 -0
  37. package/lib/services/config/env.js.map +1 -0
  38. package/lib/services/config/package-json.js +9 -0
  39. package/lib/services/config/package-json.js.map +1 -0
  40. package/lib/services/filesync/changes.js +97 -0
  41. package/lib/services/filesync/changes.js.map +1 -0
  42. package/lib/services/filesync/conflicts.js +137 -0
  43. package/lib/services/filesync/conflicts.js.map +1 -0
  44. package/lib/services/filesync/directory.js +253 -0
  45. package/lib/services/filesync/directory.js.map +1 -0
  46. package/lib/services/filesync/error.js +67 -0
  47. package/lib/services/filesync/error.js.map +1 -0
  48. package/lib/services/filesync/file.js +3 -0
  49. package/lib/services/filesync/file.js.map +1 -0
  50. package/lib/services/filesync/filesync.js +673 -0
  51. package/lib/services/filesync/filesync.js.map +1 -0
  52. package/lib/services/filesync/hashes.js +150 -0
  53. package/lib/services/filesync/hashes.js.map +1 -0
  54. package/lib/services/http/auth.js +41 -0
  55. package/lib/services/http/auth.js.map +1 -0
  56. package/lib/services/http/http.js +64 -0
  57. package/lib/services/http/http.js.map +1 -0
  58. package/lib/services/output/log/field.js +3 -0
  59. package/lib/services/output/log/field.js.map +1 -0
  60. package/lib/services/output/log/format/format.js +8 -0
  61. package/lib/services/output/log/format/format.js.map +1 -0
  62. package/lib/services/output/log/format/json.js +45 -0
  63. package/lib/services/output/log/format/json.js.map +1 -0
  64. package/lib/services/output/log/format/pretty.js +147 -0
  65. package/lib/services/output/log/format/pretty.js.map +1 -0
  66. package/lib/services/output/log/level.js +41 -0
  67. package/lib/services/output/log/level.js.map +1 -0
  68. package/lib/services/output/log/logger.js +40 -0
  69. package/lib/services/output/log/logger.js.map +1 -0
  70. package/lib/services/output/log/printer.js +120 -0
  71. package/lib/services/output/log/printer.js.map +1 -0
  72. package/lib/services/output/log/structured.js +52 -0
  73. package/lib/services/output/log/structured.js.map +1 -0
  74. package/lib/services/{notify.js → output/notify.js} +7 -6
  75. package/lib/services/output/notify.js.map +1 -0
  76. package/lib/services/output/prompt.js +52 -0
  77. package/lib/services/output/prompt.js.map +1 -0
  78. package/lib/services/output/report.js +162 -0
  79. package/lib/services/output/report.js.map +1 -0
  80. package/lib/services/output/sprint.js +21 -0
  81. package/lib/services/output/sprint.js.map +1 -0
  82. package/lib/services/output/stream.js +54 -0
  83. package/lib/services/output/stream.js.map +1 -0
  84. package/lib/services/{version.js → output/update.js} +24 -16
  85. package/lib/services/output/update.js.map +1 -0
  86. package/lib/services/user/session.js +50 -0
  87. package/lib/services/user/session.js.map +1 -0
  88. package/lib/services/{user.js → user/user.js} +23 -14
  89. package/lib/services/user/user.js.map +1 -0
  90. package/lib/services/util/boolean.js +15 -0
  91. package/lib/services/util/boolean.js.map +1 -0
  92. package/lib/services/util/collection.js +38 -0
  93. package/lib/services/util/collection.js.map +1 -0
  94. package/lib/services/util/function.js +97 -0
  95. package/lib/services/util/function.js.map +1 -0
  96. package/lib/services/{is.js → util/is.js} +7 -0
  97. package/lib/services/util/is.js.map +1 -0
  98. package/lib/services/util/number.js +27 -0
  99. package/lib/services/util/number.js.map +1 -0
  100. package/lib/services/util/object.js +101 -0
  101. package/lib/services/util/object.js.map +1 -0
  102. package/lib/services/util/paths.js +36 -0
  103. package/lib/services/util/paths.js.map +1 -0
  104. package/lib/services/{promise.js → util/promise.js} +5 -7
  105. package/lib/services/util/promise.js.map +1 -0
  106. package/npm-shrinkwrap.json +2143 -1304
  107. package/package.json +50 -42
  108. package/lib/commands/index.js +0 -9
  109. package/lib/commands/index.js.map +0 -1
  110. package/lib/services/app.js.map +0 -1
  111. package/lib/services/args.js +0 -28
  112. package/lib/services/args.js.map +0 -1
  113. package/lib/services/collections.js +0 -17
  114. package/lib/services/collections.js.map +0 -1
  115. package/lib/services/config.js.map +0 -1
  116. package/lib/services/debounce.js +0 -21
  117. package/lib/services/debounce.js.map +0 -1
  118. package/lib/services/defaults.js +0 -8
  119. package/lib/services/defaults.js.map +0 -1
  120. package/lib/services/edit-graphql.js +0 -202
  121. package/lib/services/edit-graphql.js.map +0 -1
  122. package/lib/services/errors.js +0 -277
  123. package/lib/services/errors.js.map +0 -1
  124. package/lib/services/filesync.js +0 -404
  125. package/lib/services/filesync.js.map +0 -1
  126. package/lib/services/fs.js +0 -35
  127. package/lib/services/fs.js.map +0 -1
  128. package/lib/services/http.js +0 -53
  129. package/lib/services/http.js.map +0 -1
  130. package/lib/services/is.js.map +0 -1
  131. package/lib/services/log.js +0 -45
  132. package/lib/services/log.js.map +0 -1
  133. package/lib/services/noop.js +0 -4
  134. package/lib/services/noop.js.map +0 -1
  135. package/lib/services/notify.js.map +0 -1
  136. package/lib/services/output.js +0 -74
  137. package/lib/services/output.js.map +0 -1
  138. package/lib/services/promise.js.map +0 -1
  139. package/lib/services/prompt.js +0 -22
  140. package/lib/services/prompt.js.map +0 -1
  141. package/lib/services/session.js +0 -31
  142. package/lib/services/session.js.map +0 -1
  143. package/lib/services/sleep.js +0 -21
  144. package/lib/services/sleep.js.map +0 -1
  145. package/lib/services/timeout.js +0 -8
  146. package/lib/services/timeout.js.map +0 -1
  147. package/lib/services/user.js.map +0 -1
  148. package/lib/services/version.js.map +0 -1
package/README.md CHANGED
@@ -29,10 +29,12 @@
29
29
  - [Usage](#usage)
30
30
  - [Commands](#commands)
31
31
  - [`ggt sync`](#ggt-sync)
32
+ - [`ggt deploy`](#ggt-deploy)
32
33
  - [`ggt list`](#ggt-list)
33
34
  - [`ggt login`](#ggt-login)
34
35
  - [`ggt logout`](#ggt-logout)
35
36
  - [`ggt whoami`](#ggt-whoami)
37
+ - [`ggt version`](#ggt-version)
36
38
 
37
39
  ## Intro
38
40
 
@@ -55,24 +57,24 @@ $ npm install -g @gadgetinc/ggt
55
57
  $ ggt
56
58
  The command-line interface for Gadget
57
59
 
58
- VERSION
59
- ggt/0.3.3 linux-x64 node-v16.20.2
60
-
61
60
  USAGE
62
- $ ggt [COMMAND]
61
+ ggt [COMMAND]
62
+
63
+ COMMANDS
64
+ sync Sync your Gadget application's source code
65
+ deploy Deploy your app to production
66
+ list List your apps
67
+ login Log in to your account
68
+ logout Log out of your account
69
+ whoami Print the currently logged in account
70
+ version Print the version of ggt
63
71
 
64
72
  FLAGS
65
73
  -h, --help Print command's usage
66
- -v, --version Print version
67
- --debug Print debug output
74
+ -v, --verbose Print verbose output
75
+ --json Print output as JSON
68
76
 
69
- COMMANDS
70
- sync Sync your Gadget application's source code to and
71
- from your local filesystem.
72
- list List your apps.
73
- login Log in to your account.
74
- logout Log out of your account.
75
- whoami Print the currently logged in account.
77
+ For more information on a specific command, use 'ggt [COMMAND] --help'
76
78
  ```
77
79
 
78
80
  ## Commands
@@ -80,82 +82,130 @@ COMMANDS
80
82
  ### `ggt sync`
81
83
 
82
84
  ```
83
- Sync your Gadget application's source code to and from
84
- your local filesystem.
85
+ Sync your Gadget environment's source code with your local filesystem.
85
86
 
86
87
  USAGE
87
- $ ggt sync [DIRECTORY] [--app <name>]
88
+ ggt sync [DIRECTORY]
88
89
 
89
90
  ARGUMENTS
90
- DIRECTORY [default: .] The directory to sync files to.
91
-
92
- If the directory doesn't exist, it will be created.
91
+ DIRECTORY The directory to sync files to (default: ".")
93
92
 
94
93
  FLAGS
95
- -a, --app=<name> The Gadget application to sync files to.
96
-
97
- --force Whether to sync even if we can't determine
98
- the state of your local files relative to
99
- your remote ones.
94
+ -a, --app=<name> The Gadget application to sync files to
95
+ --prefer=<filesystem> Prefer "local" or "gadget" conflicting changes
96
+ --once Sync once and exit
97
+ --force Sync regardless of local filesystem state
100
98
 
101
99
  DESCRIPTION
102
- Sync provides the ability to sync your Gadget application's source
103
- code to and from your local filesystem.
100
+ Sync allows you to synchronize your Gadget application's source
101
+ code with your local filesystem.
104
102
 
105
103
  While ggt sync is running, local file changes are immediately
106
- reflected within Gadget, while files that are changed remotely are
104
+ reflected within Gadget, while files that are changed in Gadget are
107
105
  immediately saved to your local filesystem.
108
106
 
109
- Use cases for this include:
110
- Developing locally with your own editor like VSCode
111
- • Storing your source code in a Git repository like GitHub
107
+ Ideal for:
108
+ Local development with editors like VSCode
109
+ • Storing source code in a Git repository like GitHub
112
110
 
113
- Sync includes the concept of a .ignore file. This file may
114
- contain a list of files and directories that won't be received or
115
- sent to Gadget when syncing. The format of this file is identical
116
- to the one used by Git (https://git-scm.com/docs/gitignore).
111
+ Sync looks for a ".ignore" file to exclude certain files/directories
112
+ from being synced. The format is identical to Git's.
117
113
 
118
- The following files and directories are always ignored:
114
+ These files are always ignored:
119
115
  • .DS_Store
120
116
  • .gadget
121
117
  • .git
122
118
  • node_modules
123
119
 
124
120
  Note:
125
- If you have separate development and production environments,
126
- ggt sync will only sync with your development environment
127
- • Gadget applications only support installing dependencies
128
- with Yarn 1 (https://classic.yarnpkg.com/lang/en/)
129
- • Since file changes are immediately reflected in Gadget,
130
- avoid the following while ggt sync is running:
131
- • Deleting all your files
132
- • Moving all your files to a different directory
121
+ Sync only works with your development environment
122
+ Avoid deleting/moving all your files while sync is running
123
+ • Gadget only supports Yarn v1 for dependency installation
133
124
 
134
- EXAMPLES
135
- $ ggt sync --app my-app ~/gadget/my-app
125
+ EXAMPLE
126
+ $ ggt sync ~/gadget/example --app example
127
+
128
+ App example
129
+ Editor https://example.gadget.app/edit
130
+ Playground https://example.gadget.app/api/graphql/playground
131
+ Docs https://docs.gadget.dev/api/example
132
+
133
+ Endpoints
134
+ • https://example.gadget.app
135
+ • https://example--development.gadget.app
136
+
137
+ Watching for file changes... Press Ctrl+C to stop
138
+
139
+ → Sent 09:06:25 AM
140
+ routes/GET-hello.js + created
136
141
 
137
- App my-app
138
- Editor https://my-app.gadget.app/edit
139
- Playground https://my-app.gadget.app/api/graphql/playground
140
- Docs https://docs.gadget.dev/api/my-app
142
+ → Sent 09:06:49 AM
143
+ routes/GET-hello.js ± updated
144
+
145
+ ← Received 09:06:54 AM
146
+ routes/GET-hello.js ± updated
147
+
148
+ ← Received 09:06:56 AM
149
+ routes/GET-hello.js - deleted
150
+ ^C Stopping... press Ctrl+C again to force
151
+
152
+ Goodbye!
153
+ ```
154
+
155
+ ### `ggt deploy`
156
+
157
+ ```
158
+ Deploy your Gadget application's development source code to production.
159
+
160
+ USAGE
161
+ ggt deploy [DIRECTORY] [--app=<name>]
162
+
163
+ ARGUMENTS
164
+ DIRECTORY The directory to sync files to and deploy (default: ".")
165
+
166
+ FLAGS
167
+ -a, --app=<name> The Gadget application to deploy
168
+ --force Deploy the Gadget application regardless of any issues it may have
169
+
170
+ DESCRIPTION
171
+ Deploy allows you to deploy your current Gadget application in development to production.
172
+
173
+ It detects if local files are up to date with remote and if the Gadget application
174
+ is in a deployable state. If there are any issues, it will display them and ask if
175
+ you would like to deploy anyways.
176
+
177
+ Note:
178
+ • If local files are not up to date or have not recently been synced with remote ones,
179
+ you will be prompted to run a one-time sync to ensure the files remain consistent with
180
+ what is on the remote.
181
+ • You may wish to keep ggt sync running in the background before trying to run ggt deploy
182
+
183
+ EXAMPLE
184
+ $ ggt deploy ~/gadget/example --app example
185
+
186
+ App example
187
+ Editor https://example.gadget.app/edit
188
+ Playground https://example.gadget.app/api/graphql/playground
189
+ Docs https://docs.gadget.dev/api/example
141
190
 
142
191
  Endpoints
143
- • https://my-app.gadget.app
144
- • https://my-app--development.gadget.app
192
+ • https://example.gadget.app
193
+ • https://example--development.gadget.app
145
194
 
146
- Watching for file changes... Press Ctrl+C to stop
147
195
 
148
- Received 12:00:00 PM
149
- routes/GET.js (changed)
150
- ← user/signUp/signIn.js (changed)
151
- 2 files in total. 2 changed, 0 deleted.
196
+ Building frontend assets ...
197
+ DONE
152
198
 
153
- Sent 12:00:03 PM
154
- routes/GET.ts (changed)
155
- 1 file in total. 1 changed, 0 deleted.
199
+ Setting up database ...
200
+ DONE
156
201
 
157
- ^C Stopping... (press Ctrl+C again to force)
158
- Goodbye!
202
+ Copying development ...
203
+ ✔ DONE
204
+
205
+ Restarting app ...
206
+ ✔ DONE
207
+
208
+ Deploy completed. Good bye!
159
209
  ```
160
210
 
161
211
  ### `ggt list`
@@ -164,15 +214,15 @@ EXAMPLES
164
214
  List the apps available to the currently logged in user.
165
215
 
166
216
  USAGE
167
- $ ggt list
217
+ ggt list
168
218
 
169
219
  EXAMPLE
170
220
  $ ggt list
171
- Slug Domain
172
- ─────── ──────────────────
173
- my-app my-app.gadget.app
174
- example example.gadget.app
175
- test test.gadget.app
221
+ Slug Domain
222
+ ─────── ──────────────────
223
+ my-app my-app.gadget.app
224
+ example example.gadget.app
225
+ test test.gadget.app
176
226
  ```
177
227
 
178
228
  ### `ggt login`
@@ -181,15 +231,15 @@ EXAMPLE
181
231
  Log in to your account.
182
232
 
183
233
  USAGE
184
- $ ggt login
234
+ ggt login
185
235
 
186
236
  EXAMPLES
187
237
  $ ggt login
188
- We've opened Gadget's login page using your default browser.
238
+ We've opened Gadget's login page using your default browser.
189
239
 
190
- Please log in and then return to this terminal.
240
+ Please log in and then return to this terminal.
191
241
 
192
- Hello, Jane Doe (jane@example.com)
242
+ Hello, Jane Doe (jane@example.com)
193
243
  ```
194
244
 
195
245
  ### `ggt logout`
@@ -198,22 +248,35 @@ EXAMPLES
198
248
  Log out of your account.
199
249
 
200
250
  USAGE
201
- $ ggt logout
251
+ ggt logout
202
252
 
203
253
  EXAMPLES
204
254
  $ ggt logout
205
- Goodbye
255
+ Goodbye
206
256
  ```
207
257
 
208
258
  ### `ggt whoami`
209
259
 
210
260
  ```
211
- Show the name and email address of the currently logged in user.
261
+ Show the name and email address of the currently logged in user
212
262
 
213
263
  USAGE
214
- $ ggt whoami
264
+ ggt whoami
215
265
 
216
266
  EXAMPLES
217
267
  $ ggt whoami
218
- You are logged in as Jane Doe (jane@example.com)
268
+ You are logged in as Jane Doe (jane@example.com)
269
+ ```
270
+
271
+ ### `ggt version`
272
+
273
+ ```
274
+ Print the version of ggt
275
+
276
+ USAGE
277
+ ggt version
278
+
279
+ EXAMPLES
280
+ $ ggt version
281
+ 0.4.1
219
282
  ```
package/bin/dev.js CHANGED
@@ -1,16 +1,13 @@
1
1
  #!/usr/bin/env node --loader @swc-node/register/esm --no-warnings
2
2
 
3
- import { dirname, join } from "node:path";
4
3
  import process from "node:process";
5
- import { fileURLToPath } from "node:url";
6
-
7
- const workspaceRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
4
+ import { workspacePath } from "../src/services/util/paths.js";
8
5
 
9
6
  process.env["NODE_ENV"] ??= "development";
10
7
  process.env["GGT_ENV"] ??= "development";
11
8
  process.env["GGT_SENTRY_ENABLED"] ??= "false";
12
- process.env["GGT_CONFIG_DIR"] ??= join(workspaceRoot, "tmp/config");
13
- process.env["GGT_CACHE_DIR"] ??= join(workspaceRoot, "tmp/cache");
14
- process.env["GGT_DATA_DIR"] ??= join(workspaceRoot, "tmp/data");
9
+ process.env["GGT_CONFIG_DIR"] ??= workspacePath("tmp/config");
10
+ process.env["GGT_CACHE_DIR"] ??= workspacePath("tmp/cache");
11
+ process.env["GGT_DATA_DIR"] ??= workspacePath("tmp/data");
15
12
 
16
13
  await import("../src/main.js");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/__generated__/graphql.ts"],"sourcesContent":["/**\n * ======================================================\n * THIS IS A GENERATED FILE! DO NOT EDIT IT MANUALLY!\n *\n * You can regenerate it by running `npm run generate-graphql`.\n * ======================================================\n */\n\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string | number; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n /** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n Date: { input: any; output: any; }\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n DateTime: { input: any; output: any; }\n JSON: { input: { [key: string]: any }; output: { [key: string]: any }; }\n /** The `Upload` scalar type represents a file upload. */\n Upload: { input: any; output: any; }\n};\n\nexport type ApiUpgradeConvergePlanResult = {\n __typename?: 'APIUpgradeConvergePlanResult';\n items: Array<Scalars['JSON']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ChangeAppDomainResult = {\n __typename?: 'ChangeAppDomainResult';\n onlyValidate?: Maybe<Scalars['Boolean']['output']>;\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ContributorResult = {\n __typename?: 'ContributorResult';\n email: Scalars['String']['output'];\n isOwner: Scalars['Boolean']['output'];\n isPending: Scalars['Boolean']['output'];\n};\n\nexport type DeleteAppStatusResult = {\n __typename?: 'DeleteAppStatusResult';\n isNotCreator?: Maybe<Scalars['Boolean']['output']>;\n isNotOwner?: Maybe<Scalars['Boolean']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnableFrontendResult = {\n __typename?: 'EnableFrontendResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPatchResult = {\n __typename?: 'EnvironmentPatchResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPublishResult = {\n __typename?: 'EnvironmentPublishResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentSubscriptionResult = {\n __typename?: 'EnvironmentSubscriptionResult';\n patches: Array<Scalars['JSON']['output']>;\n};\n\nexport type EnvironmentTreeClientId = {\n clientType: Scalars['String']['input'];\n id: Scalars['String']['input'];\n};\n\nexport type FileSyncChangedEvent = {\n __typename?: 'FileSyncChangedEvent';\n content: Scalars['String']['output'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncChangedEventInput = {\n content: Scalars['String']['input'];\n encoding?: InputMaybe<FileSyncEncoding>;\n mode: Scalars['Float']['input'];\n oldPath?: InputMaybe<Scalars['String']['input']>;\n path: Scalars['String']['input'];\n};\n\nexport type FileSyncDeletedEvent = {\n __typename?: 'FileSyncDeletedEvent';\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncDeletedEventInput = {\n path: Scalars['String']['input'];\n};\n\nexport enum FileSyncEncoding {\n Base64 = 'base64',\n Utf8 = 'utf8'\n}\n\nexport type GadgetRole = {\n __typename?: 'GadgetRole';\n key: Scalars['String']['output'];\n name: Scalars['String']['output'];\n order: Scalars['Int']['output'];\n selectable: Scalars['Boolean']['output'];\n};\n\nexport type IdentifySupportConversationResult = {\n __typename?: 'IdentifySupportConversationResult';\n identificationEmail: Scalars['String']['output'];\n identificationToken: Scalars['String']['output'];\n};\n\nexport type LogSearchResult = {\n __typename?: 'LogSearchResult';\n data: Scalars['JSON']['output'];\n status: Scalars['String']['output'];\n};\n\nexport type MigrateEnvironmentsResult = {\n __typename?: 'MigrateEnvironmentsResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type Mutation = {\n __typename?: 'Mutation';\n changeAppDomain?: Maybe<ChangeAppDomainResult>;\n deleteApp?: Maybe<DeleteAppStatusResult>;\n enableFrontend?: Maybe<EnableFrontendResult>;\n migrateEnvironments?: Maybe<MigrateEnvironmentsResult>;\n patchEnvironmentTree?: Maybe<EnvironmentPatchResult>;\n publish?: Maybe<EnvironmentPublishResult>;\n publishFileSyncEvents: PublishFileSyncEventsResult;\n refreshScopes?: Maybe<RefreshScopesResult>;\n registerWebhooks?: Maybe<RegisterWebhooksResult>;\n removeContributor?: Maybe<RemoveContributorResult>;\n sendAppInvitation?: Maybe<SendAppInvitationResult>;\n unregisterWebhooks?: Maybe<UnregisterWebhooksResult>;\n uploadFiles: UploadFilesResult;\n};\n\n\nexport type MutationChangeAppDomainArgs = {\n newSubdomain: Scalars['String']['input'];\n onlyValidate?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationEnableFrontendArgs = {\n hasShopifyConnection: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationMigrateEnvironmentsArgs = {\n existingToProduction: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationPatchEnvironmentTreeArgs = {\n clientID: EnvironmentTreeClientId;\n patches: Array<Scalars['JSON']['input']>;\n};\n\n\nexport type MutationPublishFileSyncEventsArgs = {\n input: PublishFileSyncEventsInput;\n};\n\n\nexport type MutationRefreshScopesArgs = {\n appConfigKey: Scalars['String']['input'];\n connectionKey: Scalars['String']['input'];\n shopId: Scalars['String']['input'];\n};\n\n\nexport type MutationRegisterWebhooksArgs = {\n connectionKey: Scalars['String']['input'];\n keepExtraTopics?: InputMaybe<Scalars['Boolean']['input']>;\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n shopIds: Array<Scalars['String']['input']>;\n};\n\n\nexport type MutationRemoveContributorArgs = {\n email: Scalars['String']['input'];\n isInvitation: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationSendAppInvitationArgs = {\n email?: InputMaybe<Scalars['String']['input']>;\n emails?: InputMaybe<Array<Scalars['String']['input']>>;\n resend?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationUnregisterWebhooksArgs = {\n apiKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n connectionKey: Scalars['String']['input'];\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\n\nexport type MutationUploadFilesArgs = {\n files: Array<UploadFile>;\n};\n\nexport type PublishFileSyncEventsInput = {\n changed: Array<FileSyncChangedEventInput>;\n deleted: Array<FileSyncDeletedEventInput>;\n expectedRemoteFilesVersion: Scalars['String']['input'];\n};\n\nexport type PublishFileSyncEventsResult = {\n __typename?: 'PublishFileSyncEventsResult';\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n apiUpgradeConvergePlan?: Maybe<ApiUpgradeConvergePlanResult>;\n currentUser: User;\n environmentTreeChildKeys: Array<Scalars['String']['output']>;\n environmentTreePath?: Maybe<Scalars['JSON']['output']>;\n identifySupportConversation?: Maybe<IdentifySupportConversationResult>;\n listContributors: Array<ContributorResult>;\n logsSearch: LogSearchResult;\n remoteFilesVersion: Scalars['String']['output'];\n roles: Array<GadgetRole>;\n runTestSupportFunction?: Maybe<Scalars['JSON']['output']>;\n team: TeamResult;\n typesManifest: TypesManifest;\n};\n\n\nexport type QueryApiUpgradeConvergePlanArgs = {\n currentVersion: Scalars['String']['input'];\n targetVersion: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreeChildKeysArgs = {\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreePathArgs = {\n hydrateChildrenGlobs?: InputMaybe<Array<Scalars['String']['input']>>;\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryLogsSearchArgs = {\n direction?: InputMaybe<Scalars['String']['input']>;\n end?: InputMaybe<Scalars['DateTime']['input']>;\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n step?: InputMaybe<Scalars['Int']['input']>;\n};\n\n\nexport type QueryTypesManifestArgs = {\n dependenciesHash: Scalars['String']['input'];\n};\n\nexport type RefreshScopesResult = {\n __typename?: 'RefreshScopesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RegisterWebhooksResult = {\n __typename?: 'RegisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RemoteFileSyncEvents = {\n __typename?: 'RemoteFileSyncEvents';\n changed: Array<FileSyncChangedEvent>;\n deleted: Array<FileSyncDeletedEvent>;\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type RemoveContributorResult = {\n __typename?: 'RemoveContributorResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type SendAppInvitationResult = {\n __typename?: 'SendAppInvitationResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type Subscription = {\n __typename?: 'Subscription';\n editorActive?: Maybe<Scalars['Boolean']['output']>;\n environmentTreePathPatches?: Maybe<EnvironmentSubscriptionResult>;\n logsSearch: LogSearchResult;\n remoteFileSyncEvents: RemoteFileSyncEvents;\n typesManifestStream: TypesManifest;\n};\n\n\nexport type SubscriptionEnvironmentTreePathPatchesArgs = {\n clientID: EnvironmentTreeClientId;\n path: Scalars['String']['input'];\n};\n\n\nexport type SubscriptionLogsSearchArgs = {\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n};\n\n\nexport type SubscriptionRemoteFileSyncEventsArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n localFilesVersion: Scalars['String']['input'];\n};\n\nexport type TeamMember = {\n __typename?: 'TeamMember';\n contributesToApp: Scalars['Boolean']['output'];\n email: Scalars['String']['output'];\n};\n\nexport type TeamResult = {\n __typename?: 'TeamResult';\n availableSeats?: Maybe<Scalars['Int']['output']>;\n costPerSeat?: Maybe<Scalars['String']['output']>;\n teamMembers: Array<TeamMember>;\n};\n\nexport type TypeManifestEntry = {\n __typename?: 'TypeManifestEntry';\n declaration: Scalars['String']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type TypesManifest = {\n __typename?: 'TypesManifest';\n cdn: Array<Scalars['String']['output']>;\n dependenciesHash: Scalars['String']['output'];\n entries: Array<TypeManifestEntry>;\n environmentVersion: Scalars['Int']['output'];\n};\n\nexport type UnregisterWebhooksResult = {\n __typename?: 'UnregisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type UploadFile = {\n file: Scalars['Upload']['input'];\n path: Scalars['String']['input'];\n};\n\nexport type UploadFilesResult = {\n __typename?: 'UploadFilesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type User = {\n __typename?: 'User';\n email: Scalars['String']['output'];\n name?: Maybe<Scalars['String']['output']>;\n};\n\nexport type RemoteFileSyncEventsSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String']['input'];\n}>;\n\n\nexport type RemoteFileSyncEventsSubscription = { __typename?: 'Subscription', remoteFileSyncEvents: { __typename?: 'RemoteFileSyncEvents', remoteFilesVersion: string, changed: Array<{ __typename?: 'FileSyncChangedEvent', path: string, mode: number, content: string, encoding: FileSyncEncoding }>, deleted: Array<{ __typename?: 'FileSyncDeletedEvent', path: string }> } };\n\nexport type RemoteFilesVersionQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type RemoteFilesVersionQuery = { __typename?: 'Query', remoteFilesVersion: string };\n\nexport type PublishFileSyncEventsMutationVariables = Exact<{\n input: PublishFileSyncEventsInput;\n}>;\n\n\nexport type PublishFileSyncEventsMutation = { __typename?: 'Mutation', publishFileSyncEvents: { __typename?: 'PublishFileSyncEventsResult', remoteFilesVersion: string } };\n"],"names":["FileSyncEncoding"],"mappings":"AAAA;;;;;;CAMC;UAuGWA;;;GAAAA,qBAAAA"}
1
+ {"version":3,"sources":["../../src/__generated__/graphql.ts"],"sourcesContent":["/**\n * ======================================================\n * THIS IS A GENERATED FILE! DO NOT EDIT IT MANUALLY!\n *\n * You can regenerate it by running `npm run generate-graphql`.\n * ======================================================\n */\n\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n /** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n Date: { input: any; output: any; }\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n DateTime: { input: any; output: any; }\n JSON: { input: { [key: string]: any }; output: { [key: string]: any }; }\n /** The `Upload` scalar type represents a file upload. */\n Upload: { input: any; output: any; }\n};\n\nexport type ApiUpgradeConvergePlanResult = {\n __typename?: 'APIUpgradeConvergePlanResult';\n items: Array<Scalars['JSON']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type AddApplicationTagResult = {\n __typename?: 'AddApplicationTagResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type AddUserTagResult = {\n __typename?: 'AddUserTagResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ChangeAppDomainResult = {\n __typename?: 'ChangeAppDomainResult';\n onlyValidate?: Maybe<Scalars['Boolean']['output']>;\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ContributorResult = {\n __typename?: 'ContributorResult';\n email: Scalars['String']['output'];\n isOwner: Scalars['Boolean']['output'];\n isPending: Scalars['Boolean']['output'];\n};\n\nexport type DeleteAppStatusResult = {\n __typename?: 'DeleteAppStatusResult';\n isNotCreator?: Maybe<Scalars['Boolean']['output']>;\n isNotOwner?: Maybe<Scalars['Boolean']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnableFrontendResult = {\n __typename?: 'EnableFrontendResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPatchResult = {\n __typename?: 'EnvironmentPatchResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPublishResult = {\n __typename?: 'EnvironmentPublishResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentSubscriptionResult = {\n __typename?: 'EnvironmentSubscriptionResult';\n patches: Array<Scalars['JSON']['output']>;\n};\n\nexport type EnvironmentTreeClientId = {\n clientType: Scalars['String']['input'];\n id: Scalars['String']['input'];\n};\n\nexport type FileSyncChangedEvent = {\n __typename?: 'FileSyncChangedEvent';\n content: Scalars['String']['output'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncChangedEventInput = {\n content: Scalars['String']['input'];\n encoding?: InputMaybe<FileSyncEncoding>;\n mode: Scalars['Float']['input'];\n oldPath?: InputMaybe<Scalars['String']['input']>;\n path: Scalars['String']['input'];\n};\n\nexport type FileSyncComparisonHashes = {\n __typename?: 'FileSyncComparisonHashes';\n filesVersionHashes: FileSyncHashes;\n latestFilesVersionHashes: FileSyncHashes;\n};\n\nexport type FileSyncDeletedEvent = {\n __typename?: 'FileSyncDeletedEvent';\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncDeletedEventInput = {\n path: Scalars['String']['input'];\n};\n\nexport enum FileSyncEncoding {\n Base64 = 'base64',\n Utf8 = 'utf8'\n}\n\nexport type FileSyncFile = {\n __typename?: 'FileSyncFile';\n content: Scalars['String']['output'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncFiles = {\n __typename?: 'FileSyncFiles';\n files: Array<FileSyncFile>;\n filesVersion: Scalars['String']['output'];\n};\n\nexport type FileSyncHashes = {\n __typename?: 'FileSyncHashes';\n filesVersion: Scalars['String']['output'];\n hashes: Scalars['JSON']['output'];\n};\n\nexport type GadgetRole = {\n __typename?: 'GadgetRole';\n key: Scalars['String']['output'];\n name: Scalars['String']['output'];\n order: Scalars['Int']['output'];\n selectable: Scalars['Boolean']['output'];\n};\n\nexport type IdentifySupportConversationResult = {\n __typename?: 'IdentifySupportConversationResult';\n identificationEmail: Scalars['String']['output'];\n identificationToken: Scalars['String']['output'];\n};\n\nexport type LogSearchResult = {\n __typename?: 'LogSearchResult';\n data: Scalars['JSON']['output'];\n status: Scalars['String']['output'];\n};\n\nexport type MigrateAacResult = {\n __typename?: 'MigrateAACResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type MigrateEnvironmentsResult = {\n __typename?: 'MigrateEnvironmentsResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type Mutation = {\n __typename?: 'Mutation';\n addApplicationTag?: Maybe<AddApplicationTagResult>;\n addUserTag?: Maybe<AddUserTagResult>;\n changeAppDomain?: Maybe<ChangeAppDomainResult>;\n convergePackages: Scalars['Boolean']['output'];\n deleteApp?: Maybe<DeleteAppStatusResult>;\n enableFrontend?: Maybe<EnableFrontendResult>;\n migrateAAC?: Maybe<MigrateAacResult>;\n migrateEnvironments?: Maybe<MigrateEnvironmentsResult>;\n patchEnvironmentTree?: Maybe<EnvironmentPatchResult>;\n publish?: Maybe<EnvironmentPublishResult>;\n publishFileSyncEvents: PublishFileSyncEventsResult;\n refreshScopes?: Maybe<RefreshScopesResult>;\n registerWebhooks?: Maybe<RegisterWebhooksResult>;\n /** @deprecated use team */\n removeContributor?: Maybe<RemoveContributorResult>;\n /** @deprecated app invitations are no longer supported */\n sendAppInvitation?: Maybe<SendAppInvitationResult>;\n setClientCurrentPath: EnvironmentPatchResult;\n setFrameworkVersion: SetFrameworkVersionResult;\n syncToWebflow: Scalars['Boolean']['output'];\n uninstallShop?: Maybe<UninstallShopResult>;\n unregisterWebhooks?: Maybe<UnregisterWebhooksResult>;\n uploadFiles: UploadFilesResult;\n uploadTemplateAsset: UploadTemplateAssetResult;\n};\n\n\nexport type MutationAddApplicationTagArgs = {\n tag: Scalars['String']['input'];\n};\n\n\nexport type MutationAddUserTagArgs = {\n replaceMatches?: InputMaybe<Array<Scalars['String']['input']>>;\n tag: Scalars['String']['input'];\n};\n\n\nexport type MutationChangeAppDomainArgs = {\n newSubdomain: Scalars['String']['input'];\n onlyValidate?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationDeleteAppArgs = {\n onlyProduction?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationEnableFrontendArgs = {\n hasShopifyConnection: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationMigrateEnvironmentsArgs = {\n existingToProduction: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationPatchEnvironmentTreeArgs = {\n clientID: EnvironmentTreeClientId;\n patches: Array<Scalars['JSON']['input']>;\n};\n\n\nexport type MutationPublishFileSyncEventsArgs = {\n input: PublishFileSyncEventsInput;\n};\n\n\nexport type MutationRefreshScopesArgs = {\n appConfigKey: Scalars['String']['input'];\n connectionKey: Scalars['String']['input'];\n shopId: Scalars['String']['input'];\n};\n\n\nexport type MutationRegisterWebhooksArgs = {\n connectionKey: Scalars['String']['input'];\n keepExtraTopics?: InputMaybe<Scalars['Boolean']['input']>;\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n shopIds: Array<Scalars['String']['input']>;\n};\n\n\nexport type MutationRemoveContributorArgs = {\n email: Scalars['String']['input'];\n isInvitation: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationSendAppInvitationArgs = {\n email?: InputMaybe<Scalars['String']['input']>;\n emails?: InputMaybe<Array<Scalars['String']['input']>>;\n resend?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationSetClientCurrentPathArgs = {\n clientID: EnvironmentTreeClientId;\n currentPath: Scalars['String']['input'];\n};\n\n\nexport type MutationSetFrameworkVersionArgs = {\n constraint: Scalars['String']['input'];\n};\n\n\nexport type MutationUninstallShopArgs = {\n shopId: Scalars['String']['input'];\n};\n\n\nexport type MutationUnregisterWebhooksArgs = {\n apiKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n connectionKey: Scalars['String']['input'];\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\n\nexport type MutationUploadFilesArgs = {\n files: Array<UploadFile>;\n};\n\n\nexport type MutationUploadTemplateAssetArgs = {\n file: Scalars['Upload']['input'];\n};\n\nexport type PublishFileSyncEventsInput = {\n changed: Array<FileSyncChangedEventInput>;\n deleted: Array<FileSyncDeletedEventInput>;\n expectedRemoteFilesVersion: Scalars['String']['input'];\n};\n\nexport type PublishFileSyncEventsResult = {\n __typename?: 'PublishFileSyncEventsResult';\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type PublishIssue = {\n __typename?: 'PublishIssue';\n message: Scalars['String']['output'];\n node?: Maybe<PublishIssueNode>;\n severity: Scalars['String']['output'];\n};\n\nexport type PublishIssueNode = {\n __typename?: 'PublishIssueNode';\n fieldType?: Maybe<Scalars['String']['output']>;\n key: Scalars['String']['output'];\n name?: Maybe<Scalars['String']['output']>;\n parentApiIdentifier?: Maybe<Scalars['String']['output']>;\n parentKey?: Maybe<Scalars['String']['output']>;\n type: Scalars['String']['output'];\n};\n\nexport type PublishStatusState = {\n __typename?: 'PublishStatusState';\n issues: Array<PublishIssue>;\n progress: Scalars['String']['output'];\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n apiUpgradeConvergePlan?: Maybe<ApiUpgradeConvergePlanResult>;\n currentUser: User;\n environmentTreeChildKeys: Array<Scalars['String']['output']>;\n environmentTreePath?: Maybe<Scalars['JSON']['output']>;\n fileSyncComparisonHashes: FileSyncComparisonHashes;\n fileSyncFiles: FileSyncFiles;\n fileSyncHashes: FileSyncHashes;\n identifySupportConversation?: Maybe<IdentifySupportConversationResult>;\n /** @deprecated use team */\n listContributors: Array<ContributorResult>;\n logsSearch: LogSearchResult;\n remoteFilesVersion: Scalars['String']['output'];\n roles: Array<GadgetRole>;\n runTestSupportFunction?: Maybe<Scalars['JSON']['output']>;\n team: TeamResult;\n typesManifest: TypesManifest;\n};\n\n\nexport type QueryApiUpgradeConvergePlanArgs = {\n currentVersion: Scalars['String']['input'];\n targetVersion: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreeChildKeysArgs = {\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreePathArgs = {\n hydrateChildrenGlobs?: InputMaybe<Array<Scalars['String']['input']>>;\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryFileSyncComparisonHashesArgs = {\n filesVersion: Scalars['String']['input'];\n};\n\n\nexport type QueryFileSyncFilesArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n filesVersion?: InputMaybe<Scalars['String']['input']>;\n paths: Array<Scalars['String']['input']>;\n};\n\n\nexport type QueryFileSyncHashesArgs = {\n filesVersion?: InputMaybe<Scalars['String']['input']>;\n};\n\n\nexport type QueryLogsSearchArgs = {\n direction?: InputMaybe<Scalars['String']['input']>;\n end?: InputMaybe<Scalars['DateTime']['input']>;\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n step?: InputMaybe<Scalars['Int']['input']>;\n};\n\n\nexport type QueryTypesManifestArgs = {\n dependenciesHash: Scalars['String']['input'];\n environmentStatus?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type RefreshScopesResult = {\n __typename?: 'RefreshScopesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RegisterWebhooksResult = {\n __typename?: 'RegisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RemoteFileSyncEvents = {\n __typename?: 'RemoteFileSyncEvents';\n changed: Array<FileSyncChangedEvent>;\n deleted: Array<FileSyncDeletedEvent>;\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type RemoveContributorResult = {\n __typename?: 'RemoveContributorResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type SendAppInvitationResult = {\n __typename?: 'SendAppInvitationResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type SetFrameworkVersionResult = {\n __typename?: 'SetFrameworkVersionResult';\n installDependenciesOperationKey?: Maybe<Scalars['String']['output']>;\n};\n\nexport type Subscription = {\n __typename?: 'Subscription';\n environmentTreePathPatches?: Maybe<EnvironmentSubscriptionResult>;\n logsSearch: LogSearchResult;\n publishStatus?: Maybe<PublishStatusState>;\n remoteFileSyncEvents: RemoteFileSyncEvents;\n reportClientPresence?: Maybe<Scalars['Boolean']['output']>;\n typesManifestStream: TypesManifest;\n};\n\n\nexport type SubscriptionEnvironmentTreePathPatchesArgs = {\n clientID: EnvironmentTreeClientId;\n path: Scalars['String']['input'];\n};\n\n\nexport type SubscriptionLogsSearchArgs = {\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n};\n\n\nexport type SubscriptionPublishStatusArgs = {\n force?: InputMaybe<Scalars['Boolean']['input']>;\n localFilesVersion: Scalars['String']['input'];\n};\n\n\nexport type SubscriptionRemoteFileSyncEventsArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n localFilesVersion: Scalars['String']['input'];\n};\n\n\nexport type SubscriptionReportClientPresenceArgs = {\n clientID: EnvironmentTreeClientId;\n};\n\nexport type TeamEntitlements = {\n __typename?: 'TeamEntitlements';\n openAICredits?: Maybe<Scalars['Boolean']['output']>;\n};\n\nexport type TeamMember = {\n __typename?: 'TeamMember';\n contributesToApp: Scalars['Boolean']['output'];\n email: Scalars['String']['output'];\n};\n\nexport type TeamResult = {\n __typename?: 'TeamResult';\n availableSeats?: Maybe<Scalars['Int']['output']>;\n canPublish: Scalars['Boolean']['output'];\n costPerApplication?: Maybe<Scalars['String']['output']>;\n costPerSeat?: Maybe<Scalars['String']['output']>;\n includedApplications?: Maybe<Scalars['Int']['output']>;\n includedApplicationsRemaining?: Maybe<Scalars['Int']['output']>;\n maxApplications?: Maybe<Scalars['Int']['output']>;\n teamEntitlements: TeamEntitlements;\n teamMembers: Array<TeamMember>;\n};\n\nexport type TypeManifestEntry = {\n __typename?: 'TypeManifestEntry';\n declaration: Scalars['String']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type TypesManifest = {\n __typename?: 'TypesManifest';\n cdn: Array<Scalars['String']['output']>;\n dependenciesHash: Scalars['String']['output'];\n entries: Array<TypeManifestEntry>;\n environmentVersion: Scalars['Int']['output'];\n};\n\nexport type UninstallShopResult = {\n __typename?: 'UninstallShopResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type UnregisterWebhooksResult = {\n __typename?: 'UnregisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type UploadFile = {\n file: Scalars['Upload']['input'];\n path: Scalars['String']['input'];\n};\n\nexport type UploadFilesResult = {\n __typename?: 'UploadFilesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type UploadTemplateAssetResult = {\n __typename?: 'UploadTemplateAssetResult';\n success: Scalars['Boolean']['output'];\n url?: Maybe<Scalars['String']['output']>;\n};\n\nexport type User = {\n __typename?: 'User';\n email: Scalars['String']['output'];\n name?: Maybe<Scalars['String']['output']>;\n};\n\nexport type RemoteFileSyncEventsSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String']['input'];\n}>;\n\n\nexport type RemoteFileSyncEventsSubscription = { __typename?: 'Subscription', remoteFileSyncEvents: { __typename?: 'RemoteFileSyncEvents', remoteFilesVersion: string, changed: Array<{ __typename?: 'FileSyncChangedEvent', path: string, mode: number, content: string, encoding: FileSyncEncoding }>, deleted: Array<{ __typename?: 'FileSyncDeletedEvent', path: string }> } };\n\nexport type RemoteFilesVersionQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type RemoteFilesVersionQuery = { __typename?: 'Query', remoteFilesVersion: string };\n\nexport type PublishFileSyncEventsMutationVariables = Exact<{\n input: PublishFileSyncEventsInput;\n}>;\n\n\nexport type PublishFileSyncEventsMutation = { __typename?: 'Mutation', publishFileSyncEvents: { __typename?: 'PublishFileSyncEventsResult', remoteFilesVersion: string } };\n\nexport type FileSyncFilesQueryVariables = Exact<{\n paths: Array<Scalars['String']['input']> | Scalars['String']['input'];\n filesVersion?: InputMaybe<Scalars['String']['input']>;\n encoding?: InputMaybe<FileSyncEncoding>;\n}>;\n\n\nexport type FileSyncFilesQuery = { __typename?: 'Query', fileSyncFiles: { __typename?: 'FileSyncFiles', filesVersion: string, files: Array<{ __typename?: 'FileSyncFile', path: string, mode: number, content: string, encoding: FileSyncEncoding }> } };\n\nexport type FileSyncHashesQueryVariables = Exact<{\n filesVersion?: InputMaybe<Scalars['String']['input']>;\n}>;\n\n\nexport type FileSyncHashesQuery = { __typename?: 'Query', fileSyncHashes: { __typename?: 'FileSyncHashes', filesVersion: string, hashes: { [key: string]: any } } };\n\nexport type FileSyncComparisonHashesQueryVariables = Exact<{\n filesVersion: Scalars['String']['input'];\n}>;\n\n\nexport type FileSyncComparisonHashesQuery = { __typename?: 'Query', fileSyncComparisonHashes: { __typename?: 'FileSyncComparisonHashes', filesVersionHashes: { __typename?: 'FileSyncHashes', filesVersion: string, hashes: { [key: string]: any } }, latestFilesVersionHashes: { __typename?: 'FileSyncHashes', filesVersion: string, hashes: { [key: string]: any } } } };\n\nexport type PublishStatusSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String']['input'];\n force?: InputMaybe<Scalars['Boolean']['input']>;\n}>;\n\n\nexport type PublishStatusSubscription = { __typename?: 'Subscription', publishStatus?: { __typename?: 'PublishStatusState', remoteFilesVersion: string, progress: string, issues: Array<{ __typename?: 'PublishIssue', severity: string, message: string, node?: { __typename?: 'PublishIssueNode', type: string, key: string, name?: string | null, fieldType?: string | null, parentKey?: string | null, parentApiIdentifier?: string | null } | null }> } | null };\n"],"names":["FileSyncEncoding"],"mappings":"AAAA;;;;;;CAMC;UAyHWA;;;GAAAA,qBAAAA"}
@@ -0,0 +1,232 @@
1
+ import chalk from "chalk";
2
+ import ora from "ora";
3
+ import { AppArg } from "../services/app/arg.js";
4
+ import { REMOTE_SERVER_CONTRACT_STATUS_SUBSCRIPTION } from "../services/app/edit-graphql.js";
5
+ import { FileSync } from "../services/filesync/filesync.js";
6
+ import { isEqualHashes } from "../services/filesync/hashes.js";
7
+ import { select } from "../services/output/prompt.js";
8
+ import { sprint } from "../services/output/sprint.js";
9
+ import { getUserOrLogin } from "../services/user/user.js";
10
+ import { isCloseEvent, isGraphQLErrors } from "../services/util/is.js";
11
+ export const usage = ()=>sprint`
12
+ Deploy your Gadget application's development source code to production.
13
+
14
+ {bold USAGE}
15
+ ggt deploy [DIRECTORY] [--app=<name>]
16
+
17
+ {bold ARGUMENTS}
18
+ DIRECTORY The directory to sync files to and deploy (default: ".")
19
+
20
+ {bold FLAGS}
21
+ -a, --app=<name> The Gadget application to deploy
22
+ --force Deploy the Gadget application regardless of any issues it may have
23
+
24
+ {bold DESCRIPTION}
25
+ Deploy allows you to deploy your current Gadget application in development to production.
26
+
27
+ It detects if local files are up to date with remote and if the Gadget application
28
+ is in a deployable state. If there are any issues, it will display them and ask if
29
+ you would like to deploy anyways.
30
+
31
+ Note:
32
+ • If local files are not up to date or have not recently been synced with remote ones,
33
+ you will be prompted to run a one-time sync to ensure the files remain consistent with
34
+ what is on the remote.
35
+ • You may wish to keep ggt sync running in the background before trying to run ggt deploy
36
+
37
+ {bold EXAMPLE}
38
+ $ ggt deploy ~/gadget/example --app example
39
+
40
+ App example
41
+ Editor https://example.gadget.app/edit
42
+ Playground https://example.gadget.app/api/graphql/playground
43
+ Docs https://docs.gadget.dev/api/example
44
+
45
+ Endpoints
46
+ • https://example.gadget.app
47
+ • https://example--development.gadget.app
48
+
49
+
50
+ Building frontend assets ...
51
+ ✔ DONE
52
+
53
+ Setting up database ...
54
+ ✔ DONE
55
+
56
+ Copying development ...
57
+ ✔ DONE
58
+
59
+ Restarting app ...
60
+ ✔ DONE
61
+
62
+ Deploy completed. Good bye!
63
+ `;
64
+ export const args = {
65
+ "--app": {
66
+ type: AppArg,
67
+ alias: "-a"
68
+ },
69
+ "--force": Boolean
70
+ };
71
+ export var Action;
72
+ (function(Action) {
73
+ Action["DEPLOY_ANYWAYS"] = "Deploy anyways";
74
+ Action["SYNC_ONCE"] = "Sync once";
75
+ Action["CANCEL"] = "Cancel (Ctrl+C)";
76
+ })(Action || (Action = {}));
77
+ const AppDeploymentStepsToAppDeployState = (step)=>{
78
+ switch(step){
79
+ case "NOT_STARTED":
80
+ return "Deploy not started";
81
+ case "STARTING":
82
+ case "BUILDING_ASSETS":
83
+ case "UPLOADING_ASSETS":
84
+ return "Building frontend assets";
85
+ case "CONVERGING_STORAGE":
86
+ return "Setting up database";
87
+ case "PUBLISHING_TREE":
88
+ return "Copying development";
89
+ case "RELOADING_SANDBOX":
90
+ return "Restarting app";
91
+ case "COMPLETED":
92
+ return "Deploy completed";
93
+ default:
94
+ return "Unknown step";
95
+ }
96
+ };
97
+ var AppDeploymentSteps;
98
+ (function(AppDeploymentSteps) {
99
+ AppDeploymentSteps["NOT_STARTED"] = "NOT_STARTED";
100
+ AppDeploymentSteps["STARTING"] = "STARTING";
101
+ AppDeploymentSteps["BUILDING_ASSETS"] = "BUILDING_ASSETS";
102
+ AppDeploymentSteps["UPLOADING_ASSETS"] = "UPLOADING_ASSETS";
103
+ AppDeploymentSteps["CONVERGING_STORAGE"] = "CONVERGING_STORAGE";
104
+ AppDeploymentSteps["PUBLISHING_TREE"] = "PUBLISHING_TREE";
105
+ AppDeploymentSteps["RELOADING_SANDBOX"] = "RELOADING_SANDBOX";
106
+ AppDeploymentSteps["COMPLETED"] = "COMPLETED";
107
+ })(AppDeploymentSteps || (AppDeploymentSteps = {}));
108
+ /**
109
+ * Runs the deploy process.
110
+ */ export const command = async (ctx, firstRun = true)=>{
111
+ const spinner = ora();
112
+ let prevProgress = AppDeploymentStepsToAppDeployState("NOT_STARTED");
113
+ let action;
114
+ const filesync = await FileSync.init({
115
+ user: await getUserOrLogin(),
116
+ dir: ctx.args._[0],
117
+ app: ctx.args["--app"]
118
+ });
119
+ const log = filesync.log.extend("deploy");
120
+ if (firstRun) {
121
+ log.printlns`App: ${filesync.app.slug}`;
122
+ }
123
+ const { localHashes, gadgetHashes } = await filesync._getHashes();
124
+ const upToDate = isEqualHashes(localHashes, gadgetHashes);
125
+ if (!upToDate) {
126
+ log.printlns`
127
+ Local files have diverged from remote. Run a sync once to converge your files or keep {italic ggt sync} running in the background.
128
+ `;
129
+ action = await select({
130
+ message: "How would you like to proceed?",
131
+ choices: [
132
+ "Cancel (Ctrl+C)",
133
+ "Sync once"
134
+ ]
135
+ });
136
+ switch(action){
137
+ case "Sync once":
138
+ {
139
+ await filesync.sync();
140
+ break;
141
+ }
142
+ case "Cancel (Ctrl+C)":
143
+ {
144
+ process.exit(0);
145
+ }
146
+ }
147
+ }
148
+ // subscribes to the graphql subscription that will listen and send back the server contract status
149
+ const unsubscribe = filesync.editGraphQL.subscribe({
150
+ query: REMOTE_SERVER_CONTRACT_STATUS_SUBSCRIPTION,
151
+ variables: ()=>({
152
+ localFilesVersion: String(filesync.filesVersion),
153
+ force: ctx.args["--force"]
154
+ }),
155
+ onError: (error)=>{
156
+ if (isCloseEvent(error.cause)) {
157
+ spinner.fail("Failed");
158
+ log.printlns(error.message);
159
+ } else if (isGraphQLErrors(error.cause)) {
160
+ const message = error.cause[0]?.message;
161
+ if (message && message.includes("GGT_PAYMENT_REQUIRED")) {
162
+ log.println("Production environment limit reached. Upgrade your plan to deploy");
163
+ } else {
164
+ log.println(`${message}`);
165
+ }
166
+ }
167
+ log.error("failed to deploy", {
168
+ error
169
+ });
170
+ unsubscribe();
171
+ return;
172
+ },
173
+ onData: async ({ publishStatus })=>{
174
+ const { progress, issues } = publishStatus ?? {};
175
+ const hasIssues = issues?.length;
176
+ if (firstRun && hasIssues) {
177
+ log.printlns`{underline Issues detected}`;
178
+ for (const issue of issues){
179
+ const message = issue.message.replace(/"/g, "");
180
+ const nodeType = issue.node?.type;
181
+ const nodeName = issue.node?.name;
182
+ const nodeParent = issue.node?.parentApiIdentifier;
183
+ log.printlns(`
184
+ • ${message}
185
+ ${nodeType ? `${nodeType}: ${chalk.cyan(nodeName)}` : ""} ${nodeParent ? `ParentResource: ${chalk.cyan(nodeParent)}` : ""}
186
+ `.trim());
187
+ }
188
+ if (!ctx.args["--force"]) {
189
+ unsubscribe();
190
+ action = await select({
191
+ message: "Detected some issues with your app. How would you like to proceed?",
192
+ choices: [
193
+ "Cancel (Ctrl+C)",
194
+ "Deploy anyways"
195
+ ]
196
+ });
197
+ switch(action){
198
+ case "Deploy anyways":
199
+ {
200
+ ctx.args["--force"] = true;
201
+ await command(ctx, false);
202
+ break;
203
+ }
204
+ case "Cancel (Ctrl+C)":
205
+ {
206
+ process.exit(0);
207
+ }
208
+ }
209
+ }
210
+ firstRun = false;
211
+ } else {
212
+ if (progress === "COMPLETED") {
213
+ spinner.succeed("DONE");
214
+ log.printlns("Deploy completed. Good bye!");
215
+ unsubscribe();
216
+ return;
217
+ }
218
+ const currentProgress = AppDeploymentStepsToAppDeployState(progress);
219
+ if (progress && currentProgress !== prevProgress) {
220
+ if (progress !== "STARTING") {
221
+ spinner.succeed("DONE");
222
+ }
223
+ prevProgress = currentProgress;
224
+ log.printlns(`${currentProgress} ...`);
225
+ spinner.start("Working ...");
226
+ }
227
+ }
228
+ }
229
+ });
230
+ };
231
+
232
+ //# sourceMappingURL=deploy.js.map