@protobase/client 0.63.1 → 0.63.3

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.
@@ -42,7 +42,7 @@ export type SamlSignIn = {
42
42
  name: string;
43
43
  };
44
44
  /**
45
- * `needsAdmin` while no user exists yet; `signInMethods` the ways to sign in the server's policy leaves on;
45
+ * `needsAdmin` while no user exists yet, with `firstAdminUrl` the platform's page where the first one is added, when it names one; `signInMethods` the ways to sign in the server's policy leaves on;
46
46
  * `signInFirst` when the sign-in page leads with an emailed code, with the password behind "Use a password"; `passwordReset` when the server can email reset links; `changeEmail` when it can email the code that confirms a new
47
47
  * address (see `account.requestEmailChange`); `accountDeletion` when people may delete their own account (see
48
48
  * `deleteAccount`); `signUp` when anyone can make their own account (see
@@ -55,6 +55,7 @@ export type SamlSignIn = {
55
55
  */
56
56
  export type SetupStatus = {
57
57
  needsAdmin: boolean;
58
+ firstAdminUrl?: string;
58
59
  signInMethods: SignInMethod[];
59
60
  signInFirst?: 'emailCode';
60
61
  passwordReset: boolean;
package/dist/auth.js CHANGED
@@ -75,6 +75,7 @@ const createAuthSession = (options = {}) => {
75
75
  const body = await response.json();
76
76
  return {
77
77
  needsAdmin: Boolean(body.needsAdmin),
78
+ ...body.needsAdmin && body.firstAdminUrl && { firstAdminUrl: body.firstAdminUrl },
78
79
  signInMethods: body.signInMethods ?? ["password"],
79
80
  ...body.signInFirst === "emailCode" && { signInFirst: "emailCode" },
80
81
  passwordReset: Boolean(body.passwordReset),
package/dist/client.js CHANGED
@@ -357,7 +357,8 @@ const createClient = (options = {}) => {
357
357
  };
358
358
  /**
359
359
  * Calls one of the app's API functions, `/api/functions/<name>`, with the user's token. Resolves to its answer: parsed
360
- * JSON, text, or `undefined` for a 204. A problem rejects as from any other call.
360
+ * JSON, text for `text/*` or no content type, a `Blob` of any other type (a PDF, an image), or `undefined` for a 204.
361
+ * A problem rejects as from any other call.
361
362
  */
362
363
  const invoke = async (name, { method, body, path = "", query, headers } = {}) => {
363
364
  const response = await send({
@@ -369,7 +370,10 @@ const createClient = (options = {}) => {
369
370
  system: true
370
371
  });
371
372
  if (response.status === 204) return void 0;
372
- return response.headers.get("content-type")?.includes("json") ? response.json() : response.text();
373
+ const type = response.headers.get("content-type");
374
+ if (type?.includes("json")) return response.json();
375
+ if (!type || type.startsWith("text/")) return response.text();
376
+ return response.blob();
373
377
  };
374
378
  /**
375
379
  * Uploads a file for a file field (`POST /{resource}:upload`). Send `value` of the result as the field's value in a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/client",
3
- "version": "0.63.1",
3
+ "version": "0.63.3",
4
4
  "description": "Typed fetch client for the Protobase REST API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@better-auth/passkey": "^1.7.12",
34
- "@protobase/layout": "0.63.1",
35
- "@protobase/schema": "0.63.1",
34
+ "@protobase/layout": "0.63.3",
35
+ "@protobase/schema": "0.63.3",
36
36
  "@simplewebauthn/browser": "^13.3.0",
37
37
  "better-auth": "^1.7.12"
38
38
  }