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

Commit c693a76

Browse files
committed
Refactor to /proxy and /backend approach. Node routes prefixed /proxy
are just proxies to the OBP-API endpoints and node adds authentication headers. /backend routes might do aggregation or other mangling
1 parent ece9701 commit c693a76

221 files changed

Lines changed: 327 additions & 5875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/lib/components/BankSelectWidget.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
error = "";
4646
4747
try {
48-
const response = await trackedFetch("/api/banks");
48+
const response = await trackedFetch("/proxy/obp/v6.0.0/banks");
4949
5050
if (!response.ok) {
5151
const errorDetails = await extractErrorFromResponse(

‎src/lib/components/ConsentRequestCard.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
logger.info(`Original roles from toolMessage:`, toolMessage.consentRequiredRoles);
6464
6565
// Call our server-side API to create the consent at OBP
66-
const response = await fetch('/api/opey/consent', {
66+
const response = await fetch('/backend/opey/consent', {
6767
method: 'POST',
6868
headers: { 'Content-Type': 'application/json' },
6969
body: JSON.stringify({

‎src/lib/components/MissingRoleAlert.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
bank_id: effectiveBankId || "",
8888
};
8989
90-
const response = await fetch("/api/rbac/entitlement-requests", {
90+
const response = await fetch("/backend/rbac/entitlement-requests", {
9191
method: "POST",
9292
headers: {
9393
"Content-Type": "application/json",

‎src/lib/components/OpeyChat.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
8989
async function fetchHealthStatus() {
9090
try {
91-
const response = await fetch('/api/status');
91+
const response = await fetch('/backend/status');
9292
if (response.ok) {
9393
const data = await response.json();
9494
const opeySnapshot = data.services['Opey II'];
@@ -333,7 +333,7 @@
333333
try {
334334
sessionState.setStatus('loading');
335335
336-
const response = await fetch('/api/opey/auth', {
336+
const response = await fetch('/backend/opey/auth', {
337337
method: 'POST',
338338
credentials: 'include'
339339
});

‎src/lib/components/UserSearchPickerWidget.svelte‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
async function fetchProviders() {
5353
isLoadingProviders = true;
5454
try {
55-
const response = await trackedFetch("/api/users/providers");
55+
const response = await trackedFetch("/backend/users/providers");
5656
if (response.ok) {
5757
const data = await response.json();
5858
providers = data.providers || [];
@@ -107,15 +107,15 @@
107107
let url: string;
108108
let usesProviderEndpoint = false;
109109
if (type === "email") {
110-
url = `/api/users/search-by-email?email=${encodeURIComponent(trimmed)}`;
110+
url = `/proxy/obp/v4.0.0/users/email/${encodeURIComponent(trimmed)}/terminator`;
111111
} else if (type === "userid") {
112-
url = `/api/users/search-by-userid?user_id=${encodeURIComponent(trimmed)}`;
112+
url = `/proxy/obp/v6.0.0/users/user-id/${encodeURIComponent(trimmed)}`;
113113
} else if (selectedProvider) {
114114
// Use provider+username endpoint when a provider is selected
115-
url = `/api/users/search-by-provider-username?provider=${encodeURIComponent(selectedProvider)}&username=${encodeURIComponent(trimmed)}`;
115+
url = `/proxy/obp/v6.0.0/users/provider/${encodeURIComponent(selectedProvider)}/username/${encodeURIComponent(trimmed)}`;
116116
usesProviderEndpoint = true;
117117
} else {
118-
url = `/api/users/search?q=${encodeURIComponent(trimmed)}`;
118+
url = `/proxy/obp/v6.0.0/users?username=${encodeURIComponent(trimmed)}`;
119119
}
120120
121121
const response = await trackedFetch(url);
@@ -133,10 +133,10 @@
133133
134134
const data = await response.json();
135135
136-
// Normalize response: provider and userid endpoints return {user: {...}}, others return {users: [...]}
136+
// Normalize response: provider and userid OBP endpoints return the user object directly, others return {users: [...]}
137137
let users: UserResult[];
138138
if (type === "userid" || usesProviderEndpoint) {
139-
users = data.user ? [data.user] : [];
139+
users = data.user_id ? [data] : [];
140140
} else {
141141
users = data.users || [];
142142
}

‎src/lib/opey/services/InsightService.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class InsightService {
2222
*/
2323
async writeNote(note: string): Promise<void> {
2424
try {
25-
const res = await fetch('/api/dynamic-entities/personal/opey_notebook/my', {
25+
const res = await fetch('/proxy/obp/dynamic-entity/my/opey_notebook', {
2626
method: 'POST',
2727
headers: { 'Content-Type': 'application/json' },
2828
credentials: 'include',
@@ -46,7 +46,7 @@ export class InsightService {
4646
*/
4747
async getRecentNotes(limit = 10): Promise<NotebookEntry[]> {
4848
try {
49-
const res = await fetch('/api/dynamic-entities/personal/opey_notebook/my', {
49+
const res = await fetch('/proxy/obp/dynamic-entity/my/opey_notebook', {
5050
credentials: 'include'
5151
});
5252

@@ -94,7 +94,7 @@ export class InsightService {
9494
].join('\n');
9595

9696
try {
97-
const res = await fetch('/api/opey/invoke', {
97+
const res = await fetch('/backend/opey/invoke', {
9898
method: 'POST',
9999
headers: { 'Content-Type': 'application/json' },
100100
credentials: 'include',

‎src/lib/stores/currentBank.svelte.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CurrentBankStore {
9494
private async _doFetch(): Promise<Bank[]> {
9595
try {
9696
this.loading = true;
97-
const response = await trackedFetch("/api/banks");
97+
const response = await trackedFetch("/proxy/obp/v6.0.0/banks");
9898

9999
if (!response.ok) {
100100
throw new Error("Failed to fetch banks");

‎src/lib/stores/resourceDocsCache.browser.svelte.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ResourceDocsCacheBrowser {
7272
try {
7373
logger.info("Fetching resource docs from API...");
7474

75-
const response = await fetch("/api/resource-docs");
75+
const response = await fetch("/proxy/obp/v6.0.0/resource-docs/v6.0.0/obp");
7676

7777
if (!response.ok) {
7878
throw new Error(

‎src/lib/stores/rolesCache.svelte.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class RolesCache {
5656
this.state.loading = true;
5757
logger.info("Fetching roles from API");
5858

59-
const response = await fetch("/api/rbac/roles-metadata");
59+
const response = await fetch("/proxy/obp/v6.0.0/roles");
6060
if (!response.ok) {
6161
throw new Error("Failed to fetch roles metadata");
6262
}

‎src/lib/stores/userPreferences.svelte.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class UserPreferencesStore {
107107
if (!browser) return;
108108
this.loading = true;
109109
try {
110-
const res = await trackedFetch("/api/user/preferences");
110+
const res = await trackedFetch("/backend/user/preferences");
111111
if (!res.ok) {
112112
logger.warn("Failed to load preferences from OBP:", res.status);
113113
return;
@@ -146,7 +146,7 @@ class UserPreferencesStore {
146146
try {
147147
if (attributeId) {
148148
// Update existing
149-
const res = await trackedFetch("/api/user/preferences", {
149+
const res = await trackedFetch("/backend/user/preferences", {
150150
method: "PUT",
151151
headers: { "Content-Type": "application/json" },
152152
body: JSON.stringify({
@@ -164,7 +164,7 @@ class UserPreferencesStore {
164164
return data.user_attribute_id || attributeId;
165165
} else {
166166
// Create new
167-
const res = await trackedFetch("/api/user/preferences", {
167+
const res = await trackedFetch("/backend/user/preferences", {
168168
method: "POST",
169169
headers: { "Content-Type": "application/json" },
170170
body: JSON.stringify({

0 commit comments

Comments
 (0)