@protobase/schema 0.59.2 → 0.60.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.
@@ -8,7 +8,10 @@ export type CallVideoLayer = {
8
8
  height: number;
9
9
  bitrate: number;
10
10
  };
11
- /** A track the browser is about to send: `cid` is its `MediaStreamTrack.id`, which its offer names in `msid`. */
11
+ /**
12
+ * A track the browser is about to send: `cid` is the id its description names it by in `msid`, its `MediaStreamTrack.id`
13
+ * to a media server, the id of the stream it is sent on to other members (`peer`).
14
+ */
12
15
  export type CallTrackRequest = {
13
16
  cid: string;
14
17
  kind: 'audio' | 'video';
@@ -26,6 +29,8 @@ export type CallCandidate = {
26
29
  };
27
30
  /** What the browser hands a new server session so it resumes the member's media session where the last one left it. */
28
31
  export type CallResume = {
32
+ /** The call the member is in, from `joined`: a resume of a call that ended is refused. */
33
+ call: string;
29
34
  /** The member's participant in the media server, from `joined`. */
30
35
  participant: string;
31
36
  /** The browser's current local (offer) and remote (answer) descriptions, with a media server. */
@@ -94,11 +99,20 @@ export type CallRemoteTrack = {
94
99
  source: CallTrackSource;
95
100
  muted: boolean;
96
101
  };
97
- /** Why the member is no longer in the call: `ended` and `removed` are final, `rejoin` asks the browser to join anew. */
98
- export type CallLeftReason = 'ended' | 'removed' | 'refused' | 'rejoin';
102
+ /**
103
+ * Why the member is no longer in the call: `ended`, `removed`, `full` and `refused` are final, `rejoin` asks the
104
+ * browser to join anew, and `unavailable` is a server that could not take the member in, after the browser tried again.
105
+ */
106
+ export type CallLeftReason = 'ended' | 'removed' | 'full' | 'refused' | 'unavailable' | 'rejoin';
107
+ /** Someone in a call, since when (ISO 8601). */
108
+ export type CallRosterMember = {
109
+ member: string;
110
+ joined_at: string;
111
+ };
99
112
  /** A message from the server. */
100
113
  export type CallServerMessage = {
101
114
  type: 'joined';
115
+ call: string;
102
116
  mode: CallMode;
103
117
  participant: string;
104
118
  iceServers: {
@@ -142,6 +156,11 @@ export type CallServerMessage = {
142
156
  type: 'unpublished';
143
157
  sid: string;
144
158
  } |
159
+ /** Everyone in the call, the member too, in the order they came, whenever that changes. */
160
+ {
161
+ type: 'members';
162
+ members: CallRosterMember[];
163
+ } |
145
164
  /** With `peer`: every other member in the call, whenever that changes. */
146
165
  {
147
166
  type: 'peers';
@@ -34,7 +34,8 @@ import { capacitorOrigin } from "./capacitor-origins.js";
34
34
  import { pushRecord, serviceWorkerFile } from "./push-record.js";
35
35
  import { deviceIdParam, devicesPath } from "./devices-path.js";
36
36
  import { historyIdParam, historyIdPattern, historyPath } from "./history-path.js";
37
+ import { Availability, PersonStatus, StatusInput, availabilities, heldStatus, maxStatusText, statusPath, statusTextProblem } from "./status.js";
37
38
  import { listColumnNames } from "./list-columns.js";
38
39
  import { builtInFieldTypes } from "./built-in-field-types.js";
39
- import { CallCandidate, CallClientMessage, CallDescription, CallLeftReason, CallMode, CallRemoteTrack, CallResume, CallServerMessage, CallTrackRequest, CallTrackSource, CallVideoLayer } from "./calls/call-protocol.js";
40
- export { type AddressCheck, type CallCandidate, type CallClientMessage, type CallDescription, type CallLeftReason, type CallMode, type CallRemoteTrack, type CallResume, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type Locale, type MobileReleaseAnswer, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type ReleaseBinding, type SearchTerm, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, boardErrors, bottomBarFor, builtInFieldTypes, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, datesErrors, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, searchTerms, serviceWorkerFile, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources };
40
+ import { CallCandidate, CallClientMessage, CallDescription, CallLeftReason, CallMode, CallRemoteTrack, CallResume, CallRosterMember, CallServerMessage, CallTrackRequest, CallTrackSource, CallVideoLayer } from "./calls/call-protocol.js";
41
+ export { type AddressCheck, type Availability, type CallCandidate, type CallClientMessage, type CallDescription, type CallLeftReason, type CallMode, type CallRemoteTrack, type CallResume, type CallRosterMember, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type Locale, type MobileReleaseAnswer, type PersonStatus, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type ReleaseBinding, type SearchTerm, type StatusInput, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, datesErrors, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources };
package/dist/internal.js CHANGED
@@ -34,6 +34,7 @@ import { capacitorOrigin } from "./capacitor-origins.js";
34
34
  import { pushRecord, serviceWorkerFile } from "./push-record.js";
35
35
  import { deviceIdParam, devicesPath } from "./devices-path.js";
36
36
  import { historyIdParam, historyIdPattern, historyPath } from "./history-path.js";
37
+ import { availabilities, heldStatus, maxStatusText, statusPath, statusTextProblem } from "./status.js";
37
38
  import { listColumnNames } from "./list-columns.js";
38
39
  import { builtInFieldTypes } from "./built-in-field-types.js";
39
- export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, boardErrors, bottomBarFor, builtInFieldTypes, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, datesErrors, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, searchTerms, serviceWorkerFile, shapes, shownInputs, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources };
40
+ export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, datesErrors, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources };
@@ -0,0 +1,26 @@
1
+ //#region src/status.d.ts
2
+ /** Whether a person may be reached: `automatic` says nothing, `busy` is a mark only, `do_not_disturb` holds their pushes. */
3
+ export declare const availabilities: readonly ["automatic", "busy", "do_not_disturb"];
4
+ export type Availability = (typeof availabilities)[number];
5
+ /** The most characters a custom status holds, counted as a person sees them, an emoji as one. */
6
+ export declare const maxStatusText = 100;
7
+ /** A person's status as the API answers it: `text` and `clearsAt` are `null` when not set. */
8
+ export type PersonStatus = {
9
+ userId: string;
10
+ availability: Availability;
11
+ text: string | null;
12
+ clearsAt: string | null;
13
+ };
14
+ /** What a person sets: an availability, a custom text, and when it clears, an ISO time, `null` for never. */
15
+ export type StatusInput = {
16
+ availability: Availability;
17
+ text: string | null;
18
+ clearsAt: string | null;
19
+ };
20
+ /** The path of the status endpoints under the API's system path (`/api`): the caller's own, or `people` they share an organization with. */
21
+ export declare const statusPath: (systemPath: string, part?: "people") => string;
22
+ /** What is wrong with a custom status text, as a sentence to show; `undefined` when it may be set. */
23
+ export declare const statusTextProblem: (text: string) => "A status is one line of text, without control characters" | "A status is at most 100 characters" | undefined;
24
+ /** The status as it holds at `now`: none once its clear time has passed, or when it says nothing. */
25
+ export declare const heldStatus: <S extends Pick<PersonStatus, "availability" | "text" | "clearsAt">>(status: S | null | undefined, now?: number) => S | undefined;
26
+ //#endregion
package/dist/status.js ADDED
@@ -0,0 +1,26 @@
1
+ //#region src/status.ts
2
+ /** Whether a person may be reached: `automatic` says nothing, `busy` is a mark only, `do_not_disturb` holds their pushes. */
3
+ const availabilities = [
4
+ "automatic",
5
+ "busy",
6
+ "do_not_disturb"
7
+ ];
8
+ /** The most characters a custom status holds, counted as a person sees them, an emoji as one. */
9
+ const maxStatusText = 100;
10
+ /** The path of the status endpoints under the API's system path (`/api`): the caller's own, or `people` they share an organization with. */
11
+ const statusPath = (systemPath, part) => `${systemPath}/status${part === void 0 ? "" : `/${part}`}`;
12
+ const controlCharacter = /\p{Cc}/u;
13
+ /** What is wrong with a custom status text, as a sentence to show; `undefined` when it may be set. */
14
+ const statusTextProblem = (text) => {
15
+ if (controlCharacter.test(text)) return "A status is one line of text, without control characters";
16
+ if ([...text].length > 100) return `A status is at most 100 characters`;
17
+ };
18
+ /** The status as it holds at `now`: none once its clear time has passed, or when it says nothing. */
19
+ const heldStatus = (status, now = Date.now()) => {
20
+ if (!status) return;
21
+ if (status.clearsAt !== null && Date.parse(status.clearsAt) <= now) return;
22
+ if (status.availability === "automatic" && status.text === null) return;
23
+ return status;
24
+ };
25
+ //#endregion
26
+ export { availabilities, heldStatus, maxStatusText, statusPath, statusTextProblem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.59.2",
3
+ "version": "0.60.0",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {