cleo-dev 0.1.2 → 0.1.3
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.js +52 -7
- package/dist/index.js +48 -5
- package/dist/public/cleo-bundle.iife.js +37 -37
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -55718,7 +55718,7 @@ var {
|
|
|
55718
55718
|
} = import_index.default;
|
|
55719
55719
|
|
|
55720
55720
|
// package.json
|
|
55721
|
-
var version = "0.1.
|
|
55721
|
+
var version = "0.1.3";
|
|
55722
55722
|
|
|
55723
55723
|
// src/commands/init.ts
|
|
55724
55724
|
init_cjs_shims();
|
|
@@ -99785,19 +99785,21 @@ function parseAiGatewayOptions(options) {
|
|
|
99785
99785
|
// src/utils/logger.ts
|
|
99786
99786
|
init_cjs_shims();
|
|
99787
99787
|
var import_chalk2 = __toESM(require_source());
|
|
99788
|
-
|
|
99788
|
+
function isDebug() {
|
|
99789
|
+
return process.env.DEBUG === "true" || process.env.CLEO_DEBUG === "true";
|
|
99790
|
+
}
|
|
99789
99791
|
var debug = {
|
|
99790
99792
|
log: (...args) => {
|
|
99791
|
-
if (isDebug) console.log(...args);
|
|
99793
|
+
if (isDebug()) console.log(...args);
|
|
99792
99794
|
},
|
|
99793
99795
|
warn: (...args) => {
|
|
99794
|
-
if (isDebug) console.warn(...args);
|
|
99796
|
+
if (isDebug()) console.warn(...args);
|
|
99795
99797
|
},
|
|
99796
99798
|
error: (...args) => {
|
|
99797
99799
|
console.error(...args);
|
|
99798
99800
|
},
|
|
99799
99801
|
info: (...args) => {
|
|
99800
|
-
if (isDebug) console.log(...args);
|
|
99802
|
+
if (isDebug()) console.log(...args);
|
|
99801
99803
|
}
|
|
99802
99804
|
};
|
|
99803
99805
|
var logger3 = {
|
|
@@ -131374,9 +131376,14 @@ async function startDevServer(options) {
|
|
|
131374
131376
|
} catch (cancelError) {
|
|
131375
131377
|
debug.log(`Note: Could not cancel free plan (may not exist)`);
|
|
131376
131378
|
}
|
|
131379
|
+
const { name: name16, email: email5 } = req.body || {};
|
|
131377
131380
|
const result = await Autumn.attach({
|
|
131378
131381
|
customer_id: userId,
|
|
131379
|
-
product_id: "early-tester"
|
|
131382
|
+
product_id: "early-tester",
|
|
131383
|
+
customer_data: {
|
|
131384
|
+
...name16 && { name: name16 },
|
|
131385
|
+
...email5 && { email: email5 }
|
|
131386
|
+
}
|
|
131380
131387
|
});
|
|
131381
131388
|
debug.log(`\u2713 Attached early-tester plan to user ${userId.slice(0, 10)}...`);
|
|
131382
131389
|
res.json({ success: true, message: "Early tester plan attached" });
|
|
@@ -131386,6 +131393,42 @@ async function startDevServer(options) {
|
|
|
131386
131393
|
res.status(500).json({ error: "Failed to attach plan", details: errorMsg });
|
|
131387
131394
|
}
|
|
131388
131395
|
});
|
|
131396
|
+
app.post("/api/autumn/sync-customer", async (req, res) => {
|
|
131397
|
+
const authHeader = req.headers.authorization;
|
|
131398
|
+
if (!authHeader || !authHeader.startsWith("Bearer ")) {
|
|
131399
|
+
res.status(401).json({ error: "User not authenticated" });
|
|
131400
|
+
return;
|
|
131401
|
+
}
|
|
131402
|
+
const userId = authHeader.replace("Bearer ", "");
|
|
131403
|
+
const { name: name16, email: email5 } = req.body || {};
|
|
131404
|
+
debug.log(`[Autumn Sync] Syncing customer ${userId.slice(0, 10)}... name: ${name16}, email: ${email5}`);
|
|
131405
|
+
try {
|
|
131406
|
+
await Autumn.attach({
|
|
131407
|
+
customer_id: userId,
|
|
131408
|
+
product_id: "free",
|
|
131409
|
+
customer_data: {
|
|
131410
|
+
...name16 && { name: name16 },
|
|
131411
|
+
...email5 && { email: email5 }
|
|
131412
|
+
}
|
|
131413
|
+
});
|
|
131414
|
+
if (name16 || email5) {
|
|
131415
|
+
try {
|
|
131416
|
+
await Autumn.customers.update(userId, {
|
|
131417
|
+
...name16 && { name: name16 },
|
|
131418
|
+
...email5 && { email: email5 }
|
|
131419
|
+
});
|
|
131420
|
+
} catch {
|
|
131421
|
+
}
|
|
131422
|
+
}
|
|
131423
|
+
debug.log(`\u2713 Synced Autumn customer ${userId.slice(0, 10)}... with name: ${name16}, email: ${email5}`);
|
|
131424
|
+
res.json({ success: true });
|
|
131425
|
+
} catch (error85) {
|
|
131426
|
+
const errorMsg = error85 instanceof Error ? error85.message : String(error85);
|
|
131427
|
+
debug.log(`[Autumn Sync] Failed to sync customer:`, error85);
|
|
131428
|
+
logger3.error("Server", "Error syncing Autumn customer:", error85);
|
|
131429
|
+
res.status(500).json({ error: "Failed to sync customer", details: errorMsg });
|
|
131430
|
+
}
|
|
131431
|
+
});
|
|
131389
131432
|
} else {
|
|
131390
131433
|
const productionApiUrl = "https://api.cleo.build";
|
|
131391
131434
|
app.post("/api/attach-early-tester", async (req, res) => {
|
|
@@ -132222,7 +132265,9 @@ var BUNDLED_CF_GATEWAY_NAME = "cleo-gateway";
|
|
|
132222
132265
|
var BUNDLED_CF_API_KEY = "BBBLe4UXD4UkBywIDlrxSCpUGabiVENmkfkCsmZU";
|
|
132223
132266
|
var BUNDLED_AUTUMN_KEY = "am_sk_live_Q1UHqTaRHW83nLppZVCQK8MDzXAYCTpklpsoKttaoB";
|
|
132224
132267
|
process.env.CONVEX_URL = PRODUCTION_CONVEX_URL;
|
|
132225
|
-
process.env.
|
|
132268
|
+
if (process.env.CLEO_DEBUG !== "true") {
|
|
132269
|
+
process.env.CLEO_API_URL = PRODUCTION_API_URL;
|
|
132270
|
+
}
|
|
132226
132271
|
if (BUNDLED_CF_ACCOUNT_ID) {
|
|
132227
132272
|
process.env.CLOUDFLARE_ACCOUNT_ID = BUNDLED_CF_ACCOUNT_ID;
|
|
132228
132273
|
}
|
package/dist/index.js
CHANGED
|
@@ -91392,19 +91392,21 @@ function parseAiGatewayOptions(options) {
|
|
|
91392
91392
|
// src/utils/logger.ts
|
|
91393
91393
|
init_cjs_shims();
|
|
91394
91394
|
var import_chalk = __toESM(require_source());
|
|
91395
|
-
|
|
91395
|
+
function isDebug() {
|
|
91396
|
+
return process.env.DEBUG === "true" || process.env.CLEO_DEBUG === "true";
|
|
91397
|
+
}
|
|
91396
91398
|
var debug = {
|
|
91397
91399
|
log: (...args) => {
|
|
91398
|
-
if (isDebug) console.log(...args);
|
|
91400
|
+
if (isDebug()) console.log(...args);
|
|
91399
91401
|
},
|
|
91400
91402
|
warn: (...args) => {
|
|
91401
|
-
if (isDebug) console.warn(...args);
|
|
91403
|
+
if (isDebug()) console.warn(...args);
|
|
91402
91404
|
},
|
|
91403
91405
|
error: (...args) => {
|
|
91404
91406
|
console.error(...args);
|
|
91405
91407
|
},
|
|
91406
91408
|
info: (...args) => {
|
|
91407
|
-
if (isDebug) console.log(...args);
|
|
91409
|
+
if (isDebug()) console.log(...args);
|
|
91408
91410
|
}
|
|
91409
91411
|
};
|
|
91410
91412
|
var logger3 = {
|
|
@@ -122981,9 +122983,14 @@ async function startDevServer(options) {
|
|
|
122981
122983
|
} catch (cancelError) {
|
|
122982
122984
|
debug.log(`Note: Could not cancel free plan (may not exist)`);
|
|
122983
122985
|
}
|
|
122986
|
+
const { name: name16, email: email5 } = req.body || {};
|
|
122984
122987
|
const result = await Autumn.attach({
|
|
122985
122988
|
customer_id: userId,
|
|
122986
|
-
product_id: "early-tester"
|
|
122989
|
+
product_id: "early-tester",
|
|
122990
|
+
customer_data: {
|
|
122991
|
+
...name16 && { name: name16 },
|
|
122992
|
+
...email5 && { email: email5 }
|
|
122993
|
+
}
|
|
122987
122994
|
});
|
|
122988
122995
|
debug.log(`\u2713 Attached early-tester plan to user ${userId.slice(0, 10)}...`);
|
|
122989
122996
|
res.json({ success: true, message: "Early tester plan attached" });
|
|
@@ -122993,6 +123000,42 @@ async function startDevServer(options) {
|
|
|
122993
123000
|
res.status(500).json({ error: "Failed to attach plan", details: errorMsg });
|
|
122994
123001
|
}
|
|
122995
123002
|
});
|
|
123003
|
+
app.post("/api/autumn/sync-customer", async (req, res) => {
|
|
123004
|
+
const authHeader = req.headers.authorization;
|
|
123005
|
+
if (!authHeader || !authHeader.startsWith("Bearer ")) {
|
|
123006
|
+
res.status(401).json({ error: "User not authenticated" });
|
|
123007
|
+
return;
|
|
123008
|
+
}
|
|
123009
|
+
const userId = authHeader.replace("Bearer ", "");
|
|
123010
|
+
const { name: name16, email: email5 } = req.body || {};
|
|
123011
|
+
debug.log(`[Autumn Sync] Syncing customer ${userId.slice(0, 10)}... name: ${name16}, email: ${email5}`);
|
|
123012
|
+
try {
|
|
123013
|
+
await Autumn.attach({
|
|
123014
|
+
customer_id: userId,
|
|
123015
|
+
product_id: "free",
|
|
123016
|
+
customer_data: {
|
|
123017
|
+
...name16 && { name: name16 },
|
|
123018
|
+
...email5 && { email: email5 }
|
|
123019
|
+
}
|
|
123020
|
+
});
|
|
123021
|
+
if (name16 || email5) {
|
|
123022
|
+
try {
|
|
123023
|
+
await Autumn.customers.update(userId, {
|
|
123024
|
+
...name16 && { name: name16 },
|
|
123025
|
+
...email5 && { email: email5 }
|
|
123026
|
+
});
|
|
123027
|
+
} catch {
|
|
123028
|
+
}
|
|
123029
|
+
}
|
|
123030
|
+
debug.log(`\u2713 Synced Autumn customer ${userId.slice(0, 10)}... with name: ${name16}, email: ${email5}`);
|
|
123031
|
+
res.json({ success: true });
|
|
123032
|
+
} catch (error85) {
|
|
123033
|
+
const errorMsg = error85 instanceof Error ? error85.message : String(error85);
|
|
123034
|
+
debug.log(`[Autumn Sync] Failed to sync customer:`, error85);
|
|
123035
|
+
logger3.error("Server", "Error syncing Autumn customer:", error85);
|
|
123036
|
+
res.status(500).json({ error: "Failed to sync customer", details: errorMsg });
|
|
123037
|
+
}
|
|
123038
|
+
});
|
|
122996
123039
|
} else {
|
|
122997
123040
|
const productionApiUrl = "https://api.cleo.build";
|
|
122998
123041
|
app.post("/api/attach-early-tester", async (req, res) => {
|