@base44-preview/cli 0.0.31-pr.189.28c55b2 → 0.0.31-pr.189.61c2518

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