Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 62711f4

Browse files
committed
Revert dynamic endpoint
1 parent 8db8cfc commit 62711f4

4 files changed

Lines changed: 22 additions & 83 deletions

File tree

‎dynamic_endpoint_plan_doc.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,14 @@ The existing `/integration/method-routings` stays as a cross-cutting admin page;
110110

111111
Each phase ships independently.
112112

113-
### Phase 1 — Roles surfacing (smallest, highest leverage)
113+
### Phase 1 — Roles surfacing ✅ done via SITE_MAP
114114

115-
- Add an `actionRoles` dict to the Dynamic Endpoint server load (same pattern as `consumers/[consumer_id]/edit/+page.server.ts`).
116-
- Pull user entitlements via `user.entitlements` (already available in other pages).
117-
- Pass `canCreate`, `canDelete`, `canUpdate` derivations into the detail and list pages.
118-
- Use the existing `MissingRoleAlert` component on action attempts.
119-
- No new OBP calls, no new routes.
115+
All six Dynamic Endpoint routes are registered in `src/lib/utils/roleChecker.ts` SITE_MAP with `required` (Get) and `optional` (Create / Update / Delete / JSON Schema) roles. `(protected)/+layout.svelte` auto-wraps each page with `PageRoleCheck`, which:
120116

121-
**Files touched:** 4 existing server+page files in `dynamic-endpoints/`.
117+
- Blocks the page if any `required` role is missing (shows `MissingRoleAlert`).
118+
- Shows a passive info note listing missing `optional` roles at the top of the page.
119+
120+
Failed action attempts (e.g. clicking Delete without `CanDeleteDynamicEndpoint`) surface the OBP error. No per-page `actionRoles` dicts needed — SITE_MAP is the single source of truth.
122121

123122
### Phase 2 — Per-operation table on the detail page
124123

@@ -140,13 +139,16 @@ Each phase ships independently.
140139

141140
**Decision:** inline panel on the detail page is simpler for v1; split to its own route only if the editor grows.
142141

143-
### Phase 4 — Method Routing deep-link
142+
### Phase 4 — Method Routing deep-link ❌ dropped
143+
144+
Earlier we added a "Configure routing" deep-link from each operation to `/integration/method-routings` with `prefill_method_name=<operationId>`. We've since removed it.
144145

145-
- Add "Configure routing" per operation that opens `/integration/method-routings?method_name=<derived>&operation_id=<op>&prefilled=true`.
146-
- Teach `method-routings/+page.svelte` to honour those query params and pre-open the create form with fields populated.
147-
- Show the current routing summary on the operation row by calling `GET /method_routings?active=true` once at page load and filtering by `method_name`.
146+
Why: OBP's `method_routing.method_name` is a Scala connector method (e.g. `getBank`) discovered via reflection at runtime (see `GET /system/connector-method-names`). Dynamic Endpoint `operation_id` values live in a different namespace and are not valid `method_name` values — OBP would reject the create with `OBP-10022: Incorrect Connector method name.`. Method Routing is a cross-cutting admin concern, not a per-Dynamic-Endpoint-operation action.
148147

149-
**Open question:** the OBP `method_name` on a `method_routing` isn't always the same as the Dynamic Endpoint's `operation_id` — it's the Scala connector method (e.g. `getBank`). For `obp_mock` endpoints there is no connector call, so a method routing is only meaningful when host is `dynamic_entity` or an external URL. We should only show "Configure routing" in those cases, and document the mapping rule clearly.
148+
`/integration/method-routings` stays as a standalone page. When operators need to wire a Dynamic Endpoint to real data, the correct paths are:
149+
- `host = <URL>` — the host itself is the backend; no routing needed.
150+
- `host = dynamic_entity` — use Endpoint Mapping (Phase 5).
151+
- `host = obp_mock` — no routing needed.
150152

151153
### Phase 5 — Endpoint Mapping (only when `host: dynamic_entity`)
152154

@@ -174,7 +176,5 @@ Each phase ships independently.
174176

175177
## Open questions / decisions needed before coding
176178

177-
1. **Method Routing linkage.** Is the mapping "Dynamic Endpoint operation ↔ method_routing.method_name" ever 1:1, or do operators typically point multiple operations at one routing? This affects whether Phase 4 shows a 1:1 "current routing" cell or a "routings that match this operation" list.
178-
2. **Bank-level roles.** Confirm via `get_endpoint_schema` whether bank-level create/update/delete dynamic-endpoint endpoints use `Can...AtAnyBank`-style roles. Schema query pending for the bank routes.
179-
3. **Inline vs routed editors.** JSON Schema editing inline is fine for small schemas, but a Monaco/codemirror editor on a full route is nicer once schemas get large. Start inline; upgrade only if users complain.
180-
4. **Try-it panel (Phase 6).** Worth doing, or leave to the API Explorer? The appeal is "verify the whole chain without leaving the page" — even a curl snippet on the operation row beats nothing.
179+
1. **Bank-level roles.** Confirm via `get_endpoint_schema` whether bank-level create/update/delete dynamic-endpoint endpoints use `Can...AtAnyBank`-style roles. Schema query pending for the bank routes.
180+
2. **Inline vs routed editors.** JSON Schema editing inline is fine for small schemas, but a Monaco/codemirror editor on a full route is nicer once schemas get large. Start inline; upgrade only if users complain.

