@zuplo/cli 6.59.12 → 6.59.17
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/dist/login/html.d.ts +1 -1
- package/dist/login/html.d.ts.map +1 -1
- package/dist/login/html.js +103 -25
- package/dist/login/html.js.map +1 -1
- package/dist/login/login.d.ts.map +1 -1
- package/dist/login/login.js +30 -1
- package/dist/login/login.js.map +1 -1
- package/package.json +4 -4
package/dist/login/html.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const html =
|
|
2
|
-
'<html>\n <head>\n <title>Authorization
|
|
2
|
+
'<html>\n <head>\n <title id="page-title">Authorization</title>\n <style>\n body {\n font-family:\n -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,\n Arial, sans-serif;\n background-color: #f9fafb;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100vh;\n margin: 0;\n }\n .container {\n max-width: 400px;\n padding: 2rem;\n background-color: white;\n border-radius: 0.5rem;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n text-align: center;\n border: 1px solid #e5e7eb;\n }\n .icon {\n border-radius: 9999px;\n width: 48px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 auto 1rem auto;\n }\n .icon.success {\n background-color: #ffe0f7;\n color: #ff00bd;\n }\n .icon.error {\n background-color: #fee2e2;\n color: #dc2626;\n }\n h1 {\n color: #111827;\n font-size: 1.5rem;\n margin-bottom: 0.5rem;\n }\n p {\n color: #6b7280;\n margin-bottom: 1.5rem;\n }\n .error-description {\n background-color: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n padding: 1rem;\n border-radius: 0.375rem;\n margin-bottom: 1rem;\n font-size: 0.875rem;\n }\n a {\n color: #d600a0;\n text-decoration: none;\n font-weight: 500;\n }\n a:hover {\n text-decoration: underline;\n }\n button {\n background-color: #ff00bd;\n color: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 0.375rem;\n font-size: 0.875rem;\n cursor: pointer;\n }\n button:hover {\n background-color: #d600a0;\n }\n button.secondary {\n background-color: #6b7280;\n margin-left: 0.5rem;\n }\n button.secondary:hover {\n background-color: #4b5563;\n }\n </style>\n </head>\n <body>\n <div class="container" id="content"></div>\n\n <script>\n // Parse URL parameters\n const urlParams = new URLSearchParams(window.location.search);\n const error = urlParams.get(\'error\');\n const errorDescription = urlParams.get(\'error_description\');\n const errorUri = urlParams.get(\'error_uri\');\n const code = urlParams.get(\'code\');\n\n const pageTitle = document.getElementById(\'page-title\');\n const content = document.getElementById(\'content\');\n\n function createIcon(type) {\n if (type === \'success\') {\n return `\n <div class="icon success">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M5 13L9 17L19 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n </div>`;\n } else {\n return `\n <div class="icon error">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>\n <line x1="15" y1="9" x2="9" y2="15" stroke="currentColor" stroke-width="2"/>\n <line x1="9" y1="9" x2="15" y2="15" stroke="currentColor" stroke-width="2"/>\n </svg>\n </div>`;\n }\n }\n\n function createSupportText() {\n return \'An error occurred during the login process. If the problem continues, please contact our support team at <a href="mailto:support@zuplo.com">support@zuplo.com</a>.\';\n }\n\n if (error) {\n // Handle OAuth error\n pageTitle.textContent = \'Authorization Failed\';\n \n content.innerHTML = `\n ${createIcon(\'error\')}\n <h1>Authorization Failed</h1>\n ${errorDescription ? `<div class="error-description">${errorDescription}</div>` : \'\'}\n <p>${createSupportText()}</p>\n <button onclick="window.close()">Close this tab</button>\n `;\n } else if (code) {\n // Handle successful authorization\n pageTitle.textContent = \'Authorization Successful\';\n content.innerHTML = `\n ${createIcon(\'success\')}\n <h1>Authorization successful</h1>\n <p>Close this tab and return to the Zuplo CLI.</p>\n <button onclick="window.close()">Close this tab</button>\n `;\n } else {\n // Handle unexpected state (no code, no error)\n pageTitle.textContent = \'Authorization Error\';\n \n content.innerHTML = `\n ${createIcon(\'error\')}\n <h1>Authorization Error</h1>\n <div class="error-description">An unexpected error occurred during the login process.</div>\n <p>${createSupportText()}</p>\n <button onclick="window.close()">Close this tab</button>\n `;\n }\n </script>\n </body>\n</html>';
|
|
3
3
|
//# sourceMappingURL=html.d.ts.map
|
package/dist/login/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/login/html.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/login/html.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,uqKAgKT,CAAC"}
|
package/dist/login/html.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const html = `<html>
|
|
2
2
|
<head>
|
|
3
|
-
<title>Authorization
|
|
3
|
+
<title id="page-title">Authorization</title>
|
|
4
4
|
<style>
|
|
5
5
|
body {
|
|
6
6
|
font-family:
|
|
@@ -23,8 +23,6 @@ export const html = `<html>
|
|
|
23
23
|
border: 1px solid #e5e7eb;
|
|
24
24
|
}
|
|
25
25
|
.icon {
|
|
26
|
-
background-color: #ffe0f7;
|
|
27
|
-
color: #ff00bd;
|
|
28
26
|
border-radius: 9999px;
|
|
29
27
|
width: 48px;
|
|
30
28
|
height: 48px;
|
|
@@ -33,6 +31,14 @@ export const html = `<html>
|
|
|
33
31
|
justify-content: center;
|
|
34
32
|
margin: 0 auto 1rem auto;
|
|
35
33
|
}
|
|
34
|
+
.icon.success {
|
|
35
|
+
background-color: #ffe0f7;
|
|
36
|
+
color: #ff00bd;
|
|
37
|
+
}
|
|
38
|
+
.icon.error {
|
|
39
|
+
background-color: #fee2e2;
|
|
40
|
+
color: #dc2626;
|
|
41
|
+
}
|
|
36
42
|
h1 {
|
|
37
43
|
color: #111827;
|
|
38
44
|
font-size: 1.5rem;
|
|
@@ -42,6 +48,23 @@ export const html = `<html>
|
|
|
42
48
|
color: #6b7280;
|
|
43
49
|
margin-bottom: 1.5rem;
|
|
44
50
|
}
|
|
51
|
+
.error-description {
|
|
52
|
+
background-color: #fef2f2;
|
|
53
|
+
border: 1px solid #fecaca;
|
|
54
|
+
color: #991b1b;
|
|
55
|
+
padding: 1rem;
|
|
56
|
+
border-radius: 0.375rem;
|
|
57
|
+
margin-bottom: 1rem;
|
|
58
|
+
font-size: 0.875rem;
|
|
59
|
+
}
|
|
60
|
+
a {
|
|
61
|
+
color: #d600a0;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
}
|
|
65
|
+
a:hover {
|
|
66
|
+
text-decoration: underline;
|
|
67
|
+
}
|
|
45
68
|
button {
|
|
46
69
|
background-color: #ff00bd;
|
|
47
70
|
color: white;
|
|
@@ -54,31 +77,86 @@ export const html = `<html>
|
|
|
54
77
|
button:hover {
|
|
55
78
|
background-color: #d600a0;
|
|
56
79
|
}
|
|
80
|
+
button.secondary {
|
|
81
|
+
background-color: #6b7280;
|
|
82
|
+
margin-left: 0.5rem;
|
|
83
|
+
}
|
|
84
|
+
button.secondary:hover {
|
|
85
|
+
background-color: #4b5563;
|
|
86
|
+
}
|
|
57
87
|
</style>
|
|
58
88
|
</head>
|
|
59
89
|
<body>
|
|
60
|
-
<div class="container">
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
<div class="container" id="content"></div>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
// Parse URL parameters
|
|
94
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
95
|
+
const error = urlParams.get('error');
|
|
96
|
+
const errorDescription = urlParams.get('error_description');
|
|
97
|
+
const errorUri = urlParams.get('error_uri');
|
|
98
|
+
const code = urlParams.get('code');
|
|
99
|
+
|
|
100
|
+
const pageTitle = document.getElementById('page-title');
|
|
101
|
+
const content = document.getElementById('content');
|
|
102
|
+
|
|
103
|
+
function createIcon(type) {
|
|
104
|
+
if (type === 'success') {
|
|
105
|
+
return \`
|
|
106
|
+
<div class="icon success">
|
|
107
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
108
|
+
<path d="M5 13L9 17L19 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
109
|
+
</svg>
|
|
110
|
+
</div>\`;
|
|
111
|
+
} else {
|
|
112
|
+
return \`
|
|
113
|
+
<div class="icon error">
|
|
114
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
+
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
|
|
116
|
+
<line x1="15" y1="9" x2="9" y2="15" stroke="currentColor" stroke-width="2"/>
|
|
117
|
+
<line x1="9" y1="9" x2="15" y2="15" stroke="currentColor" stroke-width="2"/>
|
|
118
|
+
</svg>
|
|
119
|
+
</div>\`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function createSupportText() {
|
|
124
|
+
return 'An error occurred during the login process. If the problem continues, please contact our support team at <a href="mailto:support@zuplo.com">support@zuplo.com</a>.';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (error) {
|
|
128
|
+
// Handle OAuth error
|
|
129
|
+
pageTitle.textContent = 'Authorization Failed';
|
|
130
|
+
|
|
131
|
+
content.innerHTML = \`
|
|
132
|
+
\${createIcon('error')}
|
|
133
|
+
<h1>Authorization Failed</h1>
|
|
134
|
+
\${errorDescription ? \`<div class="error-description">\${errorDescription}</div>\` : ''}
|
|
135
|
+
<p>\${createSupportText()}</p>
|
|
136
|
+
<button onclick="window.close()">Close this tab</button>
|
|
137
|
+
\`;
|
|
138
|
+
} else if (code) {
|
|
139
|
+
// Handle successful authorization
|
|
140
|
+
pageTitle.textContent = 'Authorization Successful';
|
|
141
|
+
content.innerHTML = \`
|
|
142
|
+
\${createIcon('success')}
|
|
143
|
+
<h1>Authorization successful</h1>
|
|
144
|
+
<p>Close this tab and return to the Zuplo CLI.</p>
|
|
145
|
+
<button onclick="window.close()">Close this tab</button>
|
|
146
|
+
\`;
|
|
147
|
+
} else {
|
|
148
|
+
// Handle unexpected state (no code, no error)
|
|
149
|
+
pageTitle.textContent = 'Authorization Error';
|
|
150
|
+
|
|
151
|
+
content.innerHTML = \`
|
|
152
|
+
\${createIcon('error')}
|
|
153
|
+
<h1>Authorization Error</h1>
|
|
154
|
+
<div class="error-description">An unexpected error occurred during the login process.</div>
|
|
155
|
+
<p>\${createSupportText()}</p>
|
|
156
|
+
<button onclick="window.close()">Close this tab</button>
|
|
157
|
+
\`;
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
82
160
|
</body>
|
|
83
161
|
</html>`;
|
|
84
162
|
//# sourceMappingURL=html.js.map
|
package/dist/login/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/login/html.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/login/html.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgKZ,CAAC","sourcesContent":["export const html = `<html>\n <head>\n <title id=\"page-title\">Authorization</title>\n <style>\n body {\n font-family:\n -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica,\n Arial, sans-serif;\n background-color: #f9fafb;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100vh;\n margin: 0;\n }\n .container {\n max-width: 400px;\n padding: 2rem;\n background-color: white;\n border-radius: 0.5rem;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n text-align: center;\n border: 1px solid #e5e7eb;\n }\n .icon {\n border-radius: 9999px;\n width: 48px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 auto 1rem auto;\n }\n .icon.success {\n background-color: #ffe0f7;\n color: #ff00bd;\n }\n .icon.error {\n background-color: #fee2e2;\n color: #dc2626;\n }\n h1 {\n color: #111827;\n font-size: 1.5rem;\n margin-bottom: 0.5rem;\n }\n p {\n color: #6b7280;\n margin-bottom: 1.5rem;\n }\n .error-description {\n background-color: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n padding: 1rem;\n border-radius: 0.375rem;\n margin-bottom: 1rem;\n font-size: 0.875rem;\n }\n a {\n color: #d600a0;\n text-decoration: none;\n font-weight: 500;\n }\n a:hover {\n text-decoration: underline;\n }\n button {\n background-color: #ff00bd;\n color: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 0.375rem;\n font-size: 0.875rem;\n cursor: pointer;\n }\n button:hover {\n background-color: #d600a0;\n }\n button.secondary {\n background-color: #6b7280;\n margin-left: 0.5rem;\n }\n button.secondary:hover {\n background-color: #4b5563;\n }\n </style>\n </head>\n <body>\n <div class=\"container\" id=\"content\"></div>\n\n <script>\n // Parse URL parameters\n const urlParams = new URLSearchParams(window.location.search);\n const error = urlParams.get('error');\n const errorDescription = urlParams.get('error_description');\n const errorUri = urlParams.get('error_uri');\n const code = urlParams.get('code');\n\n const pageTitle = document.getElementById('page-title');\n const content = document.getElementById('content');\n\n function createIcon(type) {\n if (type === 'success') {\n return \\`\n <div class=\"icon success\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </div>\\`;\n } else {\n return \\`\n <div class=\"icon error\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"2\"/>\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" stroke=\"currentColor\" stroke-width=\"2\"/>\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" stroke=\"currentColor\" stroke-width=\"2\"/>\n </svg>\n </div>\\`;\n }\n }\n\n function createSupportText() {\n return 'An error occurred during the login process. If the problem continues, please contact our support team at <a href=\"mailto:support@zuplo.com\">support@zuplo.com</a>.';\n }\n\n if (error) {\n // Handle OAuth error\n pageTitle.textContent = 'Authorization Failed';\n \n content.innerHTML = \\`\n \\${createIcon('error')}\n <h1>Authorization Failed</h1>\n \\${errorDescription ? \\`<div class=\"error-description\">\\${errorDescription}</div>\\` : ''}\n <p>\\${createSupportText()}</p>\n <button onclick=\"window.close()\">Close this tab</button>\n \\`;\n } else if (code) {\n // Handle successful authorization\n pageTitle.textContent = 'Authorization Successful';\n content.innerHTML = \\`\n \\${createIcon('success')}\n <h1>Authorization successful</h1>\n <p>Close this tab and return to the Zuplo CLI.</p>\n <button onclick=\"window.close()\">Close this tab</button>\n \\`;\n } else {\n // Handle unexpected state (no code, no error)\n pageTitle.textContent = 'Authorization Error';\n \n content.innerHTML = \\`\n \\${createIcon('error')}\n <h1>Authorization Error</h1>\n <div class=\"error-description\">An unexpected error occurred during the login process.</div>\n <p>\\${createSupportText()}</p>\n <button onclick=\"window.close()\">Close this tab</button>\n \\`;\n }\n </script>\n </body>\n</html>`;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,eAAO,MAAM,SAAS,qCAAqC,CAAC;AAC5D,eAAO,MAAM,YAAY,4BAA0C,CAAC;AACpE,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAC7C,eAAO,MAAM,WAAW,gCAAgC,CAAC;AACzD,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAAgB,CAAC;AACrD,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAAgB,CAAC;AAErD,eAAO,MAAM,kBAAkB,cAO9B,CAAC;AAOF,eAAO,MAAM,wBAAwB,GAAI,OAAO,MAAM,EAAE,GAAG,UAAU,WAGpE,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,GAAG,MAAM,iBAQrC,CAAC;AAEF,wBAAsB,KAAK,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,eAAO,MAAM,SAAS,qCAAqC,CAAC;AAC5D,eAAO,MAAM,YAAY,4BAA0C,CAAC;AACpE,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAC7C,eAAO,MAAM,WAAW,gCAAgC,CAAC;AACzD,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAAgB,CAAC;AACrD,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAAgB,CAAC;AAErD,eAAO,MAAM,kBAAkB,cAO9B,CAAC;AAOF,eAAO,MAAM,wBAAwB,GAAI,OAAO,MAAM,EAAE,GAAG,UAAU,WAGpE,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,GAAG,MAAM,iBAQrC,CAAC;AAEF,wBAAsB,KAAK,kBA8E1B"}
|
package/dist/login/login.js
CHANGED
|
@@ -41,9 +41,38 @@ export async function login() {
|
|
|
41
41
|
authUrl.searchParams.set("scope", OAUTH_SCOPE);
|
|
42
42
|
authUrl.searchParams.set("audience", OAUTH_AUDIENCE);
|
|
43
43
|
const params = await browserAuth(authUrl.toString());
|
|
44
|
+
const error = params.get("error");
|
|
45
|
+
if (error) {
|
|
46
|
+
const errorDescription = params.get("error_description");
|
|
47
|
+
const errorUri = params.get("error_uri");
|
|
48
|
+
const Sentry = await import("@sentry/node");
|
|
49
|
+
Sentry.captureException(new Error(`OAuth Error: ${error}`), {
|
|
50
|
+
tags: {
|
|
51
|
+
oauth_error: error,
|
|
52
|
+
source: "cli_login",
|
|
53
|
+
},
|
|
54
|
+
extra: {
|
|
55
|
+
error_description: errorDescription,
|
|
56
|
+
error_uri: errorUri,
|
|
57
|
+
callback_url: authUrl.toString(),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
throw new Error(errorDescription || `OAuth error: ${error}`);
|
|
61
|
+
}
|
|
44
62
|
const code = params.get("code");
|
|
45
63
|
if (code === null) {
|
|
46
|
-
|
|
64
|
+
const Sentry = await import("@sentry/node");
|
|
65
|
+
Sentry.captureException(new Error("OAuth callback received without code or error parameters"), {
|
|
66
|
+
tags: {
|
|
67
|
+
oauth_error: "missing_parameters",
|
|
68
|
+
source: "cli_login",
|
|
69
|
+
},
|
|
70
|
+
extra: {
|
|
71
|
+
callback_url: authUrl.toString(),
|
|
72
|
+
all_params: Object.fromEntries(params.entries()),
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
throw new Error("Authorization failed: No authorization code received");
|
|
47
76
|
}
|
|
48
77
|
const tokenParams = new URLSearchParams();
|
|
49
78
|
tokenParams.set("grant_type", "authorization_code");
|
package/dist/login/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,kCAAkC,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,gBAAgB,GAAG,CAAC;AACpE,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,6BAA6B,CAAC;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,OAAO,GACX,oEAAoE,CAAC;IACvE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5E,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,YAAY,GA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MAAM,KAAK,CAAC,WAAW,YAAY,cAAc,EAAE;QAClE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,mCAAmC;SACpD;QACD,IAAI,EAAE,WAAW;KAClB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAkB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpD,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import crypto from \"node:crypto\";\nimport { browserAuth } from \"./server.js\";\nimport { OAuthResponse, saveAuthState } from \"./tokens.js\";\n\nexport const AUTH_SERVER_PORT = 57801;\nexport const CLIENT_ID = \"mYLGcH7kB4P0pw0HAk6GH7raRwYhSlW4\";\nexport const CALLBACK_URL = `http://localhost:${AUTH_SERVER_PORT}/`;\nexport const AUTH0_DOMAIN = \"auth.zuplo.com\";\nexport const OAUTH_SCOPE = \"openid email offline_access\";\nexport const OAUTH_AUDIENCE = \"https://dev.zuplo.com/\";\n\nexport const encode = (value: string) => btoa(value);\nexport const decode = (value: string) => atob(value);\n\nexport const createRandomString = () => {\n const charset =\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.\";\n let random = \"\";\n const randomValues = Array.from(crypto.getRandomValues(new Uint8Array(43)));\n randomValues.forEach((v) => (random += charset[v % charset.length]));\n return random;\n};\n\nconst urlEncodeB64 = (input: string) => {\n const b64Chars: { [index: string]: string } = { \"+\": \"-\", \"/\": \"_\", \"=\": \"\" };\n return input.replace(/[+/=]/g, (m: string) => b64Chars[m]);\n};\n\nexport const bufferToBase64UrlEncoded = (input: number[] | Uint8Array) => {\n const ie11SafeInput = new Uint8Array(input);\n return urlEncodeB64(btoa(String.fromCharCode(...Array.from(ie11SafeInput))));\n};\n\nexport const sha256 = async (s: string) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const digestOp: any = crypto.subtle.digest(\n { name: \"SHA-256\" },\n new TextEncoder().encode(s)\n );\n\n return await digestOp;\n};\n\nexport async function login() {\n const code_verifier = createRandomString();\n const code_challengeBuffer = await sha256(code_verifier);\n const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);\n\n const authUrl = new URL(`https://${AUTH0_DOMAIN}/authorize`);\n\n authUrl.searchParams.set(\"response_type\", \"code\");\n authUrl.searchParams.set(\"code_challenge\", code_challenge);\n authUrl.searchParams.set(\"code_challenge_method\", \"S256\");\n authUrl.searchParams.set(\"client_id\", CLIENT_ID);\n authUrl.searchParams.set(\"redirect_uri\", CALLBACK_URL);\n authUrl.searchParams.set(\"scope\", OAUTH_SCOPE);\n authUrl.searchParams.set(\"audience\", OAUTH_AUDIENCE);\n\n const params = await browserAuth(authUrl.toString());\n\n // Check for OAuth errors first\n const error = params.get(\"error\");\n if (error) {\n const errorDescription = params.get(\"error_description\");\n const errorUri = params.get(\"error_uri\");\n\n // Import Sentry dynamically to capture OAuth errors\n const Sentry = await import(\"@sentry/node\");\n Sentry.captureException(new Error(`OAuth Error: ${error}`), {\n tags: {\n oauth_error: error,\n source: \"cli_login\",\n },\n extra: {\n error_description: errorDescription,\n error_uri: errorUri,\n callback_url: authUrl.toString(),\n },\n });\n\n throw new Error(errorDescription || `OAuth error: ${error}`);\n }\n\n const code = params.get(\"code\");\n if (code === null) {\n // Import Sentry dynamically for unexpected state\n const Sentry = await import(\"@sentry/node\");\n Sentry.captureException(\n new Error(\"OAuth callback received without code or error parameters\"),\n {\n tags: {\n oauth_error: \"missing_parameters\",\n source: \"cli_login\",\n },\n extra: {\n callback_url: authUrl.toString(),\n all_params: Object.fromEntries(params.entries()),\n },\n }\n );\n\n throw new Error(\"Authorization failed: No authorization code received\");\n }\n\n const tokenParams = new URLSearchParams();\n tokenParams.set(\"grant_type\", \"authorization_code\");\n tokenParams.set(\"client_id\", CLIENT_ID);\n tokenParams.set(\"code_verifier\", code_verifier);\n tokenParams.set(\"code\", code);\n tokenParams.set(\"redirect_uri\", CALLBACK_URL);\n\n const response = await fetch(`https://${AUTH0_DOMAIN}/oauth/token`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: tokenParams,\n });\n\n const result: OAuthResponse = await response.json();\n await saveAuthState(result);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "6.59.
|
|
3
|
+
"version": "6.59.17",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@opentelemetry/api": "1.9.0",
|
|
30
30
|
"@sentry/node": "9.22.0",
|
|
31
31
|
"@swc/core": "1.10.18",
|
|
32
|
-
"@zuplo/core": "6.59.
|
|
33
|
-
"@zuplo/openapi-tools": "6.59.
|
|
34
|
-
"@zuplo/runtime": "6.59.
|
|
32
|
+
"@zuplo/core": "6.59.17",
|
|
33
|
+
"@zuplo/openapi-tools": "6.59.17",
|
|
34
|
+
"@zuplo/runtime": "6.59.17",
|
|
35
35
|
"as-table": "1.0.55",
|
|
36
36
|
"chalk": "5.4.1",
|
|
37
37
|
"chokidar": "3.5.3",
|