Skip to content

Commit 3b9dd2f

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Cleanup optional return vals in zod for staged indexes (#40217)
Now that conductor is pushed, we're clear! GitOrigin-RevId: 8828081421e22e23ac72792058b41efec8cbedf9
1 parent 96fbbe3 commit 3b9dd2f

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/cli/lib/components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ function printDiff(
476476
msg = msg.slice(0, -1); // strip last new line
477477
logFinishedStep(msg);
478478
}
479-
if (rootDiff.enabled_indexes && rootDiff.enabled_indexes.length > 0) {
479+
if (rootDiff.enabled_indexes.length > 0) {
480480
let msg = opts.dryRun
481481
? `These indexes would be enabled:\n`
482482
: `These indexes are now enabled:\n`;
@@ -486,7 +486,7 @@ function printDiff(
486486
msg = msg.slice(0, -1); // strip last new line
487487
logFinishedStep(msg);
488488
}
489-
if (rootDiff.disabled_indexes && rootDiff.disabled_indexes.length > 0) {
489+
if (rootDiff.disabled_indexes.length > 0) {
490490
let msg = opts.dryRun
491491
? `These indexes would be staged:\n`
492492
: `These indexes are now staged:\n`;

src/cli/lib/deploy2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ export async function waitForSchema(
157157
msg = `Backfilling indexes (${indexesComplete}/${indexesTotal} ready)...`;
158158
// Set a more specific message if the backfill is taking a long time
159159
if (Date.now() - start > 10_000) {
160-
const rootDiff = startPush.schemaChange.indexDiffs?.[""];
160+
const rootDiff = startPush.schemaChange.indexDiffs[""];
161161
const indexName = (
162-
rootDiff?.added_indexes[0] || rootDiff?.enabled_indexes?.[0]
162+
rootDiff.added_indexes[0] || rootDiff.enabled_indexes[0]
163163
)?.name;
164164
if (indexName) {
165165
const table = indexName.split(".")[0];

src/cli/lib/deployApi/finishPush.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ export type DeveloperIndexConfig = z.infer<typeof developerIndexConfig>;
7373
export const indexDiff = looseObject({
7474
added_indexes: z.array(developerIndexConfig),
7575
removed_indexes: z.array(developerIndexConfig),
76-
enabled_indexes: z.array(developerIndexConfig).optional(),
77-
disabled_indexes: z.array(developerIndexConfig).optional(),
76+
enabled_indexes: z.array(developerIndexConfig),
77+
disabled_indexes: z.array(developerIndexConfig),
7878
});
7979
export type IndexDiff = z.infer<typeof indexDiff>;
8080

src/cli/lib/deployApi/startPush.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type StartPushRequest = z.infer<typeof startPushRequest>;
2727
export const schemaChange = looseObject({
2828
allocatedComponentIds: z.any(),
2929
schemaIds: z.any(),
30-
indexDiffs: z.record(componentDefinitionPath, indexDiff).optional(),
30+
indexDiffs: z.record(componentDefinitionPath, indexDiff),
3131
});
3232
export type SchemaChange = z.infer<typeof schemaChange>;
3333

0 commit comments

Comments
 (0)