(yargs: Argv)
| 129 | } |
| 130 | |
| 131 | export function createCommands(yargs: Argv): Argv { |
| 132 | return yargs |
| 133 | .command( |
| 134 | "bootstrap", |
| 135 | "Initialize the dittofeed application and creates a workspace.", |
| 136 | boostrapOptions, |
| 137 | bootstrapHandler, |
| 138 | ) |
| 139 | .command( |
| 140 | "refresh-not-exists-segment-definition-updated-at", |
| 141 | "Refreshes definitionUpdatedAt for segments that contain Trait NotExists nodes to force recomputation.", |
| 142 | (y) => y, |
| 143 | async () => { |
| 144 | await refreshNotExistsSegmentDefinitionUpdatedAt(); |
| 145 | }, |
| 146 | ) |
| 147 | .command( |
| 148 | "print-transfer-computed-property-state-v2-v3-query", |
| 149 | "Prints the ClickHouse query used to copy computed_property_state_v2 rows into computed_property_state_v3.", |
| 150 | (cmd) => |
| 151 | cmd |
| 152 | .option("state-exclude-workspace-id", { |
| 153 | type: "string", |
| 154 | describe: |
| 155 | "Workspace ID to exclude from the state transfer (repeatable).", |
| 156 | array: true, |
| 157 | }) |
| 158 | .option("state-limit", { |
| 159 | type: "number", |
| 160 | describe: |
| 161 | "Maximum number of distinct workspaces to include per state transfer batch (default 64).", |
| 162 | default: 64, |
| 163 | }) |
| 164 | .option("state-offset", { |
| 165 | type: "number", |
| 166 | describe: |
| 167 | "Number of distinct workspaces to skip before selecting the state transfer batch (default 0).", |
| 168 | default: 0, |
| 169 | }), |
| 170 | ({ stateExcludeWorkspaceId, stateLimit, stateOffset }) => { |
| 171 | let excludeWorkspaceIds: string[] | undefined; |
| 172 | if (Array.isArray(stateExcludeWorkspaceId)) { |
| 173 | excludeWorkspaceIds = stateExcludeWorkspaceId.filter( |
| 174 | (id): id is string => typeof id === "string" && id.length > 0, |
| 175 | ); |
| 176 | } |
| 177 | |
| 178 | const parsedStateLimit = parseIntStrict(String(stateLimit)); |
| 179 | if (parsedStateLimit <= 0) { |
| 180 | throw new Error("state-limit must be a positive number"); |
| 181 | } |
| 182 | |
| 183 | const parsedStateOffset = parseIntStrict(String(stateOffset)); |
| 184 | if (parsedStateOffset < 0) { |
| 185 | throw new Error("state-offset must be a non-negative number"); |
| 186 | } |
| 187 | |
| 188 | logger().info( |
no test coverage detected