@sdd-method/verify-cli 2.5.0 → 4.0.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.
@@ -204,4 +204,17 @@ export function surfaceMatches(entry, contractId, specPath) {
204
204
  const re = new RegExp(`(^|/)${e.split("*").map((p) => p.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join("[^/]*")}$`);
205
205
  return re.test(specPath.split("\\").join("/"));
206
206
  }
207
+ /**
208
+ * The delta entries a work order's `implements` entry names (schema 5.0.0). `<feature>::<name>` names exactly one
209
+ * requirement. A bare name resolves only when one feature in the change has a requirement of that name; across
210
+ * two features it is ambiguous, and names none.
211
+ */
212
+ export function resolveImplements(delta, entry) {
213
+ const q = /^(.+?)::(.+)$/.exec(entry);
214
+ if (q)
215
+ return { matches: delta.filter((d) => d.feature === q[1] && d.name === q[2]), ambiguous: [] };
216
+ const matches = delta.filter((d) => d.name === entry);
217
+ const features = [...new Set(matches.map((d) => d.feature))];
218
+ return features.length > 1 ? { matches: [], ambiguous: features } : { matches, ambiguous: [] };
219
+ }
207
220
  //# sourceMappingURL=archive.js.map