@protobase/schema 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/internal.d.ts +2 -1
- package/dist/internal.js +2 -1
- package/dist/status.d.ts +26 -0
- package/dist/status.js +26 -0
- package/package.json +1 -1
package/dist/internal.d.ts
CHANGED
|
@@ -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
40
|
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 };
|
|
41
|
+
export { type AddressCheck, type Availability, 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 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 };
|
package/dist/status.d.ts
ADDED
|
@@ -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 };
|