@base44-preview/cli 0.0.30-pr.189.ae9567a → 0.0.30-pr.211.740aaa4
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 +100 -64
- package/dist/cli/index.js.map +12 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -153805,7 +153805,7 @@ var SlackConnectorSchema = exports_external.object({
|
|
|
153805
153805
|
});
|
|
153806
153806
|
var NotionConnectorSchema = exports_external.object({
|
|
153807
153807
|
type: exports_external.literal("notion"),
|
|
153808
|
-
scopes: exports_external.array(exports_external.string()).default([])
|
|
153808
|
+
scopes: exports_external.array(exports_external.string()).default([]).optional()
|
|
153809
153809
|
});
|
|
153810
153810
|
var SalesforceConnectorSchema = exports_external.object({
|
|
153811
153811
|
type: exports_external.literal("salesforce"),
|
|
@@ -153823,7 +153823,12 @@ var TikTokConnectorSchema = exports_external.object({
|
|
|
153823
153823
|
type: exports_external.literal("tiktok"),
|
|
153824
153824
|
scopes: exports_external.array(exports_external.string()).default([])
|
|
153825
153825
|
});
|
|
153826
|
-
var
|
|
153826
|
+
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
153827
|
+
var GenericConnectorSchema = exports_external.object({
|
|
153828
|
+
type: CustomTypeSchema,
|
|
153829
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
153830
|
+
});
|
|
153831
|
+
var ConnectorResourceSchema = exports_external.union([
|
|
153827
153832
|
GoogleCalendarConnectorSchema,
|
|
153828
153833
|
GoogleDriveConnectorSchema,
|
|
153829
153834
|
GmailConnectorSchema,
|
|
@@ -153835,9 +153840,10 @@ var ConnectorResourceSchema = exports_external.discriminatedUnion("type", [
|
|
|
153835
153840
|
SalesforceConnectorSchema,
|
|
153836
153841
|
HubspotConnectorSchema,
|
|
153837
153842
|
LinkedInConnectorSchema,
|
|
153838
|
-
TikTokConnectorSchema
|
|
153843
|
+
TikTokConnectorSchema,
|
|
153844
|
+
GenericConnectorSchema
|
|
153839
153845
|
]);
|
|
153840
|
-
var
|
|
153846
|
+
var KnownIntegrationTypes = [
|
|
153841
153847
|
"googlecalendar",
|
|
153842
153848
|
"googledrive",
|
|
153843
153849
|
"gmail",
|
|
@@ -153850,6 +153856,10 @@ var IntegrationTypeSchema = exports_external.enum([
|
|
|
153850
153856
|
"hubspot",
|
|
153851
153857
|
"linkedin",
|
|
153852
153858
|
"tiktok"
|
|
153859
|
+
];
|
|
153860
|
+
var IntegrationTypeSchema = exports_external.union([
|
|
153861
|
+
exports_external.enum(KnownIntegrationTypes),
|
|
153862
|
+
CustomTypeSchema
|
|
153853
153863
|
]);
|
|
153854
153864
|
var ConnectorStatusSchema = exports_external.enum([
|
|
153855
153865
|
"active",
|
|
@@ -153973,7 +153983,13 @@ async function readAllConnectors(connectorsDir) {
|
|
|
153973
153983
|
const types = new Set;
|
|
153974
153984
|
for (const connector of connectors) {
|
|
153975
153985
|
if (types.has(connector.type)) {
|
|
153976
|
-
throw new
|
|
153986
|
+
throw new InvalidInputError(`Duplicate connector type "${connector.type}"`, {
|
|
153987
|
+
hints: [
|
|
153988
|
+
{
|
|
153989
|
+
message: `Remove duplicate connectors with type "${connector.type}" - only one connector per type is allowed`
|
|
153990
|
+
}
|
|
153991
|
+
]
|
|
153992
|
+
});
|
|
153977
153993
|
}
|
|
153978
153994
|
types.add(connector.type);
|
|
153979
153995
|
}
|
|
@@ -154711,7 +154727,7 @@ async function pushConnectors(connectors) {
|
|
|
154711
154727
|
const localTypes = new Set(connectors.map((c) => c.type));
|
|
154712
154728
|
for (const connector of connectors) {
|
|
154713
154729
|
try {
|
|
154714
|
-
const response = await setConnector(connector.type, connector.scopes);
|
|
154730
|
+
const response = await setConnector(connector.type, connector.scopes ?? []);
|
|
154715
154731
|
results.push(setResponseToResult(connector.type, response));
|
|
154716
154732
|
} catch (err) {
|
|
154717
154733
|
results.push({
|
|
@@ -154745,7 +154761,7 @@ function setResponseToResult(type, response) {
|
|
|
154745
154761
|
return {
|
|
154746
154762
|
type,
|
|
154747
154763
|
action: "error",
|
|
154748
|
-
error: response.error_message || `Already connected by ${response.other_user_email}`
|
|
154764
|
+
error: response.error_message || `Already connected by ${response.other_user_email ?? "another user"}`
|
|
154749
154765
|
};
|
|
154750
154766
|
}
|
|
154751
154767
|
if (response.already_authorized) {
|
|
@@ -162224,24 +162240,26 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
162224
162240
|
}
|
|
162225
162241
|
// src/core/project/deploy.ts
|
|
162226
162242
|
function hasResourcesToDeploy(projectData) {
|
|
162227
|
-
const { project, entities, functions, agents } = projectData;
|
|
162243
|
+
const { project, entities, functions, agents, connectors } = projectData;
|
|
162228
162244
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
162229
162245
|
const hasEntities = entities.length > 0;
|
|
162230
162246
|
const hasFunctions = functions.length > 0;
|
|
162231
162247
|
const hasAgents = agents.length > 0;
|
|
162232
|
-
|
|
162248
|
+
const hasConnectors = connectors.length > 0;
|
|
162249
|
+
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
162233
162250
|
}
|
|
162234
162251
|
async function deployAll(projectData) {
|
|
162235
|
-
const { project, entities, functions, agents } = projectData;
|
|
162252
|
+
const { project, entities, functions, agents, connectors } = projectData;
|
|
162236
162253
|
await entityResource.push(entities);
|
|
162237
162254
|
await functionResource.push(functions);
|
|
162238
162255
|
await agentResource.push(agents);
|
|
162256
|
+
const { results: connectorResults } = await pushConnectors(connectors);
|
|
162239
162257
|
if (project.site?.outputDirectory) {
|
|
162240
162258
|
const outputDir = resolve(project.root, project.site.outputDirectory);
|
|
162241
162259
|
const { appUrl } = await deploySite(outputDir);
|
|
162242
|
-
return { appUrl };
|
|
162260
|
+
return { appUrl, connectorResults };
|
|
162243
162261
|
}
|
|
162244
|
-
return {};
|
|
162262
|
+
return { connectorResults };
|
|
162245
162263
|
}
|
|
162246
162264
|
// src/core/clients/base44-client.ts
|
|
162247
162265
|
var retriedRequests = new WeakSet;
|
|
@@ -169697,7 +169715,7 @@ async function checkForUpgrade() {
|
|
|
169697
169715
|
function formatUpgradeMessage(info) {
|
|
169698
169716
|
const { shinyOrange } = theme.colors;
|
|
169699
169717
|
const { bold: bold2 } = theme.styles;
|
|
169700
|
-
return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm
|
|
169718
|
+
return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm install -g base44@latest"))}`;
|
|
169701
169719
|
}
|
|
169702
169720
|
async function printUpgradeNotificationIfAvailable() {
|
|
169703
169721
|
try {
|
|
@@ -169871,10 +169889,48 @@ function getWhoamiCommand(context) {
|
|
|
169871
169889
|
});
|
|
169872
169890
|
}
|
|
169873
169891
|
|
|
169874
|
-
// src/cli/commands/connectors/
|
|
169875
|
-
function
|
|
169876
|
-
return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
|
|
169892
|
+
// src/cli/commands/connectors/oauth-prompt.ts
|
|
169893
|
+
function filterPendingOAuth(results) {
|
|
169894
|
+
return results.filter((r2) => r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId);
|
|
169877
169895
|
}
|
|
169896
|
+
async function promptOAuthFlows(pending, options) {
|
|
169897
|
+
const outcomes = new Map;
|
|
169898
|
+
if (pending.length === 0) {
|
|
169899
|
+
return outcomes;
|
|
169900
|
+
}
|
|
169901
|
+
M2.info("");
|
|
169902
|
+
M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
169903
|
+
for (const connector2 of pending) {
|
|
169904
|
+
M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
169905
|
+
}
|
|
169906
|
+
if (options?.skipPrompt || process.env.CI) {
|
|
169907
|
+
return outcomes;
|
|
169908
|
+
}
|
|
169909
|
+
const shouldAuth = await ye({
|
|
169910
|
+
message: "Open browser to authorize now?"
|
|
169911
|
+
});
|
|
169912
|
+
if (pD(shouldAuth) || !shouldAuth) {
|
|
169913
|
+
return outcomes;
|
|
169914
|
+
}
|
|
169915
|
+
for (const connector2 of pending) {
|
|
169916
|
+
M2.info(`
|
|
169917
|
+
Opening browser for ${connector2.type}...`);
|
|
169918
|
+
const oauthResult = await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
|
|
169919
|
+
return await runOAuthFlow({
|
|
169920
|
+
type: connector2.type,
|
|
169921
|
+
redirectUrl: connector2.redirectUrl,
|
|
169922
|
+
connectionId: connector2.connectionId
|
|
169923
|
+
});
|
|
169924
|
+
}, {
|
|
169925
|
+
successMessage: `${connector2.type} authorization complete`,
|
|
169926
|
+
errorMessage: `${connector2.type} authorization failed`
|
|
169927
|
+
});
|
|
169928
|
+
outcomes.set(connector2.type, oauthResult.status);
|
|
169929
|
+
}
|
|
169930
|
+
return outcomes;
|
|
169931
|
+
}
|
|
169932
|
+
|
|
169933
|
+
// src/cli/commands/connectors/push.ts
|
|
169878
169934
|
function printSummary(results, oauthOutcomes) {
|
|
169879
169935
|
const synced = [];
|
|
169880
169936
|
const added = [];
|
|
@@ -169901,18 +169957,18 @@ function printSummary(results, oauthOutcomes) {
|
|
|
169901
169957
|
}
|
|
169902
169958
|
}
|
|
169903
169959
|
M2.info("");
|
|
169904
|
-
M2.info(
|
|
169960
|
+
M2.info(theme.styles.bold("Summary:"));
|
|
169905
169961
|
if (synced.length > 0) {
|
|
169906
|
-
M2.
|
|
169962
|
+
M2.success(`Synced: ${synced.join(", ")}`);
|
|
169907
169963
|
}
|
|
169908
169964
|
if (added.length > 0) {
|
|
169909
|
-
M2.
|
|
169965
|
+
M2.success(`Added: ${added.join(", ")}`);
|
|
169910
169966
|
}
|
|
169911
169967
|
if (removed.length > 0) {
|
|
169912
|
-
M2.info(
|
|
169968
|
+
M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
169913
169969
|
}
|
|
169914
169970
|
for (const r2 of failed) {
|
|
169915
|
-
M2.
|
|
169971
|
+
M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
|
|
169916
169972
|
}
|
|
169917
169973
|
}
|
|
169918
169974
|
async function pushConnectorsAction() {
|
|
@@ -169925,46 +169981,13 @@ async function pushConnectorsAction() {
|
|
|
169925
169981
|
}
|
|
169926
169982
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
169927
169983
|
return await pushConnectors(connectors);
|
|
169928
|
-
}, {
|
|
169929
|
-
successMessage: "Connectors pushed",
|
|
169930
|
-
errorMessage: "Failed to push connectors"
|
|
169931
169984
|
});
|
|
169932
|
-
const
|
|
169933
|
-
const needsOAuth = results.filter(isPendingOAuth);
|
|
169985
|
+
const needsOAuth = filterPendingOAuth(results);
|
|
169934
169986
|
let outroMessage = "Connectors pushed to Base44";
|
|
169935
|
-
|
|
169936
|
-
|
|
169937
|
-
M2.info(source_default.yellow(`${needsOAuth.length} connector(s) require authorization in your browser:`));
|
|
169938
|
-
for (const connector2 of needsOAuth) {
|
|
169939
|
-
M2.info(` ${connector2.type}: ${source_default.dim(connector2.redirectUrl)}`);
|
|
169940
|
-
}
|
|
169987
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth);
|
|
169988
|
+
if (needsOAuth.length > 0 && oauthOutcomes.size === 0) {
|
|
169941
169989
|
const pending = needsOAuth.map((c3) => c3.type).join(", ");
|
|
169942
|
-
|
|
169943
|
-
outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
|
|
169944
|
-
} else {
|
|
169945
|
-
const shouldAuth = await ye({
|
|
169946
|
-
message: "Open browser to authorize now?"
|
|
169947
|
-
});
|
|
169948
|
-
if (pD(shouldAuth) || !shouldAuth) {
|
|
169949
|
-
outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
169950
|
-
} else {
|
|
169951
|
-
for (const connector2 of needsOAuth) {
|
|
169952
|
-
M2.info(`
|
|
169953
|
-
Opening browser for ${connector2.type}...`);
|
|
169954
|
-
const oauthResult = await runTask(`Waiting for ${connector2.type} authorization...`, async () => {
|
|
169955
|
-
return await runOAuthFlow({
|
|
169956
|
-
type: connector2.type,
|
|
169957
|
-
redirectUrl: connector2.redirectUrl,
|
|
169958
|
-
connectionId: connector2.connectionId
|
|
169959
|
-
});
|
|
169960
|
-
}, {
|
|
169961
|
-
successMessage: `${connector2.type} authorization complete`,
|
|
169962
|
-
errorMessage: `${connector2.type} authorization failed`
|
|
169963
|
-
});
|
|
169964
|
-
oauthOutcomes.set(connector2.type, oauthResult.status);
|
|
169965
|
-
}
|
|
169966
|
-
}
|
|
169967
|
-
}
|
|
169990
|
+
outroMessage = process.env.CI ? `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.` : `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
169968
169991
|
}
|
|
169969
169992
|
printSummary(results, oauthOutcomes);
|
|
169970
169993
|
return { outroMessage };
|
|
@@ -170255,7 +170278,7 @@ async function deployAction(options) {
|
|
|
170255
170278
|
outroMessage: "No resources found to deploy"
|
|
170256
170279
|
};
|
|
170257
170280
|
}
|
|
170258
|
-
const { project: project2, entities, functions, agents } = projectData;
|
|
170281
|
+
const { project: project2, entities, functions, agents, connectors } = projectData;
|
|
170259
170282
|
const summaryLines = [];
|
|
170260
170283
|
if (entities.length > 0) {
|
|
170261
170284
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -170266,6 +170289,9 @@ async function deployAction(options) {
|
|
|
170266
170289
|
if (agents.length > 0) {
|
|
170267
170290
|
summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
170268
170291
|
}
|
|
170292
|
+
if (connectors.length > 0) {
|
|
170293
|
+
summaryLines.push(` - ${connectors.length} ${connectors.length === 1 ? "connector" : "connectors"}`);
|
|
170294
|
+
}
|
|
170269
170295
|
if (project2.site?.outputDirectory) {
|
|
170270
170296
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
170271
170297
|
}
|
|
@@ -170290,6 +170316,16 @@ ${summaryLines.join(`
|
|
|
170290
170316
|
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
170291
170317
|
errorMessage: "Deployment failed"
|
|
170292
170318
|
});
|
|
170319
|
+
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
170320
|
+
if (needsOAuth.length > 0) {
|
|
170321
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
170322
|
+
skipPrompt: options.yes
|
|
170323
|
+
});
|
|
170324
|
+
if (oauthOutcomes.size === 0) {
|
|
170325
|
+
const pending = needsOAuth.map((c3) => c3.type).join(", ");
|
|
170326
|
+
M2.info(`To authorize, run 'base44 connectors push' or open the links above in your browser.`);
|
|
170327
|
+
}
|
|
170328
|
+
}
|
|
170293
170329
|
M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
170294
170330
|
if (result.appUrl) {
|
|
170295
170331
|
M2.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
@@ -170297,7 +170333,7 @@ ${summaryLines.join(`
|
|
|
170297
170333
|
return { outroMessage: "App deployed successfully" };
|
|
170298
170334
|
}
|
|
170299
170335
|
function getDeployCommand(context) {
|
|
170300
|
-
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
170336
|
+
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
170301
170337
|
await runCommand(() => deployAction(options), { requireAuth: true }, context);
|
|
170302
170338
|
});
|
|
170303
170339
|
}
|
|
@@ -170536,10 +170572,10 @@ async function generateContent(input) {
|
|
|
170536
170572
|
const registryEntries = [
|
|
170537
170573
|
[
|
|
170538
170574
|
"EntityTypeRegistry",
|
|
170539
|
-
entities.map((e8) =>
|
|
170575
|
+
entities.map((e8) => `"${e8.name}": ${toPascalCase(e8.name)};`)
|
|
170540
170576
|
],
|
|
170541
|
-
["FunctionNameRegistry", functions.map((f7) =>
|
|
170542
|
-
["AgentNameRegistry", agents.map((a5) =>
|
|
170577
|
+
["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
|
|
170578
|
+
["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)]
|
|
170543
170579
|
];
|
|
170544
170580
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
170545
170581
|
return [
|
|
@@ -174919,4 +174955,4 @@ export {
|
|
|
174919
174955
|
CLIExitError
|
|
174920
174956
|
};
|
|
174921
174957
|
|
|
174922
|
-
//# debugId=
|
|
174958
|
+
//# debugId=F29098DA3AB96EDD64756E2164756E21
|