Skip to content

Commit b171592

Browse files
feat: firm_ids parameter
1 parent 990bf5c commit b171592

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

bin/cli.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ program
496496
.option("-h, --handle <handles...>", "Specify reconciliation text handle(s) - can specify multiple")
497497
.option("-at, --account-template <names...>", "Specify account detail template name(s) - can specify multiple")
498498
.option("-s, --shared-part <names...>", "Specify shared part name(s) - can specify multiple")
499-
.option("-i, --id <sampler-id>", "Specify an existing sampler ID to fetch results for (optional)")
499+
.option("--firm-ids <firm-ids...>", "Specify firm ID(s) to run the sampler against - can specify multiple (optional)")
500+
.option("--id <sampler-id>", "Specify an existing sampler ID to fetch results for (optional)")
500501
.action(async (options) => {
501502
// If an existing sampler ID is provided, fetch and display results
502503
if (options.id) {
@@ -520,7 +521,9 @@ program
520521
sharedParts: sharedParts,
521522
};
522523

523-
await new LiquidSamplerRunner(options.partner).run(templateHandles);
524+
const firmIds = options.firmIds || [];
525+
526+
await new LiquidSamplerRunner(options.partner).run(templateHandles, firmIds);
524527
});
525528

526529
// Create Liquid Test

lib/liquidSamplerRunner.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ class LiquidSamplerRunner {
2323
* @param {Array<string>} templateHandles.reconciliationTexts - Array of reconciliation text handles
2424
* @param {Array<string>} templateHandles.accountTemplates - Array of account template names
2525
* @param {Array<string>} templateHandles.sharedParts - Array of shared part names
26+
* @param {Array<number>} firmIds - Array of firm IDs to use in the sampler
2627
* @returns {Promise<void>}
2728
*/
28-
async run(templateHandles = {}) {
29+
async run(templateHandles = {}, firmIds = []) {
2930
try {
3031
// Validate at least one template specified
3132
const { reconciliationTexts = [], accountTemplates = [], sharedParts = [] } = templateHandles;
@@ -35,7 +36,7 @@ class LiquidSamplerRunner {
3536
}
3637

3738
// Build payload
38-
const samplerParams = await this.#buildSamplerParams(templateHandles);
39+
const samplerParams = await this.#buildSamplerParams(templateHandles, firmIds);
3940

4041
consola.info(`Starting sampler run with ${samplerParams.templates.length} template(s)...`);
4142

@@ -83,9 +84,10 @@ class LiquidSamplerRunner {
8384
* @param {Array<string>} templateHandles.reconciliationTexts - Array of reconciliation text handles
8485
* @param {Array<string>} templateHandles.accountTemplates - Array of account template names
8586
* @param {Array<string>} templateHandles.sharedParts - Array of shared part names
87+
* @param {Array<number>} firmIds - Array of firm IDs to use in the sampler
8688
* @returns {Object} Sampler payload with templates array
8789
*/
88-
async #buildSamplerParams(templateHandles = {}) {
90+
async #buildSamplerParams(templateHandles = {}, firmIds = []) {
8991
const templates = [];
9092
const { reconciliationTexts = [], accountTemplates = [], sharedParts = [] } = templateHandles;
9193

@@ -175,7 +177,7 @@ class LiquidSamplerRunner {
175177
});
176178
}
177179

178-
return { templates };
180+
return { templates, firm_ids: firmIds };
179181
}
180182

181183
/**
@@ -237,6 +239,11 @@ class LiquidSamplerRunner {
237239
}
238240
break;
239241

242+
case "pending":
243+
case "running":
244+
consola.info(`Sampler run is still in progress. Current status: "${response.status}". Please check again later.`);
245+
break;
246+
240247
default:
241248
consola.error(`Unexpected sampler status: ${response.status}`);
242249
process.exit(1);

0 commit comments

Comments
 (0)