@growthub/cli 0.3.16 → 0.3.18
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/index.js
CHANGED
|
@@ -1620,7 +1620,7 @@ var init_config_schema = __esm({
|
|
|
1620
1620
|
publicBaseUrl: z19.string().url().optional(),
|
|
1621
1621
|
disableSignUp: z19.boolean().default(false),
|
|
1622
1622
|
token: z19.string().min(1).optional(),
|
|
1623
|
-
growthubBaseUrl: z19.string().url().
|
|
1623
|
+
growthubBaseUrl: z19.string().url().optional(),
|
|
1624
1624
|
growthubPortalBaseUrl: z19.string().url().optional(),
|
|
1625
1625
|
growthubMachineLabel: z19.string().min(1).optional(),
|
|
1626
1626
|
growthubWorkspaceLabel: z19.string().min(1).optional()
|
|
@@ -1668,8 +1668,7 @@ var init_config_schema = __esm({
|
|
|
1668
1668
|
server: serverConfigSchema,
|
|
1669
1669
|
auth: authConfigSchema.default({
|
|
1670
1670
|
baseUrlMode: "auto",
|
|
1671
|
-
disableSignUp: false
|
|
1672
|
-
growthubBaseUrl: "https://growthhub.ai"
|
|
1671
|
+
disableSignUp: false
|
|
1673
1672
|
}),
|
|
1674
1673
|
surface: surfaceConfigSchema.default({
|
|
1675
1674
|
profile: "dx"
|
|
@@ -7510,7 +7509,6 @@ function quickstartDefaultsFromEnv() {
|
|
|
7510
7509
|
auth: {
|
|
7511
7510
|
baseUrlMode: authBaseUrlMode,
|
|
7512
7511
|
disableSignUp: false,
|
|
7513
|
-
growthubBaseUrl: "https://growthhub.ai",
|
|
7514
7512
|
...authPublicBaseUrl ? { publicBaseUrl: authPublicBaseUrl } : {}
|
|
7515
7513
|
},
|
|
7516
7514
|
surface: {
|
|
@@ -8197,8 +8195,7 @@ function defaultConfig() {
|
|
|
8197
8195
|
},
|
|
8198
8196
|
auth: {
|
|
8199
8197
|
baseUrlMode: "auto",
|
|
8200
|
-
disableSignUp: false
|
|
8201
|
-
growthubBaseUrl: "https://growthhub.ai"
|
|
8198
|
+
disableSignUp: false
|
|
8202
8199
|
},
|
|
8203
8200
|
surface: {
|
|
8204
8201
|
profile: "dx"
|
|
@@ -11436,8 +11433,7 @@ function buildWorktreeConfig(input) {
|
|
|
11436
11433
|
auth: {
|
|
11437
11434
|
baseUrlMode: source?.auth.baseUrlMode ?? "auto",
|
|
11438
11435
|
...authPublicBaseUrl ? { publicBaseUrl: authPublicBaseUrl } : {},
|
|
11439
|
-
disableSignUp: source?.auth.disableSignUp ?? false
|
|
11440
|
-
growthubBaseUrl: source?.auth.growthubBaseUrl ?? "https://growthhub.ai"
|
|
11436
|
+
disableSignUp: source?.auth.disableSignUp ?? false
|
|
11441
11437
|
},
|
|
11442
11438
|
surface: {
|
|
11443
11439
|
profile: source?.surface.profile ?? "dx"
|
|
@@ -123,7 +123,7 @@ export async function createApp(db, opts) {
|
|
|
123
123
|
auth: {
|
|
124
124
|
...config.auth,
|
|
125
125
|
token,
|
|
126
|
-
growthubBaseUrl:
|
|
126
|
+
growthubBaseUrl: config.auth.growthubBaseUrl,
|
|
127
127
|
growthubPortalBaseUrl: normalizedPortalBaseUrl ?? config.auth.growthubPortalBaseUrl,
|
|
128
128
|
growthubMachineLabel: machineLabel || config.auth.growthubMachineLabel,
|
|
129
129
|
growthubWorkspaceLabel: workspaceLabel || config.auth.growthubWorkspaceLabel,
|
|
@@ -368,4 +368,4 @@ export async function createApp(db, opts) {
|
|
|
368
368
|
});
|
|
369
369
|
return app;
|
|
370
370
|
}
|
|
371
|
-
//# sourceMappingURL=app.js.map
|
|
371
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -64,6 +64,7 @@ function getGrowthubConnectionState() {
|
|
|
64
64
|
const config = readConfigFile();
|
|
65
65
|
const baseUrl = config?.auth.growthubBaseUrl?.trim() ||
|
|
66
66
|
process.env.GROWTHUB_BASE_URL?.trim() ||
|
|
67
|
+
config?.auth.growthubPortalBaseUrl?.trim() ||
|
|
67
68
|
"";
|
|
68
69
|
return {
|
|
69
70
|
baseUrl,
|
|
@@ -147,26 +148,45 @@ export function gtmRoutes(db) {
|
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
150
|
try {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
authorization: `Bearer ${connection.token}`,
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
const data = (await response.json().catch(() => ({})));
|
|
157
|
-
if (!response.ok) {
|
|
158
|
-
res.status(response.status).json({
|
|
159
|
-
error: (typeof data.error === "string" && data.error) ||
|
|
160
|
-
"Growthub local probe failed.",
|
|
161
|
-
});
|
|
162
|
-
return;
|
|
151
|
+
const targets = [connection.baseUrl];
|
|
152
|
+
if (connection.portalBaseUrl && connection.portalBaseUrl !== connection.baseUrl) {
|
|
153
|
+
targets.push(connection.portalBaseUrl);
|
|
163
154
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
155
|
+
let lastFailure = null;
|
|
156
|
+
let lastError = null;
|
|
157
|
+
for (const target of targets) {
|
|
158
|
+
try {
|
|
159
|
+
const response = await fetch(new URL("/api/providers/growthub-local/probe", target), {
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers: {
|
|
162
|
+
authorization: `Bearer ${connection.token}`,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
const data = (await response.json().catch(() => ({})));
|
|
166
|
+
if (!response.ok) {
|
|
167
|
+
lastFailure = { status: response.status, data };
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
res.json({
|
|
171
|
+
success: true,
|
|
172
|
+
message: (typeof data.message === "string" && data.message) ||
|
|
173
|
+
"Growthub local probe succeeded.",
|
|
174
|
+
knowledgeItemId: typeof data.knowledgeItemId === "string" ? data.knowledgeItemId : null,
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
lastError = error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (lastError && !lastFailure) {
|
|
183
|
+
throw lastError;
|
|
184
|
+
}
|
|
185
|
+
res.status((lastFailure?.status) ?? 502).json({
|
|
186
|
+
error: (typeof lastFailure?.data?.error === "string" && lastFailure.data.error) ||
|
|
187
|
+
"Growthub local probe failed.",
|
|
169
188
|
});
|
|
189
|
+
return;
|
|
170
190
|
}
|
|
171
191
|
catch (error) {
|
|
172
192
|
res.status(502).json({
|
|
@@ -196,7 +216,7 @@ export function gtmRoutes(db) {
|
|
|
196
216
|
},
|
|
197
217
|
});
|
|
198
218
|
res.json({
|
|
199
|
-
baseUrl:
|
|
219
|
+
baseUrl: getGrowthubConnectionState().baseUrl,
|
|
200
220
|
callbackUrl: "/auth/callback",
|
|
201
221
|
connected: false,
|
|
202
222
|
portalBaseUrl: "",
|
|
@@ -552,4 +572,4 @@ export function gtmRoutes(db) {
|
|
|
552
572
|
});
|
|
553
573
|
return router;
|
|
554
574
|
}
|
|
555
|
-
//# sourceMappingURL=gtm.js.map
|
|
575
|
+
//# sourceMappingURL=gtm.js.map
|