@miketromba/issy-app 0.10.0 → 0.11.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.
Files changed (3) hide show
  1. package/dist/app.js +97 -97
  2. package/dist/server.js +61 -33
  3. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -98,6 +98,56 @@ function yamlUnquote(value) {
98
98
  }
99
99
  return value;
100
100
  }
101
+ function parseDependencyIds(dependsOn) {
102
+ if (!dependsOn)
103
+ return [];
104
+ const seen = new Set;
105
+ const ids = [];
106
+ for (const token of dependsOn.split(/[,\s]+/)) {
107
+ const value = token.trim().replace(/^['"]+|['"]+$/g, "").replace(/^#/, "");
108
+ if (!/^\d+$/.test(value))
109
+ continue;
110
+ const id = value.padStart(4, "0");
111
+ if (seen.has(id))
112
+ continue;
113
+ seen.add(id);
114
+ ids.push(id);
115
+ }
116
+ return ids;
117
+ }
118
+ function filterExistingDependencyIds(dependsOn, issues, excludeId) {
119
+ const existingIds = new Set(issues.map((issue) => issue.id));
120
+ const excludedId = excludeId?.padStart(4, "0");
121
+ return parseDependencyIds(dependsOn).filter((id) => existingIds.has(id) && id !== excludedId);
122
+ }
123
+ function getDependencyIssues(issue, issues) {
124
+ const dependencyIds = filterExistingDependencyIds(issue.frontmatter.depends_on, issues, issue.id);
125
+ if (dependencyIds.length === 0)
126
+ return [];
127
+ const issueById = new Map(issues.map((i) => [i.id, i]));
128
+ return dependencyIds.map((id) => issueById.get(id)).filter((dependency) => Boolean(dependency));
129
+ }
130
+ function getBlockingIssues(issue, issues) {
131
+ return getDependencyIssues(issue, issues).filter((dependency) => dependency.frontmatter.status === "open");
132
+ }
133
+ function isIssueUnblocked(issue, issues) {
134
+ return issue.frontmatter.status === "open" && getBlockingIssues(issue, issues).length === 0;
135
+ }
136
+ function compareIssuesByRoadmapOrder(a, b) {
137
+ const orderA = a.frontmatter.order;
138
+ const orderB = b.frontmatter.order;
139
+ if (orderA && orderB) {
140
+ if (orderA < orderB)
141
+ return -1;
142
+ if (orderA > orderB)
143
+ return 1;
144
+ }
145
+ if (orderA && !orderB)
146
+ return -1;
147
+ if (!orderA && orderB)
148
+ return 1;
149
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
150
+ }
101
151
  function getIssueIdFromFilename(filename) {
102
152
  const match = filename.match(/^(\d+)-/);
103
153
  return match ? match[1] : filename.replace(".md", "");
@@ -140,17 +190,7 @@ async function getAllIssues() {
140
190
  content: body
141
191
  });
142
192
  }
143
- return issues.sort((a, b) => {
144
- const orderA = a.frontmatter.order;
145
- const orderB = b.frontmatter.order;
146
- if (orderA && orderB)
147
- return orderA < orderB ? -1 : orderA > orderB ? 1 : 0;
148
- if (orderA && !orderB)
149
- return -1;
150
- if (!orderA && orderB)
151
- return 1;
152
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
153
- });
193
+ return issues.sort(compareIssuesByRoadmapOrder);
154
194
  }
155
195
  // ../core/src/lib/query-parser.ts
156
196
  var SUPPORTED_QUALIFIERS = new Set([
@@ -1573,17 +1613,7 @@ function filterAndSearchIssues(issues, filters) {
1573
1613
  function sortIssues(issues, sortBy) {
1574
1614
  const sortOption = sortBy.toLowerCase();
1575
1615
  if (sortOption === "roadmap") {
1576
- issues.sort((a, b) => {
1577
- const orderA = a.frontmatter.order;
1578
- const orderB = b.frontmatter.order;
1579
- if (orderA && orderB)
1580
- return orderA < orderB ? -1 : orderA > orderB ? 1 : 0;
1581
- if (orderA && !orderB)
1582
- return -1;
1583
- if (!orderA && orderB)
1584
- return 1;
1585
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
1586
- });
1616
+ issues.sort(compareIssuesByRoadmapOrder);
1587
1617
  } else if (sortOption === "priority") {
1588
1618
  const priorityOrder = {
1589
1619
  high: 0,
@@ -1637,17 +1667,7 @@ function sortIssues(issues, sortBy) {
1637
1667
  } else if (sortOption === "id") {
1638
1668
  issues.sort((a, b) => b.id.localeCompare(a.id));
1639
1669
  } else {
1640
- issues.sort((a, b) => {
1641
- const orderA = a.frontmatter.order;
1642
- const orderB = b.frontmatter.order;
1643
- if (orderA && orderB)
1644
- return orderA < orderB ? -1 : orderA > orderB ? 1 : 0;
1645
- if (orderA && !orderB)
1646
- return -1;
1647
- if (!orderA && orderB)
1648
- return 1;
1649
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
1650
- });
1670
+ issues.sort(compareIssuesByRoadmapOrder);
1651
1671
  }
1652
1672
  }
1653
1673
  function filterByQuery(issues, query) {
@@ -1659,6 +1679,14 @@ function filterByQuery(issues, query) {
1659
1679
  if (issue.frontmatter.status !== statusValue) {
1660
1680
  return false;
1661
1681
  }
1682
+ } else if (statusValue === "unblocked") {
1683
+ if (!isIssueUnblocked(issue, issues)) {
1684
+ return false;
1685
+ }
1686
+ } else if (statusValue === "blocked") {
1687
+ if (issue.frontmatter.status !== "open" || isIssueUnblocked(issue, issues)) {
1688
+ return false;
1689
+ }
1662
1690
  }
1663
1691
  }
1664
1692
  if (parsed.qualifiers.priority) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miketromba/issy-app",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Local web UI and API server for issy",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "node": ">=18.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "@miketromba/issy-core": "^0.10.0",
38
+ "@miketromba/issy-core": "^0.11.0",
39
39
  "bun-plugin-tailwind": "^0.1.2"
40
40
  },
41
41
  "devDependencies": {