Skip to content

Commit 6f787c6

Browse files
authored
Merge pull request #12 from ReforgeHQ/mfaga-use-reforge-endpoints
feat: use reforge.com endpoints
2 parents 853b9fa + 7612fe7 commit 6f787c6

5 files changed

Lines changed: 17 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.0.0-pre.5 - 2025-09-24
4+
5+
- Use reforge.com endpoints
6+
37
## 0.0.0-pre.4 - 2025-09-18
48

59
- rename apiKey to sdkKey

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"packageManager": "yarn@4.9.2",
33
"name": "@reforge-com/javascript",
4-
"version": "0.0.0-pre.4",
4+
"version": "0.0.0-pre.5",
55
"description": "Feature Flags & Dynamic Configuration as a Service",
66
"main": "dist/index.cjs",
77
"module": "dist/index.mjs",

src/loader.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ describe("overriding endpoints", () => {
2020
loader = new Loader({ context, sdkKey });
2121

2222
expect(loader.endpoints).toStrictEqual([
23-
"https://belt.prefab.cloud/api/v2",
24-
"https://suspenders.prefab.cloud/api/v2",
25-
"https://waistband.prefab.cloud/api/v2",
23+
"https://primary.reforge.com/api/v2",
24+
"https://secondary.reforge.com/api/v2",
2625
]);
2726
});
2827

@@ -125,7 +124,7 @@ describe("load", () => {
125124
throw new Error("Fetch hasn't happened");
126125
}
127126

128-
expect(requestUrl.host).toEqual("belt.prefab.cloud");
127+
expect(requestUrl.host).toEqual("primary.reforge.com");
129128

130129
expect(requestUrl.pathname).toStrictEqual(
131130
"/api/v2/configs/eval-with-context/eyJjb250ZXh0cyI6W3sidHlwZSI6InVzZXIiLCJ2YWx1ZXMiOnsiaWQiOnsic3RyaW5nIjoiMTIzIn0sImVtYWlsIjp7InN0cmluZyI6InRlc3RAZXhhbXBsZS5jb20ifX19LHsidHlwZSI6ImRldmljZSIsInZhbHVlcyI6eyJtb2JpbGUiOnsiYm9vbCI6dHJ1ZX19fV19"
@@ -166,7 +165,7 @@ describe("load", () => {
166165
if (!requestUrl) {
167166
throw new Error("Last fetch hasn't happened");
168167
}
169-
expect(requestUrl.host).toStrictEqual("suspenders.prefab.cloud");
168+
expect(requestUrl.host).toStrictEqual("secondary.reforge.com");
170169
});
171170

172171
it("fails when no endpoints are reachable", async () => {
@@ -183,13 +182,13 @@ describe("load", () => {
183182

184183
loader.load().catch((reason: any) => {
185184
expect(reason.message).toEqual("Network error");
186-
expect(fetchCount).toStrictEqual(3);
185+
expect(fetchCount).toStrictEqual(2);
187186

188187
if (!requestUrl) {
189188
throw new Error("Last fetch hasn't happened");
190189
}
191190

192-
expect(requestUrl.host).toStrictEqual("waistband.prefab.cloud");
191+
expect(requestUrl.host).toStrictEqual("secondary.reforge.com");
193192
});
194193
});
195194
});

src/loader.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ export type FetchOptions = {
2121
headers: Headers;
2222
};
2323

24-
const defaultEndpoints = ["belt", "suspenders", "waistband"].map(
25-
(subdomain) => `https://${subdomain}.prefab.cloud/api/v2`
26-
);
24+
const defaultEndpoints = [
25+
"https://primary.reforge.com/api/v2",
26+
"https://secondary.reforge.com/api/v2",
27+
];
2728

2829
const EARLY_TIMEOUT = 2000;
2930

src/reforge.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ describe("updateContext", () => {
493493
}
494494

495495
expect(invokedUrl).toStrictEqual(
496-
`https://belt.prefab.cloud/api/v2/configs/eval-with-context/${initialContext.encode()}?collectContextMode=PERIODIC_EXAMPLE`
496+
`https://primary.reforge.com/api/v2/configs/eval-with-context/${initialContext.encode()}?collectContextMode=PERIODIC_EXAMPLE`
497497
);
498498

499499
const newContext = new Context({ user: { device: "mobile" } });
@@ -504,7 +504,7 @@ describe("updateContext", () => {
504504
expect(reforge.context).toStrictEqual(newContext);
505505

506506
expect(invokedUrl).toStrictEqual(
507-
`https://belt.prefab.cloud/api/v2/configs/eval-with-context/${newContext.encode()}?collectContextMode=PERIODIC_EXAMPLE`
507+
`https://primary.reforge.com/api/v2/configs/eval-with-context/${newContext.encode()}?collectContextMode=PERIODIC_EXAMPLE`
508508
);
509509
});
510510
});

0 commit comments

Comments
 (0)