Skip to content

Commit 1da68e6

Browse files
authored
Merge pull request #121 from InsForge/feat/functions-domain-v2
feat(functions): derive default functions domain as function2.insforge.app
2 parents c26482f + a1f4314 commit 1da68e6

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@insforge/sdk",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Official JavaScript/TypeScript client for InsForge Backend-as-a-Service platform",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/modules/__tests__/functions.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ describe('Functions.invoke', () => {
5858
it('uses subhosting URL when functionsUrl is configured', async () => {
5959
const fetchFn = vi.fn().mockResolvedValue(jsonRes(200, { ok: true }));
6060
const http = makeHttp(fetchFn);
61-
const fns = new Functions(http, 'https://app.functions.insforge.app');
61+
const fns = new Functions(http, 'https://app.function2.insforge.app');
6262

6363
const result = await fns.invoke('hello', { body: { x: 1 } });
6464

6565
expect(result).toEqual({ data: { ok: true }, error: null });
6666
expect(fetchFn).toHaveBeenCalledOnce();
6767
const calledUrl = fetchFn.mock.calls[0][0];
68-
expect(String(calledUrl)).toBe('https://app.functions.insforge.app/hello');
68+
expect(String(calledUrl)).toBe('https://app.function2.insforge.app/hello');
6969
});
7070

7171
it('falls back to proxy when subhosting returns 404', async () => {
@@ -74,7 +74,7 @@ describe('Functions.invoke', () => {
7474
.mockResolvedValueOnce(jsonRes(404, { error: 'NOT_FOUND', message: 'no' }, 'Not Found'))
7575
.mockResolvedValueOnce(jsonRes(200, { proxied: true }));
7676
const http = makeHttp(fetchFn);
77-
const fns = new Functions(http, 'https://app.functions.insforge.app');
77+
const fns = new Functions(http, 'https://app.function2.insforge.app');
7878

7979
const result = await fns.invoke('hello');
8080

@@ -96,7 +96,7 @@ describe('Functions.invoke', () => {
9696
},
9797
makeTokenManager()
9898
);
99-
const fns = new Functions(http, 'https://app.functions.insforge.app');
99+
const fns = new Functions(http, 'https://app.function2.insforge.app');
100100
const dispatch = vi.fn().mockResolvedValue(jsonRes(200, { ok: 1 }));
101101
(globalThis as any).__insforge_dispatch__ = dispatch;
102102

@@ -216,7 +216,7 @@ describe('Functions.invoke', () => {
216216
},
217217
makeTokenManager()
218218
);
219-
const fns = new Functions(http, 'https://app-b.functions.insforge.app');
219+
const fns = new Functions(http, 'https://app-b.function2.insforge.app');
220220
const dispatch = vi.fn();
221221
(globalThis as any).__insforge_dispatch__ = dispatch;
222222

@@ -225,7 +225,7 @@ describe('Functions.invoke', () => {
225225
expect(result).toEqual({ data: { remote: true }, error: null });
226226
expect(dispatch).not.toHaveBeenCalled();
227227
expect(fetchFn).toHaveBeenCalledOnce();
228-
expect(String(fetchFn.mock.calls[0][0])).toBe('https://app-b.functions.insforge.app/hello');
228+
expect(String(fetchFn.mock.calls[0][0])).toBe('https://app-b.function2.insforge.app/hello');
229229
});
230230
});
231231
});

src/modules/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Functions {
4040
/**
4141
* Derive the subhosting URL from the base URL.
4242
* Base URL pattern: https://{appKey}.{region}.insforge.app
43-
* Functions URL: https://{appKey}.functions.insforge.app
43+
* Functions URL: https://{appKey}.function2.insforge.app
4444
* Only applies to .insforge.app domains.
4545
*/
4646
private static deriveSubhostingUrl(baseUrl: string): string | undefined {
@@ -50,7 +50,7 @@ export class Functions {
5050
return undefined;
5151
}
5252
const appKey = hostname.split('.')[0];
53-
return `https://${appKey}.functions.insforge.app`;
53+
return `https://${appKey}.function2.insforge.app`;
5454
} catch {
5555
return undefined;
5656
}

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface InsForgeConfig {
3939
* Direct URL to Deno Subhosting functions (optional)
4040
* When provided, SDK will try this URL first for function invocations.
4141
* Falls back to proxy URL if subhosting returns 404.
42-
* @example "https://{appKey}.functions.insforge.app"
42+
* @example "https://{appKey}.function2.insforge.app"
4343
*/
4444
functionsUrl?: string;
4545

0 commit comments

Comments
 (0)