@zaisma/cli 0.30.0 → 0.32.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.
- package/package.json +1 -1
- package/zaisma.mjs +14 -8
package/package.json
CHANGED
package/zaisma.mjs
CHANGED
|
@@ -65,6 +65,7 @@ const TEXTURE_CHECK_COUNT = 20;
|
|
|
65
65
|
/** The choices the API takes, checked before anything is sent (test/node/cli.test.ts holds them to the API's lists). */
|
|
66
66
|
const VISIBILITIES = ["listed", "unlisted", "private", "draft"];
|
|
67
67
|
const SCREENS = ["wide", "phone"];
|
|
68
|
+
const MATCH_UPDATE_MODES = ["next_match", "now"];
|
|
68
69
|
const TOPIC_KINDS = ["bug", "gap", "feature", "question", "talk"];
|
|
69
70
|
const MESSAGE_KINDS = ["bug", "gap", "feature", "question"];
|
|
70
71
|
const FORUM_CATEGORIES = ["publishing", "scans", "pages", "rooms", "servers", "passes", "sdk", "saves", "stats", "mcp", "api", "cli", "accounts", "dashboard", "reports", "rules", "docs", "other"];
|
|
@@ -153,7 +154,7 @@ const COMMANDS = {
|
|
|
153
154
|
game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game to upload to" },
|
|
154
155
|
"patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, shown with the update" },
|
|
155
156
|
"publish-when-approved": { hasValue: false, about: "Go live as soon as it passes review" },
|
|
156
|
-
"match-update-mode": { hasValue: true,
|
|
157
|
+
"match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, about: "With --publish-when-approved: when running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
|
|
157
158
|
},
|
|
158
159
|
},
|
|
159
160
|
shader: {
|
|
@@ -172,7 +173,7 @@ const COMMANDS = {
|
|
|
172
173
|
arguments: [{ name: "slug" }, { name: "version_id" }],
|
|
173
174
|
flags: {
|
|
174
175
|
"scheduled-publish-at": { hasValue: true, placeholder: "<time>", about: 'Publish later instead: an ISO 8601 time with Z or an offset, like "2026-11-01T17:00:00Z" or "2026-11-01T17:00+01:00"' },
|
|
175
|
-
"match-update-mode": { hasValue: true,
|
|
176
|
+
"match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, about: "When running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
|
|
176
177
|
},
|
|
177
178
|
},
|
|
178
179
|
unschedule: { about: "Cancel a publish-later", arguments: [{ name: "slug" }, { name: "version_id" }], flags: {} },
|
|
@@ -1751,15 +1752,20 @@ function* sqliteDumpStatements(sqlite) {
|
|
|
1751
1752
|
)
|
|
1752
1753
|
.all();
|
|
1753
1754
|
yield "PRAGMA foreign_keys=OFF;\nBEGIN TRANSACTION;\n";
|
|
1754
|
-
|
|
1755
|
-
|
|
1755
|
+
const tables = entries.filter((entry) => entry.type === "table" && (entry.table_kind === "table" || entry.table_kind === "virtual") && !entry.name.startsWith("sqlite_"));
|
|
1756
|
+
// Every table is made before any row goes in, so a row can refer to a table made after it.
|
|
1757
|
+
for (const table of tables) yield `${table.sql};\n`;
|
|
1758
|
+
for (const table of tables) {
|
|
1756
1759
|
const columns = sqlite.prepare("SELECT name, hidden = 0 AS is_insertable, pk AS primary_key_number FROM pragma_table_xinfo(?) ORDER BY cid").all(table.name);
|
|
1757
1760
|
const insertedColumns = columns.filter((column) => column.is_insertable === 1);
|
|
1758
|
-
|
|
1759
|
-
const
|
|
1761
|
+
// A search table's rows are known by their rowids, so they go in with them.
|
|
1762
|
+
const isVirtual = table.table_kind === "virtual";
|
|
1763
|
+
const insertInto = `INSERT INTO ${quoteName(table.name)}${insertedColumns.length < columns.length || isVirtual ? `(${[...(isVirtual ? ["rowid"] : []), ...insertedColumns.map((column) => quoteName(column.name))].join(",")})` : ""} VALUES(`;
|
|
1764
|
+
const valuesSql = [...(isVirtual ? ["rowid AS paging_rowid"] : []), ...insertedColumns.map((column, i) => `quote(${quoteName(column.name)}) AS value_${i}`)].join(", ");
|
|
1760
1765
|
const primaryKey = columns.filter((column) => column.primary_key_number > 0).sort((first, second) => first.primary_key_number - second.primary_key_number);
|
|
1761
|
-
|
|
1762
|
-
|
|
1766
|
+
// The key's order, rowid last where there is one, as Zaisma's export reads it (packages/game-server/src/dump.ts).
|
|
1767
|
+
const order = primaryKey.length ? [...primaryKey.map((column) => `${quoteName(table.name)}.${quoteName(column.name)}`), ...(table.is_without_rowid ? [] : [`${quoteName(table.name)}.rowid`])].join(", ") : "rowid";
|
|
1768
|
+
for (const row of sqlite.prepare(`SELECT ${valuesSql} FROM ${quoteName(table.name)} ORDER BY ${order}`).iterate()) yield `${insertInto}${[...(isVirtual ? [row.paging_rowid] : []), ...insertedColumns.map((_, i) => row[`value_${i}`])].join(",")});\n`;
|
|
1763
1769
|
}
|
|
1764
1770
|
if (entries.some((entry) => entry.name === "sqlite_sequence")) {
|
|
1765
1771
|
yield "DELETE FROM sqlite_sequence;\n";
|