@lonca/baron-recipes 0.4.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ declare const RECIPE_OPS: {
12
12
  readonly issueComment: "issue.comment";
13
13
  readonly issueLink: "issue.link";
14
14
  readonly issueAssign: "issue.assign";
15
+ readonly issueIterations: "issue.iterations";
16
+ readonly issueSetIteration: "issue.set-iteration";
15
17
  readonly issueQuery: "issue.query";
16
18
  readonly scmBranchCreate: "scm.branch.create";
17
19
  readonly scmPrCreate: "scm.pr.create";
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ var RECIPE_OPS = {
8
8
  issueComment: "issue.comment",
9
9
  issueLink: "issue.link",
10
10
  issueAssign: "issue.assign",
11
+ issueIterations: "issue.iterations",
12
+ issueSetIteration: "issue.set-iteration",
11
13
  issueQuery: "issue.query",
12
14
  scmBranchCreate: "scm.branch.create",
13
15
  scmPrCreate: "scm.pr.create",
@@ -214,9 +216,11 @@ function interpolate(value, context) {
214
216
  import {
215
217
  BaronError as BaronError2,
216
218
  ISSUE_LINK_TYPES,
219
+ PR_STATE_FILTERS,
217
220
  WORKFLOW_ROLES,
218
221
  WORK_ITEM_TYPE_ROLES,
219
222
  isIssueLinkType,
223
+ isPrStateFilter,
220
224
  isWorkItemTypeRole,
221
225
  isWorkflowRole
222
226
  } from "@lonca/baron-core";
@@ -389,6 +393,13 @@ async function dispatchOp(ports, op, params) {
389
393
  return issues(ports, op).comment(reqStr(params, "id", op), reqStr(params, "body", op));
390
394
  case RECIPE_OPS.issueAssign:
391
395
  return issues(ports, op).assign(reqStr(params, "id", op), reqStr(params, "assignee", op));
396
+ case RECIPE_OPS.issueIterations:
397
+ return issues(ports, op).iterations();
398
+ case RECIPE_OPS.issueSetIteration:
399
+ return issues(ports, op).setIteration(
400
+ reqStr(params, "id", op),
401
+ reqStr(params, "iteration", op)
402
+ );
392
403
  case RECIPE_OPS.issueLink:
393
404
  return issues(ports, op).link(
394
405
  reqStr(params, "fromId", op),
@@ -398,10 +409,12 @@ async function dispatchOp(ports, op, params) {
398
409
  case RECIPE_OPS.issueQuery: {
399
410
  const limit = optNum(params, "limit", op);
400
411
  const assignee = optStr(params, "assignee", op);
412
+ const iteration = optStr(params, "iteration", op);
401
413
  const query = {
402
414
  ...optStr(params, "role", op) !== void 0 ? { role: reqRole(params, "role", op) } : {},
403
415
  ...optStr(params, "typeRole", op) !== void 0 ? { typeRole: reqTypeRole(params, "typeRole", op) } : {},
404
416
  ...assignee !== void 0 ? { assignee } : {},
417
+ ...iteration !== void 0 ? { iteration } : {},
405
418
  ...limit !== void 0 ? { limit } : {}
406
419
  };
407
420
  return issues(ports, op).query(query);
@@ -427,7 +440,17 @@ async function dispatchOp(ports, op, params) {
427
440
  case RECIPE_OPS.scmPrStatus:
428
441
  return scm(ports, op).prStatus(reqStr(params, "pullRequestId", op));
429
442
  case RECIPE_OPS.scmPrFind: {
430
- const found = await scm(ports, op).prForBranch(reqStr(params, "sourceBranch", op));
443
+ const stateFilter = optStr(params, "state", op);
444
+ if (stateFilter !== void 0 && !isPrStateFilter(stateFilter)) {
445
+ throw new BaronError2(
446
+ `Step '${op}' 'state'='${stateFilter}' must be one of ${PR_STATE_FILTERS.join(", ")}.`,
447
+ ARGS
448
+ );
449
+ }
450
+ const found = await scm(ports, op).prForBranch(
451
+ reqStr(params, "sourceBranch", op),
452
+ stateFilter
453
+ );
431
454
  return found ?? null;
432
455
  }
433
456
  case RECIPE_OPS.ciRunTrigger: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lonca/baron-recipes",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -17,13 +17,13 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "yaml": "^2.6.0",
20
- "@lonca/baron-core": "0.4.0",
21
- "@lonca/baron-knowledge-loop": "0.4.0"
20
+ "@lonca/baron-core": "0.6.0",
21
+ "@lonca/baron-knowledge-loop": "0.6.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.0.0",
25
- "@lonca/baron-adapter-github": "0.4.0",
26
- "@lonca/baron-conformance": "0.4.0"
25
+ "@lonca/baron-adapter-github": "0.6.0",
26
+ "@lonca/baron-conformance": "0.6.0"
27
27
  },
28
28
  "description": "Baron recipe engine: run declarative YAML workflows over Baron primitives, deterministically.",
29
29
  "keywords": [