@protobase/client 0.19.10 → 0.19.12
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/dist/index.d.ts +2 -2
- package/dist/runtime.d.ts +15 -1
- package/dist/runtime.js +13 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ import { AuthError } from "./auth-error.js";
|
|
|
17
17
|
import { AuthSession, AuthSessionOptions, createAuthSession, tokenExpiry } from "./auth.js";
|
|
18
18
|
import { createStaticSession } from "./static-session.js";
|
|
19
19
|
import { AssistantClient, AssistantClientOptions, AssistantConnection, createAssistantClient } from "./assistant.js";
|
|
20
|
-
import { RuntimeClient, RuntimeClientOptions, RuntimePolicy, RuntimeStatus, createRuntimeClient } from "./runtime.js";
|
|
21
|
-
export { type AccountSecurity, type AccountSignIn, type ActiveRole, ApiError, type AssistantClient, type AssistantClientOptions, type AssistantConnection, AuthError, type AuthSession, type AuthSessionOptions, type AuthUser, type AuthenticatorSetup, type BatchOp, type BatchRef, type BatchResult, type Client, type ClientOptions, type CurrentOrganization, type Facet, type FilterInput, type Histogram, type HistogramBucket, type InvitationPreview, type InvitationSent, type InvokeOptions, type ListPage, type ListParams, type MapBounds, type MapBucket, type MapLayerModel, type MapParams, type MapResult, type Meta, type MetaResult, type Organization, type OrganizationInvitation, type OrganizationMember, type OrganizationRole, type OrganizationsClient, type Passkey, type PlatformSignIn, type PluginRef, PreconditionFailedError, type ProblemDetails, type ProblemError, type RecordOf, type RecordPermissions, type RecordPhotos, type RelatedLabels, type RequiredSetup, type ResourcePermissions, type ResourceRef, type RoleLabel, type RoleOption, type RolesClient, type RuntimeClient, type RuntimeClientOptions, type RuntimePolicy, type RuntimeStatus, type Series, type SeriesParams, type SeriesPoint, type SetupStatus, type SignInMethod, type SignInPolicy, type SignInPolicyClient, type SignInPolicyState, type SignInResult, type SignInRule, type SourceMeta, type SourceRef, type StaffAccessRule, type StaffSignIn, type StaffSignInClient, type Stored, type StoredFile, type StoredFileVariant, type TwoFactorMethod, type UploadOptions, type UploadProgress, type UploadResult, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, isApiError, listWire, routedClient, sourceMeta, tokenExpiry };
|
|
20
|
+
import { RuntimeClient, RuntimeClientOptions, RuntimeLastUpdate, RuntimePolicy, RuntimeStatus, RuntimeUpdateStage, createRuntimeClient } from "./runtime.js";
|
|
21
|
+
export { type AccountSecurity, type AccountSignIn, type ActiveRole, ApiError, type AssistantClient, type AssistantClientOptions, type AssistantConnection, AuthError, type AuthSession, type AuthSessionOptions, type AuthUser, type AuthenticatorSetup, type BatchOp, type BatchRef, type BatchResult, type Client, type ClientOptions, type CurrentOrganization, type Facet, type FilterInput, type Histogram, type HistogramBucket, type InvitationPreview, type InvitationSent, type InvokeOptions, type ListPage, type ListParams, type MapBounds, type MapBucket, type MapLayerModel, type MapParams, type MapResult, type Meta, type MetaResult, type Organization, type OrganizationInvitation, type OrganizationMember, type OrganizationRole, type OrganizationsClient, type Passkey, type PlatformSignIn, type PluginRef, PreconditionFailedError, type ProblemDetails, type ProblemError, type RecordOf, type RecordPermissions, type RecordPhotos, type RelatedLabels, type RequiredSetup, type ResourcePermissions, type ResourceRef, type RoleLabel, type RoleOption, type RolesClient, type RuntimeClient, type RuntimeClientOptions, type RuntimeLastUpdate, type RuntimePolicy, type RuntimeStatus, type RuntimeUpdateStage, type Series, type SeriesParams, type SeriesPoint, type SetupStatus, type SignInMethod, type SignInPolicy, type SignInPolicyClient, type SignInPolicyState, type SignInResult, type SignInRule, type SourceMeta, type SourceRef, type StaffAccessRule, type StaffSignIn, type StaffSignInClient, type Stored, type StoredFile, type StoredFileVariant, type TwoFactorMethod, type UploadOptions, type UploadProgress, type UploadResult, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, isApiError, listWire, routedClient, sourceMeta, tokenExpiry };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
//#region src/runtime.d.ts
|
|
2
2
|
export type RuntimePolicy = 'immediate' | 'weekly' | 'scheduled' | 'manual';
|
|
3
|
+
/** What a running update does: `job` moves the app to the release, `build` builds and deploys it. */
|
|
4
|
+
export type RuntimeUpdateStage = 'job' | 'build';
|
|
5
|
+
/** How the latest finished update ended; `message` is for the app's owner and null when there is nothing to say. */
|
|
6
|
+
export type RuntimeLastUpdate = {
|
|
7
|
+
toVersion: string;
|
|
8
|
+
outcome: 'succeeded' | 'unchanged' | 'failed';
|
|
9
|
+
errorCode: string | null;
|
|
10
|
+
message: string | null;
|
|
11
|
+
finishedAt: string;
|
|
12
|
+
};
|
|
3
13
|
/**
|
|
4
14
|
* What the runtime endpoint answers: the app's pinned `version`, the `latest` release, whether to show that an update
|
|
5
15
|
* is available (`indicator`), when the `policy` applies `latest` (`nextUpdateAt`, null when it never will or nothing
|
|
6
|
-
* is pending) and whether an update is running.
|
|
16
|
+
* is pending) and whether an update is running. A newer endpoint also names the running update's stage and start, and
|
|
17
|
+
* how the last one ended; an older one leaves them out.
|
|
7
18
|
*/
|
|
8
19
|
export type RuntimeStatus = {
|
|
9
20
|
version: string;
|
|
@@ -13,6 +24,9 @@ export type RuntimeStatus = {
|
|
|
13
24
|
policy: RuntimePolicy;
|
|
14
25
|
nextUpdateAt: string | null;
|
|
15
26
|
updating: boolean;
|
|
27
|
+
updateStage?: RuntimeUpdateStage | null;
|
|
28
|
+
updateStartedAt?: string | null;
|
|
29
|
+
lastUpdate?: RuntimeLastUpdate | null;
|
|
16
30
|
};
|
|
17
31
|
export type RuntimeClientOptions = {
|
|
18
32
|
/** The runtime endpoint, as `/api/meta` names it. */
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { readProblem } from "./problem.js";
|
|
1
|
+
import { ApiError, readProblem } from "./problem.js";
|
|
2
2
|
//#region src/runtime.ts
|
|
3
|
+
const isRefusal = (body) => typeof body === "object" && body !== null && "error" in body && typeof body.error === "object" && body.error !== null && "code" in body.error && "message" in body.error;
|
|
4
|
+
const readRefusal = async (response) => {
|
|
5
|
+
const body = response.headers.get("content-type")?.includes("json") ?? false ? await response.clone().json() : void 0;
|
|
6
|
+
if (!isRefusal(body)) return readProblem(response);
|
|
7
|
+
return new ApiError({
|
|
8
|
+
type: `urn:protobase:problem:${body.error.code}`,
|
|
9
|
+
title: response.statusText || "Request failed",
|
|
10
|
+
status: response.status,
|
|
11
|
+
detail: body.error.message
|
|
12
|
+
});
|
|
13
|
+
};
|
|
3
14
|
/** A client of the runtime endpoint, with the user's token. */
|
|
4
15
|
const createRuntimeClient = (options) => {
|
|
5
16
|
const base = options.url.replace(/\/+$/, "");
|
|
@@ -13,7 +24,7 @@ const createRuntimeClient = (options) => {
|
|
|
13
24
|
...token && { authorization: `Bearer ${token}` }
|
|
14
25
|
}
|
|
15
26
|
});
|
|
16
|
-
if (!response.ok) throw await
|
|
27
|
+
if (!response.ok) throw await readRefusal(response);
|
|
17
28
|
return await response.json();
|
|
18
29
|
};
|
|
19
30
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/client",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.12",
|
|
4
4
|
"description": "Typed fetch client for the Protobase REST API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@better-auth/passkey": "^1.7.7",
|
|
33
|
-
"@protobase/layout": "0.19.
|
|
34
|
-
"@protobase/schema": "0.19.
|
|
33
|
+
"@protobase/layout": "0.19.12",
|
|
34
|
+
"@protobase/schema": "0.19.12",
|
|
35
35
|
"@simplewebauthn/browser": "^13.3.0",
|
|
36
36
|
"better-auth": "^1.7.7"
|
|
37
37
|
}
|