‎src/lib/components/DynamicEndpointOperationsTable.svelte‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
interface Props {
2222
swagger: any;
2323
validations?: Validation[];
24-
bankId?: string;
2524
}
2625
27-
let { swagger, validations = [], bankId }: Props = $props();
26+
let { swagger, validations = [] }: Props = $props();
2827
2928
// Dynamic endpoints are served under /obp/dynamic-endpoint/ (no API version, no /banks/ segment
3029
// even for bank-scoped endpoints — bank scoping is enforced at the record level).
@@ -331,7 +330,6 @@
331330
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Operation ID</th>
332331
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Resolves to</th>
333332
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">JSON Schema</th>
334-
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Method Routing</th>
335333
<th class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Try it</th>
336334
</tr>
337335
</thead>
@@ -407,21 +405,6 @@
407405
{/if}
408406
{/if}
409407
</td>
410-
<td class="whitespace-nowrap px-4 py-3 align-top text-xs">
411-
{#if op.operationId}
412-
{@const mrParams = new URLSearchParams({
413-
prefill_method_name: op.operationId,
414-
...(bankId ? { prefill_bank_id_pattern: bankId, prefill_is_bank_id_exact_match: "true" } : {}),
415-
})}
416-
<a
417-
href={`/integration/method-routings?${mrParams.toString()}`}
418-
data-testid="configure-routing-link"
419-
class="text-blue-600 hover:underline dark:text-blue-400"
420-
>Configure routing →</a>
421-
{:else}
422-
<span class="text-gray-400 dark:text-gray-500">—</span>
423-
{/if}
424-
</td>
425408
<td class="whitespace-nowrap px-4 py-3 align-top text-xs">
426409
<button
427410
type="button"
@@ -433,7 +416,7 @@
433416
</tr>
434417
{#if isSchemaOpen}
435418
<tr data-testid="validation-editor-row">
436-
<td colspan="8" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
419+
<td colspan="7" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
437420
<div class="space-y-3">
438421
<div class="flex items-baseline justify-between">
439422
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">
@@ -484,7 +467,7 @@
484467
{/if}
485468
{#if isTryOpen}
486469
<tr data-testid="try-it-row">
487-
<td colspan="8" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
470+
<td colspan="7" class="px-4 py-4 bg-gray-50 dark:bg-gray-900/40">
488471
<div class="space-y-3">
489472
<div class="flex items-baseline justify-between">
490473
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">

‎src/routes/(protected)/dynamic-endpoints/bank/[bank_id]/[id]/+page.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356

357357
<!-- Operations Section -->
358358
<div class="mb-6">
359-
<DynamicEndpointOperationsTable {swagger} validations={data.validations || []} bankId={bankId} />
359+
<DynamicEndpointOperationsTable {swagger} validations={data.validations || []} />
360360
</div>
361361

362362
<!-- Raw Swagger View -->

‎src/routes/(protected)/integration/method-routings/+page.svelte‎

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -312,46 +312,11 @@
312312
return !routing.method_routing_id || routing.method_routing_id === "";
313313
}
314314
315-
// Read deep-link query params (e.g. from Dynamic Endpoint operations table)
316-
// and pre-open the create form with fields pre-filled.
317-
let prefillBanner = $state<string | null>(null);
318-
function applyPrefillFromUrl() {
319-
if (typeof window === "undefined") return;
320-
const params = new URLSearchParams(window.location.search);
321-
const prefillMethod = params.get("prefill_method_name");
322-
if (!prefillMethod) return;
323-
324-
const prefillConnector = params.get("prefill_connector_name") || "";
325-
const prefillBankPattern = params.get("prefill_bank_id_pattern") || "";
326-
const prefillExact = params.get("prefill_is_bank_id_exact_match") === "true";
327-
328-
// Dynamic Endpoint operationIds are not part of /system/connector-method-names,
329-
// so add the prefilled name to the options list. Without this, bind:value on the
330-
// <select> can't match any <option> and the field resets to empty.
331-
if (!methodNames.includes(prefillMethod)) {
332-
methodNames = [prefillMethod, ...methodNames];
333-
}
334-
335-
formData = {
336-
method_name: prefillMethod,
337-
connector_name: prefillConnector,
338-
is_bank_id_exact_match: prefillExact,
339-
bank_id_pattern: prefillBankPattern,
340-
parameters: "",
341-
};
342-
showCreateForm = true;
343-
prefillBanner = `Pre-filled from a Dynamic Endpoint operation: ${prefillMethod}. Edit the connector and parameters before saving.`;
344-
scrollToForm();
345-
}
346-
347-
onMount(async () => {
315+
onMount(() => {
348316
fetchMethodRoutings();
317+
fetchMethodNames();
349318
fetchConnectorNames();
350319
fetchBankIds();
351-
// Await method names before applying the URL prefill so the <select> options
352-
// are populated when we set formData.method_name.
353-
await fetchMethodNames();
354-
applyPrefillFromUrl();
355320
});
356321
</script>
357322

@@ -379,15 +344,6 @@
379344
{/if}
380345
</div>
381346

382-
<!-- Prefill banner (from Dynamic Endpoint deep-link) -->
383-
{#if prefillBanner}
384-
<div class="alert alert-info mb-6" data-testid="prefill-banner">
385-
<strong>ℹ️</strong>
386-
{prefillBanner}
387-
<button onclick={() => (prefillBanner = null)} class="alert-close">×</button>
388-
</div>
389-
{/if}
390-
391347
<!-- Messages -->
392348
{#if error}
393349
<div class="alert alert-error mb-6">

0 commit comments

Comments
 (0)