@rbaileysr/zephyr-managed-api 1.3.10 → 1.4.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/README.md CHANGED
@@ -22,6 +22,9 @@ import { createZephyrApi } from '@rbaileysr/zephyr-managed-api';
22
22
 
23
23
  // Base URL is configured in the Generic Connector
24
24
  const api = createZephyrApi(ZephyrApiConnection);
25
+
26
+ // With verbose logging enabled (logs full request/response details on API failures)
27
+ const apiVerbose = createZephyrApi(ZephyrApiConnection, true);
25
28
  ```
26
29
 
27
30
  **Using OAuth Token:**
@@ -34,13 +37,43 @@ const api = createZephyrApi(
34
37
  'https://api.zephyrscale.smartbear.com/v2'
35
38
  );
36
39
 
37
- // EU region
40
+ // EU region with verbose logging
38
41
  const apiEU = createZephyrApi(
39
42
  'your-oauth-token',
40
- 'https://eu.api.zephyrscale.smartbear.com/v2'
43
+ 'https://eu.api.zephyrscale.smartbear.com/v2',
44
+ true // Enable verbose logging
41
45
  );
42
46
  ```
43
47
 
48
+ ### Verbose Logging
49
+
50
+ When enabled, verbose logging automatically logs full request and response details whenever an API call fails. This is useful for debugging issues in production environments.
51
+
52
+ **Features:**
53
+ - Logs full request details (method, path, headers, body)
54
+ - Logs full response details (status, headers, body)
55
+ - Automatically sanitizes sensitive headers (authorization, API keys)
56
+ - Only logs on failures (not on successful requests)
57
+ - Includes descriptive messages about what operation was being attempted
58
+
59
+ **Example output when an API call fails:**
60
+ ```
61
+ [Zephyr API Failure]
62
+ Operation: GET /testcases/PROJ-T1
63
+ Request Details: {
64
+ method: 'GET',
65
+ path: '/testcases/PROJ-T1',
66
+ headers: { 'content-type': 'application/json', authorization: '[REDACTED]' },
67
+ body: null
68
+ }
69
+ Response Details: {
70
+ status: 404,
71
+ statusText: 'Not Found',
72
+ headers: { 'content-type': 'application/json' },
73
+ body: { message: 'Test case not found' }
74
+ }
75
+ ```
76
+
44
77
  ## Supported API calls
45
78
 
