@base44-preview/cli 0.0.31-pr.214.25a02b0 → 0.0.31-pr.214.d023fbb

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
@@ -185146,6 +185146,9 @@ async function listConnectors() {
185146
185146
  }
185147
185147
  return result.data;
185148
185148
  }
185149
+ async function fetchConnectors() {
185150
+ return await listConnectors();
185151
+ }
185149
185152
  async function setConnector(integrationType, scopes) {
185150
185153
  const appClient = getAppClient();
185151
185154
  let response;
@@ -185221,7 +185224,25 @@ async function readConnectorFiles(connectorsDir) {
185221
185224
  filePath
185222
185225
  })));
185223
185226
  }
185224
- function buildTypeToEntryMap(entries) {
185227
+ async function readAllConnectors(connectorsDir) {
185228
+ const entries = await readConnectorFiles(connectorsDir);
185229
+ const types = new Set;
185230
+ for (const { data } of entries) {
185231
+ if (types.has(data.type)) {
185232
+ throw new InvalidInputError(`Duplicate connector type "${data.type}"`, {
185233
+ hints: [
185234
+ {
185235
+ message: `Remove duplicate connectors with type "${data.type}" - only one connector per type is allowed`
185236
+ }
185237
+ ]
185238
+ });
185239
+ }
185240
+ types.add(data.type);
185241
+ }
185242
+ return entries.map((e2) => e2.data);
185243
+ }
185244
+ async function writeConnectors(connectorsDir, remoteConnectors) {
185245
+ const entries = await readConnectorFiles(connectorsDir);
185225
185246
  const typeToEntry = new Map;
185226
185247
  for (const entry of entries) {
185227
185248
  if (typeToEntry.has(entry.data.type)) {
@@ -185235,17 +185256,7 @@ function buildTypeToEntryMap(entries) {
185235
185256
  }
185236
185257
  typeToEntry.set(entry.data.type, entry);
185237
185258
  }
185238
- return typeToEntry;
185239
- }
185240
- async function readAllConnectors(connectorsDir) {
185241
- const entries = await readConnectorFiles(connectorsDir);
185242
- const typeToEntry = buildTypeToEntryMap(entries);
185243
- return [...typeToEntry.values()].map((e2) => e2.data);
185244
- }
185245
- async function writeConnectors(connectorsDir, remoteConnectors) {
185246
- const entries = await readConnectorFiles(connectorsDir);
185247
- const typeToEntry = buildTypeToEntryMap(entries);
185248
- const newTypes = new Set(remoteConnectors.map((c) => c.integrationType));
185259
+ const newTypes = new Set(remoteConnectors.map((c) => c.integration_type));
185249
185260
  const deleted = [];
185250
185261
  for (const [type, entry] of typeToEntry) {
185251
185262
  if (!newTypes.has(type)) {
@@ -185255,17 +185266,17 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
185255
185266
  }
185256
185267
  const written = [];
185257
185268
  for (const connector of remoteConnectors) {
185258
- const existing = typeToEntry.get(connector.integrationType);
185269
+ const existing = typeToEntry.get(connector.integration_type);
185259
185270
  const localConnector = {
185260
- type: connector.integrationType,
185271
+ type: connector.integration_type,
185261
185272
  scopes: connector.scopes
185262
185273
  };
185263
185274
  if (existing && isDeepStrictEqual(existing.data, localConnector)) {
185264
185275
  continue;
185265
185276
  }
185266
- const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integrationType}.${CONFIG_FILE_EXTENSION}`);
185277
+ const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integration_type}.${CONFIG_FILE_EXTENSION}`);
185267
185278
  await writeJsonFile(filePath, localConnector);
185268
- written.push(connector.integrationType);
185279
+ written.push(connector.integration_type);
185269
185280
  }
185270
185281
  return { written, deleted };
185271
185282
  }
@@ -193732,7 +193743,7 @@ async function pullConnectorsAction() {
193732
193743
  const configDir = dirname8(project2.configPath);
193733
193744
  const connectorsDir = join10(configDir, project2.connectorsDir);
193734
193745
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
193735
- return await listConnectors();
193746
+ return await fetchConnectors();
193736
193747
  }, {
193737
193748
  successMessage: "Connectors fetched successfully",
193738
193749
  errorMessage: "Failed to fetch connectors"
@@ -199699,4 +199710,4 @@ export {
199699
199710
  CLIExitError
199700
199711
  };
199701
199712
 
199702
- //# debugId=3B15B2EE2CDAA1C064756E2164756E21
199713
+ //# debugId=BEDE4C07B8ECAC1F64756E2164756E21