@base44-preview/cli 0.0.31-pr.189.61c2518 → 0.0.31-pr.189.7c5ebd3
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/cli/index.js +67 -45
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -185082,11 +185082,7 @@ var IntegrationTypeSchema = exports_external.union([
|
|
|
185082
185082
|
exports_external.enum(KnownIntegrationTypes),
|
|
185083
185083
|
CustomTypeSchema
|
|
185084
185084
|
]);
|
|
185085
|
-
var ConnectorStatusSchema = exports_external.enum([
|
|
185086
|
-
"active",
|
|
185087
|
-
"disconnected",
|
|
185088
|
-
"expired"
|
|
185089
|
-
]);
|
|
185085
|
+
var ConnectorStatusSchema = exports_external.enum(["active", "disconnected", "expired"]);
|
|
185090
185086
|
var UpstreamConnectorSchema = exports_external.object({
|
|
185091
185087
|
integration_type: IntegrationTypeSchema,
|
|
185092
185088
|
status: ConnectorStatusSchema,
|
|
@@ -185095,15 +185091,29 @@ var UpstreamConnectorSchema = exports_external.object({
|
|
|
185095
185091
|
});
|
|
185096
185092
|
var ListConnectorsResponseSchema = exports_external.object({
|
|
185097
185093
|
integrations: exports_external.array(UpstreamConnectorSchema)
|
|
185098
|
-
})
|
|
185094
|
+
}).transform((data) => ({
|
|
185095
|
+
integrations: data.integrations.map((i) => ({
|
|
185096
|
+
integrationType: i.integration_type,
|
|
185097
|
+
status: i.status,
|
|
185098
|
+
scopes: i.scopes,
|
|
185099
|
+
userEmail: i.user_email
|
|
185100
|
+
}))
|
|
185101
|
+
}));
|
|
185099
185102
|
var SetConnectorResponseSchema = exports_external.object({
|
|
185100
185103
|
redirect_url: exports_external.string().nullable(),
|
|
185101
185104
|
connection_id: exports_external.string().nullable(),
|
|
185102
185105
|
already_authorized: exports_external.boolean(),
|
|
185103
|
-
error: exports_external.string().nullable()
|
|
185104
|
-
error_message: exports_external.string().nullable()
|
|
185105
|
-
other_user_email: exports_external.string().nullable()
|
|
185106
|
-
})
|
|
185106
|
+
error: exports_external.string().nullable(),
|
|
185107
|
+
error_message: exports_external.string().nullable(),
|
|
185108
|
+
other_user_email: exports_external.string().nullable()
|
|
185109
|
+
}).transform((data) => ({
|
|
185110
|
+
redirectUrl: data.redirect_url,
|
|
185111
|
+
connectionId: data.connection_id,
|
|
185112
|
+
alreadyAuthorized: data.already_authorized,
|
|
185113
|
+
error: data.error,
|
|
185114
|
+
errorMessage: data.error_message,
|
|
185115
|
+
otherUserEmail: data.other_user_email
|
|
185116
|
+
}));
|
|
185107
185117
|
var ConnectorOAuthStatusSchema = exports_external.enum([
|
|
185108
185118
|
"ACTIVE",
|
|
185109
185119
|
"FAILED",
|
|
@@ -185115,7 +185125,10 @@ var OAuthStatusResponseSchema = exports_external.object({
|
|
|
185115
185125
|
var RemoveConnectorResponseSchema = exports_external.object({
|
|
185116
185126
|
status: exports_external.literal("removed"),
|
|
185117
185127
|
integration_type: IntegrationTypeSchema
|
|
185118
|
-
})
|
|
185128
|
+
}).transform((data) => ({
|
|
185129
|
+
status: data.status,
|
|
185130
|
+
integrationType: data.integration_type
|
|
185131
|
+
}));
|
|
185119
185132
|
|
|
185120
185133
|
// src/core/resources/connector/api.ts
|
|
185121
185134
|
async function listConnectors() {
|
|
@@ -185201,6 +185214,10 @@ async function readAllConnectors(connectorsDir) {
|
|
|
185201
185214
|
absolute: true
|
|
185202
185215
|
});
|
|
185203
185216
|
const connectors = await Promise.all(files.map((filePath) => readConnectorFile(filePath)));
|
|
185217
|
+
assertNoDuplicateConnectors(connectors);
|
|
185218
|
+
return connectors;
|
|
185219
|
+
}
|
|
185220
|
+
function assertNoDuplicateConnectors(connectors) {
|
|
185204
185221
|
const types = new Set;
|
|
185205
185222
|
for (const connector of connectors) {
|
|
185206
185223
|
if (types.has(connector.type)) {
|
|
@@ -185214,7 +185231,6 @@ async function readAllConnectors(connectorsDir) {
|
|
|
185214
185231
|
}
|
|
185215
185232
|
types.add(connector.type);
|
|
185216
185233
|
}
|
|
185217
|
-
return connectors;
|
|
185218
185234
|
}
|
|
185219
185235
|
// src/core/resources/connector/push.ts
|
|
185220
185236
|
async function pushConnectors(connectors) {
|
|
@@ -185224,7 +185240,7 @@ async function pushConnectors(connectors) {
|
|
|
185224
185240
|
for (const connector of connectors) {
|
|
185225
185241
|
try {
|
|
185226
185242
|
const response = await setConnector(connector.type, connector.scopes ?? []);
|
|
185227
|
-
results.push(
|
|
185243
|
+
results.push(getConnectorSyncResult(connector.type, response));
|
|
185228
185244
|
} catch (err) {
|
|
185229
185245
|
results.push({
|
|
185230
185246
|
type: connector.type,
|
|
@@ -185234,16 +185250,16 @@ async function pushConnectors(connectors) {
|
|
|
185234
185250
|
}
|
|
185235
185251
|
}
|
|
185236
185252
|
for (const upstreamConnector of upstream.integrations) {
|
|
185237
|
-
if (!localTypes.has(upstreamConnector.
|
|
185253
|
+
if (!localTypes.has(upstreamConnector.integrationType)) {
|
|
185238
185254
|
try {
|
|
185239
|
-
await removeConnector(upstreamConnector.
|
|
185255
|
+
await removeConnector(upstreamConnector.integrationType);
|
|
185240
185256
|
results.push({
|
|
185241
|
-
type: upstreamConnector.
|
|
185257
|
+
type: upstreamConnector.integrationType,
|
|
185242
185258
|
action: "removed"
|
|
185243
185259
|
});
|
|
185244
185260
|
} catch (err) {
|
|
185245
185261
|
results.push({
|
|
185246
|
-
type: upstreamConnector.
|
|
185262
|
+
type: upstreamConnector.integrationType,
|
|
185247
185263
|
action: "error",
|
|
185248
185264
|
error: err instanceof Error ? err.message : String(err)
|
|
185249
185265
|
});
|
|
@@ -185252,23 +185268,23 @@ async function pushConnectors(connectors) {
|
|
|
185252
185268
|
}
|
|
185253
185269
|
return { results };
|
|
185254
185270
|
}
|
|
185255
|
-
function
|
|
185271
|
+
function getConnectorSyncResult(type, response) {
|
|
185256
185272
|
if (response.error === "different_user") {
|
|
185257
185273
|
return {
|
|
185258
185274
|
type,
|
|
185259
185275
|
action: "error",
|
|
185260
|
-
error: response.
|
|
185276
|
+
error: response.errorMessage || `Already connected by ${response.otherUserEmail ?? "another user"}`
|
|
185261
185277
|
};
|
|
185262
185278
|
}
|
|
185263
|
-
if (response.
|
|
185279
|
+
if (response.alreadyAuthorized) {
|
|
185264
185280
|
return { type, action: "synced" };
|
|
185265
185281
|
}
|
|
185266
|
-
if (response.
|
|
185282
|
+
if (response.redirectUrl) {
|
|
185267
185283
|
return {
|
|
185268
185284
|
type,
|
|
185269
185285
|
action: "needs_oauth",
|
|
185270
|
-
redirectUrl: response.
|
|
185271
|
-
connectionId: response.
|
|
185286
|
+
redirectUrl: response.redirectUrl,
|
|
185287
|
+
connectionId: response.connectionId ?? undefined
|
|
185272
185288
|
};
|
|
185273
185289
|
}
|
|
185274
185290
|
return { type, action: "synced" };
|
|
@@ -194334,28 +194350,31 @@ async function pushConnectorsAction() {
|
|
|
194334
194350
|
const oauthOutcomes = new Map;
|
|
194335
194351
|
const needsOAuth = results.filter(isPendingOAuth);
|
|
194336
194352
|
let outroMessage = "Connectors pushed to Base44";
|
|
194337
|
-
if (needsOAuth.length
|
|
194338
|
-
|
|
194339
|
-
|
|
194340
|
-
|
|
194341
|
-
|
|
194342
|
-
|
|
194343
|
-
|
|
194344
|
-
|
|
194345
|
-
|
|
194353
|
+
if (needsOAuth.length === 0) {
|
|
194354
|
+
printSummary(results, oauthOutcomes);
|
|
194355
|
+
return { outroMessage };
|
|
194356
|
+
}
|
|
194357
|
+
M2.warn(`${needsOAuth.length} connector(s) require authorization in your browser:`);
|
|
194358
|
+
for (const connector2 of needsOAuth) {
|
|
194359
|
+
M2.info(` '${connector2.type}': ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
194360
|
+
}
|
|
194361
|
+
const pending = needsOAuth.map((c3) => c3.type).join(", ");
|
|
194362
|
+
if (process.env.CI) {
|
|
194363
|
+
outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
|
|
194364
|
+
} else {
|
|
194365
|
+
const shouldAuth = await ye({
|
|
194366
|
+
message: "Open browser to authorize now?"
|
|
194367
|
+
});
|
|
194368
|
+
if (pD(shouldAuth) || !shouldAuth) {
|
|
194369
|
+
outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
194346
194370
|
} else {
|
|
194347
|
-
const
|
|
194348
|
-
|
|
194349
|
-
});
|
|
194350
|
-
if (pD(shouldAuth) || !shouldAuth) {
|
|
194351
|
-
outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
194352
|
-
} else {
|
|
194353
|
-
for (const connector2 of needsOAuth) {
|
|
194371
|
+
for (const connector2 of needsOAuth) {
|
|
194372
|
+
try {
|
|
194354
194373
|
M2.info(`
|
|
194355
|
-
Opening browser for ${connector2.type}...`);
|
|
194374
|
+
Opening browser for '${connector2.type}'...`);
|
|
194356
194375
|
await open_default(connector2.redirectUrl);
|
|
194357
194376
|
let finalStatus = "PENDING";
|
|
194358
|
-
await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
|
|
194377
|
+
await runTask(`Waiting for '${connector2.type}' authorization...`, async () => {
|
|
194359
194378
|
await pWaitFor(async () => {
|
|
194360
194379
|
const response = await getOAuthStatus(connector2.type, connector2.connectionId);
|
|
194361
194380
|
finalStatus = response.status;
|
|
@@ -194365,8 +194384,8 @@ Opening browser for ${connector2.type}...`);
|
|
|
194365
194384
|
timeout: 2 * 60 * 1000
|
|
194366
194385
|
});
|
|
194367
194386
|
}, {
|
|
194368
|
-
successMessage:
|
|
194369
|
-
errorMessage:
|
|
194387
|
+
successMessage: `'${connector2.type}' authorization complete`,
|
|
194388
|
+
errorMessage: `'${connector2.type}' authorization failed`
|
|
194370
194389
|
}).catch((err) => {
|
|
194371
194390
|
if (err instanceof TimeoutError2) {
|
|
194372
194391
|
finalStatus = "PENDING";
|
|
@@ -194375,6 +194394,9 @@ Opening browser for ${connector2.type}...`);
|
|
|
194375
194394
|
}
|
|
194376
194395
|
});
|
|
194377
194396
|
oauthOutcomes.set(connector2.type, finalStatus);
|
|
194397
|
+
} catch (err) {
|
|
194398
|
+
M2.error(`Failed to authorize '${connector2.type}': ${err instanceof Error ? err.message : String(err)}`);
|
|
194399
|
+
oauthOutcomes.set(connector2.type, "FAILED");
|
|
194378
194400
|
}
|
|
194379
194401
|
}
|
|
194380
194402
|
}
|
|
@@ -194383,7 +194405,7 @@ Opening browser for ${connector2.type}...`);
|
|
|
194383
194405
|
return { outroMessage };
|
|
194384
194406
|
}
|
|
194385
194407
|
function getConnectorsPushCommand(context) {
|
|
194386
|
-
return new Command("push").description("Push local connectors to Base44 (
|
|
194408
|
+
return new Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(async () => {
|
|
194387
194409
|
await runCommand(pushConnectorsAction, { requireAuth: true }, context);
|
|
194388
194410
|
});
|
|
194389
194411
|
}
|
|
@@ -199601,4 +199623,4 @@ export {
|
|
|
199601
199623
|
CLIExitError
|
|
199602
199624
|
};
|
|
199603
199625
|
|
|
199604
|
-
//# debugId=
|
|
199626
|
+
//# debugId=B60FA69AE8B179EB64756E2164756E21
|