@gadgetinc/ggt 0.1.18 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/bin/dev.js +24 -0
- package/bin/run.js +11 -0
- package/lib/__generated__/graphql.js +6 -9
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/help.js +22 -37
- package/lib/commands/help.js.map +1 -1
- package/lib/commands/list.js +30 -56
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.js +13 -29
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js +17 -34
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/sync.js +483 -456
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/whoami.js +17 -34
- package/lib/commands/whoami.js.map +1 -1
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/base-command.js +106 -147
- package/lib/utils/base-command.js.map +1 -1
- package/lib/utils/client.js +104 -113
- package/lib/utils/client.js.map +1 -1
- package/lib/utils/context.js +63 -119
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/errors.js +161 -242
- package/lib/utils/errors.js.map +1 -1
- package/lib/utils/flags.js +23 -26
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/fs-utils.js +46 -73
- package/lib/utils/fs-utils.js.map +1 -1
- package/lib/utils/help.js +19 -26
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/promise.js +32 -78
- package/lib/utils/promise.js.map +1 -1
- package/lib/utils/sleep.js +6 -11
- package/lib/utils/sleep.js.map +1 -1
- package/npm-shrinkwrap.json +7569 -6914
- package/oclif.manifest.json +1 -1
- package/package.json +45 -45
- package/bin/dev +0 -20
- package/bin/run +0 -7
- package/lib/__generated__/graphql.d.ts +0 -294
- package/lib/commands/help.d.ts +0 -14
- package/lib/commands/list.d.ts +0 -18
- package/lib/commands/login.d.ts +0 -7
- package/lib/commands/logout.d.ts +0 -7
- package/lib/commands/sync.d.ts +0 -146
- package/lib/commands/whoami.d.ts +0 -7
- package/lib/index.d.ts +0 -1
- package/lib/utils/base-command.d.ts +0 -64
- package/lib/utils/client.d.ts +0 -42
- package/lib/utils/context.d.ts +0 -57
- package/lib/utils/errors.d.ts +0 -100
- package/lib/utils/flags.d.ts +0 -1
- package/lib/utils/fs-utils.d.ts +0 -21
- package/lib/utils/help.d.ts +0 -19
- package/lib/utils/promise.d.ts +0 -35
- package/lib/utils/sleep.d.ts +0 -5
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ EXAMPLES
|
|
|
129
129
|
Goodbye!
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
132
|
+
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/sync.ts)_
|
|
133
133
|
|
|
134
134
|
### `ggt help [COMMAND]`
|
|
135
135
|
|
|
@@ -143,7 +143,7 @@ ARGUMENTS
|
|
|
143
143
|
COMMAND The command to show help for.
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
146
|
+
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/help.ts)_
|
|
147
147
|
|
|
148
148
|
### `ggt list`
|
|
149
149
|
|
|
@@ -170,7 +170,7 @@ EXAMPLES
|
|
|
170
170
|
$ ggt list --sort=slug
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
_See code: [src/commands/list.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
173
|
+
_See code: [src/commands/list.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/list.ts)_
|
|
174
174
|
|
|
175
175
|
### `ggt login`
|
|
176
176
|
|
|
@@ -189,7 +189,7 @@ EXAMPLES
|
|
|
189
189
|
Hello, Jane Doe (jane@example.com)
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
192
|
+
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/login.ts)_
|
|
193
193
|
|
|
194
194
|
### `ggt logout`
|
|
195
195
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
Goodbye
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
207
|
+
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/logout.ts)_
|
|
208
208
|
|
|
209
209
|
### `ggt whoami`
|
|
210
210
|
|
|
@@ -219,7 +219,7 @@ EXAMPLES
|
|
|
219
219
|
You are logged in as Jane Doe (jane@example.com)
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.
|
|
222
|
+
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.2.0/src/commands/whoami.ts)_
|
|
223
223
|
|
|
224
224
|
<!-- commandsstop -->
|
|
225
225
|
|
package/bin/dev.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node --loader ts-node/esm --no-warnings
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import url from "node:url";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import oclif from "@oclif/core";
|
|
7
|
+
|
|
8
|
+
process.env["NODE_ENV"] = "development";
|
|
9
|
+
process.env["GGT_ENV"] ??= "development";
|
|
10
|
+
|
|
11
|
+
const workspaceRoot = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "..");
|
|
12
|
+
|
|
13
|
+
// store files in the project's tmp directory
|
|
14
|
+
// https://github.com/oclif/core/blob/503e263f1c224fb2b2e28538975e4d5e0a5d2028/src/config/config.ts#L155
|
|
15
|
+
process.env["GGT_CONFIG_DIR"] = path.join(workspaceRoot, "tmp", "config");
|
|
16
|
+
process.env["GGT_CACHE_DIR"] = path.join(workspaceRoot, "tmp", "cache");
|
|
17
|
+
process.env["GGT_DATA_DIR"] = path.join(workspaceRoot, "tmp", "data");
|
|
18
|
+
|
|
19
|
+
process.on("unhandledRejection", oclif.Errors.handle);
|
|
20
|
+
|
|
21
|
+
oclif
|
|
22
|
+
.run(process.argv.slice(2), import.meta.url)
|
|
23
|
+
.then(() => oclif.flush())
|
|
24
|
+
.catch(oclif.Errors.handle);
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import oclif from "@oclif/core";
|
|
5
|
+
|
|
6
|
+
process.on("unhandledRejection", oclif.Errors.handle);
|
|
7
|
+
|
|
8
|
+
oclif
|
|
9
|
+
.run(process.argv.slice(2), import.meta.url)
|
|
10
|
+
.then(() => oclif.flush())
|
|
11
|
+
.catch(oclif.Errors.handle);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* ======================================================
|
|
4
3
|
* THIS IS A GENERATED FILE! DO NOT EDIT IT MANUALLY!
|
|
5
4
|
*
|
|
6
5
|
* You can regenerate it by running `npm run generate-graphql`.
|
|
7
6
|
* ======================================================
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
FileSyncEncoding["Utf8"] = "utf8";
|
|
15
|
-
})(FileSyncEncoding = exports.FileSyncEncoding || (exports.FileSyncEncoding = {}));
|
|
7
|
+
*/ export var FileSyncEncoding;
|
|
8
|
+
(function(FileSyncEncoding) {
|
|
9
|
+
FileSyncEncoding["Base64"] = 'base64';
|
|
10
|
+
FileSyncEncoding["Utf8"] = 'utf8';
|
|
11
|
+
})(FileSyncEncoding || (FileSyncEncoding = {}));
|
|
12
|
+
|
|
16
13
|
//# sourceMappingURL=graphql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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]> };\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"],"names":["FileSyncEncoding","Base64","Utf8"],"mappings":"AAAA;;;;;;CAMC,cAqFM;UAAKA,gBAAgB;IAAhBA,iBACVC,YAAS;IADCD,iBAEVE,UAAO;GAFGF,qBAAAA"}
|
package/lib/commands/help.js
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const base_command_1 = require("../utils/base-command");
|
|
7
|
-
/**
|
|
8
|
-
* Copied from @oclif/plugin-help. Uses our own {@link Help} template class instead of the one from @oclif/core.
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/oclif/plugin-help/blob/67b580570257b45e92d3a04d50bf2a432c59afe3/src/commands/help.ts
|
|
11
|
-
*/
|
|
12
|
-
class HelpCommand extends base_command_1.BaseCommand {
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { Args } from "@oclif/core";
|
|
3
|
+
import Help from "../utils/help.js";
|
|
4
|
+
import { BaseCommand } from "../utils/base-command.js";
|
|
5
|
+
class HelpCommand extends BaseCommand {
|
|
13
6
|
async run() {
|
|
14
|
-
const { argv
|
|
15
|
-
const help = new
|
|
7
|
+
const { argv } = await this.parse();
|
|
8
|
+
const help = new Help(this.config, {
|
|
9
|
+
all: true
|
|
10
|
+
});
|
|
16
11
|
await help.showHelp(argv);
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: "Display help for ggt."
|
|
14
|
+
_define_property(HelpCommand, "strict", false);
|
|
15
|
+
_define_property(HelpCommand, "summary", "Display help for ggt.");
|
|
16
|
+
_define_property(HelpCommand, "args", {
|
|
17
|
+
command: Args.string({
|
|
18
|
+
required: false,
|
|
19
|
+
description: "The command to show help for."
|
|
20
|
+
})
|
|
30
21
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
required: false,
|
|
38
|
-
description: "The command to show help for.",
|
|
39
|
-
}),
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
exports.default = HelpCommand;
|
|
22
|
+
/**
|
|
23
|
+
* Copied from @oclif/plugin-help. Uses our own {@link Help} template class instead of the one from @oclif/core.
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/oclif/plugin-help/blob/67b580570257b45e92d3a04d50bf2a432c59afe3/src/commands/help.ts
|
|
26
|
+
*/ export { HelpCommand as default };
|
|
27
|
+
|
|
43
28
|
//# sourceMappingURL=help.js.map
|
package/lib/commands/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/help.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\nimport Help from \"../utils/help.js\";\nimport { BaseCommand } from \"../utils/base-command.js\";\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 BaseCommand<typeof HelpCommand> {\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"],"names":["Args","Help","BaseCommand","HelpCommand","run","argv","parse","help","config","all","showHelp","strict","summary","args","command","string","required","description"],"mappings":";AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,OAAOC,UAAU,mBAAmB;AACpC,SAASC,WAAW,QAAQ,2BAA2B;AAOxC,MAAMC,oBAAoBD;IAYvC,MAAME,MAAqB;QACzB,MAAM,EAAEC,KAAI,EAAE,GAAG,MAAM,IAAI,CAACC;QAC5B,MAAMC,OAAO,IAAIN,KAAK,IAAI,CAACO,QAAQ;YAAEC,KAAK;QAAK;QAC/C,MAAMF,KAAKG,SAASL;IACtB;AACF;AAhBE,iBADmBF,aACHQ,UAAS;AAEzB,iBAHmBR,aAGHS,WAAU;AAE1B,iBALmBT,aAKHU,QAAO;IACrBC,SAASd,KAAKe,OAAO;QACnBC,UAAU;QACVC,aAAa;IACf;AACF;AAfF;;;;CAIC,GACD,SAAqBd,yBAiBpB"}
|
package/lib/commands/list.js
CHANGED
|
@@ -1,80 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const context_1 = require("../utils/context");
|
|
9
|
-
class List extends base_command_1.BaseCommand {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
Object.defineProperty(this, "requireUser", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: true
|
|
17
|
-
});
|
|
18
|
-
}
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { ux } from "@oclif/core";
|
|
3
|
+
import { dedent } from "ts-dedent";
|
|
4
|
+
import { BaseCommand } from "../utils/base-command.js";
|
|
5
|
+
import { context } from "../utils/context.js";
|
|
6
|
+
import chalkTemplate from "chalk-template";
|
|
7
|
+
class List extends BaseCommand {
|
|
19
8
|
async run() {
|
|
20
|
-
const { flags
|
|
21
|
-
const apps = await
|
|
9
|
+
const { flags } = await this.parse(List);
|
|
10
|
+
const apps = await context.getAvailableApps();
|
|
22
11
|
if (!apps.length) {
|
|
23
|
-
this.log(
|
|
12
|
+
this.log(dedent`
|
|
24
13
|
It doesn't look like you have any applications.
|
|
25
14
|
|
|
26
15
|
Visit https://gadget.new to create one!
|
|
27
16
|
`);
|
|
28
17
|
return;
|
|
29
18
|
}
|
|
30
|
-
|
|
19
|
+
ux.table(apps, {
|
|
31
20
|
id: {
|
|
32
21
|
header: "ID",
|
|
33
|
-
extended: true
|
|
22
|
+
extended: true
|
|
34
23
|
},
|
|
35
24
|
slug: {
|
|
36
|
-
header: "Slug"
|
|
25
|
+
header: "Slug"
|
|
37
26
|
},
|
|
38
27
|
primaryDomain: {
|
|
39
|
-
header: "Domain"
|
|
40
|
-
}
|
|
28
|
+
header: "Domain"
|
|
29
|
+
}
|
|
41
30
|
}, {
|
|
42
31
|
printLine: this.log.bind(this),
|
|
43
|
-
...flags
|
|
32
|
+
...flags
|
|
44
33
|
});
|
|
45
34
|
}
|
|
35
|
+
constructor(...args){
|
|
36
|
+
super(...args);
|
|
37
|
+
_define_property(this, "requireUser", true);
|
|
38
|
+
}
|
|
46
39
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
value: "List the apps available to the currently logged in user."
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(List, "usage", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: "list"
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(List, "examples", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: [
|
|
64
|
-
(0, ts_dedent_1.default)((0, chalk_1.default) `
|
|
40
|
+
_define_property(List, "summary", "List the apps available to the currently logged in user.");
|
|
41
|
+
_define_property(List, "usage", "list");
|
|
42
|
+
_define_property(List, "examples", [
|
|
43
|
+
dedent(chalkTemplate`
|
|
65
44
|
{gray $ ggt list}
|
|
66
45
|
{gray $ ggt list --extended}
|
|
67
46
|
{gray $ ggt list --sort=slug}
|
|
68
|
-
`)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
enumerable: true,
|
|
73
|
-
configurable: true,
|
|
74
|
-
writable: true,
|
|
75
|
-
value: {
|
|
76
|
-
...core_1.ux.table.flags(),
|
|
77
|
-
}
|
|
47
|
+
`)
|
|
48
|
+
]);
|
|
49
|
+
_define_property(List, "flags", {
|
|
50
|
+
...ux.table.flags()
|
|
78
51
|
});
|
|
79
|
-
|
|
52
|
+
export { List as default };
|
|
53
|
+
|
|
80
54
|
//# sourceMappingURL=list.js.map
|
package/lib/commands/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/list.ts"],"sourcesContent":["import { ux } from \"@oclif/core\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport type { App } from \"../utils/context.js\";\nimport { context } from \"../utils/context.js\";\nimport chalkTemplate from \"chalk-template\";\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(chalkTemplate`\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 override requireUser = true;\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n\n const apps = await context.getAvailableApps();\n if (!apps.length) {\n this.log(dedent`\n It doesn't look like you have any applications.\n\n Visit https://gadget.new to create one!\n `);\n return;\n }\n\n 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"],"names":["ux","dedent","BaseCommand","context","chalkTemplate","List","run","flags","parse","apps","getAvailableApps","length","log","table","id","header","extended","slug","primaryDomain","printLine","bind","requireUser","summary","usage","examples"],"mappings":";AAAA,SAASA,EAAE,QAAQ,cAAc;AACjC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AAEvD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,aAAaH;IAmBhC,MAAMI,MAAqB;QACzB,MAAM,EAAEC,MAAK,EAAE,GAAG,MAAM,IAAI,CAACC,MAAMH;QAEnC,MAAMI,OAAO,MAAMN,QAAQO;QAC3B,IAAI,CAACD,KAAKE,QAAQ;YAChB,IAAI,CAACC,IAAIX,MAAM,CAAC;;;;MAIhB,CAAC;YACD;QACF;QAEAD,GAAGa,MACDJ,MACA;YACEK,IAAI;gBACFC,QAAQ;gBACRC,UAAU;YACZ;YACAC,MAAM;gBACJF,QAAQ;YACV;YACAG,eAAe;gBACbH,QAAQ;YACV;QACF,GACA;YACEI,WAAW,IAAI,CAACP,IAAIQ,KAAK,IAAI;YAC7B,GAAGb,KAAK;QACV;IAEJ;;;QAlCA,uBAASc,eAAc;;AAmCzB;AAnDE,iBADmBhB,MACHiB,WAAU;AAE1B,iBAHmBjB,MAGHkB,SAAQ;AAExB,iBALmBlB,MAKHmB,YAAW;IACzBvB,OAAOG,aAAa,CAAC;;;;IAIrB,CAAC;CACF;AAED,iBAbmBC,MAaHE,SAAQ;IACtB,GAAGP,GAAGa,MAAMN,OAAO;AACrB;AAfF,SAAqBF,kBAoDpB"}
|
package/lib/commands/login.js
CHANGED
|
@@ -1,40 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
class Login extends base_command_1.BaseCommand {
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { dedent } from "ts-dedent";
|
|
3
|
+
import { BaseCommand } from "../utils/base-command.js";
|
|
4
|
+
import chalkTemplate from "chalk-template";
|
|
5
|
+
class Login extends BaseCommand {
|
|
8
6
|
async run() {
|
|
9
7
|
await this.login();
|
|
10
8
|
}
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
value: "Log in to your account."
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(Login, "usage", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: "login"
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(Login, "examples", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: [
|
|
29
|
-
(0, ts_dedent_1.default)((0, chalk_1.default) `
|
|
10
|
+
_define_property(Login, "summary", "Log in to your account.");
|
|
11
|
+
_define_property(Login, "usage", "login");
|
|
12
|
+
_define_property(Login, "examples", [
|
|
13
|
+
dedent(chalkTemplate`
|
|
30
14
|
{gray $ ggt login}
|
|
31
15
|
We've opened Gadget's login page using your default browser.
|
|
32
16
|
|
|
33
17
|
Please log in and then return to this terminal.
|
|
34
18
|
|
|
35
19
|
Hello, Jane Doe {gray (jane@example.com)}
|
|
36
|
-
`)
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
20
|
+
`)
|
|
21
|
+
]);
|
|
22
|
+
export { Login as default };
|
|
23
|
+
|
|
40
24
|
//# sourceMappingURL=login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/login.ts"],"sourcesContent":["import { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport chalkTemplate from \"chalk-template\";\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(chalkTemplate`\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"],"names":["dedent","BaseCommand","chalkTemplate","Login","run","login","summary","usage","examples"],"mappings":";AAAA,SAASA,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,cAAcF;IAgBjC,MAAMG,MAAqB;QACzB,MAAM,IAAI,CAACC;IACb;AACF;AAlBE,iBADmBF,OACHG,WAAU;AAE1B,iBAHmBH,OAGHI,SAAQ;AAExB,iBALmBJ,OAKHK,YAAW;IACzBR,OAAOE,aAAa,CAAC;;;;;;;IAOrB,CAAC;CACF;AAdH,SAAqBC,mBAmBpB"}
|
package/lib/commands/logout.js
CHANGED
|
@@ -1,44 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const context_1 = require("../utils/context");
|
|
8
|
-
class Logout extends base_command_1.BaseCommand {
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import chalkTemplate from "chalk-template";
|
|
3
|
+
import { dedent } from "ts-dedent";
|
|
4
|
+
import { BaseCommand } from "../utils/base-command.js";
|
|
5
|
+
import { context } from "../utils/context.js";
|
|
6
|
+
class Logout extends BaseCommand {
|
|
9
7
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
10
8
|
async run() {
|
|
11
|
-
if (
|
|
12
|
-
|
|
9
|
+
if (context.session) {
|
|
10
|
+
context.session = undefined;
|
|
13
11
|
this.log("Goodbye");
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
12
|
+
} else {
|
|
16
13
|
this.log("You are not logged in");
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value: "Log out of your account."
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(Logout, "usage", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: "logout"
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(Logout, "examples", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: [
|
|
37
|
-
(0, ts_dedent_1.default)((0, chalk_1.default) `
|
|
17
|
+
_define_property(Logout, "summary", "Log out of your account.");
|
|
18
|
+
_define_property(Logout, "usage", "logout");
|
|
19
|
+
_define_property(Logout, "examples", [
|
|
20
|
+
dedent(chalkTemplate`
|
|
38
21
|
{gray $ ggt logout}
|
|
39
22
|
Goodbye
|
|
40
|
-
`)
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
23
|
+
`)
|
|
24
|
+
]);
|
|
25
|
+
export { Logout as default };
|
|
26
|
+
|
|
44
27
|
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import chalkTemplate from \"chalk-template\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport { context } from \"../utils/context.js\";\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(chalkTemplate`\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"],"names":["chalkTemplate","dedent","BaseCommand","context","Logout","run","session","undefined","log","summary","usage","examples"],"mappings":";AAAA,OAAOA,mBAAmB,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,OAAO,QAAQ,sBAAsB;AAE/B,MAAMC,eAAeF;IAYlC,4DAA4D;IAC5D,MAAMG,MAAqB;QACzB,IAAIF,QAAQG,SAAS;YACnBH,QAAQG,UAAUC;YAClB,IAAI,CAACC,IAAI;QACX,OAAO;YACL,IAAI,CAACA,IAAI;QACX;IACF;AACF;AApBE,iBADmBJ,QACHK,WAAU;AAE1B,iBAHmBL,QAGHM,SAAQ;AAExB,iBALmBN,QAKHO,YAAW;IACzBV,OAAOD,aAAa,CAAC;;;IAGrB,CAAC;CACF;AAVH,SAAqBI,oBAqBpB"}
|