@cqa-lib/cqa-ui 1.1.190 → 1.1.192

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.
@@ -7,7 +7,7 @@ export declare const API_EDIT_STEP_LABELS: {
7
7
  readonly STORE_RESPONSE: "Store Response";
8
8
  readonly VALIDATION: "Validation";
9
9
  };
10
- export declare type ApiEditPayloadTab = 'headers' | 'body' | 'params' | 'scripts';
10
+ export declare type ApiEditPayloadTab = 'headers' | 'body' | 'params' | 'authorization';
11
11
  /** Which body content block is visible: headers (tabs) or import cURL textarea. */
12
12
  export declare type ApiEditBodyView = 'headers' | 'import-curl';
13
13
  export interface ApiEditHeaderRow {
@@ -22,12 +22,27 @@ export interface ApiEditSendRequestPayload {
22
22
  url: string;
23
23
  headers: ApiEditHeaderRow[];
24
24
  }
25
+ /** OAuth 2.0 auth fields (when auth type is OAuth 2.0). */
26
+ export interface ApiEditOAuth2Payload {
27
+ grantType: string;
28
+ accessTokenUrl: string;
29
+ clientId: string;
30
+ clientSecret: string;
31
+ scope: string;
32
+ clientAuthentication: string;
33
+ }
25
34
  /** Step 1 request + body payload. */
26
35
  export interface ApiEditStep1Payload {
27
36
  environment: string;
28
37
  method: string;
29
38
  url: string;
30
39
  headers: ApiEditHeaderRow[];
40
+ /** Selected auth type: e.g. 'no-auth', 'bearer', 'oauth2'. */
41
+ authType: string;
42
+ /** Bearer token value when authType is 'bearer'. */
43
+ bearerToken?: string;
44
+ /** OAuth 2.0 fields when authType is 'oauth2'. */
45
+ oauth2?: ApiEditOAuth2Payload;
31
46
  activePayloadTab: ApiEditPayloadTab;
32
47
  payloadType: 'raw' | 'x-www-form-urlencoded' | 'form-data';
33
48
  payloadFormat: string;
@@ -41,6 +56,10 @@ export interface ApiEditStep1Payload {
41
56
  type: string;
42
57
  value: string;
43
58
  }[];
59
+ paramsRows: {
60
+ key: string;
61
+ value: string;
62
+ }[];
44
63
  }
45
64
  /** Step 2 store-response payload. */
46
65
  export interface ApiEditStep2Payload {
@@ -72,6 +91,13 @@ export interface ApiEditCreatePayload {
72
91
  }
73
92
  /** Environment option: either a string (display = value) or an object with id, name, value, label. */
74
93
  export declare type EnvironmentOptionInput = string | SelectOption;
94
+ /** Result of parsing a cURL command. */
95
+ export interface ParsedCurl {
96
+ method: string;
97
+ url: string;
98
+ headers: ApiEditHeaderRow[];
99
+ body: string;
100
+ }
75
101
  export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy {
76
102
  private readonly fb;
77
103
  private readonly cdr;
@@ -82,6 +108,8 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
82
108
  initialPayloadTab?: ApiEditPayloadTab;
83
109
  initialHeaders?: ApiEditHeaderRow[];
84
110
  initialResponsePreview?: string;
111
+ initialVariableName?: string;
112
+ editMode?: boolean;
85
113
  /** Emits the cURL string when user clicks Import (value from the textarea control). */
86
114
  importCurl: EventEmitter<string>;
87
115
  /** Emits when user cancels the Import cURL panel (clicks Cancel). */
@@ -89,6 +117,8 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
89
117
  /** Emits when user clicks Send Request, with environment, method, url, and headers. */
90
118
  sendRequest: EventEmitter<ApiEditSendRequestPayload>;
91
119
  back: EventEmitter<void>;
120
+ /** Emits when user clicks the Cancel button (step 1). */
121
+ cancel: EventEmitter<void>;
92
122
  next: EventEmitter<void>;
93
123
  /** Emits when user clicks Create with all entered details: step1 (environment, HTTP method, URL, headers, body), step2 (variable name), step3 (verifications). */
94
124
  create: EventEmitter<ApiEditCreatePayload>;
@@ -140,6 +170,30 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
140
170
  private static getOptionValue;
141
171
  private updateEnvironmentSelectConfig;
142
172
  private getEnvironmentValues;
173
+ /** Form for Auth Type select (Authorization tab) */
174
+ authTypeForm: FormGroup;
175
+ /** Auth type options: array of strings or objects with id, name, value, label (passed from parent). Falls back to built-in list when empty. */
176
+ authTypeOptions: EnvironmentOptionInput[];
177
+ /** Initial auth type (string or option object). When not set, first of authTypeOptions or default "No Auth" is used. */
178
+ initialAuthType?: string | EnvironmentOptionInput;
179
+ /** Default options when authTypeOptions is empty (same shape as environment) */
180
+ private static readonly DEFAULT_AUTH_TYPE_OPTIONS;
181
+ /** Config for Auth Type dropdown (updated when authTypeOptions changes, like environment) */
182
+ authTypeSelectConfig: DynamicSelectFieldConfig;
183
+ private updateAuthTypeSelectConfig;
184
+ private getAuthTypeValues;
185
+ /** Current auth type value (e.g. 'no-auth') for template */
186
+ get selectedAuthType(): string;
187
+ /** Bearer token value (Authorization tab, when auth type is Bearer Token). */
188
+ bearerToken: string;
189
+ /** Form for OAuth 2.0 fields (Authorization tab when auth type is OAuth 2.0). */
190
+ oauth2Form: FormGroup;
191
+ /** Grant type options for OAuth 2.0 */
192
+ private static readonly OAUTH_GRANT_TYPE_OPTIONS;
193
+ /** Client authentication method options for OAuth 2.0 */
194
+ private static readonly OAUTH_CLIENT_AUTH_OPTIONS;
195
+ readonly oauth2GrantTypeSelectConfig: DynamicSelectFieldConfig;
196
+ readonly oauth2ClientAuthSelectConfig: DynamicSelectFieldConfig;
143
197
  /** Current HTTP method (from form or default: first of httpMethodOptions). Treats empty string as unset. */
144
198
  get selectedMethod(): string;
145
199
  set selectedMethod(v: string);
@@ -162,7 +216,12 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
162
216
  key: string;
163
217
  value: unknown;
164
218
  }): void;
165
- url: string;
219
+ private _url;
220
+ /** URL for the request. Getter/setter syncs query params with the Params tab (Postman-style). */
221
+ get url(): string;
222
+ set url(value: string);
223
+ /** When true, params form changes should not update the URL (we're syncing from URL). */
224
+ private paramsSyncingFromUrl;
166
225
  readonly payloadTabs: {
167
226
  value: ApiEditPayloadTab;
168
227
  label: string;
@@ -174,7 +233,7 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
174
233
  label: string;
175
234
  }[];
176
235
  activeResponseVerificationTab: 'response-body' | 'status';
177
- /** Payload type for Body/Params/Scripts: raw, x-www-form-urlencoded, form-data */
236
+ /** Payload type for Body/Params/Authorization: raw, x-www-form-urlencoded, form-data */
178
237
  payloadType: 'raw' | 'x-www-form-urlencoded' | 'form-data';
179
238
  /** Segment options for payload type (used by cqa-segment-control) */
180
239
  readonly payloadTypeSegments: {
@@ -182,7 +241,7 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
182
241
  value: string;
183
242
  }[];
184
243
  onPayloadTypeChange(val: string): void;
185
- /** Form for Format select (Body/Params/Scripts) */
244
+ /** Form for Format select (Body/Params/Authorization) */
186
245
  payloadFormatForm: FormGroup;
187
246
  /** Format options: array of strings or objects (passed from parent). Falls back to JSON, XML, HTML, Text when empty. */
188
247
  formatOptions: EnvironmentOptionInput[];
@@ -192,7 +251,7 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
192
251
  payloadFormatSelectConfig: DynamicSelectFieldConfig;
193
252
  private updatePayloadFormatSelectConfig;
194
253
  private getFormatValues;
195
- /** Payload text area value for Body/Params/Scripts */
254
+ /** Payload text area value for Body/Params/Authorization */
196
255
  payloadText: string;
197
256
  /** JSON parse error when format is JSON and payload is invalid; null when valid or not JSON. */
198
257
  payloadJsonError: {
@@ -239,6 +298,9 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
239
298
  /** Form array for key-type-value rows; each item is FormGroup({ key, type, value }) */
240
299
  keyTypeValueFormArray: FormArray;
241
300
  get keyTypeValueRows(): FormGroup[];
301
+ /** Form array for Params tab key-value rows; each item is FormGroup({ key, value }) */
302
+ paramsFormArray: FormArray;
303
+ get paramsRows(): FormGroup[];
242
304
  /** Config for Type dropdown in key-type-value rows (Text, File) */
243
305
  readonly keyTypeValueTypeSelectConfig: DynamicSelectFieldConfig;
244
306
  /** Form array for response body verification rows; each item is FormGroup({ jsonPath, verification, dataType, expectedValue }) */
@@ -280,6 +342,7 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
280
342
  private headerNameOptionsChangesSub?;
281
343
  private environmentFormChangesSub?;
282
344
  private methodFormChangesSub?;
345
+ private paramsFormArrayChangesSub?;
283
346
  constructor(fb: FormBuilder, cdr: ChangeDetectorRef);
284
347
  ngOnInit(): void;
285
348
  ngAfterViewInit(): void;
@@ -288,12 +351,32 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
288
351
  private setupPayloadTextareaScrollSync;
289
352
  private buildKeyValueFormArray;
290
353
  private buildKeyTypeValueFormArray;
354
+ private buildParamsFormArray;
355
+ /** Parse URL into base (without query/fragment) and query key-value pairs. Preserves relative URLs. */
356
+ private parseQueryParamsFromUrl;
357
+ /** Get base URL (without query/fragment) for building URL from params. Preserves relative URLs. */
358
+ private getBaseUrl;
359
+ /** Parse application/x-www-form-urlencoded body (key=value&...) into key-value rows. */
360
+ private parseFormUrlEncodedBody;
361
+ /**
362
+ * If form body has a single key whose value is URL-decoded JSON, return it pretty-printed for Raw body.
363
+ * Otherwise return null (caller keeps x-www-form-urlencoded view).
364
+ */
365
+ private tryFormBodyValueAsRawJson;
366
+ /** Update Params table from current URL query string (Postman-style). */
367
+ private syncParamsFromUrl;
368
+ /** Update URL query string from Params table (Postman-style). */
369
+ private syncUrlFromParams;
291
370
  private buildVerificationFormArray;
292
371
  private buildStatusVerificationFormArray;
293
372
  private buildHeadersFormArray;
294
- /** Handler: show import cURL panel (called when user clicks "Import API cURL"). */
373
+ /** Reset all three steps and all entered data to initial/default state. Used when user cancels on step 1. */
374
+ private resetAllStepsAndData;
375
+ /** Handler: show import cURL panel (called when user clicks "Import API cURL"). Resets textarea so it is cleared each time. */
295
376
  openImportCurlPanel(): void;
296
- /** Handler: emit cURL value from control and close panel. Called when user clicks Import button. */
377
+ /** Reset URL, method, headers, body, and params to empty/default before applying imported cURL. */
378
+ private resetRequestFieldsBeforeCurlImport;
379
+ /** Handler: parse cURL from control, bind to form fields, emit and close panel. Called when user clicks Import button. */
297
380
  onImportCurlConfirm(): void;
298
381
  /** Handler: emit cancel and close panel. Called when user clicks Cancel in import cURL panel. */
299
382
  onCancelImportCurl(): void;
@@ -302,6 +385,8 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
302
385
  onSendRequest(): void;
303
386
  onVariableNameChange(): void;
304
387
  onBack(): void;
388
+ /** Called when user clicks the Cancel button (step 1). Emits cancel then runs normal back flow. */
389
+ onCancel(): void;
305
390
  onNext(): void;
306
391
  setPayloadTab(value: ApiEditPayloadTab): void;
307
392
  setResponseVerificationTab(value: 'response-body' | 'status'): void;
@@ -319,6 +404,9 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
319
404
  addKeyTypeValueRow(): void;
320
405
  removeKeyTypeValueRow(index: number): void;
321
406
  trackByKeyTypeValue(index: number): number;
407
+ addParamsRow(): void;
408
+ removeParamsRow(index: number): void;
409
+ trackByParams(index: number): number;
322
410
  addVerificationRow(): void;
323
411
  removeVerificationRow(index: number): void;
324
412
  trackByVerification(index: number): number;
@@ -342,5 +430,5 @@ export declare class ApiEditStepComponent implements OnChanges, OnInit, AfterVie
342
430
  get headers(): ApiEditHeaderRow[];
343
431
  ngOnChanges(changes: SimpleChanges): void;
344
432
  static ɵfac: i0.ɵɵFactoryDeclaration<ApiEditStepComponent, never>;
345
- static ɵcmp: i0.ɵɵComponentDeclaration<ApiEditStepComponent, "cqa-api-edit-step", never, { "initialMethod": "initialMethod"; "initialEnvironment": "initialEnvironment"; "initialStep": "initialStep"; "initialUrl": "initialUrl"; "initialPayloadTab": "initialPayloadTab"; "initialHeaders": "initialHeaders"; "initialResponsePreview": "initialResponsePreview"; "httpMethodOptions": "httpMethodOptions"; "environmentOptions": "environmentOptions"; "formatOptions": "formatOptions"; "initialFormat": "initialFormat"; "headerNameOptions": "headerNameOptions"; "verificationOptions": "verificationOptions"; "verificationDataTypeOptions": "verificationDataTypeOptions"; "statusVerificationOptions": "statusVerificationOptions"; }, { "importCurl": "importCurl"; "importCurlCancel": "importCurlCancel"; "sendRequest": "sendRequest"; "back": "back"; "next": "next"; "create": "create"; "headersChange": "headersChange"; }, never, never>;
433
+ static ɵcmp: i0.ɵɵComponentDeclaration<ApiEditStepComponent, "cqa-api-edit-step", never, { "initialMethod": "initialMethod"; "initialEnvironment": "initialEnvironment"; "initialStep": "initialStep"; "initialUrl": "initialUrl"; "initialPayloadTab": "initialPayloadTab"; "initialHeaders": "initialHeaders"; "initialResponsePreview": "initialResponsePreview"; "initialVariableName": "initialVariableName"; "editMode": "editMode"; "httpMethodOptions": "httpMethodOptions"; "environmentOptions": "environmentOptions"; "authTypeOptions": "authTypeOptions"; "initialAuthType": "initialAuthType"; "formatOptions": "formatOptions"; "initialFormat": "initialFormat"; "headerNameOptions": "headerNameOptions"; "verificationOptions": "verificationOptions"; "verificationDataTypeOptions": "verificationDataTypeOptions"; "statusVerificationOptions": "statusVerificationOptions"; }, { "importCurl": "importCurl"; "importCurlCancel": "importCurlCancel"; "sendRequest": "sendRequest"; "back": "back"; "cancel": "cancel"; "next": "next"; "create": "create"; "headersChange": "headersChange"; }, never, never>;
346
434
  }
@@ -31,7 +31,10 @@ export declare class TestCaseDetailsRendererComponent implements OnChanges, Afte
31
31
  openExternal: EventEmitter<{
32
32
  step: TestCaseStepConfig;
33
33
  }>;
34
- edit: EventEmitter<void>;
34
+ edit: EventEmitter<{
35
+ step: TestCaseStepConfig;
36
+ index: number;
37
+ }>;
35
38
  link: EventEmitter<void>;
36
39
  duplicate: EventEmitter<void>;
37
40
  delete: EventEmitter<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqa-lib/cqa-ui",
3
- "version": "1.1.190",
3
+ "version": "1.1.192",
4
4
  "description": "UI Kit library for Angular 13.4",
5
5
  "keywords": [
6
6
  "angular",