@protobase/client 0.59.2 → 0.59.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.
- package/dist/client.d.ts +6 -0
- package/dist/client.js +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/routed-client.d.ts +1 -1
- package/dist/routed-client.js +3 -2
- package/dist/status.d.ts +19 -0
- package/dist/status.js +36 -0
- package/dist/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -112,6 +112,12 @@ export declare const createClient: (options?: ClientOptions) => {
|
|
|
112
112
|
markRead: (id: string) => Promise<void>;
|
|
113
113
|
markAllRead: (upTo: string) => Promise<void>;
|
|
114
114
|
};
|
|
115
|
+
status: {
|
|
116
|
+
own: () => Promise<import("@protobase/schema/internal").PersonStatus | null>;
|
|
117
|
+
set: (status: import("@protobase/schema/internal").StatusInput) => Promise<import("@protobase/schema/internal").PersonStatus | null>;
|
|
118
|
+
clear: () => Promise<void>;
|
|
119
|
+
people: () => Promise<import("@protobase/schema/internal").PersonStatus[]>;
|
|
120
|
+
};
|
|
115
121
|
};
|
|
116
122
|
export type Client = ReturnType<typeof createClient>;
|
|
117
123
|
//#endregion
|
package/dist/client.js
CHANGED
|
@@ -6,6 +6,7 @@ import { followLive } from "./live.js";
|
|
|
6
6
|
import { sharedLive } from "./shared-live.js";
|
|
7
7
|
import { channelsClient } from "./channels.js";
|
|
8
8
|
import { devicesClient } from "./devices.js";
|
|
9
|
+
import { statusClient } from "./status.js";
|
|
9
10
|
import { notificationHistoryClient } from "./notification-history.js";
|
|
10
11
|
import { encodeKey } from "@protobase/schema/internal";
|
|
11
12
|
//#region src/client.ts
|
|
@@ -460,7 +461,8 @@ const createClient = (options = {}) => {
|
|
|
460
461
|
live,
|
|
461
462
|
channel,
|
|
462
463
|
devices: devicesClient(send),
|
|
463
|
-
notifications: notificationHistoryClient(send)
|
|
464
|
+
notifications: notificationHistoryClient(send),
|
|
465
|
+
status: statusClient(send)
|
|
464
466
|
};
|
|
465
467
|
};
|
|
466
468
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { UploadProgress } from "./upload-request.js";
|
|
|
9
9
|
import { LiveChange, LiveHandlers } from "./live.js";
|
|
10
10
|
import { Aggregate, AggregateGroup, AggregateParams, AggregateSplitTotal, BatchOp, BatchRef, BatchResult, CommentPage, CommentPerson, Facet, FormChallenge, FormProof, Histogram, HistogramBucket, HistoryChange, HistoryPage, ListPage, MapBounds, MapBucket, MapLayerModel, MapResult, MentionableUser, Meta, MetaResult, PluginRef, PublicForm, RecordComment, RecordOf, RecordPermissions, RecordPhotos, RelatedLabels, ResourcePermissions, ResourceRef, Series, SeriesParams, SeriesPoint, SourceRef, Stored, StoredFile, StoredFileVariant } from "./types.js";
|
|
11
11
|
import { Client, InvokeOptions, UploadOptions, UploadResult, createClient } from "./client.js";
|
|
12
|
+
import { Availability, PersonStatus, StatusClient, StatusInput } from "./status.js";
|
|
12
13
|
import { ApiError, PreconditionFailedError, ProblemDetails, ProblemError, isApiError } from "./problem.js";
|
|
13
14
|
import { fileUrl } from "./file-urls.js";
|
|
14
15
|
import { routedClient } from "./routed-client.js";
|
|
@@ -27,4 +28,5 @@ import { AuthSession, AuthSessionOptions, createAuthSession, tokenExpiry } from
|
|
|
27
28
|
import { createStaticSession } from "./static-session.js";
|
|
28
29
|
import { AssistantClient, AssistantClientOptions, AssistantConnection, createAssistantClient } from "./assistant.js";
|
|
29
30
|
import { RuntimeClient, RuntimeClientOptions, RuntimeLastUpdate, RuntimePolicy, RuntimeStatus, RuntimeUpdateStage, createRuntimeClient } from "./runtime.js";
|
|
30
|
-
|
|
31
|
+
import { availabilities, heldStatus, maxStatusText, statusTextProblem } from "@protobase/schema/internal";
|
|
32
|
+
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 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 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 PlatformSignIn, type PluginRef, PreconditionFailedError, type PresenceChange, type PresenceEntry, type ProblemDetails, type ProblemError, type PublicForm, type RecordComment, type RecordOf, type RecordPermissions, type RecordPhotos, type RegisteredDevice, 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 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, availabilities, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, heldStatus, isApiError, listWire, maxStatusText, routedClient, sourceMeta, statusTextProblem, tokenExpiry };
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ import { createAuthSession, tokenExpiry } from "./auth.js";
|
|
|
10
10
|
import { createStaticSession } from "./static-session.js";
|
|
11
11
|
import { createAssistantClient } from "./assistant.js";
|
|
12
12
|
import { createRuntimeClient } from "./runtime.js";
|
|
13
|
-
|
|
13
|
+
import { availabilities, heldStatus, maxStatusText, statusTextProblem } from "@protobase/schema/internal";
|
|
14
|
+
export { ApiError, AuthError, ChannelRefusal, PreconditionFailedError, availabilities, createAssistantClient, createAuthSession, createClient, createRuntimeClient, createStaticSession, fileUrl, filterText, heldStatus, isApiError, listWire, maxStatusText, routedClient, sourceMeta, statusTextProblem, tokenExpiry };
|
package/dist/routed-client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Client } from "./client.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* One client over the app's own API and the sources it draws resources from: a call about a resource goes to the API
|
|
5
5
|
* that serves it (`sourceOf` gives a source's client, or `undefined` for the app's own), and `meta`, `invoke`, the
|
|
6
|
-
* public forms, `live` and the user's devices and
|
|
6
|
+
* public forms, `live` and the user's devices, notifications and status go to the app's own. A batch goes to the one API all its writes are for; one that writes to two cannot be atomic, so it is
|
|
7
7
|
* refused before anything is sent.
|
|
8
8
|
*/
|
|
9
9
|
export declare const routedClient: (own: Client, sourceOf: (resource: string) => Client | undefined) => Client;
|
package/dist/routed-client.js
CHANGED
|
@@ -3,7 +3,7 @@ const nameOf = (resource) => typeof resource === "string" ? resource : resource.
|
|
|
3
3
|
/**
|
|
4
4
|
* One client over the app's own API and the sources it draws resources from: a call about a resource goes to the API
|
|
5
5
|
* that serves it (`sourceOf` gives a source's client, or `undefined` for the app's own), and `meta`, `invoke`, the
|
|
6
|
-
* public forms, `live` and the user's devices and
|
|
6
|
+
* public forms, `live` and the user's devices, notifications and status go to the app's own. A batch goes to the one API all its writes are for; one that writes to two cannot be atomic, so it is
|
|
7
7
|
* refused before anything is sent.
|
|
8
8
|
*/
|
|
9
9
|
const routedClient = (own, sourceOf) => {
|
|
@@ -42,7 +42,8 @@ const routedClient = (own, sourceOf) => {
|
|
|
42
42
|
live: (handlers) => own.live(handlers),
|
|
43
43
|
channel: (resource, key) => own.channel(resource, key),
|
|
44
44
|
devices: own.devices,
|
|
45
|
-
notifications: own.notifications
|
|
45
|
+
notifications: own.notifications,
|
|
46
|
+
status: own.status
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
//#endregion
|
package/dist/status.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Transport } from "./transport.js";
|
|
2
|
+
import { Availability, PersonStatus, PersonStatus as PersonStatus$1, StatusInput, StatusInput as StatusInput$1 } from "@protobase/schema/internal";
|
|
3
|
+
//#region src/status.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* People's own status (`/api/status`), in an app with `status: {}`: `own` the signed-in person's, `set` replaces it
|
|
6
|
+
* and answers it, `clear` removes it, and `people` the statuses of everyone who shares an organization with them, those
|
|
7
|
+
* without one left out. A status past its clear time is none. `set` rejects with an `ApiError` of slug
|
|
8
|
+
* `invalid-status-text` for a text with control characters or over `maxStatusText` characters, and
|
|
9
|
+
* `own-sign-in-only` for staff signed in as the person.
|
|
10
|
+
*/
|
|
11
|
+
export declare const statusClient: (send: Transport) => {
|
|
12
|
+
own: () => Promise<PersonStatus | null>;
|
|
13
|
+
set: (status: StatusInput) => Promise<PersonStatus | null>;
|
|
14
|
+
clear: () => Promise<void>;
|
|
15
|
+
people: () => Promise<PersonStatus[]>;
|
|
16
|
+
};
|
|
17
|
+
export type StatusClient = ReturnType<typeof statusClient>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export type { Availability, PersonStatus$1 as PersonStatus, StatusInput$1 as StatusInput };
|
package/dist/status.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { statusPath } from "@protobase/schema/internal";
|
|
2
|
+
//#region src/status.ts
|
|
3
|
+
/**
|
|
4
|
+
* People's own status (`/api/status`), in an app with `status: {}`: `own` the signed-in person's, `set` replaces it
|
|
5
|
+
* and answers it, `clear` removes it, and `people` the statuses of everyone who shares an organization with them, those
|
|
6
|
+
* without one left out. A status past its clear time is none. `set` rejects with an `ApiError` of slug
|
|
7
|
+
* `invalid-status-text` for a text with control characters or over `maxStatusText` characters, and
|
|
8
|
+
* `own-sign-in-only` for staff signed in as the person.
|
|
9
|
+
*/
|
|
10
|
+
const statusClient = (send) => ({
|
|
11
|
+
own: async () => (await (await send({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: statusPath(""),
|
|
14
|
+
system: true
|
|
15
|
+
})).json()).status,
|
|
16
|
+
set: async (status) => (await (await send({
|
|
17
|
+
method: "PUT",
|
|
18
|
+
path: statusPath(""),
|
|
19
|
+
system: true,
|
|
20
|
+
body: status
|
|
21
|
+
})).json()).status,
|
|
22
|
+
clear: async () => {
|
|
23
|
+
await send({
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
path: statusPath(""),
|
|
26
|
+
system: true
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
people: async () => (await (await send({
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: statusPath("", "people"),
|
|
32
|
+
system: true
|
|
33
|
+
})).json()).statuses
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { statusClient };
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/client",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.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.59.
|
|
35
|
-
"@protobase/schema": "0.59.
|
|
34
|
+
"@protobase/layout": "0.59.3",
|
|
35
|
+
"@protobase/schema": "0.59.3",
|
|
36
36
|
"@simplewebauthn/browser": "^13.3.0",
|
|
37
37
|
"better-auth": "^1.7.12"
|
|
38
38
|
}
|