{"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":["i2","i3","i1"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA;AACO,MAAM,YAAY,GAAyC;AAChE,IAAA,GAAG,EAAE,6BAA6B;AAClC,IAAA,IAAI,EAAE,8BAA8B;AACpC,IAAA,GAAG,EAAE,6BAA6B;AAClC,IAAA,MAAM,EAAE,gCAAgC;CACzC;AAED;AACM,SAAU,aAAa,CAAC,GAAsD,EAAA;AAClF,IAAA,MAAM,MAAM,GAAG,GAAG,EAAE,UAAU;AAC9B,IAAA,OAAO,MAAM,IAAI,MAAM,IAAI,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,cAAc;AACjF;AAEA;AACM,SAAU,SAAS,CAAC,GAAsD,EAAA;IAC9E,MAAM,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE;AAC7C,IAAA,OAAO,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK;AAC9C;AAEA;AACM,SAAU,UAAU,CAAC,GAAsD,EAAA;AAC/E,IAAA,OAAO,GAAG,EAAE,aAAa,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