@protobase/client 0.68.5 → 0.69.0
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/account-security.d.ts +27 -0
- package/dist/account-security.js +31 -0
- package/dist/auth.d.ts +4 -1
- package/dist/index.d.ts +2 -2
- package/dist/static-session.js +3 -0
- package/package.json +3 -3
|
@@ -39,6 +39,24 @@ export type ConnectedApp = {
|
|
|
39
39
|
organization?: string;
|
|
40
40
|
}[];
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* A connection a workflow plugin declares, which the person connects an account through for their workflows' steps to
|
|
44
|
+
* use: its `<plugin>:<connection>` key, label, the provider and scopes it links with, and their accounts that fit it,
|
|
45
|
+
* each marked when a trigger waits for it to be connected again. Tokens never leave the server.
|
|
46
|
+
*/
|
|
47
|
+
export type WorkflowConnection = {
|
|
48
|
+
key: string;
|
|
49
|
+
label: string;
|
|
50
|
+
provider: string;
|
|
51
|
+
scopes: string[];
|
|
52
|
+
link_params: Record<string, string>;
|
|
53
|
+
accounts: {
|
|
54
|
+
id: string;
|
|
55
|
+
scopes: string[];
|
|
56
|
+
created_at: string;
|
|
57
|
+
needs_sign_in: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
42
60
|
/** A new authenticator app: the `otpauth://` URI it scans, and the backup codes that work once each instead of a code. */
|
|
43
61
|
export type AuthenticatorSetup = {
|
|
44
62
|
totpURI: string;
|
|
@@ -77,6 +95,15 @@ export declare const accountSecurity: (client: BetterAuthClient) => {
|
|
|
77
95
|
* `?error=<code>` when the link did not go through.
|
|
78
96
|
*/
|
|
79
97
|
linkPersonalMail: (link: PersonalMailLink, callbackURL: string) => Promise<string>;
|
|
98
|
+
/** The connections the app's workflow plugins declare, with the person's accounts that fit each; none in an app without. */
|
|
99
|
+
workflowConnections: () => Promise<WorkflowConnection[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Starts connecting an account for a workflow connection: resolves with the provider's authorization URL, for the page
|
|
102
|
+
* to go to. The provider sends the browser back to `callbackURL`, with `?error=<code>` when it did not go through.
|
|
103
|
+
*/
|
|
104
|
+
connectAccount: (connection: WorkflowConnection, callbackURL: string) => Promise<string>;
|
|
105
|
+
/** Disconnects an account: its token is revoked at the provider and deleted, and the triggers on it wait for a new one. */
|
|
106
|
+
disconnectAccount: (accountId: string) => Promise<void>;
|
|
80
107
|
/** The apps the person allowed to act as them, newest first; on an app with MCP on. */
|
|
81
108
|
connectedApps: () => Promise<ConnectedApp[]>;
|
|
82
109
|
/** Disconnects an app: it is forgotten, and its access ends within 15 minutes; it has to ask again to come back. */
|
package/dist/account-security.js
CHANGED
|
@@ -109,6 +109,37 @@ const accountSecurity = (client) => ({
|
|
|
109
109
|
if (error || !data?.url) throw authError(error, "Could not start linking the mailbox");
|
|
110
110
|
return data.url;
|
|
111
111
|
},
|
|
112
|
+
/** The connections the app's workflow plugins declare, with the person's accounts that fit each; none in an app without. */
|
|
113
|
+
workflowConnections: async () => {
|
|
114
|
+
const { data, error } = await client.$fetch("/connections");
|
|
115
|
+
if (error?.status === 404) return [];
|
|
116
|
+
if (error || !data) throw authError(error, "Could not read your connections");
|
|
117
|
+
return data.connections;
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Starts connecting an account for a workflow connection: resolves with the provider's authorization URL, for the page
|
|
121
|
+
* to go to. The provider sends the browser back to `callbackURL`, with `?error=<code>` when it did not go through.
|
|
122
|
+
*/
|
|
123
|
+
connectAccount: async (connection, callbackURL) => {
|
|
124
|
+
const { data, error } = await client.linkSocial({
|
|
125
|
+
provider: connection.provider,
|
|
126
|
+
scopes: connection.scopes,
|
|
127
|
+
additionalParams: connection.link_params,
|
|
128
|
+
callbackURL,
|
|
129
|
+
errorCallbackURL: callbackURL,
|
|
130
|
+
disableRedirect: true
|
|
131
|
+
});
|
|
132
|
+
if (error || !data?.url) throw authError(error, "Could not start connecting the account");
|
|
133
|
+
return data.url;
|
|
134
|
+
},
|
|
135
|
+
/** Disconnects an account: its token is revoked at the provider and deleted, and the triggers on it wait for a new one. */
|
|
136
|
+
disconnectAccount: async (accountId) => {
|
|
137
|
+
const { error } = await client.$fetch("/connections/disconnect", {
|
|
138
|
+
method: "POST",
|
|
139
|
+
body: { accountId }
|
|
140
|
+
});
|
|
141
|
+
if (error) throw authError(error, "Could not disconnect the account");
|
|
142
|
+
},
|
|
112
143
|
/** The apps the person allowed to act as them, newest first; on an app with MCP on. */
|
|
113
144
|
connectedApps: async () => {
|
|
114
145
|
const { data, error } = await client.$fetch("/account/connected-apps");
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeviceSession } from "./account-profile.js";
|
|
2
2
|
import { AuthUser, PersonalMailLink, RoleLabel, SetupStatus, SignInResult, TwoFactorMethod } from "./auth-types.js";
|
|
3
3
|
import { SignInPolicy, SignInPolicyState } from "./sign-in-policy.js";
|
|
4
|
-
import { AccountSignIn, AuthenticatorSetup, ConnectedApp, Passkey } from "./account-security.js";
|
|
4
|
+
import { AccountSignIn, AuthenticatorSetup, ConnectedApp, Passkey, WorkflowConnection } from "./account-security.js";
|
|
5
5
|
import { ConnectingClient } from "./connect.js";
|
|
6
6
|
import { CurrentOrganization, InvitationPreview, InvitationSent, Organization, OrganizationInvitation, OrganizationMember, OrganizationPerson, OrganizationRole, OrganizationsFound } from "./organizations.js";
|
|
7
7
|
import { ActiveRole } from "./roles.js";
|
|
@@ -78,6 +78,9 @@ export declare const createAuthSession: (options?: AuthSessionOptions) => {
|
|
|
78
78
|
linkProvider: (provider: string, callbackURL: string) => Promise<string>;
|
|
79
79
|
linkedPersonalMail: (links: PersonalMailLink[]) => Promise<string[]>;
|
|
80
80
|
linkPersonalMail: (link: PersonalMailLink, callbackURL: string) => Promise<string>;
|
|
81
|
+
workflowConnections: () => Promise<WorkflowConnection[]>;
|
|
82
|
+
connectAccount: (connection: WorkflowConnection, callbackURL: string) => Promise<string>;
|
|
83
|
+
disconnectAccount: (accountId: string) => Promise<void>;
|
|
81
84
|
connectedApps: () => Promise<ConnectedApp[]>;
|
|
82
85
|
disconnectApp: (clientId: string) => Promise<void>;
|
|
83
86
|
sendConfirmationCode: () => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { SourceMeta, sourceMeta } from "./source-meta.js";
|
|
|
21
21
|
import { DeviceSession } from "./account-profile.js";
|
|
22
22
|
import { AuthUser, PersonalMailLink, PlatformSignIn, RoleLabel, SamlSignIn, SetupStatus, SignInMethod, SignInResult, TwoFactorMethod } from "./auth-types.js";
|
|
23
23
|
import { SignInPolicy, SignInPolicyClient, SignInPolicyState, SignInRule, StaffAccessRule } from "./sign-in-policy.js";
|
|
24
|
-
import { AccountSecurity, AccountSignIn, AuthenticatorSetup, ConnectedApp, Passkey, RequiredSetup } from "./account-security.js";
|
|
24
|
+
import { AccountSecurity, AccountSignIn, AuthenticatorSetup, ConnectedApp, Passkey, RequiredSetup, WorkflowConnection } from "./account-security.js";
|
|
25
25
|
import { ConnectClient, ConnectingClient } from "./connect.js";
|
|
26
26
|
import { CurrentOrganization, InvitationPreview, InvitationSent, Organization, OrganizationInvitation, OrganizationMember, OrganizationPerson, OrganizationRole, OrganizationsClient, OrganizationsFound } from "./organizations.js";
|
|
27
27
|
import { ActiveRole, RoleOption, RolesClient } from "./roles.js";
|
|
@@ -33,4 +33,4 @@ import { createStaticSession } from "./static-session.js";
|
|
|
33
33
|
import { AssistantClient, AssistantClientOptions, AssistantConnection, createAssistantClient } from "./assistant.js";
|
|
34
34
|
import { RuntimeClient, RuntimeClientOptions, RuntimeLastUpdate, RuntimePolicy, RuntimeStatus, RuntimeUpdateStage, createRuntimeClient } from "./runtime.js";
|
|
35
35
|
import { availabilities, heldStatus, maxStatusText, statusTextProblem } from "@protobase/schema/internal";
|
|
36
|
-
export { type AccountSecurity, type AccountSignIn, type ActiveRole, type Aggregate, type AggregateGroup, type AggregateParams, type AggregateSplitTotal, ApiError, type AppUser, type AssistantClient, type AssistantClientOptions, type AssistantConnection, AuthError, type AuthSession, type AuthSessionOptions, type AuthUser, type AuthenticatorSetup, type Availability, type BatchOp, type BatchRef, type BatchResult, type CallRing, type Channel, type ChannelError, type ChannelMessage, ChannelRefusal, type ChannelStatus, type ChannelUser, type Client, type ClientOptions, type CommentPage, type CommentPerson, type ConnectClient, type ConnectedApp, type ConnectingClient, type CurrentOrganization, type DeviceSession, type DevicesClient, type Facet, type FilterInput, type FormChallenge, type FormProof, type Histogram, type HistogramBucket, type HistoryChange, type HistoryPage, type InboxNotification, type InboxPage, type InvitationPreview, type InvitationSent, type InvokeOptions, type ListPage, type ListParams, type LiveChange, type LiveHandlers, type LiveSocket, type MapBounds, type MapBucket, type MapLayerModel, type MapParams, type MapResult, type MentionableUser, type Meta, type MetaResult, type NotificationHistoryClient, type Organization, type OrganizationInvitation, type OrganizationMember, type OrganizationPerson, type OrganizationRole, type OrganizationsClient, type OrganizationsFound, type Passkey, type PersonStatus, type PersonalMailLink, type PlatformSignIn, type PluginRef, type PollThenSocketOptions, PreconditionFailedError, type PresenceChange, type PresenceEntry, type ProblemDetails, type ProblemError, type PublicForm, type RecordCall, type RecordCallsHandlers, type RecordComment, type RecordOf, type RecordPermissions, type RecordPhotos, type RegisteredDevice, type RelatedLabels, type RequiredSetup, type ResourcePermissions, type ResourceRef, type RingsClient, type RoleLabel, type RoleOption, type RolesClient, type RuntimeClient, type RuntimeClientOptions, type RuntimeLastUpdate, type RuntimePolicy, type RuntimeStatus, type RuntimeUpdateStage, type SamlSignIn, type Series, type SeriesParams, type SeriesPoint, type SetupStatus, type SignInMethod, type SignInPolicy, type SignInPolicyClient, type SignInPolicyState, type SignInResult, type SignInRule, type SocketLike, type SourceMeta, type SourceRef, type StaffAccessRule, type StaffSignIn, type StaffSignInClient, type StatusClient, type StatusInput, type Stored, type StoredFile, type StoredFileVariant, type TwoFactorMethod, type UploadOptions, type UploadProgress, type UploadResult, type UserInvitation, type UserInvitationSent, type UsersClient, type UsersFound, type WebDeviceRegistration, type WorkflowTypeEntry, type WorkflowTypeList, availabilities, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, heldStatus, isApiError, listWire, maxStatusText, pollThenSocket, routedClient, sourceMeta, statusTextProblem, tokenExpiry };
|
|
36
|
+
export { type AccountSecurity, type AccountSignIn, type ActiveRole, type Aggregate, type AggregateGroup, type AggregateParams, type AggregateSplitTotal, ApiError, type AppUser, type AssistantClient, type AssistantClientOptions, type AssistantConnection, AuthError, type AuthSession, type AuthSessionOptions, type AuthUser, type AuthenticatorSetup, type Availability, type BatchOp, type BatchRef, type BatchResult, type CallRing, type Channel, type ChannelError, type ChannelMessage, ChannelRefusal, type ChannelStatus, type ChannelUser, type Client, type ClientOptions, type CommentPage, type CommentPerson, type ConnectClient, type ConnectedApp, type ConnectingClient, type CurrentOrganization, type DeviceSession, type DevicesClient, type Facet, type FilterInput, type FormChallenge, type FormProof, type Histogram, type HistogramBucket, type HistoryChange, type HistoryPage, type InboxNotification, type InboxPage, type InvitationPreview, type InvitationSent, type InvokeOptions, type ListPage, type ListParams, type LiveChange, type LiveHandlers, type LiveSocket, type MapBounds, type MapBucket, type MapLayerModel, type MapParams, type MapResult, type MentionableUser, type Meta, type MetaResult, type NotificationHistoryClient, type Organization, type OrganizationInvitation, type OrganizationMember, type OrganizationPerson, type OrganizationRole, type OrganizationsClient, type OrganizationsFound, type Passkey, type PersonStatus, type PersonalMailLink, type PlatformSignIn, type PluginRef, type PollThenSocketOptions, PreconditionFailedError, type PresenceChange, type PresenceEntry, type ProblemDetails, type ProblemError, type PublicForm, type RecordCall, type RecordCallsHandlers, type RecordComment, type RecordOf, type RecordPermissions, type RecordPhotos, type RegisteredDevice, type RelatedLabels, type RequiredSetup, type ResourcePermissions, type ResourceRef, type RingsClient, type RoleLabel, type RoleOption, type RolesClient, type RuntimeClient, type RuntimeClientOptions, type RuntimeLastUpdate, type RuntimePolicy, type RuntimeStatus, type RuntimeUpdateStage, type SamlSignIn, type Series, type SeriesParams, type SeriesPoint, type SetupStatus, type SignInMethod, type SignInPolicy, type SignInPolicyClient, type SignInPolicyState, type SignInResult, type SignInRule, type SocketLike, type SourceMeta, type SourceRef, type StaffAccessRule, type StaffSignIn, type StaffSignInClient, type StatusClient, type StatusInput, type Stored, type StoredFile, type StoredFileVariant, type TwoFactorMethod, type UploadOptions, type UploadProgress, type UploadResult, type UserInvitation, type UserInvitationSent, type UsersClient, type UsersFound, type WebDeviceRegistration, type WorkflowConnection, type WorkflowTypeEntry, type WorkflowTypeList, availabilities, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, heldStatus, isApiError, listWire, maxStatusText, pollThenSocket, routedClient, sourceMeta, statusTextProblem, tokenExpiry };
|
package/dist/static-session.js
CHANGED
|
@@ -80,6 +80,9 @@ const createStaticSession = (token, user = {
|
|
|
80
80
|
linkProvider: unsupported("link a sign-in provider"),
|
|
81
81
|
linkedPersonalMail: async () => [],
|
|
82
82
|
linkPersonalMail: unsupported("link a mailbox"),
|
|
83
|
+
workflowConnections: async () => [],
|
|
84
|
+
connectAccount: unsupported("connect an account"),
|
|
85
|
+
disconnectAccount: unsupported("disconnect an account"),
|
|
83
86
|
connectedApps: async () => [],
|
|
84
87
|
disconnectApp: unsupported("disconnect an app"),
|
|
85
88
|
updateName: unsupported("change its name"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
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.
|
|
35
|
-
"@protobase/schema": "0.
|
|
34
|
+
"@protobase/layout": "0.69.0",
|
|
35
|
+
"@protobase/schema": "0.69.0",
|
|
36
36
|
"@simplewebauthn/browser": "^13.3.0",
|
|
37
37
|
"better-auth": "^1.7.12"
|
|
38
38
|
}
|