@objectstack/client 4.0.3 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/client.hono.test.ts +11 -3
- package/src/index.ts +36 -22
- package/tests/integration/01-discovery.test.ts +5 -5
package/dist/index.mjs
CHANGED
|
@@ -635,6 +635,15 @@ var ObjectStackClient = class {
|
|
|
635
635
|
* Authentication Services
|
|
636
636
|
*/
|
|
637
637
|
this.auth = {
|
|
638
|
+
/**
|
|
639
|
+
* Get authentication configuration
|
|
640
|
+
* Returns available auth providers and features
|
|
641
|
+
*/
|
|
642
|
+
getConfig: async () => {
|
|
643
|
+
const route = this.getRoute("auth");
|
|
644
|
+
const res = await this.fetch(`${this.baseUrl}${route}/config`);
|
|
645
|
+
return this.unwrapResponse(res);
|
|
646
|
+
},
|
|
638
647
|
/**
|
|
639
648
|
* Login with email and password
|
|
640
649
|
* Uses better-auth endpoint: POST /sign-in/email
|
|
@@ -1612,6 +1621,18 @@ var ObjectStackClient = class {
|
|
|
1612
1621
|
try {
|
|
1613
1622
|
let data;
|
|
1614
1623
|
try {
|
|
1624
|
+
const discoveryUrl = `${this.baseUrl}/api/v1/discovery`;
|
|
1625
|
+
this.logger.debug("Probing protocol-standard discovery endpoint", { url: discoveryUrl });
|
|
1626
|
+
const res = await this.fetchImpl(discoveryUrl);
|
|
1627
|
+
if (res.ok) {
|
|
1628
|
+
const body = await res.json();
|
|
1629
|
+
data = body.data || body;
|
|
1630
|
+
this.logger.debug("Discovered via /api/v1/discovery");
|
|
1631
|
+
}
|
|
1632
|
+
} catch (e) {
|
|
1633
|
+
this.logger.debug("Protocol-standard discovery probe failed", { error: e.message });
|
|
1634
|
+
}
|
|
1635
|
+
if (!data) {
|
|
1615
1636
|
let wellKnownUrl;
|
|
1616
1637
|
try {
|
|
1617
1638
|
const url = new URL(this.baseUrl);
|
|
@@ -1619,22 +1640,10 @@ var ObjectStackClient = class {
|
|
|
1619
1640
|
} catch {
|
|
1620
1641
|
wellKnownUrl = "/.well-known/objectstack";
|
|
1621
1642
|
}
|
|
1622
|
-
this.logger.debug("
|
|
1643
|
+
this.logger.debug("Falling back to .well-known discovery", { url: wellKnownUrl });
|
|
1623
1644
|
const res = await this.fetchImpl(wellKnownUrl);
|
|
1624
|
-
if (res.ok) {
|
|
1625
|
-
const body = await res.json();
|
|
1626
|
-
data = body.data || body;
|
|
1627
|
-
this.logger.debug("Discovered via .well-known");
|
|
1628
|
-
}
|
|
1629
|
-
} catch (e) {
|
|
1630
|
-
this.logger.debug("Standard discovery probe failed", { error: e.message });
|
|
1631
|
-
}
|
|
1632
|
-
if (!data) {
|
|
1633
|
-
const fallbackUrl = `${this.baseUrl}/api/v1/discovery`;
|
|
1634
|
-
this.logger.debug("Falling back to standard discovery endpoint", { url: fallbackUrl });
|
|
1635
|
-
const res = await this.fetchImpl(fallbackUrl);
|
|
1636
1645
|
if (!res.ok) {
|
|
1637
|
-
throw new Error(`Failed to connect to ${
|
|
1646
|
+
throw new Error(`Failed to connect to ${wellKnownUrl}: ${res.statusText}`);
|
|
1638
1647
|
}
|
|
1639
1648
|
const body = await res.json();
|
|
1640
1649
|
data = body.data || body;
|