46
79
  - [fetch](https://docs.adaptavist.com/src/managed-apis/managed-api-abstractions)
@@ -144,7 +177,16 @@ const apiEU = createZephyrApi(
144
177
  - **DataSets**: `getDataSets`, `createDataSet`, `updateDataSet`
145
178
  - **archiveConfig** - Archive a config item (Environment, Iteration, or Status)
146
179
  - **unarchiveConfig** - Unarchive a config item (Environment, Iteration, or Status)
147
- - ### Versions
180
+ - ### TestCase (entity-based group - v1.4.0+)
181
+ - **Archiving**: `getArchivedTestCases`, `archiveTestCases`, `unarchiveTestCases`
182
+ - **TestScriptData**: `setTestCaseParamTypeToParameter`, `setTestCaseParameters`, `setTestCaseParamTypeToTestData`, `setTestCaseTestData`, `getTestCaseTestData`, `hasTestCaseTestData`
183
+ - **Versions**: `createTestCaseVersion`
184
+ - ### TestCycle (entity-based group - v1.4.0+)
185
+ - **ExtendedData**: `getTestCycleIteration`, `updateTestCycleIteration`
186
+ - ### TestExecution (entity-based group - v1.4.0+)
187
+ - **ExtendedData**: `getTestExecutionIteration`, `updateTestExecutionIteration`, `getTestExecutionVersion`, `updateTestExecutionVersion`
188
+ - **Methods**: `createTestExecutionWithTestData`, `createTestExecutionWithVersion`, `updateTestExecution`, `getTestExecutionSteps`, `updateTestExecutionStepStatus`, `updateTestExecutionStepComment`, `getTestCycleItems`
189
+ - ### Versions (deprecated - use `Private.TestCase.Versions` instead)
148
190
  - **createTestCaseVersion** - Create a new test case version
149
191
  - ### Attachments
150
192
  - **Test Case**: `getTestCaseAttachments`, `downloadAttachment`, `createTestCaseAttachment`
@@ -156,15 +198,15 @@ const apiEU = createZephyrApi(
156
198
  - ### VersionControl
157
199
  - **Test Case (version-specific)**: `getTestCaseIssueLinks`, `getTestCaseWebLinks`, `getTestCaseTestScript`, `getTestCaseTestSteps`
158
200
  - **Test Execution Step**: `getTestExecutionStepIssueLinks`, `createTestExecutionStepIssueLink`
159
- - ### ExtendedData (supplements public API with extended data: iterations and versions)
201
+ - ### ExtendedData (deprecated - use `Private.TestCycle.ExtendedData` or `Private.TestExecution.ExtendedData` instead)
160
202
  - **Test Cycle**: `getTestCycleIteration`, `updateTestCycleIteration`
161
203
  - **Test Execution**: `getTestExecutionIteration`, `updateTestExecutionIteration`, `getTestExecutionVersion`, `updateTestExecutionVersion`
162
- - ### TestCaseArchiving (access archived test cases and archiving operations)
204
+ - ### TestCaseArchiving (deprecated - use `Private.TestCase.Archiving` instead)
163
205
  - **Test Case**: `getArchivedTestCases`, `archiveTestCases`, `unarchiveTestCases`
164
- - ### TestScriptData (manage test script data: Parameters and Test Data)
206
+ - ### TestScriptData (deprecated - use `Private.TestCase.TestScriptData` instead)
165
207
  - **Test Case**: `setTestCaseParamTypeToParameter`, `setTestCaseParameters`, `setTestCaseParamTypeToTestData`, `setTestCaseTestData`, `getTestCaseTestData`, `hasTestCaseTestData`
166
- - ### TestExecutions (create and update test executions for test cases with test data)
167
- - **Test Execution**: `createTestExecutionWithTestData`, `updateTestExecution`, `getTestExecutionSteps`, `updateTestExecutionStepStatus`, `updateTestExecutionStepComment`
208
+ - ### TestExecutions (deprecated - use `Private.TestExecution` instead)
209
+ - **Test Execution**: `createTestExecutionWithTestData`, `createTestExecutionWithVersion`, `updateTestExecution`, `getTestExecutionSteps`, `updateTestExecutionStepStatus`, `updateTestExecutionStepComment`
168
210
  - **Test Cycle**: `getTestCycleItems`
169
211
 
170
212
  ## Private API Authentication
@@ -272,8 +314,8 @@ await api.Private.Config.unarchiveConfig(credentials, {
272
314
  ### Example: Create Test Case Version
273
315
 
274
316
  ```typescript
275
- // Create a new version of an existing test case
276
- const newVersion = await api.Private.Versions.createTestCaseVersion(
317
+ // Create a new version of an existing test case (v1.4.0+)
318
+ const newVersion = await api.Private.TestCase.Versions.createTestCaseVersion(
277
319
  credentials,
278
320
  {
279
321
  testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
@@ -282,6 +324,8 @@ const newVersion = await api.Private.Versions.createTestCaseVersion(
282
324
  );
283
325
  ```
284
326
 
327
+ **Note:** The old path (`Private.Versions.createTestCaseVersion`) still works but is deprecated. Use `Private.TestCase.Versions.createTestCaseVersion` for better organization.
328
+
285
329
  ### Example: Upload Attachment
286
330
 
287
331
  ```typescript
@@ -334,25 +378,25 @@ await api.Private.VersionControl.createTestExecutionStepIssueLink(credentials, {
334
378
 
335
379
  ### Example: Extended Data (Supplements Public API)
336
380
 
337
- The public API does not support iterations for Test Cycles/Executions or Jira version IDs for Test Executions. Use `ExtendedData` to supplement public API calls.
381
+ The public API does not support iterations for Test Cycles/Executions or Jira version IDs for Test Executions. Use entity-based groups (v1.4.0+) to supplement public API calls.
338
382
 
339
383
  ```typescript
340
- // Test Cycle: Set/get iteration
384
+ // Test Cycle: Set/get iteration (v1.4.0+)
341
385
  const testCycle = await api.TestCycle.createTestCycle({
342
386
  projectKey: 'M12',
343
387
  name: 'Sprint 1 Testing'
344
388
  });
345
- await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
389
+ await api.Private.TestCycle.ExtendedData.updateTestCycleIteration(credentials, {
346
390
  testCycleKey: testCycle.key,
347
391
  projectId: 10313,
348
392
  iterationId: 10952254
349
393
  });
350
- const cycleIteration = await api.Private.ExtendedData.getTestCycleIteration(credentials, {
394
+ const cycleIteration = await api.Private.TestCycle.ExtendedData.getTestCycleIteration(credentials, {
351
395
  testCycleKey: 'M12-R1',
352
396
  projectId: 10313
353
397
  });
354
398
 
355
- // Test Execution: Set/get iteration and version
399
+ // Test Execution: Set/get iteration and version (v1.4.0+)
356
400
  await api.TestExecution.createTestExecution({
357
401
  projectKey: 'M12',
358
402
  testCaseKey: 'M12-T1',
@@ -360,32 +404,34 @@ await api.TestExecution.createTestExecution({
360
404
  statusName: 'Pass'
361
405
  });
362
406
  // Note: createTestExecution returns void - use known key or look up via listTestExecutions()
363
- await api.Private.ExtendedData.updateTestExecutionIteration(credentials, {
407
+ await api.Private.TestExecution.ExtendedData.updateTestExecutionIteration(credentials, {
364
408
  testExecutionKey: 'M12-E1',
365
409
  projectId: 10313,
366
410
  iterationId: 10952254
367
411
  });
368
- await api.Private.ExtendedData.updateTestExecutionVersion(credentials, {
412
+ await api.Private.TestExecution.ExtendedData.updateTestExecutionVersion(credentials, {
369
413
  testExecutionKey: 'M15-E3',
370
414
  projectId: 10316,
371
415
  jiraVersionId: 10102
372
416
  });
373
417
 
374
418
  // Clear by setting to null
375
- await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
419
+ await api.Private.TestCycle.ExtendedData.updateTestCycleIteration(credentials, {
376
420
  testCycleKey: 'M12-R1',
377
421
  projectId: 10313,
378
422
  iterationId: null
379
423
  });
380
424
  ```
381
425
 
426
+ **Note:** The old paths (`Private.ExtendedData.*`) still work but are deprecated. Use the new entity-based paths (`Private.TestCycle.ExtendedData.*` and `Private.TestExecution.ExtendedData.*`) for better organization.
427
+
382
428
  ### Example: Test Case Archiving
383
429
 
384
- The public API does not expose the archived flag. Use `TestCaseArchiving` to list, archive, and unarchive test cases.
430
+ The public API does not expose the archived flag. Use `Private.TestCase.Archiving` (v1.4.0+) to list, archive, and unarchive test cases.
385
431
 
386
432
  ```typescript
387
433
  // Get archived test cases (paginated, optional query filter)
388
- const archived = await api.Private.TestCaseArchiving.getArchivedTestCases(credentials, {
434
+ const archived = await api.Private.TestCase.Archiving.getArchivedTestCases(credentials, {
389
435
  projectId: 10316,
390
436
  maxResults: 50,
391
437
  startAt: 0,
@@ -393,45 +439,47 @@ const archived = await api.Private.TestCaseArchiving.getArchivedTestCases(creden
393
439
  });
394
440
 
395
441
  // Archive test cases (single or multiple)
396
- await api.Private.TestCaseArchiving.archiveTestCases(credentials, {
442
+ await api.Private.TestCase.Archiving.archiveTestCases(credentials, {
397
443
  projectId: 10316,
398
444
  testCaseIds: [288004503, 288004504, 288004505]
399
445
  });
400
446
 
401
447
  // Unarchive test cases
402
- await api.Private.TestCaseArchiving.unarchiveTestCases(credentials, {
448
+ await api.Private.TestCase.Archiving.unarchiveTestCases(credentials, {
403
449
  projectId: 10316,
404
450
  testCaseIds: [288004503]
405
451
  });
406
452
  ```
407
453
 
454
+ **Note:** The old path (`Private.TestCaseArchiving.*`) still works but is deprecated. Use `Private.TestCase.Archiving.*` for better organization.
455
+
408
456
  ### Test Script Data
409
457
 
410
- The public API does not expose test script data (Parameters and Test Data). Use `TestScriptData` to manage this data.
458
+ The public API does not expose test script data (Parameters and Test Data). Use `Private.TestCase.TestScriptData` (v1.4.0+) to manage this data.
411
459
 
412
460
  ```typescript
413
461
  // Check if test case has test script data
414
- const hasData = await api.Private.TestScriptData.hasTestCaseTestData(credentials, {
462
+ const hasData = await api.Private.TestCase.TestScriptData.hasTestCaseTestData(credentials, {
415
463
  testCaseKey: 'M14-T6',
416
464
  projectId: 10315
417
465
  });
418
466
  // Returns: { hasData: true, type: 'PARAMETER' } or { hasData: false, type: null }
419
467
 
420
468
  // Get test script data
421
- const testData = await api.Private.TestScriptData.getTestCaseTestData(credentials, {
469
+ const testData = await api.Private.TestCase.TestScriptData.getTestCaseTestData(credentials, {
422
470
  testCaseKey: 'M14-T6',
423
471
  projectId: 10315
424
472
  });
425
473
  // Returns: { paramType: 'PARAMETER' | 'TEST_DATA' | null, parameters: [...], testData: [...] }
426
474
 
427
475
  // Set test case to use Parameters
428
- await api.Private.TestScriptData.setTestCaseParamTypeToParameter(credentials, {
476
+ await api.Private.TestCase.TestScriptData.setTestCaseParamTypeToParameter(credentials, {
429
477
  testCaseKey: 'M14-T6',
430
478
  projectId: 10315
431
479
  });
432
480
 
433
481
  // Set parameters
434
- await api.Private.TestScriptData.setTestCaseParameters(credentials, {
482
+ await api.Private.TestCase.TestScriptData.setTestCaseParameters(credentials, {
435
483
  testCaseKey: 'M14-T6',
436
484
  projectId: 10315,
437
485
  parameters: [
@@ -441,13 +489,13 @@ await api.Private.TestScriptData.setTestCaseParameters(credentials, {
441
489
  });
442
490
 
443
491
  // Set test case to use Test Data
444
- await api.Private.TestScriptData.setTestCaseParamTypeToTestData(credentials, {
492
+ await api.Private.TestCase.TestScriptData.setTestCaseParamTypeToTestData(credentials, {
445
493
  testCaseKey: 'M14-T6',
446
494
  projectId: 10315
447
495
  });
448
496
 
449
497
  // Set test data (simplified array format)
450
- await api.Private.TestScriptData.setTestCaseTestData(credentials, {
498
+ await api.Private.TestCase.TestScriptData.setTestCaseTestData(credentials, {
451
499
  testCaseKey: 'M14-T6',
452
500
  projectId: 10315,
453
501
  testData: [
@@ -460,9 +508,11 @@ await api.Private.TestScriptData.setTestCaseTestData(credentials, {
460
508
  });
461
509
  ```
462
510
 
511
+ **Note:** The old path (`Private.TestScriptData.*`) still works but is deprecated. Use `Private.TestCase.TestScriptData.*` for better organization.
512
+
463
513
  ### Test Executions with Test Data
464
514
 
465
- The public API does not correctly handle creating test executions for test cases with test data or test cases with "Call to Test" steps that reference test cases with test data. Use `TestExecutions` to create and update these executions.
515
+ The public API does not correctly handle creating test executions for test cases with test data or test cases with "Call to Test" steps that reference test cases with test data. Use `Private.TestExecution` (v1.4.0+) to create and update these executions.
466
516
 
467
517
  ```typescript
468
518
  // Create test execution for test case with test data
@@ -470,7 +520,7 @@ The public API does not correctly handle creating test executions for test cases
470
520
  // 1. Creates execution via public API
471
521
  // 2. Gets testRunItemId from private API
472
522
  // 3. Creates actual execution via private API
473
- const execution = await api.Private.TestExecutions.createTestExecutionWithTestData(credentials, {
523
+ const execution = await api.Private.TestExecution.createTestExecutionWithTestData(credentials, {
474
524
  testCaseKey: 'M14-T6',
475
525
  testCycleKey: 'M14-R1',
476
526
  assignedTo: '5d259f2e0b81c60c239bed83', // optional
@@ -478,14 +528,35 @@ const execution = await api.Private.TestExecutions.createTestExecutionWithTestDa
478
528
  });
479
529
  // Returns: { id: 2065132733, key: 'M14-E18' }
480
530
 
531
+ // Create test execution for specific test case version (not just latest)
532
+ // Unlike the public API which only creates executions against the latest version,
533
+ // this allows creating executions against any version of a test case
534
+ const executionWithVersion = await api.Private.TestExecution.createTestExecutionWithVersion(credentials, {
535
+ body: {
536
+ projectKey: 'M14',
537
+ testCaseKey: 'M14-T6',
538
+ testCycleKey: 'M14-R1',
539
+ statusName: 'Not Executed',
540
+ version: 2, // Create execution against version 2 of the test case
541
+ environmentName: 'Production', // optional
542
+ assignedToId: '5d259f2e0b81c60c239bed83', // optional
543
+ comment: 'Testing version 2', // optional
544
+ },
545
+ projectId: 10315,
546
+ assignedTo: '5d259f2e0b81c60c239bed83', // optional, can override body.assignedToId
547
+ iterationId: 10966272, // optional
548
+ jiraVersionId: 10206 // optional
549
+ });
550
+ // Returns: { id: 2068847141, key: 'M2-E13' }
551
+
481
552
  // Get test cycle items (to find testRunItemId for a test case)
482
- const items = await api.Private.TestExecutions.getTestCycleItems(credentials, {
553
+ const items = await api.Private.TestExecution.getTestCycleItems(credentials, {
483
554
  testCycleKey: 'M14-R1',
484
555
  projectId: 10315
485
556
  });
486
557
 
487
558
  // Update parent test execution
488
- await api.Private.TestExecutions.updateTestExecution(credentials, {
559
+ await api.Private.TestExecution.updateTestExecution(credentials, {
489
560
  testExecutionKey: 'M14-E18',
490
561
  id: 2065132733, // Optional if testExecutionKey is provided
491
562
  actualStartDate: '2025-12-24T13:02:50.233Z',
@@ -496,14 +567,14 @@ await api.Private.TestExecutions.updateTestExecution(credentials, {
496
567
  });
497
568
 
498
569
  // Get test execution steps (to get step IDs for updates)
499
- const steps = await api.Private.TestExecutions.getTestExecutionSteps(credentials, {
570
+ const steps = await api.Private.TestExecution.getTestExecutionSteps(credentials, {
500
571
  testCycleKey: 'M14-R1',
501
572
  testRunItemId: 1443476310, // From getTestCycleItems
502
573
  projectId: 10315
503
574
  });
504
575
 
505
576
  // Update test execution step status
506
- await api.Private.TestExecutions.updateTestExecutionStepStatus(credentials, {
577
+ await api.Private.TestExecution.updateTestExecutionStepStatus(credentials, {
507
578
  id: 6287896613, // From getTestExecutionSteps
508
579
  testResultStatusId: 10952942,
509
580
  executionDate: '2025-12-24T13:02:50.232Z',
@@ -511,13 +582,15 @@ await api.Private.TestExecutions.updateTestExecutionStepStatus(credentials, {
511
582
  });
512
583
 
513
584
  // Update test execution step comment (actual result)
514
- await api.Private.TestExecutions.updateTestExecutionStepComment(credentials, {
585
+ await api.Private.TestExecution.updateTestExecutionStepComment(credentials, {
515
586
  id: 6287896613, // From getTestExecutionSteps
516
587
  comment: 'Test passed successfully',
517
588
  projectId: 10315
518
589
  });
519
590
  ```
520
591
 
592
+ **Note:** The old path (`Private.TestExecutions.*`) still works but is deprecated. Use `Private.TestExecution.*` for better organization.
593
+
521
594
  **Notes:**
522
595
  - Version numbers are absolute (1-based). Use `listTestCaseVersions()` to find available versions. If `version` is not provided, the latest version is used.
523
596
  - Private API methods require `PrivateApiCredentials` (`userEmail`, `apiToken`, `jiraInstanceUrl`). Context JWT tokens expire after 15 minutes and are automatically retrieved internally.
@@ -529,6 +602,25 @@ Feel free to drop ideas, suggestions or improvements into our [Community hub](ht
529
602
 
530
603
  ## Changelog
531
604
 
605
+ ### 1.4.0
606
+
607
+ - **Changed**: Major structural reorganization of Private API to follow entity-based grouping (mirrors public API organization)
608
+ - **New Entity-Based Groups**: `Private.TestCase`, `Private.TestCycle`, `Private.TestExecution`
609
+ - **Private.TestCase**: Consolidates `Archiving`, `TestScriptData`, and `Versions` sub-groups
610
+ - **Private.TestCycle**: Adds `ExtendedData` sub-group for iteration operations
611
+ - **Private.TestExecution**: Consolidates all test execution operations and adds `ExtendedData` sub-group for iteration and version operations
612
+ - **Added**: `createTestExecutionWithVersion()` - Create test execution for a specific test case version (not just latest version). Unlike the public API which only creates executions against the latest test case version, this function allows creating executions against any version of a test case.
613
+ - **Deprecated**: Old feature-based paths are deprecated but still functional (will be removed in v2.0.0):
614
+ - `Private.TestExecutions.*` → Use `Private.TestExecution.*` instead
615
+ - `Private.ExtendedData.*` → Use `Private.TestCycle.ExtendedData.*` or `Private.TestExecution.ExtendedData.*` instead
616
+ - `Private.TestCaseArchiving.*` → Use `Private.TestCase.Archiving.*` instead
617
+ - `Private.TestScriptData.*` → Use `Private.TestCase.TestScriptData.*` instead
618
+ - `Private.Versions.*` → Use `Private.TestCase.Versions.*` instead
619
+
620
+ ### 1.3.11
621
+
622
+ - **Added**: Verbose logging option - Enable detailed request/response logging for failed API calls via `createZephyrApi(connection, true)` or `createZephyrApi(token, baseUrl, true)`
623
+
532
624
  ### 1.3.10
533
625
 
534
626
  - **Added**: New `TestScriptData` sub-group under Private API for managing test script data (Parameters and Test Data)