@meetploy/cli 1.14.0 → 1.15.0
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Ploy Dev Dashboard</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/main-
|
|
7
|
+
<script type="module" crossorigin src="/assets/main-UY1Z1kG0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/main-qA3kxECS.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/dev.js
CHANGED
|
@@ -30,10 +30,10 @@ function readPloyConfigSync(projectDir, configPath) {
|
|
|
30
30
|
function readPloyConfig(projectDir, configPath) {
|
|
31
31
|
const config = readPloyConfigSync(projectDir, configPath);
|
|
32
32
|
if (!config.kind) {
|
|
33
|
-
throw new Error(`Missing required field 'kind' in ${configPath
|
|
33
|
+
throw new Error(`Missing required field 'kind' in ${configPath ?? "ploy.yaml"}`);
|
|
34
34
|
}
|
|
35
35
|
if (config.kind !== "dynamic" && config.kind !== "worker") {
|
|
36
|
-
throw new Error(`Invalid kind '${config.kind}' in ${configPath
|
|
36
|
+
throw new Error(`Invalid kind '${config.kind}' in ${configPath ?? "ploy.yaml"}. Must be 'dynamic' or 'worker'`);
|
|
37
37
|
}
|
|
38
38
|
return config;
|
|
39
39
|
}
|
|
@@ -213,7 +213,7 @@ function createAuthHandlers(db) {
|
|
|
213
213
|
return c.json({ error: message }, 500);
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
-
const meHandler =
|
|
216
|
+
const meHandler = (c) => {
|
|
217
217
|
try {
|
|
218
218
|
const cookieToken = getCookie(c, "ploy_session");
|
|
219
219
|
const authHeader = c.req.header("Authorization");
|
|
@@ -257,7 +257,7 @@ function createAuthHandlers(db) {
|
|
|
257
257
|
return c.json({ error: message }, 500);
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
const signoutHandler =
|
|
260
|
+
const signoutHandler = (c) => {
|
|
261
261
|
try {
|
|
262
262
|
const sessionToken = getCookie(c, "ploy_session");
|
|
263
263
|
if (sessionToken) {
|
|
@@ -375,8 +375,8 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
375
375
|
if (tableName !== "auth_users" && tableName !== "auth_sessions") {
|
|
376
376
|
return c.json({ error: "Table not found" }, 404);
|
|
377
377
|
}
|
|
378
|
-
const limit = parseInt(c.req.query("limit")
|
|
379
|
-
const offset = parseInt(c.req.query("offset")
|
|
378
|
+
const limit = parseInt(c.req.query("limit") ?? "50", 10);
|
|
379
|
+
const offset = parseInt(c.req.query("offset") ?? "0", 10);
|
|
380
380
|
try {
|
|
381
381
|
const db = dbManager2.emulatorDb;
|
|
382
382
|
const columnsResult = db.prepare(`PRAGMA table_info("${tableName}")`).all();
|
|
@@ -588,8 +588,8 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
588
588
|
return c.json({ error: `Database binding '${binding}' not found` }, 404);
|
|
589
589
|
}
|
|
590
590
|
const tableName = c.req.param("tableName");
|
|
591
|
-
const limit = parseInt(c.req.query("limit")
|
|
592
|
-
const offset = parseInt(c.req.query("offset")
|
|
591
|
+
const limit = parseInt(c.req.query("limit") ?? "50", 10);
|
|
592
|
+
const offset = parseInt(c.req.query("offset") ?? "0", 10);
|
|
593
593
|
try {
|
|
594
594
|
const db = dbManager2.getD1Database(resourceName);
|
|
595
595
|
const columnsResult = db.prepare(`PRAGMA table_info("${tableName}")`).all();
|
|
@@ -670,7 +670,7 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
670
670
|
app.get("/api/queue/:binding/messages", (c) => {
|
|
671
671
|
const binding = c.req.param("binding");
|
|
672
672
|
const queueName = config.queue?.[binding];
|
|
673
|
-
const limit = parseInt(c.req.query("limit")
|
|
673
|
+
const limit = parseInt(c.req.query("limit") ?? "10", 10);
|
|
674
674
|
if (!queueName) {
|
|
675
675
|
return c.json({ error: "Queue not found" }, 404);
|
|
676
676
|
}
|
|
@@ -697,8 +697,8 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
697
697
|
app.get("/api/cache/:binding/entries", (c) => {
|
|
698
698
|
const binding = c.req.param("binding");
|
|
699
699
|
const cacheName = config.cache?.[binding];
|
|
700
|
-
const limit = parseInt(c.req.query("limit")
|
|
701
|
-
const offset = parseInt(c.req.query("offset")
|
|
700
|
+
const limit = parseInt(c.req.query("limit") ?? "20", 10);
|
|
701
|
+
const offset = parseInt(c.req.query("offset") ?? "0", 10);
|
|
702
702
|
const now = Math.floor(Date.now() / 1e3);
|
|
703
703
|
if (!cacheName) {
|
|
704
704
|
return c.json({ error: "Cache binding not found" }, 404);
|
|
@@ -730,9 +730,9 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
730
730
|
app.get("/api/state/:binding/entries", (c) => {
|
|
731
731
|
const binding = c.req.param("binding");
|
|
732
732
|
const stateName = config.state?.[binding];
|
|
733
|
-
const limit = parseInt(c.req.query("limit")
|
|
734
|
-
const offset = parseInt(c.req.query("offset")
|
|
735
|
-
const search = c.req.query("search")
|
|
733
|
+
const limit = parseInt(c.req.query("limit") ?? "20", 10);
|
|
734
|
+
const offset = parseInt(c.req.query("offset") ?? "0", 10);
|
|
735
|
+
const search = c.req.query("search") ?? "";
|
|
736
736
|
if (!stateName) {
|
|
737
737
|
return c.json({ error: "State binding not found" }, 404);
|
|
738
738
|
}
|
|
@@ -762,7 +762,7 @@ function createDashboardRoutes(app, dbManager2, config) {
|
|
|
762
762
|
app.get("/api/workflow/:binding/executions", (c) => {
|
|
763
763
|
const binding = c.req.param("binding");
|
|
764
764
|
const workflowConfig = config.workflow?.[binding];
|
|
765
|
-
const limit = parseInt(c.req.query("limit")
|
|
765
|
+
const limit = parseInt(c.req.query("limit") ?? "20", 10);
|
|
766
766
|
if (!workflowConfig) {
|
|
767
767
|
return c.json({ error: "Workflow not found" }, 404);
|
|
768
768
|
}
|
|
@@ -1002,7 +1002,7 @@ function createQueueHandlers(db) {
|
|
|
1002
1002
|
const transaction = db.transaction(() => {
|
|
1003
1003
|
for (const msg of messages) {
|
|
1004
1004
|
const id = randomUUID();
|
|
1005
|
-
const visibleAt = now + (msg.delaySeconds
|
|
1005
|
+
const visibleAt = now + (msg.delaySeconds ?? 0);
|
|
1006
1006
|
insert.run(id, queueName, JSON.stringify(msg.payload), visibleAt);
|
|
1007
1007
|
messageIds.push(id);
|
|
1008
1008
|
}
|
|
@@ -1592,7 +1592,7 @@ function createDevD1(databaseId, apiUrl) {
|
|
|
1592
1592
|
async batch(statements) {
|
|
1593
1593
|
const stmts = statements.map((s) => {
|
|
1594
1594
|
const data = s.__db_data;
|
|
1595
|
-
return data
|
|
1595
|
+
return data ?? s;
|
|
1596
1596
|
});
|
|
1597
1597
|
const response = await fetch(`${apiUrl}/db`, {
|
|
1598
1598
|
method: "POST",
|
|
@@ -1654,7 +1654,7 @@ async function initPloyForDev(config) {
|
|
|
1654
1654
|
globalThis.__PLOY_DEV_INITIALIZED__ = true;
|
|
1655
1655
|
const cliMockServerUrl = process.env.PLOY_MOCK_SERVER_URL;
|
|
1656
1656
|
if (cliMockServerUrl) {
|
|
1657
|
-
const configPath2 = config?.configPath
|
|
1657
|
+
const configPath2 = config?.configPath ?? "./ploy.yaml";
|
|
1658
1658
|
const projectDir2 = process.cwd();
|
|
1659
1659
|
let ployConfig2;
|
|
1660
1660
|
try {
|
|
@@ -1702,7 +1702,7 @@ async function initPloyForDev(config) {
|
|
|
1702
1702
|
console.log(`[Ploy] Using CLI mock server at ${cliMockServerUrl} (${features2.join(", ")})`);
|
|
1703
1703
|
return;
|
|
1704
1704
|
}
|
|
1705
|
-
const configPath = config?.configPath
|
|
1705
|
+
const configPath = config?.configPath ?? "./ploy.yaml";
|
|
1706
1706
|
const projectDir = process.cwd();
|
|
1707
1707
|
let ployConfig;
|
|
1708
1708
|
try {
|
|
@@ -1725,7 +1725,7 @@ async function initPloyForDev(config) {
|
|
|
1725
1725
|
ensureDataDir(projectDir);
|
|
1726
1726
|
dbManager = initializeDatabases(projectDir);
|
|
1727
1727
|
mockServer = await startMockServer(dbManager, ployConfig, {});
|
|
1728
|
-
const apiUrl = `http://localhost:${mockServer.port}`;
|
|
1728
|
+
const apiUrl = `http://localhost:${String(mockServer.port)}`;
|
|
1729
1729
|
const env = {};
|
|
1730
1730
|
if (hasDbBindings && ployConfig.db) {
|
|
1731
1731
|
for (const [bindingName, databaseId] of Object.entries(ployConfig.db)) {
|
|
@@ -1773,13 +1773,15 @@ async function initPloyForDev(config) {
|
|
|
1773
1773
|
dbManager.close();
|
|
1774
1774
|
}
|
|
1775
1775
|
});
|
|
1776
|
-
process.on("SIGINT",
|
|
1777
|
-
|
|
1778
|
-
|
|
1776
|
+
process.on("SIGINT", () => {
|
|
1777
|
+
void cleanup().then(() => {
|
|
1778
|
+
process.exit(0);
|
|
1779
|
+
});
|
|
1779
1780
|
});
|
|
1780
|
-
process.on("SIGTERM",
|
|
1781
|
-
|
|
1782
|
-
|
|
1781
|
+
process.on("SIGTERM", () => {
|
|
1782
|
+
void cleanup().then(() => {
|
|
1783
|
+
process.exit(0);
|
|
1784
|
+
});
|
|
1783
1785
|
});
|
|
1784
1786
|
}
|
|
1785
1787
|
|