@sortlist/cli 0.35.0 → 0.37.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.
@@ -1,155 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- import { graphql, graphqlUnauthenticated } from '../graphql/client.ts';
4
- import { Me } from '../graphql/operations/common.ts';
5
- import { DeviceAuthorize, DeviceToken } from '../graphql/operations/hermes.ts';
6
- import { saveCredentials } from '../lib/auth.ts';
7
- import { openBrowser } from '../lib/browser.ts';
8
- import { saveConfig } from '../lib/config.ts';
9
- import { error, hint, info, success } from '../lib/output.ts';
10
-
11
- // TODO: fetch the set of available API scopes dynamically (e.g. from Hermes'
12
- // resource server) once the backend exposes them. For now the CLI requests a
13
- // fixed superset so users can exercise every subgraph. Auth0 RBAC grants the
14
- // intersection of requested scopes and the user's assigned permissions by EXACT
15
- // string match — wildcards are not expanded, and unmatched scopes are dropped
16
- // silently. The list below must therefore contain every permission name the
17
- // terraform-auth0 roles can hold (superadmin `*:*`, admin `*:read`, sales
18
- // granular grants), not just the broadest wildcard per service.
19
- const API_SCOPES = [
20
- 'atlas/*:*',
21
- 'atlas/*:read',
22
- 'core/*:*',
23
- 'core/*:read',
24
- 'signals/*:*',
25
- 'signals/*:read',
26
- 'billing/*:*',
27
- 'billing/*:read',
28
- 'billing/offer:*',
29
- ];
30
- const DEFAULT_SCOPE = `openid profile email offline_access ${API_SCOPES.join(' ')}`;
31
-
32
- function sleep(ms: number): Promise<void> {
33
- return new Promise((resolve) => setTimeout(resolve, ms));
34
- }
35
-
36
- async function setupUserContext(endpoint?: string): Promise<void> {
37
- const userData = await graphql(Me, undefined, { endpoint });
38
- const user = userData.me;
39
- if (!user) return;
40
-
41
- saveConfig({ oauthId: user.sub ?? undefined });
42
- info('');
43
- info(` User: ${user.firstName} ${user.lastName} <${user.email}>`);
44
- hint('Run `sl whoami` to verify.');
45
- }
46
-
47
- export const loginCommand = new Command('login')
48
- .summary('Log in to your Sortlist account')
49
- .description(
50
- 'Log in to your Sortlist account\n\n' +
51
- 'Opens a browser to complete authentication, then saves your\n' +
52
- "credentials locally. If you belong to multiple companies, you'll\n" +
53
- 'be prompted to pick one.\n\n' +
54
- 'Examples:\n' +
55
- ' sl login Log in with default settings\n' +
56
- ' sl login --no-browser Print the login URL instead of opening it',
57
- )
58
- .option('--scope <scope>', 'OAuth scope', DEFAULT_SCOPE)
59
- .option('--no-browser', 'Print the login URL instead of opening a browser')
60
- .action(async function (this: Command) {
61
- const opts = this.optsWithGlobals();
62
-
63
- info('Starting device authorization...');
64
-
65
- const authData = await graphqlUnauthenticated(DeviceAuthorize, { input: { scope: opts.scope } }, opts.endpoint);
66
-
67
- const device = authData.deviceAuthorize;
68
- if (!device) {
69
- error('Device authorization failed — the server returned an empty response.');
70
- hint('Check your network connection and try again.');
71
- hint('If the problem persists, verify the endpoint: sl config show');
72
- process.exit(2);
73
- }
74
-
75
- const url = device.verificationUriComplete ?? device.verificationUri;
76
- info('');
77
- info(` Open this URL in your browser:`);
78
- info(` ${url}`);
79
- info('');
80
- info(` Enter code: ${device.userCode}`);
81
- info('');
82
-
83
- if (opts.browser) {
84
- openBrowser(url);
85
- info(' (Browser opened automatically)');
86
- info('');
87
- }
88
-
89
- info('Waiting for you to complete login in the browser...');
90
-
91
- let interval = device.interval * 1000;
92
- const deadline = Date.now() + device.expiresIn * 1000;
93
-
94
- while (Date.now() < deadline) {
95
- await sleep(interval);
96
-
97
- const tokenData = await graphqlUnauthenticated(
98
- DeviceToken,
99
- { input: { deviceCode: device.deviceCode } },
100
- opts.endpoint,
101
- );
102
-
103
- const token = tokenData.deviceToken;
104
- if (!token) {
105
- error('Token exchange failed — the server returned an empty response.');
106
- hint('Try running `sl login` again.');
107
- process.exit(2);
108
- }
109
-
110
- if (token.error === 'authorization_pending') {
111
- continue;
112
- }
113
-
114
- if (token.error === 'slow_down') {
115
- interval += 5000;
116
- continue;
117
- }
118
-
119
- if (token.error === 'expired_token') {
120
- error('The login code expired before you completed authentication.');
121
- hint('Run `sl login` to generate a new code.');
122
- process.exit(2);
123
- }
124
-
125
- if (token.error === 'access_denied') {
126
- error('Access was denied during authentication.');
127
- hint('Make sure you approved the request in the browser.');
128
- hint('If you denied it by mistake, run `sl login` to try again.');
129
- process.exit(2);
130
- }
131
-
132
- if (token.error) {
133
- error(`Authentication failed (${token.error}).`);
134
- hint('Run `sl login` to try again.');
135
- process.exit(2);
136
- }
137
-
138
- if (token.accessToken && token.refreshToken && token.idToken && token.expiresIn) {
139
- saveCredentials({
140
- accessToken: token.accessToken,
141
- refreshToken: token.refreshToken,
142
- idToken: token.idToken,
143
- expiresAt: Math.floor(Date.now() / 1000) + token.expiresIn,
144
- });
145
-
146
- success('Logged in successfully.');
147
- await setupUserContext(opts.endpoint);
148
- return;
149
- }
150
- }
151
-
152
- error('Authentication timed out — no response from the browser.');
153
- hint('Run `sl login` to start a new session.');
154
- process.exit(2);
155
- });
@@ -1,45 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- import { graphqlUnauthenticated } from '../graphql/client.ts';
4
- import { LogoutUrl } from '../graphql/operations/hermes.ts';
5
- import { clearCredentials } from '../lib/auth.ts';
6
- import { openBrowser } from '../lib/browser.ts';
7
- import { clearIdentity } from '../lib/config.ts';
8
- import { hint, info, success, warn } from '../lib/output.ts';
9
-
10
- export const logoutCommand = new Command('logout')
11
- .summary('Log out and remove stored credentials')
12
- .description(
13
- 'Log out and remove stored credentials\n\n' +
14
- 'Deletes the saved tokens from ~/.sortlist/credentials.json and\n' +
15
- 'opens the Auth0 logout URL in your browser so the next `sl login`\n' +
16
- "doesn't silently reuse the previous account.\n\n" +
17
- 'Examples:\n' +
18
- ' sl logout Clear credentials and log out of Auth0\n' +
19
- ' sl logout --no-browser Only clear local credentials',
20
- )
21
- .option('--no-browser', 'Skip opening the Auth0 logout URL in a browser')
22
- .action(async function (this: Command) {
23
- const opts = this.optsWithGlobals();
24
-
25
- clearCredentials();
26
- clearIdentity();
27
- success('Logged out — credentials removed.');
28
-
29
- if (!opts.browser) {
30
- hint('Run `sl login` to authenticate again.');
31
- return;
32
- }
33
-
34
- try {
35
- const data = await graphqlUnauthenticated(LogoutUrl, {}, opts.endpoint);
36
- if (data.logoutUrl) {
37
- openBrowser(data.logoutUrl);
38
- info('Opened Auth0 logout in your browser.');
39
- }
40
- } catch {
41
- warn('Could not fetch the Auth0 logout URL — skipped browser logout.');
42
- }
43
-
44
- hint('Run `sl login` to authenticate again.');
45
- });
@@ -1,23 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- import { ensureAuthenticated, isExpired } from '../lib/auth.ts';
4
- import { error, hint } from '../lib/output.ts';
5
-
6
- export const tokenCommand = new Command('token')
7
- .summary('Print your current access token to stdout')
8
- .description(
9
- 'Print your current access token to stdout\n\n' +
10
- 'Useful for piping into other tools or scripts.\n\n' +
11
- 'Examples:\n' +
12
- ' sl token Print the token\n' +
13
- ' curl -H "Authorization: Bearer $(sl token)" ...',
14
- )
15
- .action(() => {
16
- const creds = ensureAuthenticated();
17
- if (isExpired(creds)) {
18
- error('Your access token has expired.');
19
- hint('Run `sl login` to re-authenticate.');
20
- process.exit(2);
21
- }
22
- process.stdout.write(creds.accessToken);
23
- });
@@ -1,55 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- import { graphql, GraphQLRequestError } from '../graphql/client.ts';
4
- import { Me } from '../graphql/operations/common.ts';
5
- import { error, hint, info, isJsonMode, printJson } from '../lib/output.ts';
6
-
7
- export const whoamiCommand = new Command('whoami')
8
- .summary("Show who you're currently logged in as")
9
- .description(
10
- "Show who you're currently logged in as\n\n" +
11
- 'Displays your name and email. Use --json for machine-readable output.\n\n' +
12
- 'Examples:\n' +
13
- ' sl whoami Show your identity\n' +
14
- ' sl whoami --json Output full user object as JSON',
15
- )
16
- .action(async function (this: Command) {
17
- const opts = this.optsWithGlobals();
18
-
19
- let data;
20
- try {
21
- data = await graphql(Me, undefined, {
22
- endpoint: opts.endpoint,
23
- throwOnError: true,
24
- });
25
- } catch (err) {
26
- if (err instanceof GraphQLRequestError) {
27
- error('Could not verify your identity — the API returned an error:');
28
- const messages = err.graphqlErrors?.map((e) => e.message) ?? [err.message];
29
- for (const message of messages) info(` ${message}`);
30
- hint('This is a server-side or authorization error, not necessarily an expired session.');
31
- hint('Retry in a moment; if it persists, re-run `sl login` or report it.');
32
- process.exit(1);
33
- }
34
- throw err;
35
- }
36
-
37
- const user = data.me;
38
- if (!user) {
39
- // A successful `me` for a logged-in user is never null — the resolver
40
- // returns the calling user. Null here means the backend could not resolve
41
- // the account (e.g. an upstream identity/profile lookup failed), not that
42
- // the local session is invalid, so we do not tell the user to log in again.
43
- error('The API did not return your user identity.');
44
- hint('This is usually a temporary backend issue rather than an expired session.');
45
- hint('Retry in a moment; if it persists, re-run `sl login` or report it.');
46
- process.exit(1);
47
- }
48
-
49
- if (isJsonMode(opts)) {
50
- printJson(user);
51
- return;
52
- }
53
-
54
- info(`${user.firstName} ${user.lastName} <${user.email}> (sub: ${user.sub})`);
55
- });
@@ -1,259 +0,0 @@
1
- import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import { print } from 'graphql';
3
-
4
- import { ensureAuthenticated, isExpired, saveCredentials, type Credentials } from '../lib/auth.ts';
5
- import { getEndpoint } from '../lib/config.ts';
6
- import { error, hint, info, warn } from '../lib/output.ts';
7
- import { addBreadcrumb, captureException } from '../lib/sentry.ts';
8
- import { RefreshToken } from './operations/hermes.ts';
9
-
10
- function extractOperationName(query: string): string {
11
- const match = query.match(/(?:mutation|query|subscription)\s+(\w+)/);
12
- return match?.[1] ?? 'UnknownOperation';
13
- }
14
-
15
- interface GraphQLResponse<T = Record<string, unknown>> {
16
- data?: T;
17
- errors?: Array<{ message: string; extensions?: Record<string, unknown> }>;
18
- }
19
-
20
- interface RequestOptions {
21
- endpoint?: string;
22
- authenticated?: boolean;
23
- throwOnError?: boolean;
24
- }
25
-
26
- export class GraphQLRequestError extends Error {
27
- readonly operationName: string;
28
- readonly httpStatus?: number;
29
- readonly graphqlErrors?: Array<{ message: string; extensions?: Record<string, unknown> }>;
30
-
31
- constructor(
32
- message: string,
33
- details: {
34
- operationName: string;
35
- httpStatus?: number;
36
- graphqlErrors?: Array<{ message: string; extensions?: Record<string, unknown> }>;
37
- },
38
- ) {
39
- super(message);
40
- this.name = 'GraphQLRequestError';
41
- this.operationName = details.operationName;
42
- this.httpStatus = details.httpStatus;
43
- this.graphqlErrors = details.graphqlErrors;
44
- }
45
- }
46
-
47
- async function refreshAccessToken(creds: Credentials, endpoint: string): Promise<Credentials | null> {
48
- const res = await fetch(endpoint, {
49
- method: 'POST',
50
- headers: { 'Content-Type': 'application/json', 'X-API-Client': 'sl-cli' },
51
- body: JSON.stringify({
52
- query: print(RefreshToken),
53
- variables: { input: { refreshToken: creds.refreshToken } },
54
- }),
55
- });
56
-
57
- const json = (await res.json()) as GraphQLResponse<{
58
- refreshToken: {
59
- accessToken: string;
60
- refreshToken: string;
61
- idToken: string;
62
- expiresIn: number;
63
- error: string | null;
64
- };
65
- }>;
66
-
67
- const token = json.data?.refreshToken;
68
- if (!token || token.error) return null;
69
-
70
- const newCreds: Credentials = {
71
- accessToken: token.accessToken,
72
- refreshToken: token.refreshToken,
73
- idToken: token.idToken,
74
- expiresAt: Math.floor(Date.now() / 1000) + token.expiresIn,
75
- };
76
-
77
- saveCredentials(newCreds);
78
- return newCreds;
79
- }
80
-
81
- /**
82
- * Internal: execute a raw GraphQL query string.
83
- */
84
- async function executeQuery<T = Record<string, unknown>>(
85
- query: string,
86
- variables: Record<string, unknown> | undefined,
87
- options: RequestOptions = {},
88
- ): Promise<T> {
89
- const endpoint = getEndpoint(options.endpoint);
90
- const authenticated = options.authenticated ?? true;
91
- const throwOnError = options.throwOnError ?? false;
92
- const operationName = extractOperationName(query);
93
- const verbose = process.env.SL_DEBUG === '1';
94
-
95
- addBreadcrumb({
96
- category: 'graphql',
97
- message: operationName,
98
- data: { endpoint, authenticated },
99
- level: 'info',
100
- });
101
-
102
- if (verbose) {
103
- info(`[debug] ${operationName} → ${endpoint}`);
104
- info(`[debug] Query:\n${query}`);
105
- if (variables) {
106
- info(`[debug] Variables: ${JSON.stringify(variables, null, 2)}`);
107
- }
108
- }
109
-
110
- const headers: Record<string, string> = {
111
- 'Content-Type': 'application/json',
112
- 'X-API-Client': 'sl-cli',
113
- };
114
-
115
- if (authenticated) {
116
- let creds = ensureAuthenticated();
117
-
118
- if (isExpired(creds)) {
119
- const refreshed = await refreshAccessToken(creds, endpoint);
120
- if (!refreshed) {
121
- if (throwOnError) {
122
- throw new GraphQLRequestError('Session expired and could not be refreshed.', { operationName });
123
- }
124
- error('Your session has expired and could not be refreshed.');
125
- hint('Run `sl login` to re-authenticate.');
126
- process.exit(2);
127
- }
128
- creds = refreshed;
129
- }
130
-
131
- headers['Authorization'] = `Bearer ${creds.accessToken}`;
132
-
133
- if (verbose) {
134
- // Never print the full token — debug output ends up in pasted logs.
135
- // `sl token` is the deliberate way to get the raw value.
136
- info(`[debug] JWT: ...${creds.accessToken.slice(-8)}`);
137
- }
138
- }
139
-
140
- const res = await fetch(endpoint, {
141
- method: 'POST',
142
- headers,
143
- body: JSON.stringify({ query, variables }),
144
- });
145
-
146
- if (!res.ok) {
147
- const body = await res.text();
148
- captureException(new Error(`${operationName} failed: HTTP ${res.status}`), {
149
- operationName,
150
- httpStatus: res.status,
151
- endpoint,
152
- });
153
- if (throwOnError) {
154
- throw new GraphQLRequestError(`${operationName} failed: HTTP ${res.status} ${res.statusText}`, {
155
- operationName,
156
- httpStatus: res.status,
157
- });
158
- }
159
- error(`${operationName} failed: HTTP ${res.status} ${res.statusText}`);
160
- hint('Check your network connection and endpoint: sl config show');
161
- if (verbose) {
162
- info(`[debug] Response body: ${body}`);
163
- }
164
- process.exit(3);
165
- }
166
-
167
- const json = (await res.json()) as GraphQLResponse<T>;
168
-
169
- if (json.errors?.length) {
170
- // If there's also data, return it — partial success with some field errors
171
- if (json.data) {
172
- for (const gqlError of json.errors) {
173
- warn(gqlError.message);
174
- }
175
- const hasFieldError = json.errors.some(
176
- (e) => e.message.includes('Failed to implement') || e.message.includes('undefined method'),
177
- );
178
- if (hasFieldError) {
179
- hint('Use --fields to select specific fields, or --exclude to skip broken ones.');
180
- }
181
- return json.data;
182
- }
183
-
184
- captureException(new Error(`${operationName} GraphQL errors`), {
185
- operationName,
186
- errors: json.errors.map((e) => e.message),
187
- });
188
-
189
- if (throwOnError) {
190
- throw new GraphQLRequestError(`${operationName} failed: ${json.errors.map((e) => e.message).join('; ')}`, {
191
- operationName,
192
- graphqlErrors: json.errors,
193
- });
194
- }
195
-
196
- error(`${operationName} failed:`);
197
- for (const gqlError of json.errors) {
198
- info(` ${gqlError.message}`);
199
- if (verbose && gqlError.extensions) {
200
- info(`[debug] Extensions: ${JSON.stringify(gqlError.extensions)}`);
201
- }
202
- }
203
-
204
- const hasFieldError = json.errors.some(
205
- (e) => e.message.includes('Failed to implement') || e.message.includes('undefined method'),
206
- );
207
- if (hasFieldError) {
208
- hint('Use --fields to select specific fields, or --exclude to skip broken ones.');
209
- hint(`Example: sl ${operationName.toLowerCase()} --fields id,title,status`);
210
- }
211
-
212
- process.exit(1);
213
- }
214
-
215
- if (!json.data) {
216
- if (throwOnError) {
217
- throw new GraphQLRequestError(`${operationName}: no data returned from API.`, { operationName });
218
- }
219
- error(`${operationName}: no data returned from API.`);
220
- hint('This usually means the server returned an empty response.');
221
- hint('Verify your endpoint: sl config show');
222
- process.exit(1);
223
- }
224
-
225
- return json.data;
226
- }
227
-
228
- /**
229
- * Execute a typed GraphQL operation (for hand-written commands).
230
- */
231
- export async function graphql<TData, TVars>(
232
- document: TypedDocumentNode<TData, TVars>,
233
- variables?: TVars,
234
- options: RequestOptions = {},
235
- ): Promise<TData> {
236
- return executeQuery<TData>(print(document), variables as Record<string, unknown> | undefined, options);
237
- }
238
-
239
- /**
240
- * Execute a raw GraphQL query string (for generated/dynamic commands).
241
- */
242
- export async function graphqlRaw(
243
- query: string,
244
- variables?: Record<string, unknown>,
245
- options: RequestOptions = {},
246
- ): Promise<Record<string, unknown>> {
247
- return executeQuery(query, variables, options);
248
- }
249
-
250
- /**
251
- * Execute an unauthenticated typed GraphQL operation.
252
- */
253
- export async function graphqlUnauthenticated<TData, TVars>(
254
- document: TypedDocumentNode<TData, TVars>,
255
- variables?: TVars,
256
- endpoint?: string,
257
- ): Promise<TData> {
258
- return graphql(document, variables, { endpoint, authenticated: false });
259
- }
@@ -1,70 +0,0 @@
1
- /* eslint-disable */
2
- import * as types from './graphql.js';
3
- import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
4
-
5
- /**
6
- * Map of all GraphQL operations in the project.
7
- *
8
- * This map has several performance disadvantages:
9
- * 1. It is not tree-shakeable, so it will include all operations in the project.
10
- * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
11
- * 3. It does not support dead code elimination, so it will add unused operations.
12
- *
13
- * Therefore it is highly recommended to use the babel or swc plugin for production.
14
- * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
15
- */
16
- type Documents = {
17
- "\n query Me {\n me {\n sub\n email\n firstName\n lastName\n }\n }\n": typeof types.MeDocument,
18
- "\n query LogoutUrl {\n logoutUrl\n }\n": typeof types.LogoutUrlDocument,
19
- "\n mutation DeviceAuthorize($input: DeviceAuthorizeInput!) {\n deviceAuthorize(input: $input) {\n deviceCode\n expiresIn\n interval\n userCode\n verificationUri\n verificationUriComplete\n }\n }\n": typeof types.DeviceAuthorizeDocument,
20
- "\n mutation DeviceToken($input: DeviceTokenInput!) {\n deviceToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n": typeof types.DeviceTokenDocument,
21
- "\n mutation RefreshToken($input: RefreshTokenInput!) {\n refreshToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n": typeof types.RefreshTokenDocument,
22
- };
23
- const documents: Documents = {
24
- "\n query Me {\n me {\n sub\n email\n firstName\n lastName\n }\n }\n": types.MeDocument,
25
- "\n query LogoutUrl {\n logoutUrl\n }\n": types.LogoutUrlDocument,
26
- "\n mutation DeviceAuthorize($input: DeviceAuthorizeInput!) {\n deviceAuthorize(input: $input) {\n deviceCode\n expiresIn\n interval\n userCode\n verificationUri\n verificationUriComplete\n }\n }\n": types.DeviceAuthorizeDocument,
27
- "\n mutation DeviceToken($input: DeviceTokenInput!) {\n deviceToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n": types.DeviceTokenDocument,
28
- "\n mutation RefreshToken($input: RefreshTokenInput!) {\n refreshToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n": types.RefreshTokenDocument,
29
- };
30
-
31
- /**
32
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
33
- *
34
- *
35
- * @example
36
- * ```ts
37
- * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
38
- * ```
39
- *
40
- * The query argument is unknown!
41
- * Please regenerate the types.
42
- */
43
- export function gql(source: string): unknown;
44
-
45
- /**
46
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
47
- */
48
- export function gql(source: "\n query Me {\n me {\n sub\n email\n firstName\n lastName\n }\n }\n"): (typeof documents)["\n query Me {\n me {\n sub\n email\n firstName\n lastName\n }\n }\n"];
49
- /**
50
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
51
- */
52
- export function gql(source: "\n query LogoutUrl {\n logoutUrl\n }\n"): (typeof documents)["\n query LogoutUrl {\n logoutUrl\n }\n"];
53
- /**
54
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
55
- */
56
- export function gql(source: "\n mutation DeviceAuthorize($input: DeviceAuthorizeInput!) {\n deviceAuthorize(input: $input) {\n deviceCode\n expiresIn\n interval\n userCode\n verificationUri\n verificationUriComplete\n }\n }\n"): (typeof documents)["\n mutation DeviceAuthorize($input: DeviceAuthorizeInput!) {\n deviceAuthorize(input: $input) {\n deviceCode\n expiresIn\n interval\n userCode\n verificationUri\n verificationUriComplete\n }\n }\n"];
57
- /**
58
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
59
- */
60
- export function gql(source: "\n mutation DeviceToken($input: DeviceTokenInput!) {\n deviceToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n"): (typeof documents)["\n mutation DeviceToken($input: DeviceTokenInput!) {\n deviceToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n"];
61
- /**
62
- * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
63
- */
64
- export function gql(source: "\n mutation RefreshToken($input: RefreshTokenInput!) {\n refreshToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n"): (typeof documents)["\n mutation RefreshToken($input: RefreshTokenInput!) {\n refreshToken(input: $input) {\n accessToken\n error\n expiresIn\n idToken\n refreshToken\n tokenType\n }\n }\n"];
65
-
66
- export function gql(source: string) {
67
- return (documents as any)[source] ?? {};
68
- }
69
-
70
- export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;