@gadgetinc/ggt 0.1.13 → 0.1.15
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.
- package/README.md +33 -5
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/help.js +1 -1
- package/lib/commands/help.js.map +1 -1
- package/lib/commands/list.d.ts +17 -0
- package/lib/commands/list.js +71 -0
- package/lib/commands/list.js.map +1 -0
- package/lib/commands/login.js +1 -1
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js +1 -1
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/sync.d.ts +1 -1
- package/lib/commands/sync.js +36 -23
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/whoami.js +1 -1
- package/lib/commands/whoami.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/base-command.d.ts +3 -1
- package/lib/utils/base-command.js +27 -14
- package/lib/utils/base-command.js.map +1 -1
- package/lib/utils/client.js.map +1 -1
- package/lib/utils/context.d.ts +2 -2
- package/lib/utils/context.js +5 -5
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/errors.d.ts +3 -1
- package/lib/utils/errors.js +11 -5
- package/lib/utils/errors.js.map +1 -1
- package/lib/utils/flags.js +4 -4
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/fs-utils.d.ts +3 -0
- package/lib/utils/fs-utils.js +25 -1
- package/lib/utils/fs-utils.js.map +1 -1
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/sleep.js.map +1 -1
- package/npm-shrinkwrap.json +2447 -2108
- package/oclif.manifest.json +90 -1
- package/package.json +38 -36
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ USAGE
|
|
|
56
56
|
|
|
57
57
|
- [`ggt sync [DIRECTORY] [--app <name>]`](#ggt-sync-directory---app-name)
|
|
58
58
|
- [`ggt help [COMMAND]`](#ggt-help-command)
|
|
59
|
+
- [`ggt list`](#ggt-list)
|
|
59
60
|
- [`ggt login`](#ggt-login)
|
|
60
61
|
- [`ggt logout`](#ggt-logout)
|
|
61
62
|
- [`ggt whoami`](#ggt-whoami)
|
|
@@ -128,7 +129,7 @@ EXAMPLES
|
|
|
128
129
|
Goodbye!
|
|
129
130
|
```
|
|
130
131
|
|
|
131
|
-
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.1.
|
|
132
|
+
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/sync.ts)_
|
|
132
133
|
|
|
133
134
|
### `ggt help [COMMAND]`
|
|
134
135
|
|
|
@@ -142,7 +143,34 @@ ARGUMENTS
|
|
|
142
143
|
COMMAND The command to show help for.
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.1.
|
|
146
|
+
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/help.ts)_
|
|
147
|
+
|
|
148
|
+
### `ggt list`
|
|
149
|
+
|
|
150
|
+
List the apps available to the currently logged in user.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
USAGE
|
|
154
|
+
$ ggt list
|
|
155
|
+
|
|
156
|
+
FLAGS
|
|
157
|
+
-x, --extended show extra columns
|
|
158
|
+
--columns=<value> only show provided columns (comma-separated)
|
|
159
|
+
--csv output is csv format [alias: --output=csv]
|
|
160
|
+
--filter=<value> filter property by partial string matching, ex: name=foo
|
|
161
|
+
--no-header hide table header from output
|
|
162
|
+
--no-truncate do not truncate output to fit screen
|
|
163
|
+
--output=<option> output in a more machine friendly format
|
|
164
|
+
<options: csv|json|yaml>
|
|
165
|
+
--sort=<value> property to sort by (prepend '-' for descending)
|
|
166
|
+
|
|
167
|
+
EXAMPLES
|
|
168
|
+
$ ggt list
|
|
169
|
+
$ ggt list --extended
|
|
170
|
+
$ ggt list --sort=slug
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
_See code: [src/commands/list.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/list.ts)_
|
|
146
174
|
|
|
147
175
|
### `ggt login`
|
|
148
176
|
|
|
@@ -161,7 +189,7 @@ EXAMPLES
|
|
|
161
189
|
Hello, Jane Doe (jane@example.com)
|
|
162
190
|
```
|
|
163
191
|
|
|
164
|
-
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.1.
|
|
192
|
+
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/login.ts)_
|
|
165
193
|
|
|
166
194
|
### `ggt logout`
|
|
167
195
|
|
|
@@ -176,7 +204,7 @@ EXAMPLES
|
|
|
176
204
|
Goodbye
|
|
177
205
|
```
|
|
178
206
|
|
|
179
|
-
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.1.
|
|
207
|
+
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/logout.ts)_
|
|
180
208
|
|
|
181
209
|
### `ggt whoami`
|
|
182
210
|
|
|
@@ -191,7 +219,7 @@ EXAMPLES
|
|
|
191
219
|
You are logged in as Jane Doe (jane@example.com)
|
|
192
220
|
```
|
|
193
221
|
|
|
194
|
-
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.1.
|
|
222
|
+
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.1.15/src/commands/whoami.ts)_
|
|
195
223
|
|
|
196
224
|
<!-- commandsstop -->
|
|
197
225
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"/","sources":["__generated__/graphql.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqFH,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B","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]> };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: string;\n String: string;\n Boolean: boolean;\n Int: number;\n Float: 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: 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: any;\n JSON: { [key: string]: any };\n};\n\nexport type ChangeAppDomainResult = {\n __typename?: 'ChangeAppDomainResult';\n onlyValidate?: Maybe<Scalars['Boolean']>;\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type ContributorResult = {\n __typename?: 'ContributorResult';\n email: Scalars['String'];\n isOwner: Scalars['Boolean'];\n isPending: Scalars['Boolean'];\n};\n\nexport type DeleteAppStatusResult = {\n __typename?: 'DeleteAppStatusResult';\n isNotCreator?: Maybe<Scalars['Boolean']>;\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentPatchResult = {\n __typename?: 'EnvironmentPatchResult';\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentPublishResult = {\n __typename?: 'EnvironmentPublishResult';\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentSubscriptionResult = {\n __typename?: 'EnvironmentSubscriptionResult';\n patches: Array<Scalars['JSON']>;\n};\n\nexport type EnvironmentTreeClientId = {\n clientType: Scalars['String'];\n id: Scalars['String'];\n};\n\nexport type FileSyncChangedEvent = {\n __typename?: 'FileSyncChangedEvent';\n content: Scalars['String'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float'];\n path: Scalars['String'];\n};\n\nexport type FileSyncChangedEventInput = {\n content: Scalars['String'];\n encoding?: InputMaybe<FileSyncEncoding>;\n mode: Scalars['Float'];\n path: Scalars['String'];\n};\n\nexport type FileSyncDeletedEvent = {\n __typename?: 'FileSyncDeletedEvent';\n path: Scalars['String'];\n};\n\nexport type FileSyncDeletedEventInput = {\n path: Scalars['String'];\n};\n\nexport enum FileSyncEncoding {\n Base64 = 'base64',\n Utf8 = 'utf8'\n}\n\nexport type GadgetRole = {\n __typename?: 'GadgetRole';\n key: Scalars['String'];\n name: Scalars['String'];\n order: Scalars['Int'];\n selectable: Scalars['Boolean'];\n};\n\nexport type LogSearchResult = {\n __typename?: 'LogSearchResult';\n data: Scalars['JSON'];\n status: Scalars['String'];\n};\n\nexport type MigrateEnvironmentsResult = {\n __typename?: 'MigrateEnvironmentsResult';\n success: Scalars['Boolean'];\n};\n\nexport type Mutation = {\n __typename?: 'Mutation';\n changeAppDomain?: Maybe<ChangeAppDomainResult>;\n deleteApp?: Maybe<DeleteAppStatusResult>;\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};\n\n\nexport type MutationChangeAppDomainArgs = {\n newSubdomain: Scalars['String'];\n onlyValidate?: InputMaybe<Scalars['Boolean']>;\n};\n\n\nexport type MutationMigrateEnvironmentsArgs = {\n existingToProduction: Scalars['Boolean'];\n};\n\n\nexport type MutationPatchEnvironmentTreeArgs = {\n clientID: EnvironmentTreeClientId;\n patches: Array<Scalars['JSON']>;\n};\n\n\nexport type MutationPublishFileSyncEventsArgs = {\n input: PublishFileSyncEventsInput;\n};\n\n\nexport type MutationRefreshScopesArgs = {\n appConfigKey: Scalars['String'];\n connectionKey: Scalars['String'];\n shopId: Scalars['String'];\n};\n\n\nexport type MutationRegisterWebhooksArgs = {\n connectionKey: Scalars['String'];\n keepExtraTopics?: InputMaybe<Scalars['Boolean']>;\n modelKeys?: InputMaybe<Array<Scalars['String']>>;\n shopIds: Array<Scalars['String']>;\n};\n\n\nexport type MutationRemoveContributorArgs = {\n email: Scalars['String'];\n isInvitation: Scalars['Boolean'];\n};\n\n\nexport type MutationSendAppInvitationArgs = {\n email: Scalars['String'];\n resend?: InputMaybe<Scalars['Boolean']>;\n};\n\n\nexport type MutationUnregisterWebhooksArgs = {\n connectionKey: Scalars['String'];\n modelKeys?: InputMaybe<Array<Scalars['String']>>;\n shopIds?: InputMaybe<Array<Scalars['String']>>;\n};\n\nexport type PublishFileSyncEventsInput = {\n changed: Array<FileSyncChangedEventInput>;\n deleted: Array<FileSyncDeletedEventInput>;\n expectedRemoteFilesVersion: Scalars['String'];\n};\n\nexport type PublishFileSyncEventsResult = {\n __typename?: 'PublishFileSyncEventsResult';\n remoteFilesVersion: Scalars['String'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n currentUser: User;\n environmentTreePath?: Maybe<Scalars['JSON']>;\n listContributors: Array<ContributorResult>;\n logsSearch: LogSearchResult;\n remoteFilesVersion: Scalars['String'];\n roles: Array<GadgetRole>;\n runTestSupportFunction?: Maybe<Scalars['JSON']>;\n typesManifest: TypesManifest;\n};\n\n\nexport type QueryEnvironmentTreePathArgs = {\n path: Scalars['String'];\n};\n\n\nexport type QueryLogsSearchArgs = {\n direction?: InputMaybe<Scalars['String']>;\n end?: InputMaybe<Scalars['DateTime']>;\n limit?: InputMaybe<Scalars['Int']>;\n query: Scalars['String'];\n start?: InputMaybe<Scalars['DateTime']>;\n step?: InputMaybe<Scalars['Int']>;\n};\n\nexport type RefreshScopesResult = {\n __typename?: 'RefreshScopesResult';\n success: Scalars['Boolean'];\n};\n\nexport type RegisterWebhooksResult = {\n __typename?: 'RegisterWebhooksResult';\n success: Scalars['Boolean'];\n};\n\nexport type RemoteFileSyncEvents = {\n __typename?: 'RemoteFileSyncEvents';\n changed: Array<FileSyncChangedEvent>;\n deleted: Array<FileSyncDeletedEvent>;\n remoteFilesVersion: Scalars['String'];\n};\n\nexport type RemoveContributorResult = {\n __typename?: 'RemoveContributorResult';\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type SendAppInvitationResult = {\n __typename?: 'SendAppInvitationResult';\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type Subscription = {\n __typename?: 'Subscription';\n editorActive?: Maybe<Scalars['Boolean']>;\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'];\n};\n\n\nexport type SubscriptionLogsSearchArgs = {\n limit?: InputMaybe<Scalars['Int']>;\n query: Scalars['String'];\n start?: InputMaybe<Scalars['DateTime']>;\n};\n\n\nexport type SubscriptionRemoteFileSyncEventsArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n localFilesVersion: Scalars['String'];\n};\n\nexport type TypeManifestEntry = {\n __typename?: 'TypeManifestEntry';\n declaration: Scalars['String'];\n path: Scalars['String'];\n};\n\nexport type TypesManifest = {\n __typename?: 'TypesManifest';\n dependenciesHash: Scalars['String'];\n entries: Array<TypeManifestEntry>;\n environmentVersion: Scalars['Int'];\n};\n\nexport type UnregisterWebhooksResult = {\n __typename?: 'UnregisterWebhooksResult';\n success: Scalars['Boolean'];\n};\n\nexport type User = {\n __typename?: 'User';\n email: Scalars['String'];\n name?: Maybe<Scalars['String']>;\n};\n\nexport type RemoteFileSyncEventsSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String'];\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"]}
|
package/lib/commands/help.js
CHANGED
|
@@ -15,7 +15,6 @@ class HelpCommand extends core_1.Command {
|
|
|
15
15
|
await help.showHelp(argv);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
exports.default = HelpCommand;
|
|
19
18
|
Object.defineProperty(HelpCommand, "strict", {
|
|
20
19
|
enumerable: true,
|
|
21
20
|
configurable: true,
|
|
@@ -39,4 +38,5 @@ Object.defineProperty(HelpCommand, "args", {
|
|
|
39
38
|
}),
|
|
40
39
|
}
|
|
41
40
|
});
|
|
41
|
+
exports.default = HelpCommand;
|
|
42
42
|
//# sourceMappingURL=help.js.map
|
package/lib/commands/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"/","sources":["commands/help.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,iEAAiC;AAEjC;;;;GAIG;AACH,MAAqB,WAAY,SAAQ,cAAO;IAY9C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,IAAI,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAgB,CAAC,CAAC;IACxC,CAAC;;AAfe;;;;WAAS,KAAK;GAAC;AAEf;;;;WAAU,uBAAuB;GAAC;AAElC;;;;WAAO;QACrB,OAAO,EAAE,WAAI,CAAC,MAAM,CAAC;YACnB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+BAA+B;SAC7C,CAAC;KACH;GAAC;kBAViB,WAAW","sourcesContent":["import { Args, Command } from \"@oclif/core\";\nimport Help from \"../utils/help\";\n\n/**\n * Copied from @oclif/plugin-help. Uses our own {@link Help} template class instead of the one from @oclif/core.\n *\n * @see https://github.com/oclif/plugin-help/blob/67b580570257b45e92d3a04d50bf2a432c59afe3/src/commands/help.ts\n */\nexport default class HelpCommand extends Command {\n static override strict = false;\n\n static override summary = \"Display help for ggt.\";\n\n static override args = {\n command: Args.string({\n required: false,\n description: \"The command to show help for.\",\n }),\n };\n\n async run(): Promise<void> {\n const { argv } = await this.parse();\n const help = new Help(this.config, { all: true });\n await help.showHelp(argv as string[]);\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from "../utils/base-command";
|
|
2
|
+
export default class List extends BaseCommand<typeof List> {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static usage: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
columns: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
+
filter: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
csv: import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
11
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
extended: import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
13
|
+
'no-truncate': import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
14
|
+
'no-header': import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const ts_dedent_1 = tslib_1.__importDefault(require("ts-dedent"));
|
|
7
|
+
const base_command_1 = require("../utils/base-command");
|
|
8
|
+
const context_1 = require("../utils/context");
|
|
9
|
+
class List extends base_command_1.BaseCommand {
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(List);
|
|
12
|
+
const user = await context_1.context.getUser();
|
|
13
|
+
if (!user) {
|
|
14
|
+
this.error("You are not logged in -- no apps available", { exit: 1 });
|
|
15
|
+
}
|
|
16
|
+
const apps = await context_1.context.getAvailableApps();
|
|
17
|
+
if (apps.length === 0 && !flags.csv) {
|
|
18
|
+
this.log("No apps found");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
core_1.ux.table(apps, {
|
|
22
|
+
id: {
|
|
23
|
+
header: "ID",
|
|
24
|
+
extended: true,
|
|
25
|
+
},
|
|
26
|
+
slug: {
|
|
27
|
+
header: "Slug",
|
|
28
|
+
},
|
|
29
|
+
primaryDomain: {
|
|
30
|
+
header: "Domain",
|
|
31
|
+
},
|
|
32
|
+
}, {
|
|
33
|
+
printLine: this.log.bind(this),
|
|
34
|
+
...flags, // parsed flags
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
Object.defineProperty(List, "summary", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: "List the apps available to the currently logged in user."
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(List, "usage", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: "list"
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(List, "examples", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: [
|
|
55
|
+
(0, ts_dedent_1.default)((0, chalk_1.default) `
|
|
56
|
+
{gray $ ggt list}
|
|
57
|
+
{gray $ ggt list --extended}
|
|
58
|
+
{gray $ ggt list --sort=slug}
|
|
59
|
+
`),
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(List, "flags", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: {
|
|
67
|
+
...core_1.ux.table.flags(),
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
exports.default = List;
|
|
71
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"/","sources":["commands/list.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,sCAAiC;AACjC,kEAA+B;AAC/B,wDAAoD;AAEpD,8CAA2C;AAE3C,MAAqB,IAAK,SAAQ,0BAAwB;IAiBxD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,iBAAO,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,CAAC,KAAK,CAAC,4CAA4C,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;SACvE;QACD,MAAM,IAAI,GAAG,MAAM,iBAAO,CAAC,gBAAgB,EAAE,CAAC;QAE9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;YACnC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC1B,OAAO;SACR;QAED,SAAE,CAAC,KAAK,CACN,IAAkD,EAClD;YACE,EAAE,EAAE;gBACF,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,IAAI;aACf;YACD,IAAI,EAAE;gBACJ,MAAM,EAAE,MAAM;aACf;YACD,aAAa,EAAE;gBACb,MAAM,EAAE,QAAQ;aACjB;SACF,EACD;YACE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9B,GAAG,KAAK,EAAE,eAAe;SAC1B,CACF,CAAC;IACJ,CAAC;;AAhDe;;;;WAAU,0DAA0D;GAAC;AAErE;;;;WAAQ,MAAM;GAAC;AAEf;;;;WAAW;QACzB,IAAA,mBAAM,EAAC,IAAA,eAAK,EAAA;;;;KAIX,CAAC;KACH;GAAC;AAEc;;;;WAAQ;QACtB,GAAG,SAAE,CAAC,KAAK,CAAC,KAAK,EAAE;KACpB;GAAC;kBAfiB,IAAI","sourcesContent":["import chalk from \"chalk\";\nimport { ux } from \"@oclif/core\";\nimport dedent from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command\";\nimport type { App } from \"../utils/context\";\nimport { context } from \"../utils/context\";\n\nexport default class List extends BaseCommand<typeof List> {\n static override summary = \"List the apps available to the currently logged in user.\";\n\n static override usage = \"list\";\n\n static override examples = [\n dedent(chalk`\n {gray $ ggt list}\n {gray $ ggt list --extended}\n {gray $ ggt list --sort=slug}\n `),\n ];\n\n static override flags = {\n ...ux.table.flags(),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n const user = await context.getUser();\n if (!user) {\n this.error(\"You are not logged in -- no apps available\", { exit: 1 });\n }\n const apps = await context.getAvailableApps();\n\n if (apps.length === 0 && !flags.csv) {\n this.log(\"No apps found\");\n return;\n }\n\n ux.table<App & Record<string, never>>(\n apps as unknown as (App & Record<string, never>)[],\n {\n id: {\n header: \"ID\",\n extended: true,\n },\n slug: {\n header: \"Slug\",\n },\n primaryDomain: {\n header: \"Domain\",\n },\n },\n {\n printLine: this.log.bind(this),\n ...flags, // parsed flags\n }\n );\n }\n}\n"]}
|
package/lib/commands/login.js
CHANGED
|
@@ -9,7 +9,6 @@ class Login extends base_command_1.BaseCommand {
|
|
|
9
9
|
await this.login();
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
exports.default = Login;
|
|
13
12
|
Object.defineProperty(Login, "summary", {
|
|
14
13
|
enumerable: true,
|
|
15
14
|
configurable: true,
|
|
@@ -37,4 +36,5 @@ Object.defineProperty(Login, "examples", {
|
|
|
37
36
|
`),
|
|
38
37
|
]
|
|
39
38
|
});
|
|
39
|
+
exports.default = Login;
|
|
40
40
|
//# sourceMappingURL=login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"/","sources":["commands/login.ts"],"names":[],"mappings":";;;AAAA,kEAA+B;AAC/B,wDAAoD;AACpD,0DAA0B;AAE1B,MAAqB,KAAM,SAAQ,0BAAyB;IAgB1D,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;;AAjBe;;;;WAAU,yBAAyB;GAAC;AAEpC;;;;WAAQ,OAAO;GAAC;AAEhB;;;;WAAW;QACzB,IAAA,mBAAM,EAAC,IAAA,eAAK,EAAA;;;;;;;KAOX,CAAC;KACH;GAAC;kBAdiB,KAAK","sourcesContent":["import dedent from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command\";\nimport chalk from \"chalk\";\n\nexport default class Login extends BaseCommand<typeof Login> {\n static override summary = \"Log in to your account.\";\n\n static override usage = \"login\";\n\n static override examples = [\n dedent(chalk`\n {gray $ ggt login}\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\n\n Hello, Jane Doe {gray (jane@example.com)}\n `),\n ];\n\n async run(): Promise<void> {\n await this.login();\n }\n}\n"]}
|
package/lib/commands/logout.js
CHANGED
|
@@ -17,7 +17,6 @@ class Logout extends base_command_1.BaseCommand {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
exports.default = Logout;
|
|
21
20
|
Object.defineProperty(Logout, "summary", {
|
|
22
21
|
enumerable: true,
|
|
23
22
|
configurable: true,
|
|
@@ -41,4 +40,5 @@ Object.defineProperty(Logout, "examples", {
|
|
|
41
40
|
`),
|
|
42
41
|
]
|
|
43
42
|
});
|
|
43
|
+
exports.default = Logout;
|
|
44
44
|
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"/","sources":["commands/logout.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,kEAA+B;AAC/B,wDAAoD;AACpD,8CAA2C;AAE3C,MAAqB,MAAO,SAAQ,0BAA0B;IAY5D,4DAA4D;IAC5D,KAAK,CAAC,GAAG;QACP,IAAI,iBAAO,CAAC,OAAO,EAAE;YACnB,iBAAO,CAAC,OAAO,GAAG,SAAS,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SACrB;aAAM;YACL,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;SACnC;IACH,CAAC;;AAnBe;;;;WAAU,0BAA0B;GAAC;AAErC;;;;WAAQ,QAAQ;GAAC;AAEjB;;;;WAAW;QACzB,IAAA,mBAAM,EAAC,IAAA,eAAK,EAAA;;;KAGX,CAAC;KACH;GAAC;kBAViB,MAAM","sourcesContent":["import chalk from \"chalk\";\nimport dedent from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command\";\nimport { context } from \"../utils/context\";\n\nexport default class Logout extends BaseCommand<typeof Logout> {\n static override summary = \"Log out of your account.\";\n\n static override usage = \"logout\";\n\n static override examples = [\n dedent(chalk`\n {gray $ ggt logout}\n Goodbye\n `),\n ];\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async run(): Promise<void> {\n if (context.session) {\n context.session = undefined;\n this.log(\"Goodbye\");\n } else {\n this.log(\"You are not logged in\");\n }\n }\n}\n"]}
|
package/lib/commands/sync.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export default class Sync extends BaseCommand<typeof Sync> {
|
|
|
41
41
|
markFinished: () => void;
|
|
42
42
|
relative(to: string): string;
|
|
43
43
|
absolute(...pathSegments: string[]): string;
|
|
44
|
-
normalize(filepath: string): string;
|
|
44
|
+
normalize(filepath: string, isDirectory?: boolean): string;
|
|
45
45
|
logPaths(prefix: string, changed: string[], deleted: string[], { limit }?: {
|
|
46
46
|
limit?: number | undefined;
|
|
47
47
|
}): void;
|
package/lib/commands/sync.js
CHANGED
|
@@ -119,8 +119,8 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
119
119
|
absolute(...pathSegments) {
|
|
120
120
|
return path_1.default.resolve(this.dir, ...pathSegments);
|
|
121
121
|
}
|
|
122
|
-
normalize(filepath) {
|
|
123
|
-
return (0, normalize_path_1.default)(path_1.default.isAbsolute(filepath) ? this.relative(filepath) : filepath);
|
|
122
|
+
normalize(filepath, isDirectory = false) {
|
|
123
|
+
return (0, normalize_path_1.default)(`${path_1.default.isAbsolute(filepath) ? this.relative(filepath) : filepath}${isDirectory ? "/" : ""}`, false);
|
|
124
124
|
}
|
|
125
125
|
logPaths(prefix, changed, deleted, { limit = 10 } = {}) {
|
|
126
126
|
const lines = (0, lodash_1.sortBy)([
|
|
@@ -326,13 +326,22 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
326
326
|
}
|
|
327
327
|
this.log((0, chalk_1.default) `Received {gray ${(0, format_1.default)(new Date(), "pp")}}`);
|
|
328
328
|
this.logPaths("←", changed.map((x) => x.path).filter((x) => remoteFiles.has(x)), deleted.map((x) => x.path).filter((x) => remoteFiles.has(x)));
|
|
329
|
-
await (0, p_map_1.default)(
|
|
330
|
-
|
|
329
|
+
const handleFiles = async (files) => await (0, p_map_1.default)(files, async (file) => {
|
|
330
|
+
if (!remoteFiles.has(file.path)) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const filepath = this.absolute(file.path);
|
|
331
334
|
this.recentWrites.add(filepath);
|
|
332
335
|
if ("content" in file) {
|
|
333
|
-
await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath), { mode: 0o755 });
|
|
334
336
|
if (!file.path.endsWith("/")) {
|
|
335
|
-
|
|
337
|
+
this.recentWrites.add(path_1.default.dirname(filepath));
|
|
338
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath), { mode: 0o755 });
|
|
339
|
+
await fs_extra_1.default.writeFile(filepath, Buffer.from(file.content, file.encoding ?? graphql_1.FileSyncEncoding.Utf8), {
|
|
340
|
+
mode: file.mode,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
await fs_extra_1.default.ensureDir(filepath, { mode: 0o755 });
|
|
336
345
|
}
|
|
337
346
|
if (filepath == this.absolute("yarn.lock")) {
|
|
338
347
|
await (0, execa_1.default)("yarn", ["install"], { cwd: this.dir }).catch((err) => {
|
|
@@ -348,6 +357,9 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
348
357
|
this.ignorer.reload();
|
|
349
358
|
}
|
|
350
359
|
}, { stopOnError: false });
|
|
360
|
+
// we need to processed deleted files first as we may delete an empty directory once a file has been put into it. if processed out of order the new file is deleted as well
|
|
361
|
+
await handleFiles(deleted);
|
|
362
|
+
await handleFiles(changed);
|
|
351
363
|
this.debug("updated local files version from %s to %s", this.metadata.filesVersion, remoteFilesVersion);
|
|
352
364
|
this.metadata.filesVersion = remoteFilesVersion;
|
|
353
365
|
})
|
|
@@ -363,12 +375,15 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
363
375
|
const changed = [];
|
|
364
376
|
const deleted = [];
|
|
365
377
|
await (0, p_map_1.default)(localFiles, async ([filepath, file]) => {
|
|
366
|
-
if (file) {
|
|
378
|
+
if ("isDeleted" in file) {
|
|
379
|
+
deleted.push({ path: this.normalize(filepath, file.isDirectory) });
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
367
382
|
try {
|
|
368
383
|
changed.push({
|
|
369
|
-
path: this.normalize(filepath),
|
|
384
|
+
path: this.normalize(filepath, file.isDirectory),
|
|
370
385
|
mode: file.mode,
|
|
371
|
-
content: await fs_extra_1.default.readFile(filepath, "base64"),
|
|
386
|
+
content: file.isDirectory ? "" : await fs_extra_1.default.readFile(filepath, "base64"),
|
|
372
387
|
encoding: graphql_1.FileSyncEncoding.Base64,
|
|
373
388
|
});
|
|
374
389
|
}
|
|
@@ -378,9 +393,6 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
378
393
|
(0, fs_utils_1.ignoreEnoent)(error);
|
|
379
394
|
}
|
|
380
395
|
}
|
|
381
|
-
else {
|
|
382
|
-
deleted.push({ path: this.normalize(filepath) });
|
|
383
|
-
}
|
|
384
396
|
}, { stopOnError: false });
|
|
385
397
|
if (changed.length > 0 || deleted.length > 0) {
|
|
386
398
|
const data = await this.client.queryUnwrap({
|
|
@@ -404,10 +416,6 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
404
416
|
.on("error", (error) => void this.stop(error))
|
|
405
417
|
.on("all", (event, filepath, stats) => {
|
|
406
418
|
const relativePath = this.relative(filepath);
|
|
407
|
-
if (event === "addDir" || event === "unlinkDir") {
|
|
408
|
-
this.debug("skipping event caused by directory %s", relativePath);
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
419
|
if (stats?.isSymbolicLink?.()) {
|
|
412
420
|
this.debug("skipping event caused by symlink %s", relativePath);
|
|
413
421
|
return;
|
|
@@ -428,15 +436,20 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
428
436
|
this.debug("skipping event caused by recent write %s", relativePath);
|
|
429
437
|
return;
|
|
430
438
|
}
|
|
431
|
-
this.debug("file changed %s", relativePath);
|
|
439
|
+
this.debug("file changed %s", relativePath, event);
|
|
432
440
|
switch (event) {
|
|
433
441
|
case "add":
|
|
434
442
|
case "change":
|
|
435
443
|
(0, assert_1.default)(stats, "missing stats on add/change event");
|
|
436
|
-
localFilesBuffer.set(filepath, { mode: stats.mode, mtime: stats.mtime.getTime() });
|
|
444
|
+
localFilesBuffer.set(filepath, { mode: stats.mode, mtime: stats.mtime.getTime(), isDirectory: false });
|
|
437
445
|
break;
|
|
446
|
+
case "addDir":
|
|
447
|
+
(0, assert_1.default)(stats, "missing stats on addDir event");
|
|
448
|
+
localFilesBuffer.set(filepath, { mode: stats.mode, mtime: stats.mtime.getTime(), isDirectory: true });
|
|
449
|
+
break;
|
|
450
|
+
case "unlinkDir":
|
|
438
451
|
case "unlink":
|
|
439
|
-
localFilesBuffer.set(filepath,
|
|
452
|
+
localFilesBuffer.set(filepath, { isDeleted: true, isDirectory: event === "unlinkDir" });
|
|
440
453
|
break;
|
|
441
454
|
}
|
|
442
455
|
this.publish();
|
|
@@ -448,17 +461,17 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
448
461
|
this.log((0, ts_dedent_1.default)((0, chalk_1.default) `
|
|
449
462
|
{bold ggt v${this.config.version}}
|
|
450
463
|
|
|
451
|
-
App ${context_1.context.app.
|
|
464
|
+
App ${context_1.context.app.slug}
|
|
452
465
|
Editor https://${context_1.context.app.slug}.gadget.app/edit
|
|
453
466
|
Playground https://${context_1.context.app.slug}.gadget.app/api/graphql/playground
|
|
454
467
|
Docs https://docs.gadget.dev/api/${context_1.context.app.slug}
|
|
455
468
|
|
|
456
469
|
{underline Endpoints} ${context_1.context.app.hasSplitEnvironments
|
|
457
470
|
? `
|
|
458
|
-
- https://${context_1.context.app.
|
|
471
|
+
- https://${context_1.context.app.primaryDomain}
|
|
459
472
|
- https://${context_1.context.app.slug}--development.gadget.app`
|
|
460
473
|
: `
|
|
461
|
-
- https://${context_1.context.app.
|
|
474
|
+
- https://${context_1.context.app.primaryDomain}`}
|
|
462
475
|
|
|
463
476
|
Watching for file changes... {gray Press Ctrl+C to stop}
|
|
464
477
|
`));
|
|
@@ -473,7 +486,6 @@ class Sync extends base_command_1.BaseCommand {
|
|
|
473
486
|
}
|
|
474
487
|
}
|
|
475
488
|
}
|
|
476
|
-
exports.default = Sync;
|
|
477
489
|
Object.defineProperty(Sync, "priority", {
|
|
478
490
|
enumerable: true,
|
|
479
491
|
configurable: true,
|
|
@@ -603,6 +615,7 @@ Object.defineProperty(Sync, "examples", {
|
|
|
603
615
|
`),
|
|
604
616
|
]
|
|
605
617
|
});
|
|
618
|
+
exports.default = Sync;
|
|
606
619
|
var SyncStatus;
|
|
607
620
|
(function (SyncStatus) {
|
|
608
621
|
SyncStatus[SyncStatus["STARTING"] = 0] = "STARTING";
|