bktide 0.0.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.
- package/README.md +145 -0
- package/WORKFLOW_README.md +65 -0
- package/bin/alfred-entrypoint +54 -0
- package/dist/commands/BaseCommand.js +159 -0
- package/dist/commands/BaseCommand.js.map +1 -0
- package/dist/commands/BaseCommandHandler.js +80 -0
- package/dist/commands/BaseCommandHandler.js.map +1 -0
- package/dist/commands/BuildCommandHandler.js +28 -0
- package/dist/commands/BuildCommandHandler.js.map +1 -0
- package/dist/commands/HelloCommandHandler.js +6 -0
- package/dist/commands/HelloCommandHandler.js.map +1 -0
- package/dist/commands/ListAnnotations.js +60 -0
- package/dist/commands/ListAnnotations.js.map +1 -0
- package/dist/commands/ListBuilds.js +137 -0
- package/dist/commands/ListBuilds.js.map +1 -0
- package/dist/commands/ListOrganizations.js +27 -0
- package/dist/commands/ListOrganizations.js.map +1 -0
- package/dist/commands/ListPipelines.js +114 -0
- package/dist/commands/ListPipelines.js.map +1 -0
- package/dist/commands/ManageToken.js +180 -0
- package/dist/commands/ManageToken.js.map +1 -0
- package/dist/commands/OrganizationCommandHandler.js +53 -0
- package/dist/commands/OrganizationCommandHandler.js.map +1 -0
- package/dist/commands/PipelineCommandHandler.js +142 -0
- package/dist/commands/PipelineCommandHandler.js.map +1 -0
- package/dist/commands/ShowViewer.js +26 -0
- package/dist/commands/ShowViewer.js.map +1 -0
- package/dist/commands/UserBuildsCommandHandler.js +61 -0
- package/dist/commands/UserBuildsCommandHandler.js.map +1 -0
- package/dist/commands/ViewerBuildsCommandHandler.js +176 -0
- package/dist/commands/ViewerBuildsCommandHandler.js.map +1 -0
- package/dist/commands/ViewerCommandHandler.js +46 -0
- package/dist/commands/ViewerCommandHandler.js.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/formatters/BaseFormatter.js +14 -0
- package/dist/formatters/BaseFormatter.js.map +1 -0
- package/dist/formatters/FormatterFactory.js +48 -0
- package/dist/formatters/FormatterFactory.js.map +1 -0
- package/dist/formatters/annotations/Formatter.js +10 -0
- package/dist/formatters/annotations/Formatter.js.map +1 -0
- package/dist/formatters/annotations/JsonFormatter.js +20 -0
- package/dist/formatters/annotations/JsonFormatter.js.map +1 -0
- package/dist/formatters/annotations/PlainTextFormatter.js +35 -0
- package/dist/formatters/annotations/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/annotations/index.js +23 -0
- package/dist/formatters/annotations/index.js.map +1 -0
- package/dist/formatters/builds/AlfredFormatter.js +135 -0
- package/dist/formatters/builds/AlfredFormatter.js.map +1 -0
- package/dist/formatters/builds/Formatter.js +10 -0
- package/dist/formatters/builds/Formatter.js.map +1 -0
- package/dist/formatters/builds/JsonFormatter.js +44 -0
- package/dist/formatters/builds/JsonFormatter.js.map +1 -0
- package/dist/formatters/builds/PlainTextFormatter.js +113 -0
- package/dist/formatters/builds/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/builds/index.js +26 -0
- package/dist/formatters/builds/index.js.map +1 -0
- package/dist/formatters/errors/AlfredFormatter.js +110 -0
- package/dist/formatters/errors/AlfredFormatter.js.map +1 -0
- package/dist/formatters/errors/Formatter.js +98 -0
- package/dist/formatters/errors/Formatter.js.map +1 -0
- package/dist/formatters/errors/JsonFormatter.js +63 -0
- package/dist/formatters/errors/JsonFormatter.js.map +1 -0
- package/dist/formatters/errors/PlainTextFormatter.js +52 -0
- package/dist/formatters/errors/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/errors/index.js +26 -0
- package/dist/formatters/errors/index.js.map +1 -0
- package/dist/formatters/index.js +9 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/organizations/Formatter.js +10 -0
- package/dist/formatters/organizations/Formatter.js.map +1 -0
- package/dist/formatters/organizations/JsonFormatter.js +16 -0
- package/dist/formatters/organizations/JsonFormatter.js.map +1 -0
- package/dist/formatters/organizations/PlainTextFormatter.js +15 -0
- package/dist/formatters/organizations/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/organizations/index.js +21 -0
- package/dist/formatters/organizations/index.js.map +1 -0
- package/dist/formatters/pipelines/AlfredFormatter.js +42 -0
- package/dist/formatters/pipelines/AlfredFormatter.js.map +1 -0
- package/dist/formatters/pipelines/Formatter.js +10 -0
- package/dist/formatters/pipelines/Formatter.js.map +1 -0
- package/dist/formatters/pipelines/JsonFormatter.js +13 -0
- package/dist/formatters/pipelines/JsonFormatter.js.map +1 -0
- package/dist/formatters/pipelines/PlainTextFormatter.js +47 -0
- package/dist/formatters/pipelines/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/pipelines/index.js +28 -0
- package/dist/formatters/pipelines/index.js.map +1 -0
- package/dist/formatters/token/AlfredFormatter.js +191 -0
- package/dist/formatters/token/AlfredFormatter.js.map +1 -0
- package/dist/formatters/token/Formatter.js +13 -0
- package/dist/formatters/token/Formatter.js.map +1 -0
- package/dist/formatters/token/JsonFormatter.js +211 -0
- package/dist/formatters/token/JsonFormatter.js.map +1 -0
- package/dist/formatters/token/PlainTextFormatter.js +184 -0
- package/dist/formatters/token/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/token/index.js +26 -0
- package/dist/formatters/token/index.js.map +1 -0
- package/dist/formatters/viewer/Formatter.js +10 -0
- package/dist/formatters/viewer/Formatter.js.map +1 -0
- package/dist/formatters/viewer/JsonFormatter.js +20 -0
- package/dist/formatters/viewer/JsonFormatter.js.map +1 -0
- package/dist/formatters/viewer/PlainTextFormatter.js +20 -0
- package/dist/formatters/viewer/PlainTextFormatter.js.map +1 -0
- package/dist/formatters/viewer/index.js +21 -0
- package/dist/formatters/viewer/index.js.map +1 -0
- package/dist/graphql/generated/fragment-masking.js +17 -0
- package/dist/graphql/generated/fragment-masking.js.map +1 -0
- package/dist/graphql/generated/gql.js +13 -0
- package/dist/graphql/generated/gql.js.map +1 -0
- package/dist/graphql/generated/graphql.js +852 -0
- package/dist/graphql/generated/graphql.js.map +1 -0
- package/dist/graphql/generated/index.js +3 -0
- package/dist/graphql/generated/index.js.map +1 -0
- package/dist/graphql/generated/sdk.js +872 -0
- package/dist/graphql/generated/sdk.js.map +1 -0
- package/dist/graphql/queries.js +138 -0
- package/dist/graphql/queries.js.map +1 -0
- package/dist/index.js +271 -0
- package/dist/index.js.map +1 -0
- package/dist/services/BuildkiteClient.js +520 -0
- package/dist/services/BuildkiteClient.js.map +1 -0
- package/dist/services/BuildkiteRestClient.js +244 -0
- package/dist/services/BuildkiteRestClient.js.map +1 -0
- package/dist/services/CacheManager.js +221 -0
- package/dist/services/CacheManager.js.map +1 -0
- package/dist/services/CredentialManager.js +158 -0
- package/dist/services/CredentialManager.js.map +1 -0
- package/dist/services/EnhancedBuildkiteClient.js +297 -0
- package/dist/services/EnhancedBuildkiteClient.js.map +1 -0
- package/dist/services/logger.js +107 -0
- package/dist/services/logger.js.map +1 -0
- package/dist/types/buildkite.js +5 -0
- package/dist/types/buildkite.js.map +1 -0
- package/dist/types/credentials.js +2 -0
- package/dist/types/credentials.js.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cli-error-handler.js +172 -0
- package/dist/utils/cli-error-handler.js.map +1 -0
- package/dist/utils/errorUtils.js +59 -0
- package/dist/utils/errorUtils.js.map +1 -0
- package/dist/utils/parseBuildRef.js +31 -0
- package/dist/utils/parseBuildRef.js.map +1 -0
- package/dist/utils/textFormatter.js +53 -0
- package/dist/utils/textFormatter.js.map +1 -0
- package/dist/utils/xdgPaths.js +95 -0
- package/dist/utils/xdgPaths.js.map +1 -0
- package/env.example +66 -0
- package/icons/README.md +68 -0
- package/icons/blocked.png +0 -0
- package/icons/buildkite.png +0 -0
- package/icons/failed.png +0 -0
- package/icons/failing.png +0 -0
- package/icons/passed.png +0 -0
- package/icons/running.png +0 -0
- package/icons/scheduled.png +0 -0
- package/icons/skipped.png +0 -0
- package/icons/unknown.png +0 -0
- package/info.plist +734 -0
- package/package.json +87 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { BaseTokenFormatter } from './Formatter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Plain text formatter for tokens
|
|
4
|
+
*/
|
|
5
|
+
export class PlainTextFormatter extends BaseTokenFormatter {
|
|
6
|
+
name = 'plain';
|
|
7
|
+
/**
|
|
8
|
+
* Format token status information in plain text
|
|
9
|
+
*
|
|
10
|
+
* @param status The token status information
|
|
11
|
+
* @returns Formatted token status message
|
|
12
|
+
*/
|
|
13
|
+
formatTokenStatus(status) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push(`Token Status: ${status.hasToken ? 'Present' : 'Not Present'}`);
|
|
16
|
+
if (status.hasToken) {
|
|
17
|
+
lines.push(`Valid: ${status.isValid ? 'Yes' : 'No'}`);
|
|
18
|
+
if (status.validation.canListOrganizations) {
|
|
19
|
+
const validOrgs = Object.entries(status.validation.organizations)
|
|
20
|
+
.filter(([_, status]) => status.graphql && status.builds && status.organizations)
|
|
21
|
+
.map(([org]) => org);
|
|
22
|
+
if (validOrgs.length > 0) {
|
|
23
|
+
lines.push('Valid Organizations:');
|
|
24
|
+
validOrgs.forEach(org => lines.push(` - ${org}`));
|
|
25
|
+
}
|
|
26
|
+
const invalidOrgs = Object.entries(status.validation.organizations)
|
|
27
|
+
.filter(([_, status]) => !status.graphql || !status.builds || !status.organizations);
|
|
28
|
+
if (invalidOrgs.length > 0) {
|
|
29
|
+
lines.push('Organizations with Limited Access:');
|
|
30
|
+
invalidOrgs.forEach(([org, status]) => {
|
|
31
|
+
const invalidApis = [];
|
|
32
|
+
if (!status.graphql)
|
|
33
|
+
invalidApis.push('GraphQL');
|
|
34
|
+
if (!status.builds)
|
|
35
|
+
invalidApis.push('Builds');
|
|
36
|
+
if (!status.organizations)
|
|
37
|
+
invalidApis.push('Organizations');
|
|
38
|
+
lines.push(` - ${org} (${invalidApis.join(', ')})`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
lines.push('Cannot list organizations - token may be invalid');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Format token storage result in plain text
|
|
50
|
+
*
|
|
51
|
+
* @param success Whether the token was successfully stored
|
|
52
|
+
* @returns Formatted token storage result message
|
|
53
|
+
*/
|
|
54
|
+
formatTokenStorageResult(success) {
|
|
55
|
+
if (success) {
|
|
56
|
+
return 'Token successfully stored in system keychain';
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return 'Failed to store token';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Format token reset result in plain text
|
|
64
|
+
*
|
|
65
|
+
* @param success Whether the token was successfully reset
|
|
66
|
+
* @param hadToken Whether there was a token before reset
|
|
67
|
+
* @returns Formatted token reset result message
|
|
68
|
+
*/
|
|
69
|
+
formatTokenResetResult(success, hadToken) {
|
|
70
|
+
if (!hadToken) {
|
|
71
|
+
return 'No token found in system keychain';
|
|
72
|
+
}
|
|
73
|
+
if (success) {
|
|
74
|
+
return 'Token successfully deleted from system keychain';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return 'Failed to delete token';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format token validation error in plain text
|
|
82
|
+
*
|
|
83
|
+
* @param validation The validation status for each API
|
|
84
|
+
* @returns Formatted token validation error message
|
|
85
|
+
*/
|
|
86
|
+
formatTokenValidationError(validation) {
|
|
87
|
+
if (!validation.canListOrganizations) {
|
|
88
|
+
return 'Token is invalid or does not have access to list organizations';
|
|
89
|
+
}
|
|
90
|
+
const invalidOrgs = Object.entries(validation.organizations)
|
|
91
|
+
.filter(([_, status]) => !status.graphql || !status.builds || !status.organizations)
|
|
92
|
+
.map(([org, status]) => {
|
|
93
|
+
const invalidApis = [];
|
|
94
|
+
if (!status.graphql)
|
|
95
|
+
invalidApis.push('GraphQL');
|
|
96
|
+
if (!status.builds)
|
|
97
|
+
invalidApis.push('Builds');
|
|
98
|
+
if (!status.organizations)
|
|
99
|
+
invalidApis.push('Organizations');
|
|
100
|
+
return `${org} (${invalidApis.join(', ')})`;
|
|
101
|
+
});
|
|
102
|
+
if (invalidOrgs.length === 0) {
|
|
103
|
+
return 'Token is valid for all organizations';
|
|
104
|
+
}
|
|
105
|
+
return `Token has limited access in some organizations: ${invalidOrgs.join(', ')}`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Format token validation status in plain text
|
|
109
|
+
*
|
|
110
|
+
* @param validation The validation status for each API
|
|
111
|
+
* @returns Formatted token validation status message
|
|
112
|
+
*/
|
|
113
|
+
formatTokenValidationStatus(validation) {
|
|
114
|
+
if (!validation.canListOrganizations) {
|
|
115
|
+
return 'Token is invalid or does not have access to list organizations';
|
|
116
|
+
}
|
|
117
|
+
const lines = [];
|
|
118
|
+
const validOrgs = Object.entries(validation.organizations)
|
|
119
|
+
.filter(([_, status]) => status.graphql && status.builds && status.organizations)
|
|
120
|
+
.map(([org]) => org);
|
|
121
|
+
if (validOrgs.length > 0) {
|
|
122
|
+
lines.push('Valid Organizations:');
|
|
123
|
+
validOrgs.forEach(org => lines.push(` - ${org}`));
|
|
124
|
+
}
|
|
125
|
+
const invalidOrgs = Object.entries(validation.organizations)
|
|
126
|
+
.filter(([_, status]) => !status.graphql || !status.builds || !status.organizations);
|
|
127
|
+
if (invalidOrgs.length > 0) {
|
|
128
|
+
lines.push('Organizations with Limited Access:');
|
|
129
|
+
invalidOrgs.forEach(([org, status]) => {
|
|
130
|
+
const invalidApis = [];
|
|
131
|
+
if (!status.graphql)
|
|
132
|
+
invalidApis.push('GraphQL');
|
|
133
|
+
if (!status.builds)
|
|
134
|
+
invalidApis.push('Builds');
|
|
135
|
+
if (!status.organizations)
|
|
136
|
+
invalidApis.push('Organizations');
|
|
137
|
+
lines.push(` - ${org} (${invalidApis.join(', ')})`);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return lines.join('\n');
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Format error message(s) in plain text
|
|
144
|
+
*
|
|
145
|
+
* @param operation The operation that failed (e.g., 'storing', 'resetting', 'validating')
|
|
146
|
+
* @param error The error that occurred, or an array of errors
|
|
147
|
+
* @returns Formatted error message(s)
|
|
148
|
+
*/
|
|
149
|
+
formatError(operation, error) {
|
|
150
|
+
const errors = Array.isArray(error) ? error : [error];
|
|
151
|
+
return errors.map(error => {
|
|
152
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
153
|
+
return `Error ${operation} token: ${errorMessage}`;
|
|
154
|
+
}).join('\n');
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format authentication error message(s) in plain text
|
|
158
|
+
*
|
|
159
|
+
* @param operation The authentication operation that failed (e.g., 'storing', 'validating')
|
|
160
|
+
* @param error The authentication error that occurred, or an array of errors
|
|
161
|
+
* @returns Formatted authentication error message(s)
|
|
162
|
+
*/
|
|
163
|
+
formatAuthErrors(operation, error) {
|
|
164
|
+
const errors = Array.isArray(error) ? error : [error];
|
|
165
|
+
return errors.map(error => {
|
|
166
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
167
|
+
return `Authentication error ${operation} token: ${errorMessage}\nPlease check your token permissions and try again`;
|
|
168
|
+
}).join('\n\n');
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Format multiple error messages in plain text
|
|
172
|
+
*
|
|
173
|
+
* @param operation The operation that failed (e.g., 'storing', 'resetting', 'validating')
|
|
174
|
+
* @param errors Array of errors that occurred
|
|
175
|
+
* @returns Formatted error messages
|
|
176
|
+
*/
|
|
177
|
+
formatErrors(operation, errors) {
|
|
178
|
+
return errors.map(error => {
|
|
179
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
180
|
+
return `Error ${operation} token: ${errorMessage}`;
|
|
181
|
+
}).join('\n');
|
|
182
|
+
}
|
|
183
|
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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,wBAAwB,SAAS,WAAW,YAAY,qDAAqD,CAAC;QACvH,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CACV,SAAiB,EACjB,MAAiB;QAEjB,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,SAAS,SAAS,WAAW,YAAY,EAAE,CAAC;QACrD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { BaseTokenFormatter, TokenFormatter } from './Formatter.js';\nimport { TokenStatus, TokenValidationStatus } from '../../types/credentials.js';\n \n/**\n * Plain text formatter for tokens\n */\nexport class PlainTextFormatter extends BaseTokenFormatter implements TokenFormatter {\n name = 'plain';\n\n /**\n * Format token status information in plain text\n * \n * @param status The token status information\n * @returns Formatted token status message\n */\n formatTokenStatus(status: TokenStatus): string {\n const lines: string[] = [];\n lines.push(`Token Status: ${status.hasToken ? 'Present' : 'Not Present'}`);\n \n if (status.hasToken) {\n lines.push(`Valid: ${status.isValid ? 'Yes' : 'No'}`);\n \n if (status.validation.canListOrganizations) {\n const validOrgs = Object.entries(status.validation.organizations)\n .filter(([_, status]) => status.graphql && status.builds && status.organizations)\n .map(([org]) => org);\n \n if (validOrgs.length > 0) {\n lines.push('Valid Organizations:');\n validOrgs.forEach(org => lines.push(` - ${org}`));\n }\n\n const invalidOrgs = Object.entries(status.validation.organizations)\n .filter(([_, status]) => !status.graphql || !status.builds || !status.organizations);\n \n if (invalidOrgs.length > 0) {\n lines.push('Organizations with Limited Access:');\n invalidOrgs.forEach(([org, status]) => {\n const invalidApis = [];\n if (!status.graphql) invalidApis.push('GraphQL');\n if (!status.builds) invalidApis.push('Builds');\n if (!status.organizations) invalidApis.push('Organizations');\n lines.push(` - ${org} (${invalidApis.join(', ')})`);\n });\n }\n } else {\n lines.push('Cannot list organizations - token may be invalid');\n }\n }\n \n return lines.join('\\n');\n }\n\n /**\n * Format token storage result in plain text\n * \n * @param success Whether the token was successfully stored\n * @returns Formatted token storage result message\n */\n formatTokenStorageResult(success: boolean): string {\n if (success) {\n return 'Token successfully stored in system keychain';\n } else {\n return 'Failed to store token';\n }\n }\n\n /**\n * Format token reset result in plain text\n * \n * @param success Whether the token was successfully reset\n * @param hadToken Whether there was a token before reset\n * @returns Formatted token reset result message\n */\n formatTokenResetResult(success: boolean, hadToken: boolean): string {\n if (!hadToken) {\n return 'No token found in system keychain';\n }\n\n if (success) {\n return 'Token successfully deleted from system keychain';\n } else {\n return 'Failed to delete token';\n }\n }\n\n /**\n * Format token validation error in plain text\n * \n * @param validation The validation status for each API\n * @returns Formatted token validation error message\n */\n formatTokenValidationError(\n validation: TokenValidationStatus\n ): string {\n if (!validation.canListOrganizations) {\n return 'Token is invalid or does not have access to list organizations';\n }\n\n const invalidOrgs = Object.entries(validation.organizations)\n .filter(([_, status]) => !status.graphql || !status.builds || !status.organizations)\n .map(([org, status]) => {\n const invalidApis = [];\n if (!status.graphql) invalidApis.push('GraphQL');\n if (!status.builds) invalidApis.push('Builds');\n if (!status.organizations) invalidApis.push('Organizations');\n return `${org} (${invalidApis.join(', ')})`;\n });\n\n if (invalidOrgs.length === 0) {\n return 'Token is valid for all organizations';\n }\n\n return `Token has limited access in some organizations: ${invalidOrgs.join(', ')}`;\n }\n\n /**\n * Format token validation status in plain text\n * \n * @param validation The validation status for each API\n * @returns Formatted token validation status message\n */\n formatTokenValidationStatus(validation: TokenValidationStatus): string {\n if (!validation.canListOrganizations) {\n return 'Token is invalid or does not have access to list organizations';\n }\n\n const lines: string[] = [];\n const validOrgs = Object.entries(validation.organizations)\n .filter(([_, status]) => status.graphql && status.builds && status.organizations)\n .map(([org]) => org);\n \n if (validOrgs.length > 0) {\n lines.push('Valid Organizations:');\n validOrgs.forEach(org => lines.push(` - ${org}`));\n }\n\n const invalidOrgs = Object.entries(validation.organizations)\n .filter(([_, status]) => !status.graphql || !status.builds || !status.organizations);\n \n if (invalidOrgs.length > 0) {\n lines.push('Organizations with Limited Access:');\n invalidOrgs.forEach(([org, status]) => {\n const invalidApis = [];\n if (!status.graphql) invalidApis.push('GraphQL');\n if (!status.builds) invalidApis.push('Builds');\n if (!status.organizations) invalidApis.push('Organizations');\n lines.push(` - ${org} (${invalidApis.join(', ')})`);\n });\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Format error message(s) in plain text\n * \n * @param operation The operation that failed (e.g., 'storing', 'resetting', 'validating')\n * @param error The error that occurred, or an array of errors\n * @returns Formatted error message(s)\n */\n formatError(\n operation: string,\n error: unknown | unknown[]\n ): string {\n const errors = Array.isArray(error) ? error : [error];\n return errors.map(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return `Error ${operation} token: ${errorMessage}`;\n }).join('\\n');\n }\n\n /**\n * Format authentication error message(s) in plain text\n * \n * @param operation The authentication operation that failed (e.g., 'storing', 'validating')\n * @param error The authentication error that occurred, or an array of errors\n * @returns Formatted authentication error message(s)\n */\n formatAuthErrors(\n operation: string,\n error: unknown | unknown[]\n ): string {\n const errors = Array.isArray(error) ? error : [error];\n return errors.map(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return `Authentication error ${operation} token: ${errorMessage}\\nPlease check your token permissions and try again`;\n }).join('\\n\\n');\n }\n\n /**\n * Format multiple error messages in plain text\n * \n * @param operation The operation that failed (e.g., 'storing', 'resetting', 'validating')\n * @param errors Array of errors that occurred\n * @returns Formatted error messages\n */\n formatErrors(\n operation: string,\n errors: unknown[]\n ): string {\n return errors.map(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return `Error ${operation} token: ${errorMessage}`;\n }).join('\\n');\n }\n} "]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PlainTextFormatter } from './PlainTextFormatter.js';
|
|
2
|
+
import { JsonFormatter } from './JsonFormatter.js';
|
|
3
|
+
import { AlfredFormatter } from './AlfredFormatter.js';
|
|
4
|
+
import { logger } from '../../services/logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Get the appropriate token formatter based on the format string
|
|
7
|
+
* @param format The format to use ('plain', 'json', or 'alfred')
|
|
8
|
+
* @returns A TokenFormatter instance
|
|
9
|
+
*/
|
|
10
|
+
export function getTokenFormatter(format = 'plain') {
|
|
11
|
+
// Normalize the format string
|
|
12
|
+
const normalizedFormat = format.toLowerCase().trim();
|
|
13
|
+
switch (normalizedFormat) {
|
|
14
|
+
case 'json':
|
|
15
|
+
return new JsonFormatter();
|
|
16
|
+
case 'alfred':
|
|
17
|
+
return new AlfredFormatter();
|
|
18
|
+
case 'plain':
|
|
19
|
+
case 'text':
|
|
20
|
+
return new PlainTextFormatter();
|
|
21
|
+
default:
|
|
22
|
+
logger.warn(`Unknown format '${format}', defaulting to plain text for token output`);
|
|
23
|
+
return new PlainTextFormatter();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["formatters/token/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,OAAO;IACxD,8BAA8B;IAC9B,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IAErD,QAAQ,gBAAgB,EAAE,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,IAAI,aAAa,EAAE,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,IAAI,eAAe,EAAE,CAAC;QAC/B,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,kBAAkB,EAAE,CAAC;QAClC;YACE,MAAM,CAAC,IAAI,CAAC,mBAAmB,MAAM,8CAA8C,CAAC,CAAC;YACrF,OAAO,IAAI,kBAAkB,EAAE,CAAC;IACpC,CAAC;AACH,CAAC","sourcesContent":["import { TokenFormatter, TokenFormatterOptions } from './Formatter.js';\nimport { PlainTextFormatter } from './PlainTextFormatter.js';\nimport { JsonFormatter } from './JsonFormatter.js';\nimport { AlfredFormatter } from './AlfredFormatter.js';\nimport { logger } from '../../services/logger.js';\n\n/**\n * Get the appropriate token formatter based on the format string\n * @param format The format to use ('plain', 'json', or 'alfred')\n * @returns A TokenFormatter instance\n */\nexport function getTokenFormatter(format: string = 'plain'): TokenFormatter {\n // Normalize the format string\n const normalizedFormat = format.toLowerCase().trim();\n \n switch (normalizedFormat) {\n case 'json':\n return new JsonFormatter();\n case 'alfred':\n return new AlfredFormatter();\n case 'plain':\n case 'text':\n return new PlainTextFormatter();\n default:\n logger.warn(`Unknown format '${format}', defaulting to plain text for token output`);\n return new PlainTextFormatter();\n }\n}\n\nexport { TokenFormatter, TokenFormatterOptions }; "]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { logger } from '../../services/logger.js';
|
|
2
|
+
export class BaseFormatter {
|
|
3
|
+
format(data, formatFn, options) {
|
|
4
|
+
if (options?.debug) {
|
|
5
|
+
logger.debug(`Formatting with ${this.name} formatter`);
|
|
6
|
+
}
|
|
7
|
+
return formatFn(data, options);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Formatter.js","sourceRoot":"/","sources":["formatters/viewer/Formatter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAMlD,MAAM,OAAgB,aAAa;IAKjC,MAAM,CAAI,IAAS,EAAE,QAA2D,EAAE,OAA0B;QAC1G,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,IAAI,YAAY,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CACF","sourcesContent":["import { BaseFormatter as BaseFormatterInterface, FormatterOptions } from '../BaseFormatter.js';\nimport { ViewerData } from '../../types/index.js';\nimport { logger } from '../../services/logger.js';\n\nexport interface ViewerFormatter extends BaseFormatterInterface {\n formatViewer(viewerData: ViewerData, options?: FormatterOptions): string;\n}\n\nexport abstract class BaseFormatter implements ViewerFormatter {\n abstract name: string;\n \n abstract formatViewer(viewerData: ViewerData, options?: FormatterOptions): string;\n \n format<T>(data: T[], formatFn: (data: T[], options?: FormatterOptions) => string, options?: FormatterOptions): string {\n if (options?.debug) {\n logger.debug(`Formatting with ${this.name} formatter`);\n }\n return formatFn(data, options);\n }\n} "]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseFormatter } from './Formatter.js';
|
|
2
|
+
export class JsonFormatter extends BaseFormatter {
|
|
3
|
+
name = 'json';
|
|
4
|
+
formatViewer(viewerData, _options) {
|
|
5
|
+
if (!viewerData?.viewer) {
|
|
6
|
+
return JSON.stringify({ error: 'No viewer data found' }, null, 2);
|
|
7
|
+
}
|
|
8
|
+
const result = {
|
|
9
|
+
id: viewerData.viewer.id,
|
|
10
|
+
user: viewerData.viewer.user ? {
|
|
11
|
+
id: viewerData.viewer.user.id || null,
|
|
12
|
+
uuid: viewerData.viewer.user.uuid || null,
|
|
13
|
+
name: viewerData.viewer.user.name || null,
|
|
14
|
+
email: viewerData.viewer.user.email || null
|
|
15
|
+
} : null
|
|
16
|
+
};
|
|
17
|
+
return JSON.stringify(result, null, 2);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=JsonFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonFormatter.js","sourceRoot":"/","sources":["formatters/viewer/JsonFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,IAAI,GAAG,MAAM,CAAC;IAEd,YAAY,CAAC,UAAsB,EAAE,QAA2B;QAC9D,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,MAAM,GAAG;YACb,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE;YACxB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC7B,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI;gBACrC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI;gBACzC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI;gBACzC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;aAC5C,CAAC,CAAC,CAAC,IAAI;SACT,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF","sourcesContent":["import { FormatterOptions } from '../BaseFormatter.js';\nimport { BaseFormatter } from './Formatter.js';\nimport { ViewerData } from '../../types/index.js';\n\nexport class JsonFormatter extends BaseFormatter {\n name = 'json';\n \n formatViewer(viewerData: ViewerData, _options?: FormatterOptions): string {\n if (!viewerData?.viewer) {\n return JSON.stringify({ error: 'No viewer data found' }, null, 2);\n }\n \n const result = {\n id: viewerData.viewer.id,\n user: viewerData.viewer.user ? {\n id: viewerData.viewer.user.id || null,\n uuid: viewerData.viewer.user.uuid || null,\n name: viewerData.viewer.user.name || null,\n email: viewerData.viewer.user.email || null\n } : null\n };\n \n return JSON.stringify(result, null, 2);\n }\n} "]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseFormatter } from './Formatter.js';
|
|
2
|
+
export class PlainTextFormatter extends BaseFormatter {
|
|
3
|
+
name = 'plain-text';
|
|
4
|
+
formatViewer(viewerData, _options) {
|
|
5
|
+
if (!viewerData?.viewer) {
|
|
6
|
+
return 'No viewer data found.';
|
|
7
|
+
}
|
|
8
|
+
let output = 'Logged in as:\n';
|
|
9
|
+
if (viewerData.viewer.user) {
|
|
10
|
+
output += `- ID: ${viewerData.viewer.user?.id}\n`;
|
|
11
|
+
output += `- Name: ${viewerData.viewer.user?.name}\n`;
|
|
12
|
+
output += `- Email: ${viewerData.viewer.user?.email}\n`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
output += `- No user data found.\n`;
|
|
16
|
+
}
|
|
17
|
+
return output;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=PlainTextFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlainTextFormatter.js","sourceRoot":"/","sources":["formatters/viewer/PlainTextFormatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD,IAAI,GAAG,YAAY,CAAC;IAEpB,YAAY,CAAC,UAAsB,EAAE,QAA2B;QAC9D,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YACxB,OAAO,uBAAuB,CAAC;QACjC,CAAC;QAED,IAAI,MAAM,GAAG,iBAAiB,CAAC;QAC/B,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,IAAI,SAAS,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC;YAClD,MAAM,IAAI,WAAW,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;YACtD,MAAM,IAAI,YAAY,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,yBAAyB,CAAC;QACtC,CAAC;QAGD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { FormatterOptions } from '../BaseFormatter.js';\nimport { BaseFormatter } from './Formatter.js';\nimport { ViewerData } from '../../types/index.js';\n\nexport class PlainTextFormatter extends BaseFormatter {\n name = 'plain-text';\n \n formatViewer(viewerData: ViewerData, _options?: FormatterOptions): string {\n if (!viewerData?.viewer) {\n return 'No viewer data found.';\n }\n\n let output = 'Logged in as:\\n';\n if (viewerData.viewer.user) {\n output += `- ID: ${viewerData.viewer.user?.id}\\n`;\n output += `- Name: ${viewerData.viewer.user?.name}\\n`;\n output += `- Email: ${viewerData.viewer.user?.email}\\n`;\n } else {\n output += `- No user data found.\\n`;\n }\n \n \n return output;\n }\n} "]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PlainTextFormatter } from './PlainTextFormatter.js';
|
|
2
|
+
import { JsonFormatter } from './JsonFormatter.js';
|
|
3
|
+
import { logger } from '../../services/logger.js';
|
|
4
|
+
/**
|
|
5
|
+
* Factory function to create the appropriate formatter for viewer data
|
|
6
|
+
* @param format The format to use
|
|
7
|
+
* @returns A ViewerFormatter instance
|
|
8
|
+
*/
|
|
9
|
+
export function getViewerFormatter(format = 'plain') {
|
|
10
|
+
switch (format.toLowerCase()) {
|
|
11
|
+
case 'plain':
|
|
12
|
+
case 'text':
|
|
13
|
+
return new PlainTextFormatter();
|
|
14
|
+
case 'json':
|
|
15
|
+
return new JsonFormatter();
|
|
16
|
+
default:
|
|
17
|
+
logger.warn(`Unknown format '${format}', defaulting to plain text`);
|
|
18
|
+
return new PlainTextFormatter();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["formatters/viewer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB,OAAO;IACzD,QAAQ,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7B,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,kBAAkB,EAAE,CAAC;QAClC,KAAK,MAAM;YACT,OAAO,IAAI,aAAa,EAAE,CAAC;QAC7B;YACE,MAAM,CAAC,IAAI,CAAC,mBAAmB,MAAM,6BAA6B,CAAC,CAAC;YACpE,OAAO,IAAI,kBAAkB,EAAE,CAAC;IACpC,CAAC;AACH,CAAC","sourcesContent":["import { PlainTextFormatter } from './PlainTextFormatter.js';\nimport { JsonFormatter } from './JsonFormatter.js';\nimport { ViewerFormatter } from './Formatter.js';\nimport { logger } from '../../services/logger.js';\n\n/**\n * Factory function to create the appropriate formatter for viewer data\n * @param format The format to use\n * @returns A ViewerFormatter instance\n */\nexport function getViewerFormatter(format: string = 'plain'): ViewerFormatter {\n switch (format.toLowerCase()) {\n case 'plain':\n case 'text':\n return new PlainTextFormatter();\n case 'json':\n return new JsonFormatter();\n default:\n logger.warn(`Unknown format '${format}', defaulting to plain text`);\n return new PlainTextFormatter();\n }\n}\n\nexport { ViewerFormatter }; "]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function useFragment(_documentNode, fragmentType) {
|
|
2
|
+
return fragmentType;
|
|
3
|
+
}
|
|
4
|
+
export function makeFragmentData(data, _fragment) {
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
+
const deferredFields = queryNode.__meta__
|
|
9
|
+
?.deferredFields;
|
|
10
|
+
if (!deferredFields)
|
|
11
|
+
return true;
|
|
12
|
+
const fragDef = fragmentNode.definitions[0];
|
|
13
|
+
const fragName = fragDef?.name?.value;
|
|
14
|
+
const fields = (fragName && deferredFields[fragName]) || [];
|
|
15
|
+
return fields.length > 0 && fields.every(field => data && field in data);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=fragment-masking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","sourceRoot":"/","sources":["graphql/generated/fragment-masking.ts"],"names":[],"mappings":"AAyDA,MAAM,UAAU,WAAW,CACzB,aAAiD,EACjD,YAA6M;IAE7M,OAAO,YAAmB,CAAC;AAC7B,CAAC;AAGD,MAAM,UAAU,gBAAgB,CAG9B,IAAQ,EAAE,SAAY;IACtB,OAAO,IAAuB,CAAC;AACjC,CAAC;AACD,MAAM,UAAU,eAAe,CAC7B,SAA8C,EAC9C,YAAsC,EACtC,IAAiF;IAEjF,MAAM,cAAc,GAAI,SAAgF,CAAC,QAAQ;QAC/G,EAAE,cAAc,CAAC;IAEnB,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC,CAAuC,CAAC;IAClF,MAAM,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;IAEtC,MAAM,MAAM,GAAG,CAAC,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["/* eslint-disable */\nimport { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql.js';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is undefined\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined\n): TType | undefined;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null\n): TType | null;\n// return nullable if `fragmentType` is nullable or undefined\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>\n): Array<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): Array<TType> | null | undefined;\n// return readonly array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return readonly array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | Array<FragmentType<DocumentTypeDecoration<TType, any>>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as types from './graphql.js';
|
|
3
|
+
const documents = {
|
|
4
|
+
"\n query GetViewer {\n viewer {\n id\n user {\n id\n uuid\n name\n email\n }\n }\n }\n": types.GetViewerDocument,
|
|
5
|
+
"\n query GetOrganizations {\n viewer {\n organizations {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n }\n": types.GetOrganizationsDocument,
|
|
6
|
+
"\n query GetPipelines($organizationSlug: ID!, $first: Int, $after: String) {\n organization(slug: $organizationSlug) {\n pipelines(first: $first, after: $after) {\n edges {\n node {\n uuid\n id\n name\n slug\n description\n url\n repository {\n url\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": types.GetPipelinesDocument,
|
|
7
|
+
"\n query GetBuilds($pipelineSlug: String!, $organizationSlug: ID!, $first: Int) {\n organization(slug: $organizationSlug) {\n pipelines(first: 1, search: $pipelineSlug) {\n edges {\n node {\n builds(first: $first) {\n edges {\n node {\n id\n number\n url\n state\n message\n commit\n branch\n createdAt\n startedAt\n finishedAt\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n }\n }\n": types.GetBuildsDocument,
|
|
8
|
+
"\n query GetViewerBuilds($first: Int!) {\n viewer {\n builds(first: $first) {\n edges {\n node {\n id\n number\n state\n url\n createdAt\n branch\n message\n pipeline {\n name\n slug\n }\n organization {\n name\n slug\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": types.GetViewerBuildsDocument,
|
|
9
|
+
};
|
|
10
|
+
export function graphql(source) {
|
|
11
|
+
return documents[source] ?? {};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=gql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gql.js","sourceRoot":"/","sources":["graphql/generated/gql.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAqBtC,MAAM,SAAS,GAAc;IACzB,2IAA2I,EAAE,KAAK,CAAC,iBAAiB;IACpK,yMAAyM,EAAE,KAAK,CAAC,wBAAwB;IACzO,sfAAsf,EAAE,KAAK,CAAC,oBAAoB;IAClhB,wvBAAwvB,EAAE,KAAK,CAAC,iBAAiB;IACjxB,+hBAA+hB,EAAE,KAAK,CAAC,uBAAuB;CACjkB,CAAC;AAqCF,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,OAAQ,SAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["/* eslint-disable */\nimport * as types from './graphql.js';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size\n */\ntype Documents = {\n \"\\n query GetViewer {\\n viewer {\\n id\\n user {\\n id\\n uuid\\n name\\n email\\n }\\n }\\n }\\n\": typeof types.GetViewerDocument,\n \"\\n query GetOrganizations {\\n viewer {\\n organizations {\\n edges {\\n node {\\n id\\n name\\n slug\\n }\\n }\\n }\\n }\\n }\\n\": typeof types.GetOrganizationsDocument,\n \"\\n query GetPipelines($organizationSlug: ID!, $first: Int, $after: String) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: $first, after: $after) {\\n edges {\\n node {\\n uuid\\n id\\n name\\n slug\\n description\\n url\\n repository {\\n url\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\": typeof types.GetPipelinesDocument,\n \"\\n query GetBuilds($pipelineSlug: String!, $organizationSlug: ID!, $first: Int) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: 1, search: $pipelineSlug) {\\n edges {\\n node {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n url\\n state\\n message\\n commit\\n branch\\n createdAt\\n startedAt\\n finishedAt\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n\": typeof types.GetBuildsDocument,\n \"\\n query GetViewerBuilds($first: Int!) {\\n viewer {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n state\\n url\\n createdAt\\n branch\\n message\\n pipeline {\\n name\\n slug\\n }\\n organization {\\n name\\n slug\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\": typeof types.GetViewerBuildsDocument,\n};\nconst documents: Documents = {\n \"\\n query GetViewer {\\n viewer {\\n id\\n user {\\n id\\n uuid\\n name\\n email\\n }\\n }\\n }\\n\": types.GetViewerDocument,\n \"\\n query GetOrganizations {\\n viewer {\\n organizations {\\n edges {\\n node {\\n id\\n name\\n slug\\n }\\n }\\n }\\n }\\n }\\n\": types.GetOrganizationsDocument,\n \"\\n query GetPipelines($organizationSlug: ID!, $first: Int, $after: String) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: $first, after: $after) {\\n edges {\\n node {\\n uuid\\n id\\n name\\n slug\\n description\\n url\\n repository {\\n url\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\": types.GetPipelinesDocument,\n \"\\n query GetBuilds($pipelineSlug: String!, $organizationSlug: ID!, $first: Int) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: 1, search: $pipelineSlug) {\\n edges {\\n node {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n url\\n state\\n message\\n commit\\n branch\\n createdAt\\n startedAt\\n finishedAt\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n\": types.GetBuildsDocument,\n \"\\n query GetViewerBuilds($first: Int!) {\\n viewer {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n state\\n url\\n createdAt\\n branch\\n message\\n pipeline {\\n name\\n slug\\n }\\n organization {\\n name\\n slug\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\": types.GetViewerBuildsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetViewer {\\n viewer {\\n id\\n user {\\n id\\n uuid\\n name\\n email\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetViewer {\\n viewer {\\n id\\n user {\\n id\\n uuid\\n name\\n email\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetOrganizations {\\n viewer {\\n organizations {\\n edges {\\n node {\\n id\\n name\\n slug\\n }\\n }\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetOrganizations {\\n viewer {\\n organizations {\\n edges {\\n node {\\n id\\n name\\n slug\\n }\\n }\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetPipelines($organizationSlug: ID!, $first: Int, $after: String) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: $first, after: $after) {\\n edges {\\n node {\\n uuid\\n id\\n name\\n slug\\n description\\n url\\n repository {\\n url\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetPipelines($organizationSlug: ID!, $first: Int, $after: String) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: $first, after: $after) {\\n edges {\\n node {\\n uuid\\n id\\n name\\n slug\\n description\\n url\\n repository {\\n url\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetBuilds($pipelineSlug: String!, $organizationSlug: ID!, $first: Int) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: 1, search: $pipelineSlug) {\\n edges {\\n node {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n url\\n state\\n message\\n commit\\n branch\\n createdAt\\n startedAt\\n finishedAt\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetBuilds($pipelineSlug: String!, $organizationSlug: ID!, $first: Int) {\\n organization(slug: $organizationSlug) {\\n pipelines(first: 1, search: $pipelineSlug) {\\n edges {\\n node {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n url\\n state\\n message\\n commit\\n branch\\n createdAt\\n startedAt\\n finishedAt\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetViewerBuilds($first: Int!) {\\n viewer {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n state\\n url\\n createdAt\\n branch\\n message\\n pipeline {\\n name\\n slug\\n }\\n organization {\\n name\\n slug\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetViewerBuilds($first: Int!) {\\n viewer {\\n builds(first: $first) {\\n edges {\\n node {\\n id\\n number\\n state\\n url\\n createdAt\\n branch\\n message\\n pipeline {\\n name\\n slug\\n }\\n organization {\\n name\\n slug\\n }\\n }\\n }\\n pageInfo {\\n hasNextPage\\n endCursor\\n }\\n }\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"]}
|