ngx-t-forms 3.1.1 → 3.1.3

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.
Files changed (115) hide show
  1. package/fesm2022/{ngx-t-forms-api-endpoint-config.component-CZm3Z_7B.mjs → ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs} +15 -13
  2. package/fesm2022/ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs.map +1 -0
  3. package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-IciY6hb3.mjs → ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs} +2 -2
  4. package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-IciY6hb3.mjs.map → ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs.map} +1 -1
  5. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-CykKxWu0.mjs → ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs} +3 -3
  6. package/fesm2022/{ngx-t-forms-basic-input-input-element.component-CykKxWu0.mjs.map → ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs.map} +1 -1
  7. package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CwI-WEX7.mjs → ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs} +2 -2
  8. package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CwI-WEX7.mjs.map → ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs.map} +1 -1
  9. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-CO_3EQ_v.mjs → ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs} +2 -2
  10. package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-CO_3EQ_v.mjs.map → ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs.map} +1 -1
  11. package/fesm2022/{ngx-t-forms-conditional-display-config.component-Cmf7gDfO.mjs → ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs} +2 -2
  12. package/fesm2022/{ngx-t-forms-conditional-display-config.component-Cmf7gDfO.mjs.map → ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map} +1 -1
  13. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-BHiOEQe4.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs} +2 -2
  14. package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-BHiOEQe4.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs.map} +1 -1
  15. package/fesm2022/{ngx-t-forms-data-source-picker.component-CN51SdCK.mjs → ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs} +6 -6
  16. package/fesm2022/{ngx-t-forms-data-source-picker.component-CN51SdCK.mjs.map → ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs.map} +1 -1
  17. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-c3OSDXWw.mjs → ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs} +2 -2
  18. package/fesm2022/{ngx-t-forms-date-picker-input-element.component-c3OSDXWw.mjs.map → ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs.map} +1 -1
  19. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-C-4fqOF0.mjs → ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs} +2 -2
  20. package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-C-4fqOF0.mjs.map → ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs.map} +1 -1
  21. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-DLzba2AQ.mjs → ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs} +3 -3
  22. package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-DLzba2AQ.mjs.map → ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs.map} +1 -1
  23. package/fesm2022/{ngx-t-forms-document-picker.component-9clYsOcl.mjs → ngx-t-forms-document-picker.component-3mqXc4s6.mjs} +2 -2
  24. package/fesm2022/{ngx-t-forms-document-picker.component-9clYsOcl.mjs.map → ngx-t-forms-document-picker.component-3mqXc4s6.mjs.map} +1 -1
  25. package/fesm2022/{ngx-t-forms-editor-js-input.component-02HnmInT.mjs → ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs} +46 -191
  26. package/fesm2022/ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs.map +1 -0
  27. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-BF7KbSPb.mjs → ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs} +2 -2
  28. package/fesm2022/{ngx-t-forms-file-upload-input-element.component-BF7KbSPb.mjs.map → ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs.map} +1 -1
  29. package/fesm2022/{ngx-t-forms-form-input-selector.component-vCj2SCxs.mjs → ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs} +2 -3
  30. package/fesm2022/{ngx-t-forms-form-input-selector.component-vCj2SCxs.mjs.map → ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs.map} +1 -1
  31. package/fesm2022/{ngx-t-forms-form-json-view.component-Cmw1hHGZ.mjs → ngx-t-forms-form-json-view.component-DsEizrc-.mjs} +2 -2
  32. package/fesm2022/{ngx-t-forms-form-json-view.component-Cmw1hHGZ.mjs.map → ngx-t-forms-form-json-view.component-DsEizrc-.mjs.map} +1 -1
  33. package/fesm2022/{ngx-t-forms-form-section-stepper.component-CFdwgxRl.mjs → ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs} +4 -4
  34. package/fesm2022/{ngx-t-forms-form-section-stepper.component-CFdwgxRl.mjs.map → ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs.map} +1 -1
  35. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-DisrOv5x.mjs → ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs} +4 -4
  36. package/fesm2022/{ngx-t-forms-forms-builder-menu.component-DisrOv5x.mjs.map → ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs.map} +1 -1
  37. package/fesm2022/{ngx-t-forms-geo-location.component-D-BhLdx6.mjs → ngx-t-forms-geo-location.component-Cml0Do4m.mjs} +2 -2
  38. package/fesm2022/{ngx-t-forms-geo-location.component-D-BhLdx6.mjs.map → ngx-t-forms-geo-location.component-Cml0Do4m.mjs.map} +1 -1
  39. package/fesm2022/{ngx-t-forms-header-template-editor.component-Z5frEhho.mjs → ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs} +2 -3
  40. package/fesm2022/{ngx-t-forms-header-template-editor.component-Z5frEhho.mjs.map → ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs.map} +1 -1
  41. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-CoJTXMbL.mjs → ngx-t-forms-image-capture-input-element.component-IFval472.mjs} +2 -2
  42. package/fesm2022/{ngx-t-forms-image-capture-input-element.component-CoJTXMbL.mjs.map → ngx-t-forms-image-capture-input-element.component-IFval472.mjs.map} +1 -1
  43. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs +2 -0
  44. package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs.map +1 -0
  45. package/fesm2022/{ngx-t-forms-input-custom.component-s1ryJQy4.mjs → ngx-t-forms-input-custom.component-q8jPq7KI.mjs} +2 -2
  46. package/fesm2022/{ngx-t-forms-input-custom.component-s1ryJQy4.mjs.map → ngx-t-forms-input-custom.component-q8jPq7KI.mjs.map} +1 -1
  47. package/fesm2022/{ngx-t-forms-input-editor.component-oIzCTmbx.mjs → ngx-t-forms-input-editor.component-zL4cp2gq.mjs} +3 -4
  48. package/fesm2022/{ngx-t-forms-input-editor.component-oIzCTmbx.mjs.map → ngx-t-forms-input-editor.component-zL4cp2gq.mjs.map} +1 -1
  49. package/fesm2022/{ngx-t-forms-map-mat-options-keys-C1kxlZS_.mjs → ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs} +2 -2
  50. package/fesm2022/{ngx-t-forms-map-mat-options-keys-C1kxlZS_.mjs.map → ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs.map} +1 -1
  51. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-wskkKr4y.mjs → ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs} +2 -2
  52. package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-wskkKr4y.mjs.map → ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs.map} +1 -1
  53. package/fesm2022/{ngx-t-forms-missing-form-configs.component-C1XuXRdn.mjs → ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs} +2 -2
  54. package/fesm2022/{ngx-t-forms-missing-form-configs.component-C1XuXRdn.mjs.map → ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs.map} +1 -1
  55. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BJrOTRuQ.mjs → ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs} +2 -2
  56. package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BJrOTRuQ.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs.map} +1 -1
  57. package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs +594 -0
  58. package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs.map +1 -0
  59. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-GyKF31Ve.mjs → ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs} +2 -2
  60. package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-GyKF31Ve.mjs.map → ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs.map} +1 -1
  61. package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-BrPJPR2R.mjs → ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs} +34 -30
  62. package/fesm2022/ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs.map +1 -0
  63. package/fesm2022/{ngx-t-forms-ngx-t-forms-DqAcUfN4.mjs → ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs} +1079 -67
  64. package/fesm2022/ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs.map +1 -0
  65. package/fesm2022/{ngx-t-forms-paginated-selection-table-Bk77dBo9.mjs → ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs} +2 -2
  66. package/fesm2022/{ngx-t-forms-paginated-selection-table-Bk77dBo9.mjs.map → ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs.map} +1 -1
  67. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CVzOTLYE.mjs → ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs} +2 -3
  68. package/fesm2022/{ngx-t-forms-payload-template-editor.component-CVzOTLYE.mjs.map → ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs.map} +1 -1
  69. package/fesm2022/{ngx-t-forms-pipeline-generator.component-7Vfwaqnx.mjs → ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs} +2 -2
  70. package/fesm2022/{ngx-t-forms-pipeline-generator.component-7Vfwaqnx.mjs.map → ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs.map} +1 -1
  71. package/fesm2022/ngx-t-forms-quill-input.component-CKYNVDDV.mjs +731 -0
  72. package/fesm2022/ngx-t-forms-quill-input.component-CKYNVDDV.mjs.map +1 -0
  73. package/fesm2022/{ngx-t-forms-record-list-manager.component-CfZdqKhY.mjs → ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs} +2 -2
  74. package/fesm2022/{ngx-t-forms-record-list-manager.component-CfZdqKhY.mjs.map → ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs.map} +1 -1
  75. package/fesm2022/{ngx-t-forms-required-inputs.component-CK7NIhbq.mjs → ngx-t-forms-required-inputs.component-D_cQIScV.mjs} +2 -3
  76. package/fesm2022/{ngx-t-forms-required-inputs.component-CK7NIhbq.mjs.map → ngx-t-forms-required-inputs.component-D_cQIScV.mjs.map} +1 -1
  77. package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-YChv7Arm.mjs → ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs} +150 -3
  78. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs.map +1 -0
  79. package/fesm2022/{ngx-t-forms-section-report.component-DhSaf85h.mjs → ngx-t-forms-section-report.component-m2Z6qA3j.mjs} +2 -2
  80. package/fesm2022/{ngx-t-forms-section-report.component-DhSaf85h.mjs.map → ngx-t-forms-section-report.component-m2Z6qA3j.mjs.map} +1 -1
  81. package/fesm2022/{ngx-t-forms-select-input-element.component-D5HFzh35.mjs → ngx-t-forms-select-input-element.component-DH5knOzd.mjs} +2 -2
  82. package/fesm2022/{ngx-t-forms-select-input-element.component-D5HFzh35.mjs.map → ngx-t-forms-select-input-element.component-DH5knOzd.mjs.map} +1 -1
  83. package/fesm2022/{ngx-t-forms-selection-options-editor.component-BhmmJOco.mjs → ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs} +2 -2
  84. package/fesm2022/{ngx-t-forms-selection-options-editor.component-BhmmJOco.mjs.map → ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs.map} +1 -1
  85. package/fesm2022/{ngx-t-forms-textarea-input-element.component-DWEADTsz.mjs → ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs} +2 -2
  86. package/fesm2022/{ngx-t-forms-textarea-input-element.component-DWEADTsz.mjs.map → ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs.map} +1 -1
  87. package/fesm2022/{ngx-t-forms-toggle-input-element.component-XZi6kPnL.mjs → ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs} +2 -2
  88. package/fesm2022/{ngx-t-forms-toggle-input-element.component-XZi6kPnL.mjs.map → ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs.map} +1 -1
  89. package/fesm2022/ngx-t-forms-token-binding-menu.component-CLpjkUnf.mjs +109 -0
  90. package/fesm2022/ngx-t-forms-token-binding-menu.component-CLpjkUnf.mjs.map +1 -0
  91. package/fesm2022/ngx-t-forms-token-text-input.component-BQADsnFn.mjs +296 -0
  92. package/fesm2022/ngx-t-forms-token-text-input.component-BQADsnFn.mjs.map +1 -0
  93. package/fesm2022/{ngx-t-forms-validators-config.component-0_Y6bvtE.mjs → ngx-t-forms-validators-config.component-qO6Y4x1v.mjs} +2 -2
  94. package/fesm2022/{ngx-t-forms-validators-config.component-0_Y6bvtE.mjs.map → ngx-t-forms-validators-config.component-qO6Y4x1v.mjs.map} +1 -1
  95. package/fesm2022/ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs +2096 -0
  96. package/fesm2022/ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map +1 -0
  97. package/fesm2022/ngx-t-forms.mjs +1 -1
  98. package/package.json +2 -2
  99. package/styles/_tokens.scss +6 -0
  100. package/types/ngx-t-forms.d.ts +53 -1
  101. package/fesm2022/ngx-t-forms-api-endpoint-config.component-CZm3Z_7B.mjs.map +0 -1
  102. package/fesm2022/ngx-t-forms-editor-input-element.component-BGdZ4evj.mjs +0 -417
  103. package/fesm2022/ngx-t-forms-editor-input-element.component-BGdZ4evj.mjs.map +0 -1
  104. package/fesm2022/ngx-t-forms-editor-js-input.component-02HnmInT.mjs.map +0 -1
  105. package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs +0 -31
  106. package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs.map +0 -1
  107. package/fesm2022/ngx-t-forms-index-D8xr_Sxp.mjs +0 -2
  108. package/fesm2022/ngx-t-forms-index-D8xr_Sxp.mjs.map +0 -1
  109. package/fesm2022/ngx-t-forms-multiple-input-input-element.component-BrPJPR2R.mjs.map +0 -1
  110. package/fesm2022/ngx-t-forms-ngx-t-forms-DqAcUfN4.mjs.map +0 -1
  111. package/fesm2022/ngx-t-forms-rest-api-call-setup.component-YChv7Arm.mjs.map +0 -1
  112. package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs +0 -173
  113. package/fesm2022/ngx-t-forms-token-transform-D_wsFbNc.mjs.map +0 -1
  114. package/fesm2022/ngx-t-forms-workflow-adjudication.component-Gkimmw-X.mjs +0 -1303
  115. package/fesm2022/ngx-t-forms-workflow-adjudication.component-Gkimmw-X.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngx-t-forms-rest-api-call-setup.component-YChv7Arm.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/api-endpoint-config/api-endpoint-config.logic.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/postman-collections/functions/filterCollectionItems.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/postman-collections/functions/methodColors.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/postman-collections/postman-collections.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/postman-collections/postman-collections.component.html","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/rest-api-call-setup/rest-api-call-setup.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/rest-api-call-setup/rest-api-call-setup.component.html"],"sourcesContent":["import type {\n APIDataFetchingConfigurationInterface,\n FormColumnInputs,\n MinimumInputRequiredInterface,\n PayloadTemplate,\n RequestBodyMode,\n} from 'ngx-t-forms-types';\n\nimport {\n collectHeaderTemplateInputIds,\n collectQueryTemplateInputIds,\n mergeHeaderOptions,\n mergeQueryOptions,\n resolveHeaderTemplate,\n resolveQueryTemplate,\n} from '../../../../services/core/t-form-tower-controller/functions/builders/header-template';\nimport { collectMinInputDepIds } from '../../../../services/core/t-form-tower-controller/functions/builders/missing-dependency-hint';\nimport {\n collectTemplateInputIds,\n resolvePayloadTemplate,\n} from '../../../../services/core/t-form-tower-controller/functions/builders/payload-template';\nimport { deriveDefaultPayloadTemplate } from '../../../../services/core/t-form-builder/functions/deriveDefaultPayloadTemplate';\nimport { returnMappedData } from '../../../../services/core/t-form-controller/function/postApiDataFetching';\n\n/**\n * Pure derivations shared by the inline endpoint summary\n * (`ApiEndpointConfigComponent`) and the full-screen editor dialog\n * (`ApiEndpointConfigDialogComponent`), so the two surfaces can never disagree\n * about what a fetch configuration contains or waits for.\n */\n\n/** One entry in the readiness rail. */\nexport interface ReadinessItem {\n readonly label: string;\n readonly state: 'done' | 'pending' | 'skip';\n}\n\n/** HTTP method understood by the method-colour map; falls back to neutral. */\ntype HttpMethod = APIDataFetchingConfigurationInterface['httpMethod'];\n\n/** CSS-variable colour per HTTP method (dark-mode-safe; never a hex literal). */\nexport const METHOD_COLOR: Readonly<Record<HttpMethod, string>> = {\n GET: 'var(--lib-forms-method-get)',\n POST: 'var(--lib-forms-method-post)',\n PUT: 'var(--lib-forms-method-put)',\n DELETE: 'var(--lib-forms-method-delete)',\n};\n\n/** Token colour for a config's HTTP method badge; `currentColor` when unknown. */\nexport function methodColorOf(cfg: APIDataFetchingConfigurationInterface | undefined): string {\n const method = cfg?.httpMethod;\n return method && method in METHOD_COLOR ? METHOD_COLOR[method] : 'currentColor';\n}\n\n/** POST and PUT carry a body; GET (and anything else) has no body panel. */\nexport function sendsBody(cfg: APIDataFetchingConfigurationInterface | undefined): boolean {\n const method = cfg?.httpMethod?.toUpperCase();\n return method === 'POST' || method === 'PUT';\n}\n\n/** Active body mechanism — unset means mapped inputs (runtime parity). */\nexport function bodyModeOf(cfg: APIDataFetchingConfigurationInterface | undefined): RequestBodyMode {\n return cfg?.backEndConfig?.requestBodyMode === 'template' ? 'template' : 'mappedInputs';\n}\n\n/** The configured minimum-input mapping, `[]` when none. */\nexport function minInputsOf(\n cfg: APIDataFetchingConfigurationInterface | undefined,\n): MinimumInputRequiredInterface[] {\n return cfg?.backEndConfig?.minimumInputRequired ?? [];\n}\n\n/** True once a response mapping has been authored. */\nexport function hasMappingOf(cfg: APIDataFetchingConfigurationInterface | undefined): boolean {\n const rules = cfg?.valueAccessRules;\n return Array.isArray(rules) ? rules.length > 0 : Boolean(rules);\n}\n\n/**\n * Number of query parameters the request carries — the authored template when\n * one exists, otherwise the endpoint's captured params (what the editor opens\n * on). Display-only; the runtime sends the authored template.\n */\nexport function paramCountOf(cfg: APIDataFetchingConfigurationInterface | undefined): number {\n return Object.keys(cfg?.queryTemplate ?? cfg?.capturedQuery ?? {}).length;\n}\n\n/** Number of request headers — same authored-else-captured read as params. */\nexport function headerCountOf(cfg: APIDataFetchingConfigurationInterface | undefined): number {\n return Object.keys(cfg?.headerTemplate ?? cfg?.capturedHeaders ?? {}).length;\n}\n\n/** Editor default for template mode, derived from the captured body/mapping. */\nexport function payloadDefaultOf(\n cfg: APIDataFetchingConfigurationInterface | undefined,\n): PayloadTemplate {\n return deriveDefaultPayloadTemplate(cfg?.backEndConfig) as PayloadTemplate;\n}\n\n/** The readiness rail, in configuration order. */\nexport function readinessOf(\n cfg: APIDataFetchingConfigurationInterface | undefined,\n kind: 'value' | 'options',\n): readonly ReadinessItem[] {\n const items: ReadinessItem[] = [\n { label: 'Endpoint', state: cfg?.httpEndPoint ? 'done' : 'pending' },\n ];\n if (sendsBody(cfg)) {\n const bodyDone =\n bodyModeOf(cfg) === 'template'\n ? Boolean(cfg?.backEndConfig?.payloadTemplate)\n : minInputsOf(cfg).length > 0;\n items.push({ label: 'Body', state: bodyDone ? 'done' : 'pending' });\n }\n items.push({\n label: kind === 'options' ? 'Options mapping' : 'Response mapping',\n state: hasMappingOf(cfg) ? 'done' : 'skip',\n });\n return items;\n}\n\n/**\n * Labels of the live fields this fetch waits for at fill time — the union of\n * header tokens, query tokens, and the active body mechanism's dependencies,\n * collected with the SAME pure helpers the runtime gates with.\n */\nexport function waitsForLabels(\n cfg: APIDataFetchingConfigurationInterface | undefined,\n formInputs: readonly FormColumnInputs[],\n): readonly string[] {\n if (!cfg) return [];\n const ids = new Set<string>([\n ...collectHeaderTemplateInputIds(cfg.headerTemplate),\n ...collectQueryTemplateInputIds(cfg.queryTemplate),\n ]);\n if (sendsBody(cfg)) {\n if (bodyModeOf(cfg) === 'template') {\n for (const tokenId of collectTemplateInputIds(cfg.backEndConfig?.payloadTemplate)) {\n ids.add(tokenId);\n }\n } else {\n for (const minInput of minInputsOf(cfg)) {\n for (const depId of collectMinInputDepIds(minInput)) ids.add(depId);\n }\n }\n }\n return [...ids].map((depId) => labelOf(formInputs, depId));\n}\n\n/**\n * A builder-side test request derived from the configuration alone — what the\n * dialog's \"Run API call\" sends to refresh the sample response.\n *\n * Built with the SAME pure resolvers the runtime request-gating uses, with one\n * deliberate difference: at build time there are no live form values, so\n * instead of idling on an unmet `{{inputId}}` token the request is sent with\n * that value empty/omitted and the token's id reported in `unresolved` — the\n * admin wants the fresh response SHAPE, and the UI names what was missing.\n *\n * The URL is passed **verbatim** (env `{{$KEY}}` tokens included), exactly as\n * the runtime passes it: the host-provided HTTP functions own URL resolution.\n */\nexport interface ConfiguredTestRequest {\n readonly method: HttpMethod;\n readonly url: string;\n /** The merged HttpClient options bag (persisted + resolved header/query templates). */\n readonly options: APIDataFetchingConfigurationInterface['httpHeaderOptions'];\n /** The request body for body-bearing methods; `undefined` for GET. */\n readonly body: Record<string, unknown> | undefined;\n /** inputIds bound to live fields that could not resolve at build time. */\n readonly unresolved: readonly string[];\n}\n\n/**\n * Derives the {@link ConfiguredTestRequest} for a fetch config, or `undefined`\n * while no endpoint is configured (there is nothing to run).\n *\n * @param cfg - The fetch-slot configuration.\n * @returns The runnable request, or `undefined` without an endpoint.\n */\nexport function deriveConfiguredRequest(\n cfg: APIDataFetchingConfigurationInterface | undefined,\n): ConfiguredTestRequest | undefined {\n if (!cfg?.httpEndPoint) return undefined;\n\n const noLiveValues = (): undefined => undefined;\n const headers = resolveHeaderTemplate(cfg.headerTemplate, noLiveValues);\n const query = resolveQueryTemplate(cfg.queryTemplate, noLiveValues);\n const unresolved = new Set<string>([...headers.missing, ...query.missing]);\n\n let body: Record<string, unknown> | undefined;\n if (sendsBody(cfg)) {\n if (bodyModeOf(cfg) === 'template' && cfg.backEndConfig?.payloadTemplate) {\n const resolved = resolvePayloadTemplate(cfg.backEndConfig.payloadTemplate, noLiveValues);\n for (const id of resolved.missing) unresolved.add(id);\n body = resolved.payload as Record<string, unknown>;\n } else {\n const minInputs = minInputsOf(cfg);\n // Defaults resolve; mapped entries have no live value yet — send the\n // body anyway (shape over completeness) and name what was missing.\n try {\n body = returnMappedData({}, minInputs, cfg.httpEndPoint) as Record<string, unknown>;\n } catch {\n body = { data: undefined };\n }\n for (const minInput of minInputs) {\n for (const depId of collectMinInputDepIds(minInput)) unresolved.add(depId);\n }\n }\n }\n\n return {\n method: (cfg.httpMethod?.toUpperCase() as HttpMethod) ?? 'GET',\n url: cfg.httpEndPoint,\n options: mergeQueryOptions(\n mergeHeaderOptions(cfg.httpHeaderOptions, headers.headers),\n query.params,\n ),\n body,\n unresolved: [...unresolved],\n };\n}\n\n/** Friendly labels for a set of dependency ids (date-range halves included). */\nexport function dependencyLabels(\n formInputs: readonly FormColumnInputs[],\n ids: readonly string[],\n): readonly string[] {\n return ids.map((depId) => labelOf(formInputs, depId));\n}\n\n/** Resolves a dependency id to a friendly label (date-range halves included). */\nfunction labelOf(inputs: readonly FormColumnInputs[], depId: string): string {\n const direct = inputs.find((candidate) => candidate.id === depId);\n if (direct?.label) return direct.label;\n // A date-range dependency is the HALF id `${columnId}.${key}` while the\n // builder's input list carries the raw column — name it via the column.\n const dot = depId.indexOf('.');\n if (dot > 0) {\n const column = inputs.find((candidate) => candidate.id === depId.slice(0, dot));\n if (column?.label) return `${column.label} (${depId.slice(dot + 1)})`;\n }\n return depId;\n}\n","import type { IFolderItem, IGetPostmanCollections } from 'ngx-t-forms-types';\r\n\r\n/** True when an item's own name or description contains the (already-lowercased) search text. */\r\nfunction itemMatches(item: IFolderItem, searchText: string): boolean {\r\n return (\r\n (item.name?.toLowerCase().includes(searchText) ?? false) ||\r\n (item.description?.toLowerCase().includes(searchText) ?? false)\r\n );\r\n}\r\n\r\n/**\r\n * Recursively prunes a folder tree to the items relevant to `searchText`.\r\n *\r\n * An item is kept when it matches directly (its whole subtree is then\r\n * preserved) OR when one of its descendants matches — in which case the\r\n * ancestor folder is preserved but its children are pruned to only the\r\n * matching branches. This fixes the legacy defect where ancestor folders of a\r\n * deep match were dropped (or whole sibling subtrees were retained).\r\n */\r\nfunction pruneItems(items: IFolderItem[] | undefined, searchText: string): IFolderItem[] {\r\n if (!items) {\r\n return [];\r\n }\r\n return items.reduce<IFolderItem[]>((kept, item) => {\r\n if (itemMatches(item, searchText)) {\r\n // Direct hit: keep the item and its full subtree intact.\r\n kept.push(item);\r\n return kept;\r\n }\r\n const matchingChildren = pruneItems(item.item, searchText);\r\n if (matchingChildren.length > 0) {\r\n // Ancestor of a match: keep the folder but only the matching branches.\r\n kept.push({ ...item, item: matchingChildren });\r\n }\r\n return kept;\r\n }, []);\r\n}\r\n\r\n/**\r\n * Filters a fetched Postman collection by a free-text search key, preserving\r\n * the ancestor folders of every match. An empty/whitespace key returns the\r\n * full set of top-level items unchanged.\r\n */\r\nexport function filterCollectionItems(\r\n collections: IGetPostmanCollections,\r\n searchKey: string,\r\n): IFolderItem[] {\r\n const items = collections.collection.item;\r\n const searchText = searchKey.trim().toLowerCase();\r\n if (!searchText) {\r\n return items;\r\n }\r\n return pruneItems(items, searchText);\r\n}\r\n","/**\r\n * Maps an HTTP method to its design-token CSS colour value.\r\n *\r\n * Returns a `var(--lib-forms-method-*)` reference (dark-mode safe, no hex /\r\n * named colours) so the tree can colour-code endpoints. Unknown methods fall\r\n * back to `currentColor`. Matching is case-insensitive.\r\n */\r\nexport function methodColor(method: string): string {\r\n switch (method.toUpperCase()) {\r\n case 'GET':\r\n return 'var(--lib-forms-method-get)';\r\n case 'POST':\r\n return 'var(--lib-forms-method-post)';\r\n case 'PUT':\r\n return 'var(--lib-forms-method-put)';\r\n case 'PATCH':\r\n return 'var(--lib-forms-method-patch)';\r\n case 'DELETE':\r\n return 'var(--lib-forms-method-delete)';\r\n default:\r\n return 'currentColor';\r\n }\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DestroyRef,\r\n ViewEncapsulation,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { HttpErrorResponse } from '@angular/common/http';\r\nimport { catchError, take, tap, throwError } from 'rxjs';\r\n\r\nimport { MatTreeModule } from '@angular/material/tree';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\n\r\nimport type {\r\n FlatNode,\r\n IFolderItem,\r\n IGetPostmanCollections,\r\n IPostmanCollectionConfig,\r\n TreeNode,\r\n} from 'ngx-t-forms-types';\r\n\r\nimport { TreeComponent } from '../api-value-access-rules/functions/convertDataToTree';\r\nimport { convertPostmanFolderItemsToTree } from './functions/convertPostmanCollectionToTree';\r\nimport { filterCollectionItems } from './functions/filterCollectionItems';\r\nimport { methodColor } from './functions/methodColors';\r\nimport { SearchFieldComponent } from '../_shared/search-field/search-field.component';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\nimport { PostmanCollectionLoaderService } from '../_shared/postman-collection-loader.service';\r\nimport { _isEqual } from '../../../../shared/functions/isEqual';\r\n\r\n/**\r\n * Internal Postman-collection picker used by `rest-api-call-setup`.\r\n *\r\n * Fetches a Postman collection over HTTP and renders it as a searchable tree of\r\n * endpoints, emitting the selected folder item to the parent. Embedded\r\n * component — owns only its tree content; the parent renders any field\r\n * label / hint / errors.\r\n */\r\n@Component({\r\n selector: 'lib-postman-collections',\r\n templateUrl: './postman-collections.component.html',\r\n styleUrls: ['./postman-collections.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n host: { 'class': 'lib-postman-collections' },\r\n imports: [\r\n MatTreeModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatProgressSpinnerModule,\r\n MatTooltipModule,\r\n SearchFieldComponent,\r\n EmptyStateComponent,\r\n ],\r\n})\r\nexport class PostmanCollectionsComponent {\r\n /** Postman API config (collection URL + key). When invalid the component shows an error. */\r\n readonly postmanCollectionConfig = input<IPostmanCollectionConfig | undefined>(undefined);\r\n\r\n /** Endpoint IDs currently in a loading state (rendered with a spinner in the tree). */\r\n readonly loadingEndPoints = input<string[]>([]);\r\n\r\n /** Emits when the user picks an endpoint node from the tree. */\r\n readonly nodeSelectionChanged = output<IFolderItem>();\r\n\r\n readonly #collectionLoader = inject(PostmanCollectionLoaderService);\r\n readonly #destroyRef = inject(DestroyRef);\r\n\r\n /** Imperative mat-tree backing store reused from the access-rules tree. */\r\n protected readonly treeComponent = new TreeComponent();\r\n\r\n /** Raw fetched collection; `undefined` until the request resolves. */\r\n readonly #collection = signal<IGetPostmanCollections | undefined>(undefined);\r\n\r\n /** Current search text, two-way bound to the search field. */\r\n protected readonly searchKey = signal<string>('');\r\n\r\n /** Request-in-flight flag. */\r\n protected readonly loading = signal<boolean>(false);\r\n\r\n /** Last error (invalid config or HTTP failure); `undefined` when healthy. */\r\n protected readonly error = signal<HttpErrorResponse | undefined>(undefined);\r\n\r\n /** Folder items after applying the current search, ancestor-folders preserved. */\r\n protected readonly filteredItems = computed<IFolderItem[]>(() => {\r\n const collection = this.#collection();\r\n if (!collection) {\r\n return [];\r\n }\r\n return filterCollectionItems(collection, this.searchKey());\r\n });\r\n\r\n /** Tree nodes derived from {@link filteredItems}. */\r\n readonly #treeData = computed<TreeNode[]>(() =>\r\n convertPostmanFolderItemsToTree(this.filteredItems()),\r\n );\r\n\r\n /** True once a collection is loaded but the current search yields nothing. */\r\n protected readonly isEmpty = computed<boolean>(\r\n () => Boolean(this.#collection()) && this.#treeData().length === 0,\r\n );\r\n\r\n /** Cache for {@link getNodeLines} so identical levels reuse one array. */\r\n readonly #nodeLinesCache = new Map<number, readonly number[]>();\r\n\r\n /** Push derived tree data into the imperative mat-tree data source. */\r\n protected readonly syncTree = effect(() => {\r\n this.treeComponent.assignDataSourceData(this.#treeData());\r\n });\r\n\r\n /** Last config the effect acted on; guards against re-fetching when an unstable parent binding hands us a new-but-equal reference. */\r\n #loadedConfig: IPostmanCollectionConfig | undefined;\r\n #hasLoadedOnce = false;\r\n\r\n /** Fetch (or re-fetch) the collection only when the config input's content actually changes. */\r\n protected readonly loadOnConfigChange = effect(() => {\r\n const config = this.postmanCollectionConfig();\r\n if (this.#hasLoadedOnce && _isEqual(this.#loadedConfig, config)) {\r\n return;\r\n }\r\n this.#hasLoadedOnce = true;\r\n this.#loadedConfig = config;\r\n this.#loadCollection(config);\r\n });\r\n\r\n #isValidConfig(config: IPostmanCollectionConfig | undefined): config is IPostmanCollectionConfig {\r\n return Boolean(config?.collectionUrl) && Boolean(config?.collectionKey);\r\n }\r\n\r\n #loadCollection(config: IPostmanCollectionConfig | undefined): void {\r\n if (!this.#isValidConfig(config)) {\r\n this.#collection.set(undefined);\r\n this.loading.set(false);\r\n this.error.set(new HttpErrorResponse({ error: 'Invalid Postman Collection Config' }));\r\n return;\r\n }\r\n\r\n this.loading.set(true);\r\n this.#collectionLoader\r\n .getCollection(config)\r\n .pipe(\r\n take(1),\r\n tap(data => {\r\n this.#collection.set(data);\r\n this.error.set(undefined);\r\n this.loading.set(false);\r\n }),\r\n catchError((err: HttpErrorResponse) => {\r\n this.loading.set(false);\r\n this.error.set(err);\r\n return throwError(() => err);\r\n }),\r\n takeUntilDestroyed(this.#destroyRef),\r\n )\r\n .subscribe();\r\n }\r\n\r\n protected selectNode(node: IFolderItem): void {\r\n this.nodeSelectionChanged.emit(node);\r\n }\r\n\r\n protected methodColor(method: string): string {\r\n return methodColor(method);\r\n }\r\n\r\n /**\r\n * `true` when an endpoint cannot be configured onto an input: no URL, a\r\n * body-bearing method (POST/PUT) captured without a body to map, or DELETE —\r\n * which the runtime has no transport for (owner decision 2026-08-18: PUT is\r\n * supported and rides the POST family; DELETE stays blocked here until a\r\n * real need arrives).\r\n */\r\n protected isUnselectable(request: {\r\n method?: string;\r\n url?: { raw?: string };\r\n body?: { raw?: string };\r\n }): boolean {\r\n if (!request.url?.raw) return true;\r\n if (request.method === 'DELETE') return true;\r\n return !request.body?.raw && (request.method === 'POST' || request.method === 'PUT');\r\n }\r\n\r\n /** Why the endpoint is (un)selectable — shown as the row tooltip. */\r\n protected selectionTooltip(request: {\r\n method?: string;\r\n url?: { raw?: string };\r\n body?: { raw?: string };\r\n }): string {\r\n if (!request.url?.raw) return 'Invalid Postman config, missing Endpoint URL';\r\n if (request.method === 'DELETE') return 'DELETE endpoints are not supported';\r\n if (!request.body?.raw && (request.method === 'POST' || request.method === 'PUT')) {\r\n return `This ${request.method} endpoint has no request body to map`;\r\n }\r\n return request.url.raw;\r\n }\r\n\r\n protected isEndpointLoading(id: string): boolean {\r\n return this.loadingEndPoints().includes(id);\r\n }\r\n\r\n protected hasChild = (_: number, node: FlatNode): boolean =>\r\n this.treeComponent.hasChild(_, node);\r\n\r\n /** Memoised 1..level vertical guide-line indices for tree indentation. */\r\n protected getNodeLines(level: number): readonly number[] {\r\n const cached = this.#nodeLinesCache.get(level);\r\n if (cached) {\r\n return cached;\r\n }\r\n const lines = Array.from({ length: level }, (_, i) => i + 1);\r\n this.#nodeLinesCache.set(level, lines);\r\n return lines;\r\n }\r\n}\r\n","@if (loading()) {\r\n <div class=\"loading-container\">\r\n <mat-spinner diameter=\"36\"></mat-spinner>\r\n </div>\r\n} @else {\r\n <lib-search-field\r\n class=\"search\"\r\n placeholder=\"Search api\"\r\n [(value)]=\"searchKey\" />\r\n\r\n @if (error(); as err) {\r\n <lib-empty-state icon=\"error_outline\" [message]=\"err.message\" />\r\n } @else if (isEmpty()) {\r\n <lib-empty-state\r\n icon=\"search_off\"\r\n [message]=\"searchKey() ? 'No endpoints match your search' : 'No endpoints in this collection'\" />\r\n } @else {\r\n <mat-tree\r\n [dataSource]=\"treeComponent.dataSource\"\r\n [treeControl]=\"treeComponent.treeControl\">\r\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\r\n @if (isEndpointLoading(node.value.id)) {\r\n <mat-spinner diameter=\"22\" class=\"loading-spinner\"></mat-spinner>\r\n }\r\n @for (line of getNodeLines(node.level); track line) {\r\n <div class=\"line\" [style.left.px]=\"line * 40 + 8\"></div>\r\n }\r\n @if (node.value?.request; as request) {\r\n <button\r\n mat-button\r\n class=\"item\"\r\n [disabled]=\"isUnselectable(request)\"\r\n [matTooltip]=\"selectionTooltip(request)\"\r\n (click)=\"selectNode(node.value)\">\r\n <span class=\"node-key method\" [style.color]=\"methodColor(request.method)\">\r\n {{ request.method }}\r\n </span>\r\n <span>{{ node.key }}</span>\r\n </button>\r\n }\r\n </mat-tree-node>\r\n\r\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\r\n <button\r\n mat-icon-button\r\n matTreeNodeToggle\r\n class=\"toggle\"\r\n [attr.aria-label]=\"'Toggle ' + node.key\">\r\n <mat-icon>\r\n {{ treeComponent.treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\r\n </mat-icon>\r\n </button>\r\n <mat-icon class=\"folder-icon\">\r\n {{ treeComponent.treeControl.isExpanded(node) ? 'folder_open' : 'folder' }}\r\n </mat-icon>\r\n <span class=\"folder-label\">{{ node.key }}</span>\r\n </mat-tree-node>\r\n </mat-tree>\r\n }\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ViewEncapsulation,\r\n computed,\r\n effect,\r\n input,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport type { Observable } from 'rxjs';\r\n\r\nimport {\r\n APIDataFetchingConfigurationInterface,\r\n DataSources,\r\n HeaderTemplate,\r\n IFolderItem,\r\n IPostmanCollectionConfig,\r\n JsDataTypes,\r\n MinimumInputRequiredInterface,\r\n QueryTemplate,\r\n} from 'ngx-t-forms-types';\r\n\r\nimport type { IConfigElementError } from '../../t-dynamic-data-edit.component';\r\nimport { _isEqual } from '../../../../shared/functions/isEqual';\r\nimport { EmptyStateComponent } from '../_shared/empty-state/empty-state.component';\r\nimport { ErrorListComponent } from '../_shared/error-list/error-list.component';\r\nimport { METHOD_COLOR } from '../api-endpoint-config/api-endpoint-config.logic';\r\nimport { PostmanCollectionsComponent } from '../postman-collections/postman-collections.component';\r\n\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\n\r\nlet nextId = 0;\r\n\r\n/** Discrete UI mode this editor is in, derived from its inputs and value. */\r\ntype SetupMode = 'no-collection' | 'picker' | 'selected';\r\n\r\n/**\r\n * Parses a Postman raw request body into a plain object.\r\n *\r\n * Returns `{}` for an absent, blank or non-JSON body (a `graphql` / `formdata`\r\n * mode, or raw text with comments). Nesting and key names are preserved exactly as\r\n * authored — this is the document template mode seeds from.\r\n *\r\n * @param raw - `request.body.raw` from the Postman collection.\r\n * @returns The parsed body, or `{}` when there is nothing usable.\r\n */\r\nfunction parseRawBody(raw: string | undefined): Record<string, unknown> {\r\n if (typeof raw !== 'string' || raw.trim() === '') return {};\r\n try {\r\n const parsed: unknown = JSON.parse(raw);\r\n return parsed !== null && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : {};\r\n } catch {\r\n return {};\r\n }\r\n}\r\n\r\n/** True when a parsed body carries at least one key — i.e. it is worth persisting. */\r\nfunction isNonEmptyBody(body: Record<string, unknown>): boolean {\r\n return Object.keys(body).length > 0;\r\n}\r\n\r\n/**\r\n * Collects the endpoint's enabled request headers from the Postman item.\r\n *\r\n * Postman stores headers as `[{ key, value, disabled? }]`; a `disabled` entry is\r\n * one the author deliberately switched off in the collection, so it is skipped\r\n * rather than carried into the form config. The result seeds the header-template\r\n * editor, so the author starts from what the endpoint actually declares and only\r\n * has to swap the values they want bound to live fields.\r\n *\r\n * @param header - `request.header` from the Postman collection.\r\n * @returns The captured `name → value` map (empty when there is nothing usable).\r\n */\r\nfunction parseRequestHeaders(header: unknown): HeaderTemplate {\r\n if (!Array.isArray(header)) return {};\r\n\r\n const captured: Record<string, string> = {};\r\n for (const entry of header as Array<{ key?: unknown; value?: unknown; disabled?: unknown }>) {\r\n if (entry?.disabled === true) continue;\r\n const key = typeof entry?.key === 'string' ? entry.key.trim() : '';\r\n if (key === '') continue;\r\n captured[key] = typeof entry.value === 'string' ? entry.value : String(entry?.value ?? '');\r\n }\r\n return captured;\r\n}\r\n\r\n/**\r\n * Collects the endpoint's enabled URL query params from the Postman item —\r\n * the exact twin of {@link parseRequestHeaders} for `request.url.query`.\r\n * Unticked (`disabled: true`) entries are excluded, mirroring what Postman\r\n * itself would send. Seeds `capturedQuery`, never sent on its own.\r\n *\r\n * @param query - `request.url.query` from the Postman collection.\r\n * @returns The captured `name → value` map (empty when there is nothing usable).\r\n */\r\nfunction parseRequestQuery(query: unknown): QueryTemplate {\r\n if (!Array.isArray(query)) return {};\r\n\r\n const captured: Record<string, string> = {};\r\n for (const entry of query as Array<{ key?: unknown; value?: unknown; disabled?: unknown }>) {\r\n if (entry?.disabled === true) continue;\r\n const key = typeof entry?.key === 'string' ? entry.key.trim() : '';\r\n if (key === '') continue;\r\n captured[key] = typeof entry.value === 'string' ? entry.value : String(entry?.value ?? '');\r\n }\r\n return captured;\r\n}\r\n\r\n/**\r\n * Strips the query string from a captured endpoint URL — but ONLY when the\r\n * query was captured structurally (so nothing is lost): once the params live in\r\n * `capturedQuery`/`queryTemplate`, leaving them in the URL as text would send\r\n * every param twice. A URL whose `?…` had no structured `url.query` entries is\r\n * left verbatim — the text is then the only record of it.\r\n *\r\n * @param raw - `request.url.raw` from the Postman collection.\r\n * @param capturedQuery - What {@link parseRequestQuery} extracted.\r\n * @returns The URL to persist as `httpEndPoint`.\r\n */\r\nfunction stripCapturedQueryString(raw: string, capturedQuery: QueryTemplate): string {\r\n if (Object.keys(capturedQuery).length === 0) return raw;\r\n const cut = raw.indexOf('?');\r\n return cut === -1 ? raw : raw.slice(0, cut);\r\n}\r\n\r\n/** Maps a JS `typeof` string to the shared {@link JsDataTypes} enum member. */\r\nfunction toJsDataType(value: unknown): JsDataTypes {\r\n switch (typeof value) {\r\n case 'string':\r\n return JsDataTypes.String;\r\n case 'number':\r\n return JsDataTypes.Number;\r\n case 'bigint':\r\n return JsDataTypes.BigInt;\r\n case 'boolean':\r\n return JsDataTypes.Boolean;\r\n case 'symbol':\r\n return JsDataTypes.Symbol;\r\n case 'function':\r\n return JsDataTypes.Function;\r\n case 'object':\r\n return JsDataTypes.Object;\r\n default:\r\n return JsDataTypes.Undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Lets the user pick an API endpoint from a Postman collection and exposes the\r\n * resulting {@link APIDataFetchingConfigurationInterface}. Renders one of three\r\n * states — no collection configured, the endpoint picker, or the selected\r\n * endpoint card — and embeds {@link PostmanCollectionsComponent} for the tree.\r\n *\r\n * Internal editor consumed by `t-dynamic-data-edit` and `data-source-picker`;\r\n * the parent owns the field label, hint and validation chrome.\r\n *\r\n * @example\r\n * <lib-rest-api-call-setup\r\n * [postmanCollectionConfig]=\"config()\"\r\n * [value]=\"value()\"\r\n * [disabled]=\"disabled()\"\r\n * (valueChanged)=\"onApiConfig($event)\" />\r\n */\r\n@Component({\r\n selector: 'lib-rest-api-call-setup',\r\n templateUrl: './rest-api-call-setup.component.html',\r\n styleUrl: './rest-api-call-setup.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.Emulated,\r\n imports: [\r\n PostmanCollectionsComponent,\r\n EmptyStateComponent,\r\n ErrorListComponent,\r\n MatButtonModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n ],\r\n host: {\r\n 'class': 'lib-rest-api-call-setup',\r\n '[id]': 'hostId()',\r\n '[attr.data-mode]': 'mode()',\r\n },\r\n})\r\nexport class RestApiCallSetupComponent {\r\n readonly #fallbackId = `lib-rest-api-call-setup-${nextId++}`;\r\n\r\n /** Optional consumer-provided host id. */\r\n readonly id = input<string | undefined>(undefined);\r\n\r\n /** Postman collection that backs the picker. */\r\n readonly postmanCollectionConfig = input<IPostmanCollectionConfig | undefined>(undefined);\r\n\r\n /**\r\n * Optional HTTP GET function for fetching sample responses. Retained on the\r\n * contract for parity; this editor does not invoke it (selection is resolved\r\n * from the Postman collection the parent already loads).\r\n */\r\n readonly httpGetDataFunction = input<\r\n ((url: string, options: Record<string, unknown>) => Observable<unknown>) | undefined\r\n >(undefined);\r\n\r\n /** Disables the picker and shows a lock affordance. */\r\n readonly disabled = input<boolean>(false);\r\n\r\n /** Current configuration value. */\r\n readonly value = input<APIDataFetchingConfigurationInterface | undefined>(undefined);\r\n\r\n /** Validation errors surfaced from the parent editor. */\r\n readonly errors = input<IConfigElementError[] | undefined>([]);\r\n\r\n /** Emits whenever the user selects a new endpoint or clears the value. */\r\n readonly valueChanged = output<APIDataFetchingConfigurationInterface | undefined>();\r\n\r\n /** Endpoint IDs currently loading sample data (forwarded to the picker). */\r\n protected readonly loadingEndPoints = signal<string[]>([]);\r\n\r\n /** Local snapshot of the value, bridged from the `value` input. */\r\n readonly #localValue = signal<APIDataFetchingConfigurationInterface | undefined>(undefined);\r\n\r\n /** Read-only view of the active configuration for the template. */\r\n protected readonly currentValue = this.#localValue.asReadonly();\r\n\r\n /** Host id: consumer-provided or a stable per-instance fallback. */\r\n protected readonly hostId = computed<string>(() => this.id() ?? this.#fallbackId);\r\n\r\n /** True once the snapshot carries a usable endpoint + method. */\r\n protected readonly hasValidValue = computed<boolean>(() => {\r\n const v = this.#localValue();\r\n return Boolean(v?.httpEndPoint) && Boolean(v?.httpMethod);\r\n });\r\n\r\n /** Discrete UI mode driving the template's `@switch`. */\r\n protected readonly mode = computed<SetupMode>(() => {\r\n if (!this.postmanCollectionConfig()) return 'no-collection';\r\n return this.hasValidValue() ? 'selected' : 'picker';\r\n });\r\n\r\n /** Token-based colour for the selected endpoint's HTTP method badge. */\r\n protected readonly methodColor = computed<string>(() => {\r\n const method = this.#localValue()?.httpMethod;\r\n return method && method in METHOD_COLOR ? METHOD_COLOR[method] : 'currentColor';\r\n });\r\n\r\n /**\r\n * Bridge the `value` input into the local mutable snapshot, de-duping with a\r\n * deep structural compare (replaces the legacy `JSON.stringify` equality so\r\n * key order and `undefined` no longer cause spurious resets).\r\n */\r\n protected readonly valueBridge = effect(() => {\r\n const next = this.value();\r\n if (!_isEqual(next, this.#localValue())) {\r\n this.#localValue.set(next);\r\n }\r\n });\r\n\r\n /**\r\n * Maps the selected tree node into the API config and emits it.\r\n *\r\n * Gated on `request` alone. It used to also require `node.response` — a saved\r\n * Postman *example response* — even though nothing here reads it. An endpoint\r\n * without one could not be selected at all: the click was a silent no-op, the\r\n * config was never rebuilt, `requestBody` was never captured, and template mode\r\n * went on showing whatever skeleton was already persisted. A folder node (the\r\n * only other thing the picker can emit) has no `request`, so that check alone\r\n * is the correct guard.\r\n */\r\n protected nodeSelectionChanged(node: IFolderItem): void {\r\n const { id, name, request } = node;\r\n\r\n if (!request) return;\r\n\r\n const requestBody = parseRawBody(request.body?.raw);\r\n const capturedHeaders = parseRequestHeaders(request.header);\r\n const capturedQuery = parseRequestQuery(request.url.query);\r\n\r\n // PUT is body-bearing exactly like POST (it rides the POST branch family\r\n // at runtime), so it seeds the same required-input mapping.\r\n const sendsBody = request.method === 'POST' || request.method === 'PUT';\r\n const minimumInputRequired: MinimumInputRequiredInterface[] = sendsBody\r\n ? this.#extractRequiredInputs(requestBody)\r\n : [];\r\n\r\n const config: APIDataFetchingConfigurationInterface = {\r\n _id: id,\r\n name,\r\n // Structurally-captured query params are stripped from the URL text so a\r\n // param never rides twice (once as literal text, once via queryTemplate).\r\n httpEndPoint: stripCapturedQueryString(request.url.raw, capturedQuery),\r\n httpMethod: request.method,\r\n source: DataSources.Api,\r\n postFormData: sendsBody,\r\n // The endpoint's own headers, kept so the header-template editor opens on\r\n // what the API declares. Omitted when it declared none, so the editor falls\r\n // back to its skeleton rather than persisting an empty map.\r\n ...(Object.keys(capturedHeaders).length > 0 ? { capturedHeaders } : {}),\r\n // Same contract for the URL's own query params → the query-template editor.\r\n ...(Object.keys(capturedQuery).length > 0 ? { capturedQuery } : {}),\r\n // The endpoint's Postman documentation, verbatim → the Docs tab.\r\n ...(request.description?.trim() ? { capturedDocs: request.description } : {}),\r\n backEndConfig: {\r\n minimumInputRequired,\r\n // The endpoint's untouched body is the ONLY faithful record of a nested\r\n // payload (`minimumInputRequired` entries carry a `name`, not a path), so it\r\n // is what seeds template mode. Captured for every method that actually sends\r\n // one — keyed on the body being present, not on `method === 'POST'`, because\r\n // PUT/PATCH bodies are equally real. Omitted entirely when there is nothing\r\n // to store, so `deriveDefaultPayloadTemplate` falls back cleanly.\r\n ...(isNonEmptyBody(requestBody)\r\n ? { requestBody: requestBody as APIDataFetchingConfigurationInterface['backEndConfig']['requestBody'] }\r\n : {}),\r\n },\r\n };\r\n\r\n this.#localValue.set(config);\r\n this.valueChanged.emit(config);\r\n }\r\n\r\n /**\r\n * Clears the selection and emits a single `undefined` (the legacy double-emit\r\n * — `undefined` then a stub `{ source }` — was removed; see FLAG).\r\n */\r\n protected clearValue(): void {\r\n this.#localValue.set(undefined);\r\n this.valueChanged.emit(undefined);\r\n }\r\n\r\n /**\r\n * Derives the POST endpoint's required inputs from the request body. Top-level\r\n * keys are primary; entries under `data` are secondary (non-primary).\r\n *\r\n * **Deliberately flat.** `MinimumInputRequiredInterface` has a `name`, not a path,\r\n * so a nested value can only ever become one `JsDataTypes.Object` entry — mapping\r\n * `filter.archive` is not expressible here. That is what template mode is for, and\r\n * why the untouched `requestBody` is captured alongside this (see the caller): it is\r\n * the only faithful record of a nested payload.\r\n */\r\n #extractRequiredInputs(requestBody: Record<string, unknown>): MinimumInputRequiredInterface[] {\r\n const { data, ...rest } = requestBody;\r\n const dataEntries: Record<string, unknown> =\r\n data && typeof data === 'object' ? { ...data } : {};\r\n\r\n const primaryKeys = Object.entries(rest).map(([key, val]) =>\r\n this.#toRequiredInput(key, val, true),\r\n );\r\n const secondaryKeys = Object.entries(dataEntries).map(([key, val]) =>\r\n this.#toRequiredInput(key, val, false),\r\n );\r\n\r\n return [...primaryKeys, ...secondaryKeys];\r\n }\r\n\r\n #toRequiredInput(\r\n name: string,\r\n value: unknown,\r\n primaryKey: boolean,\r\n ): MinimumInputRequiredInterface {\r\n return { name, type: toJsDataType(value), primaryKey };\r\n }\r\n}\r\n","@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"],"names":["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a;wBACb,gBAAgB;qBACjB,EAAA,IAAA,EACK;AACJ,wBAAA,OAAO,EAAE,yBAAyB;AAClC,wBAAA,MAAM,EAAE,UAAU;AAClB,wBAAA,kBAAkB,EAAE,QAAQ;AAC7B,qBAAA,EAAA,QAAA,EAAA,olDAAA,EAAA,MAAA,EAAA,CAAA,imCAAA,CAAA,EAAA;;;;;;;;;;"}
@@ -1,173 +0,0 @@
1
- import { ElementTypes } from 'ngx-t-forms-types';
2
- import { g as getInputIcon } from './ngx-t-forms-getInputIcon-B4ADgevZ.mjs';
3
-
4
- /**
5
- * @file Field → `$`-picker binding derivation, shared by every token-binding
6
- * JSON editor (payload templates, header templates).
7
- *
8
- * Both editors offer the same gesture — type `$`, pick a form field, get its
9
- * `{{token}}` inserted — over the same {@link JsonEditorComponent}. The only
10
- * thing that differs is the document being edited, so the field list, the icon
11
- * and kind labels, and the friendly-label ⇄ id aliasing live here rather than
12
- * being copied per editor.
13
- *
14
- * Pure: no Angular DI, no signals. Callers wrap these in `computed()`.
15
- */
16
- /**
17
- * Turns an element type into a short, friendly field-kind label — the muted
18
- * second line in the picker that disambiguates same-named fields.
19
- *
20
- * @param element - The input's element type.
21
- * @returns A spaced, capitalised label (e.g. `MultipleInput` → `Multiple Input`).
22
- */
23
- function humanizeElement(element) {
24
- return String(element)
25
- .replace(/([a-z])([A-Z])/g, '$1 $2')
26
- .replace(/^./, (c) => c.toUpperCase());
27
- }
28
- /**
29
- * The inputs a token may bind to.
30
- *
31
- * Excludes what cannot carry a value at request time: a `SectionTitle` (layout
32
- * only) and a MultipleInput **sub-row** input (`multipleInputInEditId`), whose
33
- * control exists only while its row is open — a token bound to one would resolve
34
- * empty for every closed row and hold the fetch idle forever.
35
- *
36
- * @param formInputs - Every input on the form being configured.
37
- * @returns The bindable inputs, unfiltered by anything else.
38
- */
39
- function bindableInputs(formInputs) {
40
- return formInputs.filter((input) => input.element !== ElementTypes.SectionTitle && !input.multipleInputInEditId && !!input.id);
41
- }
42
- /**
43
- * The bindable inputs as id/label pairs — the input to `buildTokenMaps`.
44
- *
45
- * @param formInputs - Every input on the form being configured.
46
- * @returns One {@link TokenField} per bindable input, labelled by its display
47
- * label (falling back to the raw id when none is authored).
48
- */
49
- function bindableFields(formInputs) {
50
- return bindableInputs(formInputs).map((input) => ({
51
- id: input.id,
52
- label: input.label?.trim() || input.id,
53
- }));
54
- }
55
- /**
56
- * The bindings for the JSON editor's `$`-trigger picker.
57
- *
58
- * The picker shows the friendly label + field kind (never the raw id); the
59
- * inserted token is the friendly `{{Label}}` when that label earned one, else the
60
- * raw `{{id}}`. Each binding also aliases the *other* form, so a pasted or legacy
61
- * `{{id}}` still renders as a valid (clickable) pill — and vice versa.
62
- *
63
- * @param formInputs - Every input on the form being configured.
64
- * @param idToLabel - The `id → label` half of `buildTokenMaps`; only safe,
65
- * uniquely-labelled fields appear in it, so anything absent keeps its raw id.
66
- * @returns One {@link EditorBinding} per bindable input.
67
- */
68
- function fieldEditorBindings(formInputs, idToLabel) {
69
- return bindableInputs(formInputs).map((input) => {
70
- const label = input.label?.trim() || input.id;
71
- const display = idToLabel.get(input.id);
72
- return {
73
- label,
74
- insert: display ? `{{${display}}}` : `{{${input.id}}}`,
75
- searchText: `${input.id} ${input.label ?? ''}`,
76
- icon: getInputIcon(input.element),
77
- detail: humanizeElement(input.element),
78
- aliases: display ? [input.id] : [label],
79
- };
80
- });
81
- }
82
-
83
- /**
84
- * @file Friendly-label ⇄ id token transform for the payload-template editor.
85
- *
86
- * The stored config always uses `{{inputId}}` tokens, but the editor shows the
87
- * user-friendly field **label** inline (`{{Contract Type}}`). This module maps
88
- * between the two forms on a per-field basis.
89
- *
90
- * ### Robustness (why this is safe despite arbitrary labels)
91
- * The transform runs on the **parsed value** (objects/strings), never on raw
92
- * JSON text — so `JSON.stringify`/`parse` handle escaping and a label with a
93
- * quote can never corrupt the document. On top of that, a label only earns a
94
- * friendly token when it is BOTH:
95
- * - **safe** — contains none of `{ } " \` (which would break the `{{…}}`
96
- * delimiters or a raw picker-insertion), and
97
- * - **unique** — no other field shares it (so `label → id` is unambiguous).
98
- *
99
- * Any field failing either test keeps its raw `{{id}}` inline. The friendly view
100
- * is therefore a lossless, best-effort layer that degrades to the id — it can
101
- * never produce invalid JSON or an ambiguous mapping.
102
- */
103
- /** Characters that make a label unusable as a `{{label}}` token. */
104
- const UNSAFE_LABEL = /[{}"\\]/;
105
- /** Matches a `{{token}}` occurrence inside a string (token captured, trimmed by the caller). */
106
- const TOKEN_RE = /\{\{\s*([^{}]+?)\s*\}\}/g;
107
- /**
108
- * Builds the id⇄label token maps for a set of fields, applying the safety and
109
- * uniqueness rules described in the file header.
110
- *
111
- * @param fields - The candidate fields (id + label).
112
- * @returns The bidirectional maps; a field absent from them keeps its raw id.
113
- */
114
- function buildTokenMaps(fields) {
115
- const labelCounts = new Map();
116
- for (const field of fields) {
117
- const label = field.label?.trim();
118
- if (!label || UNSAFE_LABEL.test(label))
119
- continue;
120
- labelCounts.set(label, (labelCounts.get(label) ?? 0) + 1);
121
- }
122
- const idToLabel = new Map();
123
- const labelToId = new Map();
124
- for (const field of fields) {
125
- const label = field.label?.trim();
126
- if (!label || UNSAFE_LABEL.test(label))
127
- continue;
128
- if (labelCounts.get(label) !== 1)
129
- continue; // ambiguous → keep the raw id
130
- if (label === field.id)
131
- continue; // transform would be a no-op
132
- idToLabel.set(field.id, label);
133
- labelToId.set(label, field.id);
134
- }
135
- return { idToLabel, labelToId };
136
- }
137
- /**
138
- * Deep-walks a parsed JSON value, rewriting every `{{token}}` whose trimmed token
139
- * is a key in `lookup` to `{{mappedValue}}`. Unmapped tokens are left untouched.
140
- * Non-string leaves (numbers/booleans/null) pass through unchanged.
141
- *
142
- * @typeParam T - The value shape (preserved).
143
- * @param value - The parsed template value (object / array / primitive / undefined).
144
- * @param lookup - `idToLabel` for display, `labelToId` for save.
145
- * @returns A structurally-cloned value with tokens rewritten (or the original when `lookup` is empty).
146
- */
147
- function mapTemplateTokens(value, lookup) {
148
- if (lookup.size === 0)
149
- return value;
150
- return walk(value, lookup);
151
- }
152
- function walk(node, lookup) {
153
- if (typeof node === 'string') {
154
- return node.replace(TOKEN_RE, (match, rawToken) => {
155
- const mapped = lookup.get(rawToken.trim());
156
- return mapped !== undefined ? `{{${mapped}}}` : match;
157
- });
158
- }
159
- if (Array.isArray(node)) {
160
- return node.map((item) => walk(item, lookup));
161
- }
162
- if (node !== null && typeof node === 'object') {
163
- const out = {};
164
- for (const [key, val] of Object.entries(node)) {
165
- out[key] = walk(val, lookup);
166
- }
167
- return out;
168
- }
169
- return node;
170
- }
171
-
172
- export { bindableFields as a, buildTokenMaps as b, fieldEditorBindings as f, mapTemplateTokens as m };
173
- //# sourceMappingURL=ngx-t-forms-token-transform-D_wsFbNc.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngx-t-forms-token-transform-D_wsFbNc.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/_shared/field-bindings.ts","../../../projects/ngx-t-forms/src/lib/components/t-dynamic-data-edit/elements/payload-template-editor/token-transform.ts"],"sourcesContent":["/**\r\n * @file Field → `$`-picker binding derivation, shared by every token-binding\r\n * JSON editor (payload templates, header templates).\r\n *\r\n * Both editors offer the same gesture — type `$`, pick a form field, get its\r\n * `{{token}}` inserted — over the same {@link JsonEditorComponent}. The only\r\n * thing that differs is the document being edited, so the field list, the icon\r\n * and kind labels, and the friendly-label ⇄ id aliasing live here rather than\r\n * being copied per editor.\r\n *\r\n * Pure: no Angular DI, no signals. Callers wrap these in `computed()`.\r\n */\r\nimport { ElementTypes } from 'ngx-t-forms-types';\r\nimport type { FormColumnInputs } from 'ngx-t-forms-types';\r\n\r\nimport { getInputIcon } from '../../../../shared/functions/getInputIcon';\r\nimport type { EditorBinding } from '../json-editor/json-editor.component';\r\nimport type { TokenField } from '../payload-template-editor/token-transform';\r\n\r\n/**\r\n * Turns an element type into a short, friendly field-kind label — the muted\r\n * second line in the picker that disambiguates same-named fields.\r\n *\r\n * @param element - The input's element type.\r\n * @returns A spaced, capitalised label (e.g. `MultipleInput` → `Multiple Input`).\r\n */\r\nfunction humanizeElement(element: ElementTypes): string {\r\n return String(element)\r\n .replace(/([a-z])([A-Z])/g, '$1 $2')\r\n .replace(/^./, (c) => c.toUpperCase());\r\n}\r\n\r\n/**\r\n * The inputs a token may bind to.\r\n *\r\n * Excludes what cannot carry a value at request time: a `SectionTitle` (layout\r\n * only) and a MultipleInput **sub-row** input (`multipleInputInEditId`), whose\r\n * control exists only while its row is open — a token bound to one would resolve\r\n * empty for every closed row and hold the fetch idle forever.\r\n *\r\n * @param formInputs - Every input on the form being configured.\r\n * @returns The bindable inputs, unfiltered by anything else.\r\n */\r\nexport function bindableInputs(\r\n formInputs: readonly FormColumnInputs[],\r\n): readonly FormColumnInputs[] {\r\n return formInputs.filter(\r\n (input) => input.element !== ElementTypes.SectionTitle && !input.multipleInputInEditId && !!input.id,\r\n );\r\n}\r\n\r\n/**\r\n * The bindable inputs as id/label pairs — the input to `buildTokenMaps`.\r\n *\r\n * @param formInputs - Every input on the form being configured.\r\n * @returns One {@link TokenField} per bindable input, labelled by its display\r\n * label (falling back to the raw id when none is authored).\r\n */\r\nexport function bindableFields(formInputs: readonly FormColumnInputs[]): readonly TokenField[] {\r\n return bindableInputs(formInputs).map((input) => ({\r\n id: input.id,\r\n label: input.label?.trim() || input.id,\r\n }));\r\n}\r\n\r\n/**\r\n * The bindings for the JSON editor's `$`-trigger picker.\r\n *\r\n * The picker shows the friendly label + field kind (never the raw id); the\r\n * inserted token is the friendly `{{Label}}` when that label earned one, else the\r\n * raw `{{id}}`. Each binding also aliases the *other* form, so a pasted or legacy\r\n * `{{id}}` still renders as a valid (clickable) pill — and vice versa.\r\n *\r\n * @param formInputs - Every input on the form being configured.\r\n * @param idToLabel - The `id → label` half of `buildTokenMaps`; only safe,\r\n * uniquely-labelled fields appear in it, so anything absent keeps its raw id.\r\n * @returns One {@link EditorBinding} per bindable input.\r\n */\r\nexport function fieldEditorBindings(\r\n formInputs: readonly FormColumnInputs[],\r\n idToLabel: ReadonlyMap<string, string>,\r\n): readonly EditorBinding[] {\r\n return bindableInputs(formInputs).map((input) => {\r\n const label = input.label?.trim() || input.id;\r\n const display = idToLabel.get(input.id);\r\n return {\r\n label,\r\n insert: display ? `{{${display}}}` : `{{${input.id}}}`,\r\n searchText: `${input.id} ${input.label ?? ''}`,\r\n icon: getInputIcon(input.element),\r\n detail: humanizeElement(input.element),\r\n aliases: display ? [input.id] : [label],\r\n } satisfies EditorBinding;\r\n });\r\n}\r\n","/**\r\n * @file Friendly-label ⇄ id token transform for the payload-template editor.\r\n *\r\n * The stored config always uses `{{inputId}}` tokens, but the editor shows the\r\n * user-friendly field **label** inline (`{{Contract Type}}`). This module maps\r\n * between the two forms on a per-field basis.\r\n *\r\n * ### Robustness (why this is safe despite arbitrary labels)\r\n * The transform runs on the **parsed value** (objects/strings), never on raw\r\n * JSON text — so `JSON.stringify`/`parse` handle escaping and a label with a\r\n * quote can never corrupt the document. On top of that, a label only earns a\r\n * friendly token when it is BOTH:\r\n * - **safe** — contains none of `{ } \" \\` (which would break the `{{…}}`\r\n * delimiters or a raw picker-insertion), and\r\n * - **unique** — no other field shares it (so `label → id` is unambiguous).\r\n *\r\n * Any field failing either test keeps its raw `{{id}}` inline. The friendly view\r\n * is therefore a lossless, best-effort layer that degrades to the id — it can\r\n * never produce invalid JSON or an ambiguous mapping.\r\n */\r\n\r\n/** A field that can back a token: its stable `id` and its display `label`. */\r\nexport interface TokenField {\r\n readonly id: string;\r\n readonly label: string;\r\n}\r\n\r\n/** Bidirectional token maps (only safe, uniquely-labelled fields are included). */\r\nexport interface TokenMaps {\r\n /** `id → label` (drives the id→friendly display transform + picker insert). */\r\n readonly idToLabel: ReadonlyMap<string, string>;\r\n /** `label → id` (drives the friendly→id save transform). */\r\n readonly labelToId: ReadonlyMap<string, string>;\r\n}\r\n\r\n/** Characters that make a label unusable as a `{{label}}` token. */\r\nconst UNSAFE_LABEL = /[{}\"\\\\]/;\r\n\r\n/** Matches a `{{token}}` occurrence inside a string (token captured, trimmed by the caller). */\r\nconst TOKEN_RE = /\\{\\{\\s*([^{}]+?)\\s*\\}\\}/g;\r\n\r\n/**\r\n * Builds the id⇄label token maps for a set of fields, applying the safety and\r\n * uniqueness rules described in the file header.\r\n *\r\n * @param fields - The candidate fields (id + label).\r\n * @returns The bidirectional maps; a field absent from them keeps its raw id.\r\n */\r\nexport function buildTokenMaps(fields: readonly TokenField[]): TokenMaps {\r\n const labelCounts = new Map<string, number>();\r\n for (const field of fields) {\r\n const label = field.label?.trim();\r\n if (!label || UNSAFE_LABEL.test(label)) continue;\r\n labelCounts.set(label, (labelCounts.get(label) ?? 0) + 1);\r\n }\r\n\r\n const idToLabel = new Map<string, string>();\r\n const labelToId = new Map<string, string>();\r\n for (const field of fields) {\r\n const label = field.label?.trim();\r\n if (!label || UNSAFE_LABEL.test(label)) continue;\r\n if (labelCounts.get(label) !== 1) continue; // ambiguous → keep the raw id\r\n if (label === field.id) continue; // transform would be a no-op\r\n idToLabel.set(field.id, label);\r\n labelToId.set(label, field.id);\r\n }\r\n return { idToLabel, labelToId };\r\n}\r\n\r\n/**\r\n * Deep-walks a parsed JSON value, rewriting every `{{token}}` whose trimmed token\r\n * is a key in `lookup` to `{{mappedValue}}`. Unmapped tokens are left untouched.\r\n * Non-string leaves (numbers/booleans/null) pass through unchanged.\r\n *\r\n * @typeParam T - The value shape (preserved).\r\n * @param value - The parsed template value (object / array / primitive / undefined).\r\n * @param lookup - `idToLabel` for display, `labelToId` for save.\r\n * @returns A structurally-cloned value with tokens rewritten (or the original when `lookup` is empty).\r\n */\r\nexport function mapTemplateTokens<T>(value: T, lookup: ReadonlyMap<string, string>): T {\r\n if (lookup.size === 0) return value;\r\n return walk(value, lookup) as T;\r\n}\r\n\r\nfunction walk(node: unknown, lookup: ReadonlyMap<string, string>): unknown {\r\n if (typeof node === 'string') {\r\n return node.replace(TOKEN_RE, (match, rawToken: string) => {\r\n const mapped = lookup.get(rawToken.trim());\r\n return mapped !== undefined ? `{{${mapped}}}` : match;\r\n });\r\n }\r\n if (Array.isArray(node)) {\r\n return node.map((item) => walk(item, lookup));\r\n }\r\n if (node !== null && typeof node === 'object') {\r\n const out: Record<string, unknown> = {};\r\n for (const [key, val] of Object.entries(node as Record<string, unknown>)) {\r\n out[key] = walk(val, lookup);\r\n }\r\n return out;\r\n }\r\n return node;\r\n}\r\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;AAWG;AAQH;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,OAAqB,EAAA;IAC5C,OAAO,MAAM,CAAC,OAAO;AAClB,SAAA,OAAO,CAAC,iBAAiB,EAAE,OAAO;AAClC,SAAA,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1C;AAEA;;;;;;;;;;AAUG;AACG,SAAU,cAAc,CAC5B,UAAuC,EAAA;AAEvC,IAAA,OAAO,UAAU,CAAC,MAAM,CACtB,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,KAAK,YAAY,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CACrG;AACH;AAEA;;;;;;AAMG;AACG,SAAU,cAAc,CAAC,UAAuC,EAAA;AACpE,IAAA,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM;QAChD,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,EAAE;AACvC,KAAA,CAAC,CAAC;AACL;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,mBAAmB,CACjC,UAAuC,EACvC,SAAsC,EAAA;IAEtC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;AAC9C,QAAA,MAAM,K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