@t0.labs/daxta 0.4.21 → 0.4.22

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.
@@ -171,6 +171,42 @@ function exampleKeyForHit(hit, index) {
171
171
  const base = slug(label, index);
172
172
  return base ? `${base}-${index}` : `example-${index + 1}`;
173
173
  }
174
+ function isSuccessStatus(status) {
175
+ return status >= 200 && status < 300;
176
+ }
177
+ /**
178
+ * Seed calls in the same it() share Jest's currentTestName.
179
+ * SEMANTIC: create-then-assert-409 must not surface the setup 201.
180
+ */
181
+ function selectHitsForDocs(hits) {
182
+ const byTest = new Map();
183
+ const unlabeled = [];
184
+ for (const hit of hits) {
185
+ if (!hit.test) {
186
+ unlabeled.push(hit);
187
+ continue;
188
+ }
189
+ const list = byTest.get(hit.test) ?? [];
190
+ list.push(hit);
191
+ byTest.set(hit.test, list);
192
+ }
193
+ const selected = [...unlabeled];
194
+ for (const group of byTest.values()) {
195
+ const section = (0, catalog_1.parseCaseSection)(group[0]?.test);
196
+ if (section === 'semantic' || section === 'invalid' || section === 'omitted' || section === 'auth') {
197
+ const errors = group.filter((hit) => !isSuccessStatus(hit.status));
198
+ selected.push(...(errors.length ? errors : group));
199
+ continue;
200
+ }
201
+ if (section === 'positive') {
202
+ const ok = group.filter((hit) => isSuccessStatus(hit.status));
203
+ selected.push(...(ok.length ? ok : group));
204
+ continue;
205
+ }
206
+ selected.push(...group);
207
+ }
208
+ return selected;
209
+ }
174
210
  function isPrimaryHit(hit) {
175
211
  if (!hit.test)
176
212
  return false;
@@ -460,7 +496,7 @@ function sortOperations(entries) {
460
496
  }
461
497
  function buildSpec(hits) {
462
498
  const grouped = new Map();
463
- for (const hit of hits.filter(isPrimaryHit)) {
499
+ for (const hit of selectHitsForDocs(hits.filter(isPrimaryHit))) {
464
500
  const key = `${hit.method} ${hit.path}`;
465
501
  const opHits = grouped.get(key) ?? [];
466
502
  opHits.push(hit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t0.labs/daxta",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "description": "DAxTA \u2014 docs from Nest integration traffic + DTO field CLI / Try-it",
5
5
  "license": "MIT",
6
6
  "repository": {