@base44-preview/cli 0.0.41-pr.382.5e7988f → 0.0.41-pr.383.0ebfd7a
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 +277 -465
- package/dist/cli/index.js.map +21 -22
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16459,7 +16459,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16459
16459
|
}
|
|
16460
16460
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
16461
16461
|
});
|
|
16462
|
-
function
|
|
16462
|
+
function join10(array2, separator) {
|
|
16463
16463
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
16464
16464
|
}
|
|
16465
16465
|
function last(array2) {
|
|
@@ -16481,7 +16481,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16481
16481
|
function nth(array2, n2) {
|
|
16482
16482
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
16483
16483
|
}
|
|
16484
|
-
var
|
|
16484
|
+
var pull = baseRest(pullAll);
|
|
16485
16485
|
function pullAll(array2, values2) {
|
|
16486
16486
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
16487
16487
|
}
|
|
@@ -18246,7 +18246,7 @@ __p += '`;
|
|
|
18246
18246
|
lodash.pickBy = pickBy;
|
|
18247
18247
|
lodash.property = property;
|
|
18248
18248
|
lodash.propertyOf = propertyOf;
|
|
18249
|
-
lodash.pull =
|
|
18249
|
+
lodash.pull = pull;
|
|
18250
18250
|
lodash.pullAll = pullAll;
|
|
18251
18251
|
lodash.pullAllBy = pullAllBy;
|
|
18252
18252
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -18391,7 +18391,7 @@ __p += '`;
|
|
|
18391
18391
|
lodash.isUndefined = isUndefined;
|
|
18392
18392
|
lodash.isWeakMap = isWeakMap;
|
|
18393
18393
|
lodash.isWeakSet = isWeakSet;
|
|
18394
|
-
lodash.join =
|
|
18394
|
+
lodash.join = join10;
|
|
18395
18395
|
lodash.kebabCase = kebabCase;
|
|
18396
18396
|
lodash.last = last;
|
|
18397
18397
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -27503,7 +27503,7 @@ function cleanDoc(doc2) {
|
|
|
27503
27503
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
27504
27504
|
}
|
|
27505
27505
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
27506
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
27506
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join13(replacement, currentDoc.split(`
|
|
27507
27507
|
`)) : currentDoc);
|
|
27508
27508
|
}
|
|
27509
27509
|
function canBreakFn(doc2) {
|
|
@@ -27583,7 +27583,7 @@ function indentIfBreak(contents, options) {
|
|
|
27583
27583
|
negate: options.negate
|
|
27584
27584
|
};
|
|
27585
27585
|
}
|
|
27586
|
-
function
|
|
27586
|
+
function join13(separator, docs) {
|
|
27587
27587
|
assertDoc(separator);
|
|
27588
27588
|
assertDocArray(docs);
|
|
27589
27589
|
const parts = [];
|
|
@@ -28294,7 +28294,7 @@ var init_doc = __esm(() => {
|
|
|
28294
28294
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
28295
28295
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
28296
28296
|
builders = {
|
|
28297
|
-
join:
|
|
28297
|
+
join: join13,
|
|
28298
28298
|
line,
|
|
28299
28299
|
softline,
|
|
28300
28300
|
hardline,
|
|
@@ -133208,7 +133208,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133208
133208
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
133209
133209
|
}
|
|
133210
133210
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
133211
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
133211
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
|
|
133212
133212
|
`)) : currentDoc);
|
|
133213
133213
|
}
|
|
133214
133214
|
function canBreakFn2(doc2) {
|
|
@@ -133294,7 +133294,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133294
133294
|
negate: options8.negate
|
|
133295
133295
|
};
|
|
133296
133296
|
}
|
|
133297
|
-
function
|
|
133297
|
+
function join15(separator, docs) {
|
|
133298
133298
|
assertDoc2(separator);
|
|
133299
133299
|
assertDocArray2(docs);
|
|
133300
133300
|
const parts = [];
|
|
@@ -133959,7 +133959,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133959
133959
|
}
|
|
133960
133960
|
}
|
|
133961
133961
|
var builders2 = {
|
|
133962
|
-
join:
|
|
133962
|
+
join: join15,
|
|
133963
133963
|
line: line3,
|
|
133964
133964
|
softline: softline2,
|
|
133965
133965
|
hardline: hardline4,
|
|
@@ -160399,10 +160399,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160399
160399
|
var debug = require_src4()("express:view");
|
|
160400
160400
|
var path18 = __require("node:path");
|
|
160401
160401
|
var fs28 = __require("node:fs");
|
|
160402
|
-
var
|
|
160402
|
+
var dirname11 = path18.dirname;
|
|
160403
160403
|
var basename4 = path18.basename;
|
|
160404
160404
|
var extname2 = path18.extname;
|
|
160405
|
-
var
|
|
160405
|
+
var join16 = path18.join;
|
|
160406
160406
|
var resolve6 = path18.resolve;
|
|
160407
160407
|
module.exports = View;
|
|
160408
160408
|
function View(name2, options8) {
|
|
@@ -160438,7 +160438,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160438
160438
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
160439
160439
|
var root2 = roots[i5];
|
|
160440
160440
|
var loc = resolve6(root2, name2);
|
|
160441
|
-
var dir =
|
|
160441
|
+
var dir = dirname11(loc);
|
|
160442
160442
|
var file2 = basename4(loc);
|
|
160443
160443
|
path19 = this.resolve(dir, file2);
|
|
160444
160444
|
}
|
|
@@ -160464,12 +160464,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160464
160464
|
};
|
|
160465
160465
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
160466
160466
|
var ext = this.ext;
|
|
160467
|
-
var path19 =
|
|
160467
|
+
var path19 = join16(dir, file2);
|
|
160468
160468
|
var stat2 = tryStat(path19);
|
|
160469
160469
|
if (stat2 && stat2.isFile()) {
|
|
160470
160470
|
return path19;
|
|
160471
160471
|
}
|
|
160472
|
-
path19 =
|
|
160472
|
+
path19 = join16(dir, basename4(file2, ext), "index" + ext);
|
|
160473
160473
|
stat2 = tryStat(path19);
|
|
160474
160474
|
if (stat2 && stat2.isFile()) {
|
|
160475
160475
|
return path19;
|
|
@@ -164164,7 +164164,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164164
164164
|
var Stream2 = __require("stream");
|
|
164165
164165
|
var util2 = __require("util");
|
|
164166
164166
|
var extname2 = path18.extname;
|
|
164167
|
-
var
|
|
164167
|
+
var join16 = path18.join;
|
|
164168
164168
|
var normalize = path18.normalize;
|
|
164169
164169
|
var resolve6 = path18.resolve;
|
|
164170
164170
|
var sep = path18.sep;
|
|
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164336
164336
|
return res;
|
|
164337
164337
|
}
|
|
164338
164338
|
parts = path19.split(sep);
|
|
164339
|
-
path19 = normalize(
|
|
164339
|
+
path19 = normalize(join16(root2, path19));
|
|
164340
164340
|
} else {
|
|
164341
164341
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
164342
164342
|
debug('malicious path "%s"', path19);
|
|
@@ -164476,7 +164476,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164476
164476
|
return self2.onStatError(err);
|
|
164477
164477
|
return self2.error(404);
|
|
164478
164478
|
}
|
|
164479
|
-
var p4 =
|
|
164479
|
+
var p4 = join16(path19, self2._index[i5]);
|
|
164480
164480
|
debug('stat "%s"', p4);
|
|
164481
164481
|
fs28.stat(p4, function(err2, stat2) {
|
|
164482
164482
|
if (err2)
|
|
@@ -211071,7 +211071,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
211071
211071
|
}
|
|
211072
211072
|
}, {
|
|
211073
211073
|
key: "join",
|
|
211074
|
-
value: function
|
|
211074
|
+
value: function join16(s5) {
|
|
211075
211075
|
if (this.length === 0)
|
|
211076
211076
|
return "";
|
|
211077
211077
|
var p4 = this.head;
|
|
@@ -214782,7 +214782,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
214782
214782
|
});
|
|
214783
214783
|
|
|
214784
214784
|
// src/cli/index.ts
|
|
214785
|
-
import { dirname as
|
|
214785
|
+
import { dirname as dirname15, join as join19 } from "node:path";
|
|
214786
214786
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
214787
214787
|
|
|
214788
214788
|
// ../../node_modules/commander/esm.mjs
|
|
@@ -214802,7 +214802,7 @@ var {
|
|
|
214802
214802
|
} = import__.default;
|
|
214803
214803
|
|
|
214804
214804
|
// src/cli/commands/agents/pull.ts
|
|
214805
|
-
import { dirname as dirname7, join as
|
|
214805
|
+
import { dirname as dirname7, join as join10 } from "node:path";
|
|
214806
214806
|
|
|
214807
214807
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
214808
214808
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -237298,7 +237298,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
237298
237298
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
237299
237299
|
|
|
237300
237300
|
// src/core/project/config.ts
|
|
237301
|
-
import { dirname as dirname5, join as
|
|
237301
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
237302
237302
|
|
|
237303
237303
|
// src/core/resources/agent/schema.ts
|
|
237304
237304
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -237514,10 +237514,6 @@ var GoogleBigQueryConnectorSchema = exports_external.object({
|
|
|
237514
237514
|
type: exports_external.literal("googlebigquery"),
|
|
237515
237515
|
scopes: exports_external.array(exports_external.string()).default([])
|
|
237516
237516
|
});
|
|
237517
|
-
var StripeConnectorSchema = exports_external.object({
|
|
237518
|
-
type: exports_external.literal("stripe"),
|
|
237519
|
-
scopes: exports_external.array(exports_external.string()).default([])
|
|
237520
|
-
});
|
|
237521
237517
|
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
237522
237518
|
var GenericConnectorSchema = exports_external.object({
|
|
237523
237519
|
type: CustomTypeSchema,
|
|
@@ -237537,7 +237533,6 @@ var ConnectorResourceSchema = exports_external.union([
|
|
|
237537
237533
|
HubspotConnectorSchema,
|
|
237538
237534
|
LinkedInConnectorSchema,
|
|
237539
237535
|
TikTokConnectorSchema,
|
|
237540
|
-
StripeConnectorSchema,
|
|
237541
237536
|
GenericConnectorSchema
|
|
237542
237537
|
]);
|
|
237543
237538
|
var KnownIntegrationTypes = [
|
|
@@ -237553,8 +237548,7 @@ var KnownIntegrationTypes = [
|
|
|
237553
237548
|
"salesforce",
|
|
237554
237549
|
"hubspot",
|
|
237555
237550
|
"linkedin",
|
|
237556
|
-
"tiktok"
|
|
237557
|
-
"stripe"
|
|
237551
|
+
"tiktok"
|
|
237558
237552
|
];
|
|
237559
237553
|
var IntegrationTypeSchema = exports_external.union([
|
|
237560
237554
|
exports_external.enum(KnownIntegrationTypes),
|
|
@@ -237607,24 +237601,6 @@ var RemoveConnectorResponseSchema = exports_external.object({
|
|
|
237607
237601
|
status: data.status,
|
|
237608
237602
|
integrationType: data.integration_type
|
|
237609
237603
|
}));
|
|
237610
|
-
var STRIPE_CONNECTOR_TYPE = "stripe";
|
|
237611
|
-
var InstallStripeResponseSchema = exports_external.object({
|
|
237612
|
-
already_installed: exports_external.boolean(),
|
|
237613
|
-
claim_url: exports_external.string().nullable()
|
|
237614
|
-
}).transform((data) => ({
|
|
237615
|
-
alreadyInstalled: data.already_installed,
|
|
237616
|
-
claimUrl: data.claim_url
|
|
237617
|
-
}));
|
|
237618
|
-
var StripeStatusResponseSchema = exports_external.object({
|
|
237619
|
-
stripe_mode: exports_external.enum(["sandbox", "live"]).nullable(),
|
|
237620
|
-
sandbox_claim_url: exports_external.string().nullable().optional()
|
|
237621
|
-
}).transform((data) => ({
|
|
237622
|
-
stripeMode: data.stripe_mode,
|
|
237623
|
-
sandboxClaimUrl: data.sandbox_claim_url
|
|
237624
|
-
}));
|
|
237625
|
-
var RemoveStripeResponseSchema = exports_external.object({
|
|
237626
|
-
success: exports_external.boolean()
|
|
237627
|
-
});
|
|
237628
237604
|
var ConnectionConfigFieldSchema = exports_external.object({
|
|
237629
237605
|
name: exports_external.string(),
|
|
237630
237606
|
display_name: exports_external.string(),
|
|
@@ -237739,54 +237715,6 @@ async function removeConnector(integrationType) {
|
|
|
237739
237715
|
}
|
|
237740
237716
|
return result.data;
|
|
237741
237717
|
}
|
|
237742
|
-
async function installStripe() {
|
|
237743
|
-
const appClient = getAppClient();
|
|
237744
|
-
let response;
|
|
237745
|
-
try {
|
|
237746
|
-
response = await appClient.post("payments/stripe/install", {
|
|
237747
|
-
timeout: 60000
|
|
237748
|
-
});
|
|
237749
|
-
} catch (error48) {
|
|
237750
|
-
throw await ApiError.fromHttpError(error48, "installing Stripe");
|
|
237751
|
-
}
|
|
237752
|
-
const result = InstallStripeResponseSchema.safeParse(await response.json());
|
|
237753
|
-
if (!result.success) {
|
|
237754
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
237755
|
-
}
|
|
237756
|
-
return result.data;
|
|
237757
|
-
}
|
|
237758
|
-
async function getStripeStatus() {
|
|
237759
|
-
const appClient = getAppClient();
|
|
237760
|
-
let response;
|
|
237761
|
-
try {
|
|
237762
|
-
response = await appClient.get("payments/stripe/status", {
|
|
237763
|
-
timeout: 60000
|
|
237764
|
-
});
|
|
237765
|
-
} catch (error48) {
|
|
237766
|
-
throw await ApiError.fromHttpError(error48, "checking Stripe integration status");
|
|
237767
|
-
}
|
|
237768
|
-
const result = StripeStatusResponseSchema.safeParse(await response.json());
|
|
237769
|
-
if (!result.success) {
|
|
237770
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
237771
|
-
}
|
|
237772
|
-
return result.data;
|
|
237773
|
-
}
|
|
237774
|
-
async function removeStripe() {
|
|
237775
|
-
const appClient = getAppClient();
|
|
237776
|
-
let response;
|
|
237777
|
-
try {
|
|
237778
|
-
response = await appClient.delete("payments/stripe", {
|
|
237779
|
-
timeout: 60000
|
|
237780
|
-
});
|
|
237781
|
-
} catch (error48) {
|
|
237782
|
-
throw await ApiError.fromHttpError(error48, "removing Stripe integration");
|
|
237783
|
-
}
|
|
237784
|
-
const result = RemoveStripeResponseSchema.safeParse(await response.json());
|
|
237785
|
-
if (!result.success) {
|
|
237786
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
237787
|
-
}
|
|
237788
|
-
return result.data;
|
|
237789
|
-
}
|
|
237790
237718
|
// src/core/resources/connector/config.ts
|
|
237791
237719
|
import { join as join4 } from "node:path";
|
|
237792
237720
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
@@ -237835,7 +237763,7 @@ async function readAllConnectors(connectorsDir) {
|
|
|
237835
237763
|
async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
237836
237764
|
const entries = await readConnectorFiles(connectorsDir);
|
|
237837
237765
|
const typeToEntry = buildTypeToEntryMap(entries);
|
|
237838
|
-
const newTypes = new Set(remoteConnectors.map((c) => c.
|
|
237766
|
+
const newTypes = new Set(remoteConnectors.map((c) => c.integrationType));
|
|
237839
237767
|
const deleted = [];
|
|
237840
237768
|
for (const [type, entry] of typeToEntry) {
|
|
237841
237769
|
if (!newTypes.has(type)) {
|
|
@@ -237845,105 +237773,22 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
|
237845
237773
|
}
|
|
237846
237774
|
const written = [];
|
|
237847
237775
|
for (const connector of remoteConnectors) {
|
|
237848
|
-
const existing = typeToEntry.get(connector.
|
|
237849
|
-
|
|
237776
|
+
const existing = typeToEntry.get(connector.integrationType);
|
|
237777
|
+
const localConnector = {
|
|
237778
|
+
type: connector.integrationType,
|
|
237779
|
+
scopes: connector.scopes
|
|
237780
|
+
};
|
|
237781
|
+
if (existing && isDeepStrictEqual2(existing.data, localConnector)) {
|
|
237850
237782
|
continue;
|
|
237851
237783
|
}
|
|
237852
|
-
const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.
|
|
237853
|
-
await writeJsonFile(filePath,
|
|
237854
|
-
written.push(connector.
|
|
237784
|
+
const filePath = existing?.filePath ?? join4(connectorsDir, `${connector.integrationType}.${CONFIG_FILE_EXTENSION}`);
|
|
237785
|
+
await writeJsonFile(filePath, localConnector);
|
|
237786
|
+
written.push(connector.integrationType);
|
|
237855
237787
|
}
|
|
237856
237788
|
return { written, deleted };
|
|
237857
237789
|
}
|
|
237858
|
-
// src/core/resources/connector/stripe.ts
|
|
237859
|
-
async function syncStripeConnector(localStripe) {
|
|
237860
|
-
const remoteStatus = await fetchStripeRemoteStatus();
|
|
237861
|
-
if (remoteStatus === "error") {
|
|
237862
|
-
return localStripe ? stripeError("Failed to check Stripe integration status") : null;
|
|
237863
|
-
}
|
|
237864
|
-
const isRemoteInstalled = remoteStatus.stripeMode !== null;
|
|
237865
|
-
const needsInstall = localStripe && !isRemoteInstalled;
|
|
237866
|
-
const alreadySynced = localStripe && isRemoteInstalled;
|
|
237867
|
-
const needsRemoval = !localStripe && isRemoteInstalled;
|
|
237868
|
-
if (needsInstall) {
|
|
237869
|
-
return handleStripeInstall();
|
|
237870
|
-
}
|
|
237871
|
-
if (alreadySynced) {
|
|
237872
|
-
return stripeSynced();
|
|
237873
|
-
}
|
|
237874
|
-
if (needsRemoval) {
|
|
237875
|
-
return handleStripeRemoval();
|
|
237876
|
-
}
|
|
237877
|
-
return null;
|
|
237878
|
-
}
|
|
237879
|
-
async function isStripeInstalled() {
|
|
237880
|
-
const status = await getStripeStatus();
|
|
237881
|
-
return status.stripeMode !== null;
|
|
237882
|
-
}
|
|
237883
|
-
async function fetchStripeRemoteStatus() {
|
|
237884
|
-
try {
|
|
237885
|
-
return await getStripeStatus();
|
|
237886
|
-
} catch {
|
|
237887
|
-
return "error";
|
|
237888
|
-
}
|
|
237889
|
-
}
|
|
237890
|
-
async function handleStripeInstall() {
|
|
237891
|
-
try {
|
|
237892
|
-
const result = await installStripe();
|
|
237893
|
-
return stripeProvisioned(result.claimUrl ?? undefined);
|
|
237894
|
-
} catch (err) {
|
|
237895
|
-
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237896
|
-
}
|
|
237897
|
-
}
|
|
237898
|
-
async function handleStripeRemoval() {
|
|
237899
|
-
try {
|
|
237900
|
-
await removeStripe();
|
|
237901
|
-
return stripeRemoved();
|
|
237902
|
-
} catch (err) {
|
|
237903
|
-
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237904
|
-
}
|
|
237905
|
-
}
|
|
237906
|
-
function stripeSynced() {
|
|
237907
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "synced" };
|
|
237908
|
-
}
|
|
237909
|
-
function stripeProvisioned(claimUrl) {
|
|
237910
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "provisioned", claimUrl };
|
|
237911
|
-
}
|
|
237912
|
-
function stripeRemoved() {
|
|
237913
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "removed" };
|
|
237914
|
-
}
|
|
237915
|
-
function stripeError(error48) {
|
|
237916
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "error", error: error48 };
|
|
237917
|
-
}
|
|
237918
|
-
|
|
237919
|
-
// src/core/resources/connector/pull.ts
|
|
237920
|
-
async function pullAllConnectors() {
|
|
237921
|
-
const [oauthResponse, stripeInstalled] = await Promise.all([
|
|
237922
|
-
listConnectors(),
|
|
237923
|
-
isStripeInstalled()
|
|
237924
|
-
]);
|
|
237925
|
-
const connectors = oauthResponse.integrations.map((i) => ({
|
|
237926
|
-
type: i.integrationType,
|
|
237927
|
-
scopes: i.scopes
|
|
237928
|
-
}));
|
|
237929
|
-
if (stripeInstalled) {
|
|
237930
|
-
connectors.push({ type: STRIPE_CONNECTOR_TYPE, scopes: [] });
|
|
237931
|
-
}
|
|
237932
|
-
return connectors;
|
|
237933
|
-
}
|
|
237934
237790
|
// src/core/resources/connector/push.ts
|
|
237935
237791
|
async function pushConnectors(connectors) {
|
|
237936
|
-
const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
|
|
237937
|
-
const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
|
|
237938
|
-
const oauthResults = await syncOAuthConnectors(oauthConnectors);
|
|
237939
|
-
const stripeResult = await syncStripeConnector(stripeConnector);
|
|
237940
|
-
const results = [...oauthResults];
|
|
237941
|
-
if (stripeResult) {
|
|
237942
|
-
results.push(stripeResult);
|
|
237943
|
-
}
|
|
237944
|
-
return { results };
|
|
237945
|
-
}
|
|
237946
|
-
async function syncOAuthConnectors(connectors) {
|
|
237947
237792
|
const results = [];
|
|
237948
237793
|
const upstream = await listConnectors();
|
|
237949
237794
|
const localTypes = new Set(connectors.map((c) => c.type));
|
|
@@ -237976,7 +237821,7 @@ async function syncOAuthConnectors(connectors) {
|
|
|
237976
237821
|
}
|
|
237977
237822
|
}
|
|
237978
237823
|
}
|
|
237979
|
-
return results;
|
|
237824
|
+
return { results };
|
|
237980
237825
|
}
|
|
237981
237826
|
function getConnectorSyncResult(type, response) {
|
|
237982
237827
|
if (response.error === "different_user") {
|
|
@@ -238230,27 +238075,15 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
238230
238075
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
238231
238076
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
238232
238077
|
});
|
|
238233
|
-
var
|
|
238234
|
-
|
|
238235
|
-
deleted: exports_external.array(exports_external.string()),
|
|
238236
|
-
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
238237
|
-
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
238078
|
+
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
238079
|
+
status: exports_external.enum(["deployed", "unchanged"])
|
|
238238
238080
|
});
|
|
238239
|
-
var FunctionAutomationInfoSchema = exports_external.object({
|
|
238240
|
-
name: exports_external.string(),
|
|
238241
|
-
type: exports_external.string(),
|
|
238242
|
-
is_active: exports_external.boolean()
|
|
238243
|
-
}).transform((data) => ({
|
|
238244
|
-
name: data.name,
|
|
238245
|
-
type: data.type,
|
|
238246
|
-
isActive: data.is_active
|
|
238247
|
-
}));
|
|
238248
238081
|
var FunctionInfoSchema = exports_external.object({
|
|
238249
238082
|
name: exports_external.string(),
|
|
238250
238083
|
deployment_id: exports_external.string(),
|
|
238251
238084
|
entry: exports_external.string(),
|
|
238252
238085
|
files: exports_external.array(FunctionFileSchema),
|
|
238253
|
-
automations: exports_external.array(
|
|
238086
|
+
automations: exports_external.array(AutomationSchema)
|
|
238254
238087
|
}).transform((data) => ({
|
|
238255
238088
|
name: data.name,
|
|
238256
238089
|
deploymentId: data.deployment_id,
|
|
@@ -238270,29 +238103,39 @@ var FunctionLogEntrySchema = exports_external.object({
|
|
|
238270
238103
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
238271
238104
|
|
|
238272
238105
|
// src/core/resources/function/api.ts
|
|
238273
|
-
function
|
|
238274
|
-
return {
|
|
238275
|
-
name: fn.name,
|
|
238276
|
-
entry: fn.entry,
|
|
238277
|
-
files: fn.files,
|
|
238278
|
-
automations: fn.automations
|
|
238279
|
-
};
|
|
238280
|
-
}
|
|
238281
|
-
async function deployFunctions(functions) {
|
|
238106
|
+
async function deploySingleFunction(name2, payload) {
|
|
238282
238107
|
const appClient = getAppClient();
|
|
238283
|
-
const payload = {
|
|
238284
|
-
functions: functions.map(toDeployPayloadItem)
|
|
238285
|
-
};
|
|
238286
238108
|
let response;
|
|
238287
238109
|
try {
|
|
238288
|
-
response = await appClient.put(
|
|
238289
|
-
|
|
238290
|
-
|
|
238110
|
+
response = await appClient.put(`backend-functions/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
|
|
238111
|
+
} catch (error48) {
|
|
238112
|
+
throw await ApiError.fromHttpError(error48, `deploying function "${name2}"`);
|
|
238113
|
+
}
|
|
238114
|
+
const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
|
|
238115
|
+
if (!result.success) {
|
|
238116
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238117
|
+
}
|
|
238118
|
+
return result.data;
|
|
238119
|
+
}
|
|
238120
|
+
async function deleteSingleFunction(name2) {
|
|
238121
|
+
const appClient = getAppClient();
|
|
238122
|
+
try {
|
|
238123
|
+
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
|
|
238124
|
+
timeout: 60000
|
|
238291
238125
|
});
|
|
238292
238126
|
} catch (error48) {
|
|
238293
|
-
throw await ApiError.fromHttpError(error48,
|
|
238127
|
+
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
238128
|
+
}
|
|
238129
|
+
}
|
|
238130
|
+
async function listDeployedFunctions() {
|
|
238131
|
+
const appClient = getAppClient();
|
|
238132
|
+
let response;
|
|
238133
|
+
try {
|
|
238134
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
238135
|
+
} catch (error48) {
|
|
238136
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
238294
238137
|
}
|
|
238295
|
-
const result =
|
|
238138
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
238296
238139
|
if (!result.success) {
|
|
238297
238140
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238298
238141
|
}
|
|
@@ -238334,20 +238177,6 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
238334
238177
|
}
|
|
238335
238178
|
return result.data;
|
|
238336
238179
|
}
|
|
238337
|
-
async function listDeployedFunctions() {
|
|
238338
|
-
const appClient = getAppClient();
|
|
238339
|
-
let response;
|
|
238340
|
-
try {
|
|
238341
|
-
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
238342
|
-
} catch (error48) {
|
|
238343
|
-
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
238344
|
-
}
|
|
238345
|
-
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
238346
|
-
if (!result.success) {
|
|
238347
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238348
|
-
}
|
|
238349
|
-
return result.data;
|
|
238350
|
-
}
|
|
238351
238180
|
// src/core/resources/function/config.ts
|
|
238352
238181
|
import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
|
|
238353
238182
|
async function readFunctionConfig(configPath) {
|
|
@@ -238429,84 +238258,70 @@ async function readAllFunctions(functionsDir) {
|
|
|
238429
238258
|
import { dirname as dirname4, relative as relative2 } from "node:path";
|
|
238430
238259
|
async function loadFunctionCode(fn) {
|
|
238431
238260
|
const functionDir = dirname4(fn.entryPath);
|
|
238432
|
-
const
|
|
238261
|
+
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
238433
238262
|
const content = await readTextFile(filePath);
|
|
238434
238263
|
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
238435
238264
|
return { path: path11, content };
|
|
238436
238265
|
}));
|
|
238437
|
-
return { ...fn, files:
|
|
238438
|
-
}
|
|
238439
|
-
async function pushFunctions(functions) {
|
|
238440
|
-
if (functions.length === 0) {
|
|
238441
|
-
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
238442
|
-
}
|
|
238443
|
-
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
238444
|
-
return deployFunctions(functionsWithCode);
|
|
238266
|
+
return { ...fn, files: resolvedFiles };
|
|
238445
238267
|
}
|
|
238446
|
-
|
|
238447
|
-
|
|
238448
|
-
|
|
238449
|
-
|
|
238450
|
-
|
|
238451
|
-
|
|
238452
|
-
|
|
238453
|
-
|
|
238454
|
-
|
|
238455
|
-
|
|
238456
|
-
|
|
238457
|
-
|
|
238458
|
-
|
|
238459
|
-
|
|
238268
|
+
async function deployOne(fn) {
|
|
238269
|
+
const start = Date.now();
|
|
238270
|
+
try {
|
|
238271
|
+
const functionWithCode = await loadFunctionCode(fn);
|
|
238272
|
+
const response = await deploySingleFunction(functionWithCode.name, {
|
|
238273
|
+
entry: functionWithCode.entry,
|
|
238274
|
+
files: functionWithCode.files,
|
|
238275
|
+
automations: functionWithCode.automations
|
|
238276
|
+
});
|
|
238277
|
+
return {
|
|
238278
|
+
name: functionWithCode.name,
|
|
238279
|
+
status: response.status,
|
|
238280
|
+
durationMs: Date.now() - start
|
|
238281
|
+
};
|
|
238282
|
+
} catch (error48) {
|
|
238283
|
+
return {
|
|
238460
238284
|
name: fn.name,
|
|
238461
|
-
|
|
238285
|
+
status: "error",
|
|
238286
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
238462
238287
|
};
|
|
238463
|
-
if (fn.automations.length > 0) {
|
|
238464
|
-
config5.automations = fn.automations;
|
|
238465
|
-
}
|
|
238466
|
-
await writeJsonFile(configPath, config5);
|
|
238467
|
-
for (const file2 of fn.files) {
|
|
238468
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
238469
|
-
}
|
|
238470
|
-
written.push(fn.name);
|
|
238471
238288
|
}
|
|
238472
|
-
return { written, skipped };
|
|
238473
238289
|
}
|
|
238474
|
-
async function
|
|
238475
|
-
if (
|
|
238476
|
-
return
|
|
238477
|
-
|
|
238478
|
-
const
|
|
238479
|
-
|
|
238480
|
-
const
|
|
238481
|
-
|
|
238482
|
-
|
|
238483
|
-
}
|
|
238484
|
-
if (!isDeepStrictEqual3(localConfig.automations ?? [], fn.automations)) {
|
|
238485
|
-
return false;
|
|
238486
|
-
}
|
|
238487
|
-
} catch {
|
|
238488
|
-
return false;
|
|
238290
|
+
async function deployFunctionsSequentially(functions, options) {
|
|
238291
|
+
if (functions.length === 0)
|
|
238292
|
+
return [];
|
|
238293
|
+
const results = [];
|
|
238294
|
+
for (const fn of functions) {
|
|
238295
|
+
options?.onStart?.([fn.name]);
|
|
238296
|
+
const result = await deployOne(fn);
|
|
238297
|
+
results.push(result);
|
|
238298
|
+
options?.onResult?.(result);
|
|
238489
238299
|
}
|
|
238490
|
-
|
|
238491
|
-
|
|
238492
|
-
|
|
238493
|
-
|
|
238494
|
-
|
|
238300
|
+
return results;
|
|
238301
|
+
}
|
|
238302
|
+
async function pruneRemovedFunctions(localFunctionNames) {
|
|
238303
|
+
const remote = await listDeployedFunctions();
|
|
238304
|
+
const localSet = new Set(localFunctionNames);
|
|
238305
|
+
const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
|
|
238306
|
+
const results = [];
|
|
238307
|
+
for (const fn of toDelete) {
|
|
238495
238308
|
try {
|
|
238496
|
-
|
|
238497
|
-
|
|
238498
|
-
|
|
238499
|
-
|
|
238500
|
-
|
|
238501
|
-
|
|
238309
|
+
await deleteSingleFunction(fn.name);
|
|
238310
|
+
results.push({ name: fn.name, deleted: true });
|
|
238311
|
+
} catch (error48) {
|
|
238312
|
+
results.push({
|
|
238313
|
+
name: fn.name,
|
|
238314
|
+
deleted: false,
|
|
238315
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
238316
|
+
});
|
|
238502
238317
|
}
|
|
238503
238318
|
}
|
|
238504
|
-
return
|
|
238319
|
+
return results;
|
|
238505
238320
|
}
|
|
238506
238321
|
// src/core/resources/function/resource.ts
|
|
238507
238322
|
var functionResource = {
|
|
238508
238323
|
readAll: readAllFunctions,
|
|
238509
|
-
push:
|
|
238324
|
+
push: (functions) => deployFunctionsSequentially(functions)
|
|
238510
238325
|
};
|
|
238511
238326
|
// src/core/project/config.ts
|
|
238512
238327
|
async function findConfigInDir(dir) {
|
|
@@ -238547,10 +238362,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
238547
238362
|
const project = result.data;
|
|
238548
238363
|
const configDir = dirname5(configPath);
|
|
238549
238364
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
238550
|
-
entityResource.readAll(
|
|
238551
|
-
functionResource.readAll(
|
|
238552
|
-
agentResource.readAll(
|
|
238553
|
-
connectorResource.readAll(
|
|
238365
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
238366
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
238367
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
238368
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
238554
238369
|
]);
|
|
238555
238370
|
return {
|
|
238556
238371
|
project: { ...project, root, configPath },
|
|
@@ -238647,12 +238462,12 @@ async function readAppConfig(projectRoot) {
|
|
|
238647
238462
|
// src/core/project/template.ts
|
|
238648
238463
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
238649
238464
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
238650
|
-
import { dirname as dirname6, join as
|
|
238465
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
238651
238466
|
|
|
238652
238467
|
// src/core/assets.ts
|
|
238653
238468
|
import { cpSync, existsSync } from "node:fs";
|
|
238654
238469
|
import { homedir as homedir2 } from "node:os";
|
|
238655
|
-
import { join as
|
|
238470
|
+
import { join as join7 } from "node:path";
|
|
238656
238471
|
// package.json
|
|
238657
238472
|
var package_default = {
|
|
238658
238473
|
name: "base44",
|
|
@@ -238745,15 +238560,15 @@ var package_default = {
|
|
|
238745
238560
|
};
|
|
238746
238561
|
|
|
238747
238562
|
// src/core/assets.ts
|
|
238748
|
-
var ASSETS_DIR =
|
|
238563
|
+
var ASSETS_DIR = join7(homedir2(), ".base44", "assets", package_default.version);
|
|
238749
238564
|
function getTemplatesDir() {
|
|
238750
|
-
return
|
|
238565
|
+
return join7(ASSETS_DIR, "templates");
|
|
238751
238566
|
}
|
|
238752
238567
|
function getTemplatesIndexPath() {
|
|
238753
|
-
return
|
|
238568
|
+
return join7(ASSETS_DIR, "templates", "templates.json");
|
|
238754
238569
|
}
|
|
238755
238570
|
function getDenoWrapperPath() {
|
|
238756
|
-
return
|
|
238571
|
+
return join7(ASSETS_DIR, "deno-runtime", "main.js");
|
|
238757
238572
|
}
|
|
238758
238573
|
function ensureNpmAssets(sourceDir) {
|
|
238759
238574
|
if (existsSync(ASSETS_DIR))
|
|
@@ -238774,23 +238589,23 @@ async function listTemplates() {
|
|
|
238774
238589
|
return result.data.templates;
|
|
238775
238590
|
}
|
|
238776
238591
|
async function renderTemplate(template, destPath, data) {
|
|
238777
|
-
const templateDir =
|
|
238592
|
+
const templateDir = join8(getTemplatesDir(), template.path);
|
|
238778
238593
|
const files = await globby("**/*", {
|
|
238779
238594
|
cwd: templateDir,
|
|
238780
238595
|
dot: true,
|
|
238781
238596
|
onlyFiles: true
|
|
238782
238597
|
});
|
|
238783
238598
|
for (const file2 of files) {
|
|
238784
|
-
const srcPath =
|
|
238599
|
+
const srcPath = join8(templateDir, file2);
|
|
238785
238600
|
try {
|
|
238786
238601
|
if (file2.endsWith(".ejs")) {
|
|
238787
238602
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
238788
238603
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
238789
|
-
const destFile = attributes.outputFileName ?
|
|
238790
|
-
const destFilePath =
|
|
238604
|
+
const destFile = attributes.outputFileName ? join8(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
238605
|
+
const destFilePath = join8(destPath, destFile);
|
|
238791
238606
|
await writeFile(destFilePath, body);
|
|
238792
238607
|
} else {
|
|
238793
|
-
const destFilePath =
|
|
238608
|
+
const destFilePath = join8(destPath, file2);
|
|
238794
238609
|
await copyFile(srcPath, destFilePath);
|
|
238795
238610
|
}
|
|
238796
238611
|
} catch (error48) {
|
|
@@ -238889,7 +238704,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
238889
238704
|
// src/core/site/deploy.ts
|
|
238890
238705
|
import { randomUUID } from "node:crypto";
|
|
238891
238706
|
import { tmpdir } from "node:os";
|
|
238892
|
-
import { join as
|
|
238707
|
+
import { join as join9 } from "node:path";
|
|
238893
238708
|
async function deploySite(siteOutputDir) {
|
|
238894
238709
|
if (!await pathExists(siteOutputDir)) {
|
|
238895
238710
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -238906,7 +238721,7 @@ async function deploySite(siteOutputDir) {
|
|
|
238906
238721
|
]
|
|
238907
238722
|
});
|
|
238908
238723
|
}
|
|
238909
|
-
const archivePath =
|
|
238724
|
+
const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
238910
238725
|
try {
|
|
238911
238726
|
await createArchive(siteOutputDir, archivePath);
|
|
238912
238727
|
return await uploadSite(archivePath);
|
|
@@ -246591,10 +246406,6 @@ function getDashboardUrl(projectId) {
|
|
|
246591
246406
|
const id = projectId ?? getAppConfig().id;
|
|
246592
246407
|
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
|
|
246593
246408
|
}
|
|
246594
|
-
function getConnectorsUrl(projectId) {
|
|
246595
|
-
const id = projectId ?? getAppConfig().id;
|
|
246596
|
-
return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
|
|
246597
|
-
}
|
|
246598
246409
|
// src/cli/utils/yaml.ts
|
|
246599
246410
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
246600
246411
|
|
|
@@ -246662,7 +246473,7 @@ function formatYaml(data, options = {}) {
|
|
|
246662
246473
|
async function pullAgentsAction() {
|
|
246663
246474
|
const { project: project2 } = await readProjectConfig();
|
|
246664
246475
|
const configDir = dirname7(project2.configPath);
|
|
246665
|
-
const agentsDir =
|
|
246476
|
+
const agentsDir = join10(configDir, project2.agentsDir);
|
|
246666
246477
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
246667
246478
|
return await fetchAgents();
|
|
246668
246479
|
}, {
|
|
@@ -246784,19 +246595,19 @@ function getConnectorsListAvailableCommand(context) {
|
|
|
246784
246595
|
}
|
|
246785
246596
|
|
|
246786
246597
|
// src/cli/commands/connectors/pull.ts
|
|
246787
|
-
import { dirname as dirname8, join as
|
|
246598
|
+
import { dirname as dirname8, join as join11 } from "node:path";
|
|
246788
246599
|
async function pullConnectorsAction() {
|
|
246789
246600
|
const { project: project2 } = await readProjectConfig();
|
|
246790
246601
|
const configDir = dirname8(project2.configPath);
|
|
246791
|
-
const connectorsDir =
|
|
246602
|
+
const connectorsDir = join11(configDir, project2.connectorsDir);
|
|
246792
246603
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
246793
|
-
return await
|
|
246604
|
+
return await listConnectors();
|
|
246794
246605
|
}, {
|
|
246795
246606
|
successMessage: "Connectors fetched successfully",
|
|
246796
246607
|
errorMessage: "Failed to fetch connectors"
|
|
246797
246608
|
});
|
|
246798
246609
|
const { written, deleted } = await runTask("Syncing connector files", async () => {
|
|
246799
|
-
return await writeConnectors(connectorsDir, remoteConnectors);
|
|
246610
|
+
return await writeConnectors(connectorsDir, remoteConnectors.integrations);
|
|
246800
246611
|
}, {
|
|
246801
246612
|
successMessage: "Connector files synced successfully",
|
|
246802
246613
|
errorMessage: "Failed to sync connector files"
|
|
@@ -246811,7 +246622,7 @@ async function pullConnectorsAction() {
|
|
|
246811
246622
|
R2.info("All connectors are already up to date");
|
|
246812
246623
|
}
|
|
246813
246624
|
return {
|
|
246814
|
-
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
246625
|
+
outroMessage: `Pulled ${remoteConnectors.integrations.length} connectors to ${connectorsDir}`
|
|
246815
246626
|
};
|
|
246816
246627
|
}
|
|
246817
246628
|
function getConnectorsPullCommand(context) {
|
|
@@ -247430,7 +247241,7 @@ var open_default = open;
|
|
|
247430
247241
|
var POLL_INTERVAL_MS = 2000;
|
|
247431
247242
|
var POLL_TIMEOUT_MS = 2 * 60 * 1000;
|
|
247432
247243
|
function filterPendingOAuth(results) {
|
|
247433
|
-
return results.filter((r) => r.action === "needs_oauth" && !!r.connectionId);
|
|
247244
|
+
return results.filter((r) => r.action === "needs_oauth" && !!r.redirectUrl && !!r.connectionId);
|
|
247434
247245
|
}
|
|
247435
247246
|
async function runOAuthFlowWithSkip(connector2) {
|
|
247436
247247
|
await open_default(connector2.redirectUrl);
|
|
@@ -247448,10 +247259,6 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
247448
247259
|
finalStatus = "SKIPPED";
|
|
247449
247260
|
return true;
|
|
247450
247261
|
}
|
|
247451
|
-
if (!connector2.connectionId) {
|
|
247452
|
-
finalStatus = "FAILED";
|
|
247453
|
-
return true;
|
|
247454
|
-
}
|
|
247455
247262
|
const response = await getOAuthStatus(connector2.type, connector2.connectionId);
|
|
247456
247263
|
finalStatus = response.status;
|
|
247457
247264
|
return response.status !== "PENDING";
|
|
@@ -247514,49 +247321,32 @@ async function promptOAuthFlows(pending, options) {
|
|
|
247514
247321
|
function printSummary(results, oauthOutcomes) {
|
|
247515
247322
|
const synced = [];
|
|
247516
247323
|
const added = [];
|
|
247517
|
-
let provisioned;
|
|
247518
247324
|
const removed = [];
|
|
247519
247325
|
const skipped = [];
|
|
247520
247326
|
const failed = [];
|
|
247521
247327
|
for (const r of results) {
|
|
247522
|
-
|
|
247523
|
-
|
|
247524
|
-
|
|
247525
|
-
|
|
247526
|
-
|
|
247527
|
-
|
|
247528
|
-
|
|
247529
|
-
|
|
247530
|
-
|
|
247531
|
-
|
|
247532
|
-
|
|
247533
|
-
|
|
247534
|
-
|
|
247535
|
-
|
|
247536
|
-
|
|
247537
|
-
|
|
247538
|
-
|
|
247539
|
-
|
|
247540
|
-
skipped.push(r.type);
|
|
247541
|
-
} else if (oauthStatus === "PENDING") {
|
|
247542
|
-
failed.push({ type: r.type, error: "authorization timed out" });
|
|
247543
|
-
} else if (oauthStatus === "FAILED") {
|
|
247544
|
-
failed.push({ type: r.type, error: "authorization failed" });
|
|
247545
|
-
} else {
|
|
247546
|
-
failed.push({ type: r.type, error: "needs authorization" });
|
|
247547
|
-
}
|
|
247548
|
-
break;
|
|
247328
|
+
const oauthStatus = oauthOutcomes.get(r.type);
|
|
247329
|
+
if (r.action === "synced") {
|
|
247330
|
+
synced.push(r.type);
|
|
247331
|
+
} else if (r.action === "removed") {
|
|
247332
|
+
removed.push(r.type);
|
|
247333
|
+
} else if (r.action === "error") {
|
|
247334
|
+
failed.push({ type: r.type, error: r.error });
|
|
247335
|
+
} else if (r.action === "needs_oauth") {
|
|
247336
|
+
if (oauthStatus === "ACTIVE") {
|
|
247337
|
+
added.push(r.type);
|
|
247338
|
+
} else if (oauthStatus === "SKIPPED") {
|
|
247339
|
+
skipped.push(r.type);
|
|
247340
|
+
} else if (oauthStatus === "PENDING") {
|
|
247341
|
+
failed.push({ type: r.type, error: "authorization timed out" });
|
|
247342
|
+
} else if (oauthStatus === "FAILED") {
|
|
247343
|
+
failed.push({ type: r.type, error: "authorization failed" });
|
|
247344
|
+
} else {
|
|
247345
|
+
failed.push({ type: r.type, error: "needs authorization" });
|
|
247549
247346
|
}
|
|
247550
247347
|
}
|
|
247551
247348
|
}
|
|
247552
247349
|
R2.info(theme.styles.bold("Summary:"));
|
|
247553
|
-
if (provisioned) {
|
|
247554
|
-
R2.success("Stripe sandbox provisioned");
|
|
247555
|
-
if (provisioned.claimUrl) {
|
|
247556
|
-
R2.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
|
|
247557
|
-
}
|
|
247558
|
-
R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
247559
|
-
}
|
|
247560
247350
|
if (synced.length > 0) {
|
|
247561
247351
|
R2.success(`Synced: ${synced.join(", ")}`);
|
|
247562
247352
|
}
|
|
@@ -247570,7 +247360,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
247570
247360
|
R2.warn(`Skipped: ${skipped.join(", ")}`);
|
|
247571
247361
|
}
|
|
247572
247362
|
for (const r of failed) {
|
|
247573
|
-
R2.error(`Failed: ${r.type} - ${r.error}`);
|
|
247363
|
+
R2.error(`Failed: ${r.type}${r.error ? ` - ${r.error}` : ""}`);
|
|
247574
247364
|
}
|
|
247575
247365
|
}
|
|
247576
247366
|
async function pushConnectorsAction(isNonInteractive) {
|
|
@@ -247657,95 +247447,132 @@ function getEntitiesPushCommand(context) {
|
|
|
247657
247447
|
}));
|
|
247658
247448
|
}
|
|
247659
247449
|
|
|
247450
|
+
// src/cli/commands/functions/formatDeployResult.ts
|
|
247451
|
+
function formatDuration(ms) {
|
|
247452
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
247453
|
+
}
|
|
247454
|
+
function formatDeployResult(result) {
|
|
247455
|
+
const label = result.name.padEnd(25);
|
|
247456
|
+
if (result.status === "deployed") {
|
|
247457
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
247458
|
+
R2.success(`${label} deployed${timing}`);
|
|
247459
|
+
} else if (result.status === "unchanged") {
|
|
247460
|
+
R2.success(`${label} unchanged`);
|
|
247461
|
+
} else {
|
|
247462
|
+
R2.error(`${label} error: ${result.error}`);
|
|
247463
|
+
}
|
|
247464
|
+
}
|
|
247465
|
+
|
|
247466
|
+
// src/cli/commands/functions/parseNames.ts
|
|
247467
|
+
function parseNames(args) {
|
|
247468
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247469
|
+
}
|
|
247470
|
+
|
|
247660
247471
|
// src/cli/commands/functions/deploy.ts
|
|
247661
|
-
|
|
247472
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
247473
|
+
if (names.length === 0)
|
|
247474
|
+
return allFunctions;
|
|
247475
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
247476
|
+
if (notFound.length > 0) {
|
|
247477
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
247478
|
+
}
|
|
247479
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
247480
|
+
}
|
|
247481
|
+
function formatPruneResults(pruneResults) {
|
|
247482
|
+
for (const pruneResult of pruneResults) {
|
|
247483
|
+
if (pruneResult.deleted) {
|
|
247484
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
247485
|
+
} else {
|
|
247486
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
247487
|
+
}
|
|
247488
|
+
}
|
|
247489
|
+
if (pruneResults.length > 0) {
|
|
247490
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
247491
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
247492
|
+
}
|
|
247493
|
+
}
|
|
247494
|
+
function buildDeploySummary(results) {
|
|
247495
|
+
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
247496
|
+
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
247497
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
247498
|
+
const parts = [];
|
|
247499
|
+
if (deployed > 0)
|
|
247500
|
+
parts.push(`${deployed} deployed`);
|
|
247501
|
+
if (unchanged > 0)
|
|
247502
|
+
parts.push(`${unchanged} unchanged`);
|
|
247503
|
+
if (failed > 0)
|
|
247504
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
247505
|
+
return parts.join(", ") || "No functions deployed";
|
|
247506
|
+
}
|
|
247507
|
+
async function deployFunctionsAction(names, options) {
|
|
247508
|
+
if (options.force && names.length > 0) {
|
|
247509
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
247510
|
+
}
|
|
247662
247511
|
const { functions } = await readProjectConfig();
|
|
247663
|
-
|
|
247512
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
247513
|
+
if (toDeploy.length === 0) {
|
|
247664
247514
|
return {
|
|
247665
247515
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
247666
247516
|
};
|
|
247667
247517
|
}
|
|
247668
|
-
R2.info(`Found ${
|
|
247669
|
-
|
|
247670
|
-
|
|
247671
|
-
|
|
247672
|
-
|
|
247673
|
-
|
|
247518
|
+
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
247519
|
+
let completed = 0;
|
|
247520
|
+
const total = toDeploy.length;
|
|
247521
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
247522
|
+
onStart: (startNames) => {
|
|
247523
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
247524
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
247525
|
+
},
|
|
247526
|
+
onResult: (result) => {
|
|
247527
|
+
completed++;
|
|
247528
|
+
formatDeployResult(result);
|
|
247529
|
+
}
|
|
247674
247530
|
});
|
|
247675
|
-
if (
|
|
247676
|
-
R2.
|
|
247531
|
+
if (options.force) {
|
|
247532
|
+
R2.info("Removing remote functions not found locally...");
|
|
247533
|
+
const allLocalNames = functions.map((f) => f.name);
|
|
247534
|
+
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
247535
|
+
formatPruneResults(pruneResults);
|
|
247677
247536
|
}
|
|
247678
|
-
|
|
247679
|
-
R2.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
247680
|
-
}
|
|
247681
|
-
if (result.errors && result.errors.length > 0) {
|
|
247682
|
-
throw new ApiError("Function deployment errors", {
|
|
247683
|
-
details: result.errors.map((e2) => `'${e2.name}': ${e2.message}`),
|
|
247684
|
-
hints: [
|
|
247685
|
-
{ message: "Check the function code for syntax errors" },
|
|
247686
|
-
{ message: "Ensure all imports are valid" }
|
|
247687
|
-
]
|
|
247688
|
-
});
|
|
247689
|
-
}
|
|
247690
|
-
return { outroMessage: "Functions deployed to Base44" };
|
|
247537
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
247691
247538
|
}
|
|
247692
247539
|
function getDeployCommand(context) {
|
|
247693
|
-
return new Command("deploy").description("Deploy
|
|
247694
|
-
await runCommand(
|
|
247540
|
+
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
247541
|
+
await runCommand(() => {
|
|
247542
|
+
const names = parseNames(rawNames);
|
|
247543
|
+
return deployFunctionsAction(names, options);
|
|
247544
|
+
}, { requireAuth: true }, context);
|
|
247695
247545
|
});
|
|
247696
247546
|
}
|
|
247697
247547
|
|
|
247698
|
-
// src/cli/commands/functions/
|
|
247699
|
-
|
|
247700
|
-
async
|
|
247701
|
-
|
|
247702
|
-
|
|
247703
|
-
const functionsDir = join13(configDir, project2.functionsDir);
|
|
247704
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
247705
|
-
const { functions } = await listDeployedFunctions();
|
|
247706
|
-
return functions;
|
|
247707
|
-
}, {
|
|
247708
|
-
successMessage: "Functions fetched successfully",
|
|
247709
|
-
errorMessage: "Failed to fetch functions"
|
|
247710
|
-
});
|
|
247711
|
-
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
247712
|
-
if (name2 && toPull.length === 0) {
|
|
247713
|
-
return {
|
|
247714
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
247715
|
-
};
|
|
247716
|
-
}
|
|
247717
|
-
if (toPull.length === 0) {
|
|
247718
|
-
return { outroMessage: "No functions found on remote" };
|
|
247719
|
-
}
|
|
247720
|
-
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
247721
|
-
return await writeFunctions(functionsDir, toPull);
|
|
247722
|
-
}, {
|
|
247723
|
-
successMessage: "Function files written successfully",
|
|
247724
|
-
errorMessage: "Failed to write function files"
|
|
247725
|
-
});
|
|
247726
|
-
for (const name3 of written) {
|
|
247727
|
-
R2.success(`${name3.padEnd(25)} written`);
|
|
247548
|
+
// src/cli/commands/functions/list.ts
|
|
247549
|
+
async function listFunctionsAction() {
|
|
247550
|
+
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
247551
|
+
if (functions.length === 0) {
|
|
247552
|
+
return { outroMessage: "No functions on remote" };
|
|
247728
247553
|
}
|
|
247729
|
-
for (const
|
|
247730
|
-
|
|
247554
|
+
for (const fn of functions) {
|
|
247555
|
+
const automationCount = fn.automations.length;
|
|
247556
|
+
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
247557
|
+
R2.message(` ${fn.name}${automationLabel}`);
|
|
247731
247558
|
}
|
|
247732
247559
|
return {
|
|
247733
|
-
outroMessage:
|
|
247560
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
247734
247561
|
};
|
|
247735
247562
|
}
|
|
247736
|
-
function
|
|
247737
|
-
return new Command("
|
|
247738
|
-
await runCommand(
|
|
247563
|
+
function getListCommand(context) {
|
|
247564
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
247565
|
+
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
247739
247566
|
});
|
|
247740
247567
|
}
|
|
247741
247568
|
|
|
247742
247569
|
// src/cli/commands/functions/index.ts
|
|
247743
247570
|
function getFunctionsCommand(context) {
|
|
247744
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
247571
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
|
|
247745
247572
|
}
|
|
247746
247573
|
|
|
247747
247574
|
// src/cli/commands/project/create.ts
|
|
247748
|
-
import { basename as basename3, join as
|
|
247575
|
+
import { basename as basename3, join as join12, resolve as resolve2 } from "node:path";
|
|
247749
247576
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
247750
247577
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
247751
247578
|
async function getTemplateById(templateId) {
|
|
@@ -247881,7 +247708,7 @@ async function executeCreate({
|
|
|
247881
247708
|
updateMessage("Building project...");
|
|
247882
247709
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
247883
247710
|
updateMessage("Deploying site...");
|
|
247884
|
-
return await deploySite(
|
|
247711
|
+
return await deploySite(join12(resolvedPath, outputDirectory));
|
|
247885
247712
|
}, {
|
|
247886
247713
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
247887
247714
|
errorMessage: "Failed to deploy site"
|
|
@@ -247967,11 +247794,15 @@ ${summaryLines.join(`
|
|
|
247967
247794
|
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
247968
247795
|
errorMessage: "Deployment failed"
|
|
247969
247796
|
});
|
|
247970
|
-
const
|
|
247971
|
-
|
|
247972
|
-
|
|
247973
|
-
|
|
247974
|
-
|
|
247797
|
+
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
247798
|
+
if (needsOAuth.length > 0) {
|
|
247799
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
247800
|
+
skipPrompt: options.yes || options.isNonInteractive
|
|
247801
|
+
});
|
|
247802
|
+
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
247803
|
+
if (!allAuthorized) {
|
|
247804
|
+
R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
247805
|
+
}
|
|
247975
247806
|
}
|
|
247976
247807
|
R2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
247977
247808
|
if (result.appUrl) {
|
|
@@ -247987,25 +247818,6 @@ function getDeployCommand2(context) {
|
|
|
247987
247818
|
}), { requireAuth: true }, context);
|
|
247988
247819
|
});
|
|
247989
247820
|
}
|
|
247990
|
-
async function handleOAuthConnectors(connectorResults, options) {
|
|
247991
|
-
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
247992
|
-
if (needsOAuth.length === 0)
|
|
247993
|
-
return;
|
|
247994
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
247995
|
-
skipPrompt: options.yes || options.isNonInteractive
|
|
247996
|
-
});
|
|
247997
|
-
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
247998
|
-
if (!allAuthorized) {
|
|
247999
|
-
R2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
248000
|
-
}
|
|
248001
|
-
}
|
|
248002
|
-
function printStripeResult(r) {
|
|
248003
|
-
R2.success("Stripe sandbox provisioned");
|
|
248004
|
-
if (r.claimUrl) {
|
|
248005
|
-
R2.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
|
|
248006
|
-
}
|
|
248007
|
-
R2.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
248008
|
-
}
|
|
248009
247821
|
|
|
248010
247822
|
// src/cli/commands/project/link.ts
|
|
248011
247823
|
function validateNonInteractiveFlags2(command) {
|
|
@@ -248524,10 +248336,10 @@ function toPascalCase(name2) {
|
|
|
248524
248336
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
248525
248337
|
}
|
|
248526
248338
|
// src/core/types/update-project.ts
|
|
248527
|
-
import { join as
|
|
248339
|
+
import { join as join15 } from "node:path";
|
|
248528
248340
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
248529
248341
|
async function updateProjectConfig(projectRoot) {
|
|
248530
|
-
const tsconfigPath =
|
|
248342
|
+
const tsconfigPath = join15(projectRoot, "tsconfig.json");
|
|
248531
248343
|
if (!await pathExists(tsconfigPath)) {
|
|
248532
248344
|
return false;
|
|
248533
248345
|
}
|
|
@@ -248570,7 +248382,7 @@ function getTypesCommand(context) {
|
|
|
248570
248382
|
}
|
|
248571
248383
|
|
|
248572
248384
|
// src/cli/dev/dev-server/main.ts
|
|
248573
|
-
import { dirname as
|
|
248385
|
+
import { dirname as dirname13, join as join18 } from "node:path";
|
|
248574
248386
|
var import_cors = __toESM(require_lib4(), 1);
|
|
248575
248387
|
var import_express4 = __toESM(require_express(), 1);
|
|
248576
248388
|
|
|
@@ -250050,9 +249862,9 @@ class NodeFsHandler {
|
|
|
250050
249862
|
if (this.fsw.closed) {
|
|
250051
249863
|
return;
|
|
250052
249864
|
}
|
|
250053
|
-
const
|
|
249865
|
+
const dirname12 = sp2.dirname(file2);
|
|
250054
249866
|
const basename5 = sp2.basename(file2);
|
|
250055
|
-
const parent = this.fsw._getWatchedDir(
|
|
249867
|
+
const parent = this.fsw._getWatchedDir(dirname12);
|
|
250056
249868
|
let prevStats = stats;
|
|
250057
249869
|
if (parent.has(basename5))
|
|
250058
249870
|
return;
|
|
@@ -250079,7 +249891,7 @@ class NodeFsHandler {
|
|
|
250079
249891
|
prevStats = newStats2;
|
|
250080
249892
|
}
|
|
250081
249893
|
} catch (error48) {
|
|
250082
|
-
this.fsw._remove(
|
|
249894
|
+
this.fsw._remove(dirname12, basename5);
|
|
250083
249895
|
}
|
|
250084
249896
|
} else if (parent.has(basename5)) {
|
|
250085
249897
|
const at13 = newStats.atimeMs;
|
|
@@ -251100,8 +250912,8 @@ async function createDevServer(options8) {
|
|
|
251100
250912
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
251101
250913
|
};
|
|
251102
250914
|
const base44ConfigWatcher = new WatchBase44({
|
|
251103
|
-
functions:
|
|
251104
|
-
entities:
|
|
250915
|
+
functions: join18(dirname13(project2.configPath), project2.functionsDir),
|
|
250916
|
+
entities: join18(dirname13(project2.configPath), project2.entitiesDir)
|
|
251105
250917
|
}, devLogger);
|
|
251106
250918
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
251107
250919
|
try {
|
|
@@ -251291,7 +251103,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
251291
251103
|
import { release, type } from "node:os";
|
|
251292
251104
|
|
|
251293
251105
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
251294
|
-
import { dirname as
|
|
251106
|
+
import { dirname as dirname14, posix, sep } from "path";
|
|
251295
251107
|
function createModulerModifier() {
|
|
251296
251108
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
251297
251109
|
return async (frames) => {
|
|
@@ -251300,7 +251112,7 @@ function createModulerModifier() {
|
|
|
251300
251112
|
return frames;
|
|
251301
251113
|
};
|
|
251302
251114
|
}
|
|
251303
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
251115
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
251304
251116
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
251305
251117
|
return (filename) => {
|
|
251306
251118
|
if (!filename)
|
|
@@ -255489,9 +255301,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
255489
255301
|
});
|
|
255490
255302
|
}
|
|
255491
255303
|
// src/cli/index.ts
|
|
255492
|
-
var __dirname4 =
|
|
255304
|
+
var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
|
|
255493
255305
|
async function runCLI() {
|
|
255494
|
-
ensureNpmAssets(
|
|
255306
|
+
ensureNpmAssets(join19(__dirname4, "../assets"));
|
|
255495
255307
|
const errorReporter = new ErrorReporter;
|
|
255496
255308
|
errorReporter.registerProcessErrorHandlers();
|
|
255497
255309
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -255523,4 +255335,4 @@ export {
|
|
|
255523
255335
|
CLIExitError
|
|
255524
255336
|
};
|
|
255525
255337
|
|
|
255526
|
-
//# debugId=
|
|
255338
|
+
//# debugId=F3F799D2EDA5BC2A64756E2164756E21
|