ngx-t-forms 3.1.2 → 3.1.4
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/fesm2022/{ngx-t-forms-api-endpoint-config.component-B9tCHtwV.mjs → ngx-t-forms-api-endpoint-config.component-Bt7rWYJq.mjs} +15 -13
- package/fesm2022/ngx-t-forms-api-endpoint-config.component-Bt7rWYJq.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-D2Vty1Aj.mjs → ngx-t-forms-auto-complete-input-element.component-IS266hPn.mjs} +28 -11
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-IS266hPn.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-Dr2bhCnH.mjs → ngx-t-forms-basic-input-input-element.component-BLcDBM6M.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-Dr2bhCnH.mjs.map → ngx-t-forms-basic-input-input-element.component-BLcDBM6M.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-calculated-field-rules.component-DLBTjfMj.mjs → ngx-t-forms-calculated-field-rules.component-BMheLioT.mjs} +2 -42
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-BMheLioT.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-Bh6jMmtu.mjs → ngx-t-forms-chip-options-creator-editor.component-mPoQRw0c.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-Bh6jMmtu.mjs.map → ngx-t-forms-chip-options-creator-editor.component-mPoQRw0c.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-ayrWl-c2.mjs → ngx-t-forms-conditional-display-config.component-Cw7Axzql.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-ayrWl-c2.mjs.map → ngx-t-forms-conditional-display-config.component-Cw7Axzql.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-nOnJfMTo.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-Cacd0Sl8.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-nOnJfMTo.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-Cacd0Sl8.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-data-source-picker.component-mmyhOBvA.mjs → ngx-t-forms-data-source-picker.component-CwQgtKfU.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-data-source-picker.component-mmyhOBvA.mjs.map → ngx-t-forms-data-source-picker.component-CwQgtKfU.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-DmiBra1D.mjs → ngx-t-forms-date-picker-input-element.component-OAnP4aVx.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-DmiBra1D.mjs.map → ngx-t-forms-date-picker-input-element.component-OAnP4aVx.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-Cke5qSzR.mjs → ngx-t-forms-date-range-picker-input-element.component-DJVUs5xV.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-Cke5qSzR.mjs.map → ngx-t-forms-date-range-picker-input-element.component-DJVUs5xV.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-2Cq0ZEVD.mjs +232 -0
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-2Cq0ZEVD.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-C0xx4jrN.mjs → ngx-t-forms-document-list-label-config-editor.component-CZ-XFrjM.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-C0xx4jrN.mjs.map → ngx-t-forms-document-list-label-config-editor.component-CZ-XFrjM.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-document-picker.component-DI7wtEv6.mjs → ngx-t-forms-document-picker.component-qzqg4O0I.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-document-picker.component-DI7wtEv6.mjs.map → ngx-t-forms-document-picker.component-qzqg4O0I.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-editor-input-element.component-DbogKrdk.mjs → ngx-t-forms-editor-input-element.component-hf5qe7sH.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-editor-input-element.component-DbogKrdk.mjs.map → ngx-t-forms-editor-input-element.component-hf5qe7sH.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DbwvZghJ.mjs → ngx-t-forms-file-upload-input-element.component-s1pe3gKq.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DbwvZghJ.mjs.map → ngx-t-forms-file-upload-input-element.component-s1pe3gKq.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-input-selector.component-CkuzNdjx.mjs → ngx-t-forms-form-input-selector.component-T3yqbRnV.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-input-selector.component-CkuzNdjx.mjs.map → ngx-t-forms-form-input-selector.component-T3yqbRnV.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-json-view.component-DBCpa_rZ.mjs → ngx-t-forms-form-json-view.component-D5AXKbXq.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-json-view.component-DBCpa_rZ.mjs.map → ngx-t-forms-form-json-view.component-D5AXKbXq.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-jLj6vePZ.mjs → ngx-t-forms-form-section-stepper.component-5p9gBgjj.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-jLj6vePZ.mjs.map → ngx-t-forms-form-section-stepper.component-5p9gBgjj.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-Iyd0grju.mjs → ngx-t-forms-forms-builder-menu.component-DH4-vxBX.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-Iyd0grju.mjs.map → ngx-t-forms-forms-builder-menu.component-DH4-vxBX.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-geo-location.component-BUXRaPy0.mjs → ngx-t-forms-geo-location.component-CaW4y8X1.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-geo-location.component-BUXRaPy0.mjs.map → ngx-t-forms-geo-location.component-CaW4y8X1.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-header-template-editor.component-BLmAqiQA.mjs → ngx-t-forms-header-template-editor.component-D9lka3Y5.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-header-template-editor.component-BLmAqiQA.mjs.map → ngx-t-forms-header-template-editor.component-D9lka3Y5.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-D6Ffuhbv.mjs → ngx-t-forms-image-capture-input-element.component-Dt50q6pH.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-D6Ffuhbv.mjs.map → ngx-t-forms-image-capture-input-element.component-Dt50q6pH.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-index-CJwmJP3u.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-CJwmJP3u.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-custom.component-45DTVv-R.mjs +309 -0
- package/fesm2022/ngx-t-forms-input-custom.component-45DTVv-R.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-editor.component-D60TpWzO.mjs → ngx-t-forms-input-editor.component-DNg-p_Wl.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-input-editor.component-D60TpWzO.mjs.map → ngx-t-forms-input-editor.component-DNg-p_Wl.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-yfxnNDPs.mjs → ngx-t-forms-map-mat-options-keys-DvrLH9wd.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-yfxnNDPs.mjs.map → ngx-t-forms-map-mat-options-keys-DvrLH9wd.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-cfBBan80.mjs → ngx-t-forms-mat-chip-list-editor.component-1YdhWOqQ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-cfBBan80.mjs.map → ngx-t-forms-mat-chip-list-editor.component-1YdhWOqQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BcYuduah.mjs → ngx-t-forms-missing-form-configs.component-P8CDm5nZ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BcYuduah.mjs.map → ngx-t-forms-missing-form-configs.component-P8CDm5nZ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-nLawxM9j.mjs → ngx-t-forms-mscoa-chart-toolbar.component-Cj1zfMAW.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-nLawxM9j.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-Cj1zfMAW.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-config.component-B9G_WlEc.mjs → ngx-t-forms-mscoa-config.component-CyG4Lafw.mjs} +61 -12
- package/fesm2022/ngx-t-forms-mscoa-config.component-CyG4Lafw.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-DKEEZ8MD.mjs → ngx-t-forms-mscoa-segment-config.component-BcAgMwcV.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-DKEEZ8MD.mjs.map → ngx-t-forms-mscoa-segment-config.component-BcAgMwcV.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-B99ANTUL.mjs → ngx-t-forms-multiple-input-input-element.component-DN25FtGd.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-B99ANTUL.mjs.map → ngx-t-forms-multiple-input-input-element.component-DN25FtGd.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-ngx-t-forms-9BfJdjl4.mjs → ngx-t-forms-ngx-t-forms-D_PCGH-i.mjs} +10585 -154
- package/fesm2022/ngx-t-forms-ngx-t-forms-D_PCGH-i.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-paginated-selection-table-Bm5-5VWe.mjs → ngx-t-forms-paginated-selection-table-B62XtkB5.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-paginated-selection-table-Bm5-5VWe.mjs.map → ngx-t-forms-paginated-selection-table-B62XtkB5.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-2hwGuKAB.mjs → ngx-t-forms-payload-template-editor.component-CY7BRHuw.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-2hwGuKAB.mjs.map → ngx-t-forms-payload-template-editor.component-CY7BRHuw.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-BvjT2zfL.mjs → ngx-t-forms-pipeline-generator.component-I2K-Csz3.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-BvjT2zfL.mjs.map → ngx-t-forms-pipeline-generator.component-I2K-Csz3.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-quill-input.component-BsuOKfZT.mjs → ngx-t-forms-quill-input.component-BrOSKvq1.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-quill-input.component-BsuOKfZT.mjs.map → ngx-t-forms-quill-input.component-BrOSKvq1.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-record-list-manager.component-BK5nwwDp.mjs → ngx-t-forms-record-list-manager.component-BEeTQy5N.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-record-list-manager.component-BK5nwwDp.mjs.map → ngx-t-forms-record-list-manager.component-BEeTQy5N.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-required-inputs.component-DiwMttVf.mjs → ngx-t-forms-required-inputs.component-BUUrpNR0.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-required-inputs.component-DiwMttVf.mjs.map → ngx-t-forms-required-inputs.component-BUUrpNR0.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-CBgG_f06.mjs → ngx-t-forms-rest-api-call-setup.component-CJyrmfYU.mjs} +345 -176
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CJyrmfYU.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-section-report.component-CyPpFiWS.mjs → ngx-t-forms-section-report.component-Dxecd1uL.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-section-report.component-CyPpFiWS.mjs.map → ngx-t-forms-section-report.component-Dxecd1uL.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-select-input-element.component-B2wr5_88.mjs → ngx-t-forms-select-input-element.component-DPMSwCHF.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-select-input-element.component-B2wr5_88.mjs.map → ngx-t-forms-select-input-element.component-DPMSwCHF.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-BEZLG1Z8.mjs → ngx-t-forms-selection-options-editor.component-i0c0M02r.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-BEZLG1Z8.mjs.map → ngx-t-forms-selection-options-editor.component-i0c0M02r.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-Cmbd0krg.mjs → ngx-t-forms-textarea-input-element.component-CZ5Zlcdy.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-Cmbd0krg.mjs.map → ngx-t-forms-textarea-input-element.component-CZ5Zlcdy.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-Dd_FcAoD.mjs → ngx-t-forms-toggle-input-element.component-Cbnjjcv4.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-Dd_FcAoD.mjs.map → ngx-t-forms-toggle-input-element.component-Cbnjjcv4.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-token-text-input.component-DY04Z0fn.mjs → ngx-t-forms-token-text-input.component-B0_C_BSx.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-token-text-input.component-DY04Z0fn.mjs.map → ngx-t-forms-token-text-input.component-B0_C_BSx.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-validators-config.component-Btmz2cKH.mjs → ngx-t-forms-validators-config.component-BvCwOCgs.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-validators-config.component-Btmz2cKH.mjs.map → ngx-t-forms-validators-config.component-BvCwOCgs.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-CT6sN9E4.mjs → ngx-t-forms-workflow-adjudication.component-DzE8_xCE.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-CT6sN9E4.mjs.map → ngx-t-forms-workflow-adjudication.component-DzE8_xCE.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms.mjs +1 -1
- package/package.json +3 -3
- package/types/ngx-t-forms.d.ts +1754 -5
- package/fesm2022/ngx-t-forms-api-endpoint-config.component-B9tCHtwV.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-D2Vty1Aj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-DLBTjfMj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-index-CKj1Oacc.mjs +0 -2
- package/fesm2022/ngx-t-forms-index-CKj1Oacc.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-custom.component-BMui37o-.mjs +0 -105
- package/fesm2022/ngx-t-forms-input-custom.component-BMui37o-.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-config.component-B9G_WlEc.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-9BfJdjl4.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CBgG_f06.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, output, inject, DestroyRef, signal, computed, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { m as deriveDefaultPayloadTemplate, n as collectHeaderTemplateInputIds, o as collectQueryTemplateInputIds, q as collectTemplateInputIds, u as collectMinInputDepIds, v as resolveHeaderTemplate, w as resolveQueryTemplate, x as resolvePayloadTemplate, y as returnMappedData, z as mergeQueryOptions, C as mergeHeaderOptions, G as PostmanCollectionLoaderService, H as TreeComponent, I as convertPostmanFolderItemsToTree, _ as _isEqual, E as EmptyStateComponent, l as ErrorListComponent } from './ngx-t-forms-ngx-t-forms-D_PCGH-i.mjs';
|
|
3
4
|
import { JsDataTypes, DataSources } from 'ngx-t-forms-types';
|
|
4
|
-
import { l as deriveDefaultPayloadTemplate, m as collectHeaderTemplateInputIds, n as collectQueryTemplateInputIds, o as collectTemplateInputIds, q as collectMinInputDepIds, u as resolveHeaderTemplate, v as resolveQueryTemplate, w as resolvePayloadTemplate, x as returnMappedData, y as mergeQueryOptions, z as mergeHeaderOptions, C as PostmanCollectionLoaderService, G as TreeComponent, H as convertPostmanFolderItemsToTree, _ as _isEqual, E as EmptyStateComponent, k as ErrorListComponent } from './ngx-t-forms-ngx-t-forms-9BfJdjl4.mjs';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
7
7
|
import { take, tap, catchError, throwError } from 'rxjs';
|
|
@@ -17,6 +17,199 @@ import * as i5 from '@angular/material/tooltip';
|
|
|
17
17
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
18
18
|
import { S as SearchFieldComponent } from './ngx-t-forms-search-field.component-mR4Kk12C.mjs';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @file Maps a Postman collection item to a stored
|
|
22
|
+
* `APIDataFetchingConfigurationInterface`.
|
|
23
|
+
*
|
|
24
|
+
* Extracted from `rest-api-call-setup.component.ts`, where it was the whole of
|
|
25
|
+
* `nodeSelectionChanged` plus six module-local helpers and two private methods.
|
|
26
|
+
* Nothing outside that component could produce the configuration a human
|
|
27
|
+
* produces by picking an endpoint, which made every other caller either
|
|
28
|
+
* duplicate the mapping — guaranteed to drift from the editor — or hand-author
|
|
29
|
+
* configs. The AI form-builder's endpoint catalog is the caller that forced the
|
|
30
|
+
* issue: it needs complete stored configurations, and the library already
|
|
31
|
+
* fetches the collection they would come from.
|
|
32
|
+
*
|
|
33
|
+
* Pure by construction: no Angular, no injection, no I/O, no component state.
|
|
34
|
+
* The component keeps ownership of what to DO with the result (set its local
|
|
35
|
+
* value, emit it); this module only decides what the result is.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Parses a Postman raw request body into a plain object.
|
|
39
|
+
*
|
|
40
|
+
* Returns `{}` for an absent, blank or non-JSON body (a `graphql` / `formdata`
|
|
41
|
+
* mode, or raw text with comments). Nesting and key names are preserved exactly
|
|
42
|
+
* as authored — this is the document template mode seeds from.
|
|
43
|
+
*
|
|
44
|
+
* @param raw - `request.body.raw` from the Postman collection.
|
|
45
|
+
* @returns The parsed body, or `{}` when there is nothing usable.
|
|
46
|
+
*/
|
|
47
|
+
function parseRawBody(raw) {
|
|
48
|
+
if (typeof raw !== 'string' || raw.trim() === '')
|
|
49
|
+
return {};
|
|
50
|
+
try {
|
|
51
|
+
const parsed = JSON.parse(raw);
|
|
52
|
+
return parsed !== null && typeof parsed === 'object' ? parsed : {};
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** True when a parsed body carries at least one key — i.e. it is worth persisting. */
|
|
59
|
+
function isNonEmptyBody(body) {
|
|
60
|
+
return Object.keys(body).length > 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Collects the enabled entries of a Postman `[{ key, value, disabled? }]` list.
|
|
64
|
+
*
|
|
65
|
+
* A `disabled` entry is one the author deliberately switched off in the
|
|
66
|
+
* collection, so it is skipped rather than carried into the form config —
|
|
67
|
+
* mirroring what Postman itself would send.
|
|
68
|
+
*
|
|
69
|
+
* Headers and URL query params have the identical shape and the identical rule,
|
|
70
|
+
* so they share one implementation here; they were two copies of the same loop
|
|
71
|
+
* in the component.
|
|
72
|
+
*
|
|
73
|
+
* @param entries - `request.header` or `request.url.query`.
|
|
74
|
+
* @returns The captured `name → value` map (empty when there is nothing usable).
|
|
75
|
+
*/
|
|
76
|
+
function parseKeyValueList(entries) {
|
|
77
|
+
if (!Array.isArray(entries))
|
|
78
|
+
return {};
|
|
79
|
+
const captured = {};
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
if (entry?.disabled === true)
|
|
82
|
+
continue;
|
|
83
|
+
const key = typeof entry?.key === 'string' ? entry.key.trim() : '';
|
|
84
|
+
if (key === '')
|
|
85
|
+
continue;
|
|
86
|
+
captured[key] = typeof entry.value === 'string' ? entry.value : String(entry?.value ?? '');
|
|
87
|
+
}
|
|
88
|
+
return captured;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Strips the query string from a captured endpoint URL — but ONLY when the
|
|
92
|
+
* query was captured structurally (so nothing is lost): once the params live in
|
|
93
|
+
* `capturedQuery`/`queryTemplate`, leaving them in the URL as text would send
|
|
94
|
+
* every param twice. A URL whose `?…` had no structured `url.query` entries is
|
|
95
|
+
* left verbatim — the text is then the only record of it.
|
|
96
|
+
*
|
|
97
|
+
* @param raw - `request.url.raw` from the Postman collection.
|
|
98
|
+
* @param capturedQuery - What {@link parseKeyValueList} extracted from the query.
|
|
99
|
+
* @returns The URL to persist as `httpEndPoint`.
|
|
100
|
+
*/
|
|
101
|
+
function stripCapturedQueryString(raw, capturedQuery) {
|
|
102
|
+
if (Object.keys(capturedQuery).length === 0)
|
|
103
|
+
return raw;
|
|
104
|
+
const cut = raw.indexOf('?');
|
|
105
|
+
return cut === -1 ? raw : raw.slice(0, cut);
|
|
106
|
+
}
|
|
107
|
+
/** Maps a JS `typeof` string to the shared {@link JsDataTypes} enum member. */
|
|
108
|
+
function toJsDataType(value) {
|
|
109
|
+
switch (typeof value) {
|
|
110
|
+
case 'string':
|
|
111
|
+
return JsDataTypes.String;
|
|
112
|
+
case 'number':
|
|
113
|
+
return JsDataTypes.Number;
|
|
114
|
+
case 'bigint':
|
|
115
|
+
return JsDataTypes.BigInt;
|
|
116
|
+
case 'boolean':
|
|
117
|
+
return JsDataTypes.Boolean;
|
|
118
|
+
case 'symbol':
|
|
119
|
+
return JsDataTypes.Symbol;
|
|
120
|
+
case 'function':
|
|
121
|
+
return JsDataTypes.Function;
|
|
122
|
+
case 'object':
|
|
123
|
+
return JsDataTypes.Object;
|
|
124
|
+
default:
|
|
125
|
+
return JsDataTypes.Undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** One `minimumInputRequired` entry. */
|
|
129
|
+
function toRequiredInput(name, value, primaryKey) {
|
|
130
|
+
return { name, type: toJsDataType(value), primaryKey };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Derives the body-bearing endpoint's required inputs from its request body.
|
|
134
|
+
* Top-level keys are primary; entries under `data` are secondary (non-primary).
|
|
135
|
+
*
|
|
136
|
+
* **Deliberately flat.** `MinimumInputRequiredInterface` has a `name`, not a
|
|
137
|
+
* path, so a nested value can only ever become one `JsDataTypes.Object` entry —
|
|
138
|
+
* mapping `filter.archive` is not expressible here. That is what template mode
|
|
139
|
+
* is for, and why the untouched `requestBody` is captured alongside this: it is
|
|
140
|
+
* the only faithful record of a nested payload.
|
|
141
|
+
*/
|
|
142
|
+
function extractRequiredInputs(requestBody) {
|
|
143
|
+
const { data, ...rest } = requestBody;
|
|
144
|
+
const dataEntries = data && typeof data === 'object' ? { ...data } : {};
|
|
145
|
+
const primaryKeys = Object.entries(rest).map(([key, val]) => toRequiredInput(key, val, true));
|
|
146
|
+
const secondaryKeys = Object.entries(dataEntries).map(([key, val]) => toRequiredInput(key, val, false));
|
|
147
|
+
return [...primaryKeys, ...secondaryKeys];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @public
|
|
151
|
+
*
|
|
152
|
+
* Builds the stored fetch configuration for one Postman collection item.
|
|
153
|
+
*
|
|
154
|
+
* @param node - A node from the collection tree. A FOLDER node — the only other
|
|
155
|
+
* thing the picker can emit — has no `request`, so that check alone is the
|
|
156
|
+
* correct guard, and it is why this returns `undefined` rather than a partial
|
|
157
|
+
* configuration: a half-built config persisted as if it were real is the
|
|
158
|
+
* failure this whole mapping exists to avoid.
|
|
159
|
+
* @returns The configuration to persist, or `undefined` when the node carries
|
|
160
|
+
* no request.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* const config = postmanItemToFetchConfig(node);
|
|
164
|
+
* if (config) this.valueChanged.emit(config);
|
|
165
|
+
*/
|
|
166
|
+
function postmanItemToFetchConfig(node) {
|
|
167
|
+
const { id, name, request } = node;
|
|
168
|
+
if (!request)
|
|
169
|
+
return undefined;
|
|
170
|
+
const requestBody = parseRawBody(request.body?.raw);
|
|
171
|
+
const capturedHeaders = parseKeyValueList(request.header);
|
|
172
|
+
const capturedQuery = parseKeyValueList(request.url.query);
|
|
173
|
+
// PUT is body-bearing exactly like POST (it rides the POST branch family at
|
|
174
|
+
// runtime), so it seeds the same required-input mapping.
|
|
175
|
+
const sendsBody = request.method === 'POST' || request.method === 'PUT';
|
|
176
|
+
const minimumInputRequired = sendsBody
|
|
177
|
+
? extractRequiredInputs(requestBody)
|
|
178
|
+
: [];
|
|
179
|
+
return {
|
|
180
|
+
_id: id,
|
|
181
|
+
name,
|
|
182
|
+
// Structurally-captured query params are stripped from the URL text so a
|
|
183
|
+
// param never rides twice (once as literal text, once via queryTemplate).
|
|
184
|
+
httpEndPoint: stripCapturedQueryString(request.url.raw, capturedQuery),
|
|
185
|
+
httpMethod: request.method,
|
|
186
|
+
source: DataSources.Api,
|
|
187
|
+
postFormData: sendsBody,
|
|
188
|
+
// The endpoint's own headers, kept so the header-template editor opens on
|
|
189
|
+
// what the API declares. Omitted when it declared none, so the editor falls
|
|
190
|
+
// back to its skeleton rather than persisting an empty map.
|
|
191
|
+
...(Object.keys(capturedHeaders).length > 0 ? { capturedHeaders } : {}),
|
|
192
|
+
// Same contract for the URL's own query params → the query-template editor.
|
|
193
|
+
...(Object.keys(capturedQuery).length > 0 ? { capturedQuery } : {}),
|
|
194
|
+
// The endpoint's Postman documentation, verbatim → the Docs tab.
|
|
195
|
+
...(request.description?.trim() ? { capturedDocs: request.description } : {}),
|
|
196
|
+
backEndConfig: {
|
|
197
|
+
minimumInputRequired,
|
|
198
|
+
// The endpoint's untouched body is the ONLY faithful record of a nested
|
|
199
|
+
// payload (`minimumInputRequired` entries carry a `name`, not a path), so
|
|
200
|
+
// it is what seeds template mode. Captured for every method that actually
|
|
201
|
+
// sends one — keyed on the body being present, not on `method === 'POST'`,
|
|
202
|
+
// because PUT/PATCH bodies are equally real. Omitted entirely when there
|
|
203
|
+
// is nothing to store, so `deriveDefaultPayloadTemplate` falls back cleanly.
|
|
204
|
+
...(isNonEmptyBody(requestBody)
|
|
205
|
+
? {
|
|
206
|
+
requestBody: requestBody,
|
|
207
|
+
}
|
|
208
|
+
: {}),
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
20
213
|
/** CSS-variable colour per HTTP method (dark-mode-safe; never a hex literal). */
|
|
21
214
|
const METHOD_COLOR = {
|
|
22
215
|
GET: 'var(--lib-forms-method-get)',
|
|
@@ -157,6 +350,153 @@ function deriveConfiguredRequest(cfg) {
|
|
|
157
350
|
function dependencyLabels(formInputs, ids) {
|
|
158
351
|
return ids.map((depId) => labelOf(formInputs, depId));
|
|
159
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Renders an endpoint's Postman description (markdown) to safe HTML for the
|
|
355
|
+
* dialog's Docs tab.
|
|
356
|
+
*
|
|
357
|
+
* Every character is HTML-escaped FIRST; the only tags in the output are the
|
|
358
|
+
* ones this renderer emits, all of which survive Angular's `[innerHTML]`
|
|
359
|
+
* sanitizer — so the binding needs no security bypass. The subset covers what
|
|
360
|
+
* Postman authors actually write: headings, paragraphs, hard line breaks,
|
|
361
|
+
* bold, italics, inline and fenced code, bullet/numbered lists, blockquotes,
|
|
362
|
+
* and http(s) links. Anything else stays visible as plain text rather than
|
|
363
|
+
* being swallowed.
|
|
364
|
+
*
|
|
365
|
+
* @param markdown - The captured Postman description, verbatim.
|
|
366
|
+
* @returns An HTML string safe to bind via `[innerHTML]`.
|
|
367
|
+
*/
|
|
368
|
+
function docsHtmlOf(markdown) {
|
|
369
|
+
// Fenced blocks first, on the ESCAPED text (backticks survive escaping) —
|
|
370
|
+
// their contents must not be re-interpreted as markdown.
|
|
371
|
+
return escapeHtml(markdown)
|
|
372
|
+
.split('```')
|
|
373
|
+
.map((segment, index) => {
|
|
374
|
+
if (index % 2 === 1) {
|
|
375
|
+
// Odd segments are fenced code; drop a leading language tag line.
|
|
376
|
+
const code = segment.replace(/^[a-zA-Z0-9+#-]*\r?\n/, '').replace(/\s+$/, '');
|
|
377
|
+
return `<pre><code>${code}</code></pre>`;
|
|
378
|
+
}
|
|
379
|
+
return renderDocBlocks(segment);
|
|
380
|
+
})
|
|
381
|
+
.join('');
|
|
382
|
+
}
|
|
383
|
+
/** Escapes the five HTML-significant characters; runs before any tag is emitted. */
|
|
384
|
+
function escapeHtml(text) {
|
|
385
|
+
return text
|
|
386
|
+
.replace(/&/g, '&')
|
|
387
|
+
.replace(/</g, '<')
|
|
388
|
+
.replace(/>/g, '>')
|
|
389
|
+
.replace(/"/g, '"')
|
|
390
|
+
.replace(/'/g, ''');
|
|
391
|
+
}
|
|
392
|
+
/** Block-level pass: headings, lists, blockquotes, rules, paragraphs. */
|
|
393
|
+
function renderDocBlocks(text) {
|
|
394
|
+
const out = [];
|
|
395
|
+
let paragraph = [];
|
|
396
|
+
let listTag;
|
|
397
|
+
let listItems = [];
|
|
398
|
+
let quoteLines = [];
|
|
399
|
+
const flushParagraph = () => {
|
|
400
|
+
// Single newlines are hard breaks — Postman authors line up key: value
|
|
401
|
+
// rows and expect them to stay on their own lines.
|
|
402
|
+
if (paragraph.length > 0)
|
|
403
|
+
out.push(`<p>${paragraph.map(renderDocInline).join('<br />')}</p>`);
|
|
404
|
+
paragraph = [];
|
|
405
|
+
};
|
|
406
|
+
const flushList = () => {
|
|
407
|
+
if (listTag) {
|
|
408
|
+
const items = listItems.map((item) => `<li>${renderDocInline(item)}</li>`).join('');
|
|
409
|
+
out.push(`<${listTag}>${items}</${listTag}>`);
|
|
410
|
+
}
|
|
411
|
+
listTag = undefined;
|
|
412
|
+
listItems = [];
|
|
413
|
+
};
|
|
414
|
+
const flushQuote = () => {
|
|
415
|
+
if (quoteLines.length > 0) {
|
|
416
|
+
out.push(`<blockquote>${quoteLines.map(renderDocInline).join('<br />')}</blockquote>`);
|
|
417
|
+
}
|
|
418
|
+
quoteLines = [];
|
|
419
|
+
};
|
|
420
|
+
const flushAll = () => {
|
|
421
|
+
flushParagraph();
|
|
422
|
+
flushList();
|
|
423
|
+
flushQuote();
|
|
424
|
+
};
|
|
425
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
426
|
+
const line = raw.trimEnd();
|
|
427
|
+
if (line.trim() === '') {
|
|
428
|
+
flushAll();
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
const heading = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
432
|
+
if (heading) {
|
|
433
|
+
flushAll();
|
|
434
|
+
// The dialog owns h1/h2 — doc headings start at h3 so hierarchy holds.
|
|
435
|
+
const level = Math.min((heading[1]?.length ?? 1) + 2, 6);
|
|
436
|
+
out.push(`<h${level}>${renderDocInline(heading[2] ?? '')}</h${level}>`);
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
|
|
440
|
+
flushAll();
|
|
441
|
+
out.push('<hr />');
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
const bullet = /^\s*[-*+]\s+(.*)$/.exec(line);
|
|
445
|
+
if (bullet) {
|
|
446
|
+
flushParagraph();
|
|
447
|
+
flushQuote();
|
|
448
|
+
if (listTag !== 'ul')
|
|
449
|
+
flushList();
|
|
450
|
+
listTag = 'ul';
|
|
451
|
+
listItems.push(bullet[1] ?? '');
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
const numbered = /^\s*\d+[.)]\s+(.*)$/.exec(line);
|
|
455
|
+
if (numbered) {
|
|
456
|
+
flushParagraph();
|
|
457
|
+
flushQuote();
|
|
458
|
+
if (listTag !== 'ol')
|
|
459
|
+
flushList();
|
|
460
|
+
listTag = 'ol';
|
|
461
|
+
listItems.push(numbered[1] ?? '');
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
const quoted = /^\s*>\s?(.*)$/.exec(line);
|
|
465
|
+
if (quoted) {
|
|
466
|
+
flushParagraph();
|
|
467
|
+
flushList();
|
|
468
|
+
quoteLines.push(quoted[1] ?? '');
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
flushList();
|
|
472
|
+
flushQuote();
|
|
473
|
+
paragraph.push(line);
|
|
474
|
+
}
|
|
475
|
+
flushAll();
|
|
476
|
+
return out.join('');
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Inline pass: code spans, links, bold, italics. Code spans are cut out first
|
|
480
|
+
* so their contents are never re-styled. `_underscore_` italics are left
|
|
481
|
+
* alone on purpose — snake_case identifiers are common in these docs.
|
|
482
|
+
*/
|
|
483
|
+
function renderDocInline(text) {
|
|
484
|
+
return text
|
|
485
|
+
.split(/(`[^`]+`)/)
|
|
486
|
+
.map((part) => {
|
|
487
|
+
const code = /^`([^`]+)`$/.exec(part);
|
|
488
|
+
if (code)
|
|
489
|
+
return `<code>${code[1]}</code>`;
|
|
490
|
+
return (part
|
|
491
|
+
// Images collapse to their alt text — remote fetches stay out of the dialog.
|
|
492
|
+
.replace(/!\[([^\]]*)\]\(([^()\s]+)\)/g, '$1')
|
|
493
|
+
.replace(/\[([^\]]+)\]\((https?:\/\/[^()\s]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>')
|
|
494
|
+
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
495
|
+
.replace(/__([^_]+)__/g, '<strong>$1</strong>')
|
|
496
|
+
.replace(/\*([^*]+)\*/g, '<em>$1</em>'));
|
|
497
|
+
})
|
|
498
|
+
.join('');
|
|
499
|
+
}
|
|
160
500
|
/** Resolves a dependency id to a friendly label (date-range halves included). */
|
|
161
501
|
function labelOf(inputs, depId) {
|
|
162
502
|
const direct = inputs.find((candidate) => candidate.id === depId);
|
|
@@ -398,118 +738,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
398
738
|
}], propDecorators: { postmanCollectionConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "postmanCollectionConfig", required: false }] }], loadingEndPoints: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingEndPoints", required: false }] }], nodeSelectionChanged: [{ type: i0.Output, args: ["nodeSelectionChanged"] }] } });
|
|
399
739
|
|
|
400
740
|
let nextId = 0;
|
|
401
|
-
/**
|
|
402
|
-
* Parses a Postman raw request body into a plain object.
|
|
403
|
-
*
|
|
404
|
-
* Returns `{}` for an absent, blank or non-JSON body (a `graphql` / `formdata`
|
|
405
|
-
* mode, or raw text with comments). Nesting and key names are preserved exactly as
|
|
406
|
-
* authored — this is the document template mode seeds from.
|
|
407
|
-
*
|
|
408
|
-
* @param raw - `request.body.raw` from the Postman collection.
|
|
409
|
-
* @returns The parsed body, or `{}` when there is nothing usable.
|
|
410
|
-
*/
|
|
411
|
-
function parseRawBody(raw) {
|
|
412
|
-
if (typeof raw !== 'string' || raw.trim() === '')
|
|
413
|
-
return {};
|
|
414
|
-
try {
|
|
415
|
-
const parsed = JSON.parse(raw);
|
|
416
|
-
return parsed !== null && typeof parsed === 'object' ? parsed : {};
|
|
417
|
-
}
|
|
418
|
-
catch {
|
|
419
|
-
return {};
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
/** True when a parsed body carries at least one key — i.e. it is worth persisting. */
|
|
423
|
-
function isNonEmptyBody(body) {
|
|
424
|
-
return Object.keys(body).length > 0;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Collects the endpoint's enabled request headers from the Postman item.
|
|
428
|
-
*
|
|
429
|
-
* Postman stores headers as `[{ key, value, disabled? }]`; a `disabled` entry is
|
|
430
|
-
* one the author deliberately switched off in the collection, so it is skipped
|
|
431
|
-
* rather than carried into the form config. The result seeds the header-template
|
|
432
|
-
* editor, so the author starts from what the endpoint actually declares and only
|
|
433
|
-
* has to swap the values they want bound to live fields.
|
|
434
|
-
*
|
|
435
|
-
* @param header - `request.header` from the Postman collection.
|
|
436
|
-
* @returns The captured `name → value` map (empty when there is nothing usable).
|
|
437
|
-
*/
|
|
438
|
-
function parseRequestHeaders(header) {
|
|
439
|
-
if (!Array.isArray(header))
|
|
440
|
-
return {};
|
|
441
|
-
const captured = {};
|
|
442
|
-
for (const entry of header) {
|
|
443
|
-
if (entry?.disabled === true)
|
|
444
|
-
continue;
|
|
445
|
-
const key = typeof entry?.key === 'string' ? entry.key.trim() : '';
|
|
446
|
-
if (key === '')
|
|
447
|
-
continue;
|
|
448
|
-
captured[key] = typeof entry.value === 'string' ? entry.value : String(entry?.value ?? '');
|
|
449
|
-
}
|
|
450
|
-
return captured;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Collects the endpoint's enabled URL query params from the Postman item —
|
|
454
|
-
* the exact twin of {@link parseRequestHeaders} for `request.url.query`.
|
|
455
|
-
* Unticked (`disabled: true`) entries are excluded, mirroring what Postman
|
|
456
|
-
* itself would send. Seeds `capturedQuery`, never sent on its own.
|
|
457
|
-
*
|
|
458
|
-
* @param query - `request.url.query` from the Postman collection.
|
|
459
|
-
* @returns The captured `name → value` map (empty when there is nothing usable).
|
|
460
|
-
*/
|
|
461
|
-
function parseRequestQuery(query) {
|
|
462
|
-
if (!Array.isArray(query))
|
|
463
|
-
return {};
|
|
464
|
-
const captured = {};
|
|
465
|
-
for (const entry of query) {
|
|
466
|
-
if (entry?.disabled === true)
|
|
467
|
-
continue;
|
|
468
|
-
const key = typeof entry?.key === 'string' ? entry.key.trim() : '';
|
|
469
|
-
if (key === '')
|
|
470
|
-
continue;
|
|
471
|
-
captured[key] = typeof entry.value === 'string' ? entry.value : String(entry?.value ?? '');
|
|
472
|
-
}
|
|
473
|
-
return captured;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Strips the query string from a captured endpoint URL — but ONLY when the
|
|
477
|
-
* query was captured structurally (so nothing is lost): once the params live in
|
|
478
|
-
* `capturedQuery`/`queryTemplate`, leaving them in the URL as text would send
|
|
479
|
-
* every param twice. A URL whose `?…` had no structured `url.query` entries is
|
|
480
|
-
* left verbatim — the text is then the only record of it.
|
|
481
|
-
*
|
|
482
|
-
* @param raw - `request.url.raw` from the Postman collection.
|
|
483
|
-
* @param capturedQuery - What {@link parseRequestQuery} extracted.
|
|
484
|
-
* @returns The URL to persist as `httpEndPoint`.
|
|
485
|
-
*/
|
|
486
|
-
function stripCapturedQueryString(raw, capturedQuery) {
|
|
487
|
-
if (Object.keys(capturedQuery).length === 0)
|
|
488
|
-
return raw;
|
|
489
|
-
const cut = raw.indexOf('?');
|
|
490
|
-
return cut === -1 ? raw : raw.slice(0, cut);
|
|
491
|
-
}
|
|
492
|
-
/** Maps a JS `typeof` string to the shared {@link JsDataTypes} enum member. */
|
|
493
|
-
function toJsDataType(value) {
|
|
494
|
-
switch (typeof value) {
|
|
495
|
-
case 'string':
|
|
496
|
-
return JsDataTypes.String;
|
|
497
|
-
case 'number':
|
|
498
|
-
return JsDataTypes.Number;
|
|
499
|
-
case 'bigint':
|
|
500
|
-
return JsDataTypes.BigInt;
|
|
501
|
-
case 'boolean':
|
|
502
|
-
return JsDataTypes.Boolean;
|
|
503
|
-
case 'symbol':
|
|
504
|
-
return JsDataTypes.Symbol;
|
|
505
|
-
case 'function':
|
|
506
|
-
return JsDataTypes.Function;
|
|
507
|
-
case 'object':
|
|
508
|
-
return JsDataTypes.Object;
|
|
509
|
-
default:
|
|
510
|
-
return JsDataTypes.Undefined;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
741
|
/**
|
|
514
742
|
* Lets the user pick an API endpoint from a Postman collection and exposes the
|
|
515
743
|
* resulting {@link APIDataFetchingConfigurationInterface}. Renders one of three
|
|
@@ -598,48 +826,9 @@ class RestApiCallSetupComponent {
|
|
|
598
826
|
* is the correct guard.
|
|
599
827
|
*/
|
|
600
828
|
nodeSelectionChanged(node) {
|
|
601
|
-
const
|
|
602
|
-
if (!
|
|
829
|
+
const config = postmanItemToFetchConfig(node);
|
|
830
|
+
if (!config)
|
|
603
831
|
return;
|
|
604
|
-
const requestBody = parseRawBody(request.body?.raw);
|
|
605
|
-
const capturedHeaders = parseRequestHeaders(request.header);
|
|
606
|
-
const capturedQuery = parseRequestQuery(request.url.query);
|
|
607
|
-
// PUT is body-bearing exactly like POST (it rides the POST branch family
|
|
608
|
-
// at runtime), so it seeds the same required-input mapping.
|
|
609
|
-
const sendsBody = request.method === 'POST' || request.method === 'PUT';
|
|
610
|
-
const minimumInputRequired = sendsBody
|
|
611
|
-
? this.#extractRequiredInputs(requestBody)
|
|
612
|
-
: [];
|
|
613
|
-
const config = {
|
|
614
|
-
_id: id,
|
|
615
|
-
name,
|
|
616
|
-
// Structurally-captured query params are stripped from the URL text so a
|
|
617
|
-
// param never rides twice (once as literal text, once via queryTemplate).
|
|
618
|
-
httpEndPoint: stripCapturedQueryString(request.url.raw, capturedQuery),
|
|
619
|
-
httpMethod: request.method,
|
|
620
|
-
source: DataSources.Api,
|
|
621
|
-
postFormData: sendsBody,
|
|
622
|
-
// The endpoint's own headers, kept so the header-template editor opens on
|
|
623
|
-
// what the API declares. Omitted when it declared none, so the editor falls
|
|
624
|
-
// back to its skeleton rather than persisting an empty map.
|
|
625
|
-
...(Object.keys(capturedHeaders).length > 0 ? { capturedHeaders } : {}),
|
|
626
|
-
// Same contract for the URL's own query params → the query-template editor.
|
|
627
|
-
...(Object.keys(capturedQuery).length > 0 ? { capturedQuery } : {}),
|
|
628
|
-
// The endpoint's Postman documentation, verbatim → the Docs tab.
|
|
629
|
-
...(request.description?.trim() ? { capturedDocs: request.description } : {}),
|
|
630
|
-
backEndConfig: {
|
|
631
|
-
minimumInputRequired,
|
|
632
|
-
// The endpoint's untouched body is the ONLY faithful record of a nested
|
|
633
|
-
// payload (`minimumInputRequired` entries carry a `name`, not a path), so it
|
|
634
|
-
// is what seeds template mode. Captured for every method that actually sends
|
|
635
|
-
// one — keyed on the body being present, not on `method === 'POST'`, because
|
|
636
|
-
// PUT/PATCH bodies are equally real. Omitted entirely when there is nothing
|
|
637
|
-
// to store, so `deriveDefaultPayloadTemplate` falls back cleanly.
|
|
638
|
-
...(isNonEmptyBody(requestBody)
|
|
639
|
-
? { requestBody: requestBody }
|
|
640
|
-
: {}),
|
|
641
|
-
},
|
|
642
|
-
};
|
|
643
832
|
this.#localValue.set(config);
|
|
644
833
|
this.valueChanged.emit(config);
|
|
645
834
|
}
|
|
@@ -651,26 +840,6 @@ class RestApiCallSetupComponent {
|
|
|
651
840
|
this.#localValue.set(undefined);
|
|
652
841
|
this.valueChanged.emit(undefined);
|
|
653
842
|
}
|
|
654
|
-
/**
|
|
655
|
-
* Derives the POST endpoint's required inputs from the request body. Top-level
|
|
656
|
-
* keys are primary; entries under `data` are secondary (non-primary).
|
|
657
|
-
*
|
|
658
|
-
* **Deliberately flat.** `MinimumInputRequiredInterface` has a `name`, not a path,
|
|
659
|
-
* so a nested value can only ever become one `JsDataTypes.Object` entry — mapping
|
|
660
|
-
* `filter.archive` is not expressible here. That is what template mode is for, and
|
|
661
|
-
* why the untouched `requestBody` is captured alongside this (see the caller): it is
|
|
662
|
-
* the only faithful record of a nested payload.
|
|
663
|
-
*/
|
|
664
|
-
#extractRequiredInputs(requestBody) {
|
|
665
|
-
const { data, ...rest } = requestBody;
|
|
666
|
-
const dataEntries = data && typeof data === 'object' ? { ...data } : {};
|
|
667
|
-
const primaryKeys = Object.entries(rest).map(([key, val]) => this.#toRequiredInput(key, val, true));
|
|
668
|
-
const secondaryKeys = Object.entries(dataEntries).map(([key, val]) => this.#toRequiredInput(key, val, false));
|
|
669
|
-
return [...primaryKeys, ...secondaryKeys];
|
|
670
|
-
}
|
|
671
|
-
#toRequiredInput(name, value, primaryKey) {
|
|
672
|
-
return { name, type: toJsDataType(value), primaryKey };
|
|
673
|
-
}
|
|
674
843
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RestApiCallSetupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
675
844
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: RestApiCallSetupComponent, isStandalone: true, selector: "lib-rest-api-call-setup", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, postmanCollectionConfig: { classPropertyName: "postmanCollectionConfig", publicName: "postmanCollectionConfig", isSignal: true, isRequired: false, transformFunction: null }, httpGetDataFunction: { classPropertyName: "httpGetDataFunction", publicName: "httpGetDataFunction", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChanged: "valueChanged" }, host: { properties: { "id": "hostId()", "attr.data-mode": "mode()" }, classAttribute: "lib-rest-api-call-setup" }, ngImport: i0, template: "@switch (mode()) {\r\n @case ('no-collection') {\r\n <lib-empty-state\r\n icon=\"link_off\"\r\n message=\"No Postman collection configured. Add a collection id and API key to pick an endpoint.\" />\r\n }\r\n\r\n @case ('selected') {\r\n <div class=\"lib-rest-api-call-setup__card\">\r\n <button\r\n type=\"button\"\r\n class=\"lib-rest-api-call-setup__endpoint\"\r\n mat-button\r\n [disabled]=\"disabled()\"\r\n [matTooltip]=\"currentValue()?.httpEndPoint ?? ''\"\r\n (click)=\"clearValue()\">\r\n <span class=\"lib-rest-api-call-setup__method\" [style.color]=\"methodColor()\">\r\n {{ currentValue()?.httpMethod }}\r\n </span>\r\n <span class=\"lib-rest-api-call-setup__name\">\r\n {{ currentValue()?.name }}\r\n </span>\r\n <mat-icon class=\"lib-rest-api-call-setup__clear\" aria-hidden=\"true\">close</mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @case ('picker') {\r\n <lib-postman-collections\r\n class=\"lib-rest-api-call-setup__picker\"\r\n [class.lib-rest-api-call-setup__picker--disabled]=\"disabled()\"\r\n [postmanCollectionConfig]=\"postmanCollectionConfig()!\"\r\n [loadingEndPoints]=\"loadingEndPoints()\"\r\n (nodeSelectionChanged)=\"nodeSelectionChanged($event)\" />\r\n }\r\n}\r\n\r\n@if (disabled()) {\r\n <p class=\"lib-rest-api-call-setup__lock\">\r\n <mat-icon aria-hidden=\"true\">lock</mat-icon>\r\n <span>This endpoint is locked and cannot be changed.</span>\r\n </p>\r\n}\r\n\r\n<lib-error-list [errors]=\"errors()\" />\r\n", styles: [":host{display:flex;flex-direction:column;gap:1.5rem}.lib-rest-api-call-setup__card{background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 15%,transparent);border-radius:var(--lib-forms-radius-lg, 12px);box-shadow:var(--lib-forms-shadow-resting);padding:.5rem}.lib-rest-api-call-setup__endpoint{display:flex;align-items:center;gap:.75rem;width:100%;justify-content:flex-start;padding:.5rem .75rem;font-weight:400;text-align:left;color:var(--lib-forms-on-surface);overflow:hidden}.lib-rest-api-call-setup__method{flex:0 0 auto;font-size:.625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase}.lib-rest-api-call-setup__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--lib-forms-on-surface)}.lib-rest-api-call-setup__clear{flex:0 0 auto;color:var(--lib-forms-on-surface-variant)}.lib-rest-api-call-setup__picker--disabled{opacity:.55;pointer-events:none}.lib-rest-api-call-setup__lock{display:flex;align-items:center;gap:.5rem;margin:0;font-size:.8125rem;line-height:1.4;color:var(--lib-forms-on-surface-variant)}\n"], dependencies: [{ kind: "component", type: PostmanCollectionsComponent, selector: "lib-postman-collections", inputs: ["postmanCollectionConfig", "loadingEndPoints"], outputs: ["nodeSelectionChanged"] }, { kind: "component", type: EmptyStateComponent, selector: "lib-empty-state", inputs: ["icon", "message"] }, { kind: "component", type: ErrorListComponent, selector: "lib-error-list", inputs: ["errors"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
676
845
|
}
|
|
@@ -695,5 +864,5 @@ var restApiCallSetup_component = /*#__PURE__*/Object.freeze({
|
|
|
695
864
|
RestApiCallSetupComponent: RestApiCallSetupComponent
|
|
696
865
|
});
|
|
697
866
|
|
|
698
|
-
export { RestApiCallSetupComponent as R, payloadDefaultOf as a, bodyModeOf as b, minInputsOf as c,
|
|
699
|
-
//# sourceMappingURL=ngx-t-forms-rest-api-call-setup.component-
|
|
867
|
+
export { RestApiCallSetupComponent as R, payloadDefaultOf as a, bodyModeOf as b, minInputsOf as c, docsHtmlOf as d, deriveConfiguredRequest as e, dependencyLabels as f, restApiCallSetup_component as g, headerCountOf as h, methodColorOf as m, paramCountOf as p, readinessOf as r, sendsBody as s, waitsForLabels as w };
|
|
868
|
+
//# sourceMappingURL=ngx-t-forms-rest-api-call-setup.component-CJyrmfYU.mjs.map
|