@protobase/schema 0.21.10 → 0.21.11
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 +3 -2
- package/dist/index.js +2 -1
- package/dist/layout.d.ts +3 -3
- package/dist/model.d.ts +10 -6
- package/dist/record-when.d.ts +4 -0
- package/dist/record-when.js +10 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
|
|
2
|
-
import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, PeriodChartModel, RecordMode, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
2
|
+
import { ActionInputKind, ActionInputModel, ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CalendarView, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CommentsSectionModel, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, FormModel, GalleryModel, GroupChartModel, HelpWhen, HistorySectionModel, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, PeriodChartModel, RecordMode, RecordWhen, RelatedColumnModel, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, ShowWhen, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
|
|
3
3
|
import { AccessAction, AccessContext, AccessFn, AccessResult, AccessUser, FieldAccess, FieldRule } from "./access/types.js";
|
|
4
4
|
import { AnyField, Constraint, Field, FieldMeta, FieldTypeDef } from "./field.js";
|
|
5
5
|
import { RelationField } from "./relation-field.js";
|
|
@@ -9,6 +9,7 @@ import { FieldRefs, FieldsInput, Ref, Refs } from "./refs.js";
|
|
|
9
9
|
import { CreatedOptions, DeletedOptions, EventActor, EventContext, EventHelpers, EventMatch, EventSpec, UndeletedOptions, UpdatedOptions } from "./events/event-helpers.js";
|
|
10
10
|
import { Access, InferRecord, Issue, KeyOf, KeyRefs, RecordKey, RecordOf } from "./resource-types.js";
|
|
11
11
|
import { ResourceBuilder, SearchRef, SearchRefs, Validator, resource } from "./resource.js";
|
|
12
|
+
import { isRecordCondition } from "./record-when.js";
|
|
12
13
|
import { ChartInput, GroupChartInput, PeriodChartInput } from "./view-chart.js";
|
|
13
14
|
import { FormInput } from "./view-form.js";
|
|
14
15
|
import { ListColumn } from "./view-columns.js";
|
|
@@ -41,4 +42,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
|
|
|
41
42
|
import { restrictModel } from "./access/restrict.js";
|
|
42
43
|
import "./access/index.js";
|
|
43
44
|
import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
|
|
44
|
-
export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type Constraint, type CreateModel, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileField, type FileFieldModel, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PeriodChartInput, type PeriodChartModel, type RecordKey, type RecordMode, type RecordOf, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
|
|
45
|
+
export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, type ActionInputKind, type ActionInputModel, type ActionModel, type ActionRun, type AnyField, type AppAddress, type AssistantAction, type AssistantActionRequest, type AssistantCardPart, type AssistantDiff, type AssistantEvent, type AssistantMessage, type AssistantMessageRequest, type AssistantPart, type AssistantState, type AssistantStep, type AssistantStepState, type AssistantTablePart, type AssistantTextPart, type AssistantTone, type AssistantWidgetPart, type BadgeShape, type BottomBarItemModel, type BottomBarModel, type BottomBarNames, type BottomBarSource, type CalendarView, type Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartInput, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CommentsSectionModel, type CompareOp, type ComponentRef, type Constraint, type CreateModel, type CreatedOptions, type CustomSectionModel, type DatePreset, type DeletedOptions, type DurationLiteral, type DurationUnit, type EvaluateOptions, type EventActor, type EventContext, type EventHelpers, type EventMatch, type EventModel, type EventOperation, type EventSpec, type ExportModel, type Field, type FieldAccess, type FieldFormat, type FieldMeta, type FieldModel, type FieldPath, type FieldRefValue, type FieldRefs, type FieldRule, type FieldType, type FieldTypeDef, type FieldView, type FieldViewModel, type FieldViews, type FieldWidgetModel, type FieldsInput, type FileField, type FileFieldModel, type FileOptions, type FileProcessor, type FileProcessorInput, type FilterError, type FilterErrorCode, type FilterExpr, type FilterLayout, type FilterLimits, type FilterOf, type FilterParse, type FilterValue, type FilterWidgetModel, type FormAddress, type FormInput, type FormModel, type GalleryModel, type Grant, type GroupChartInput, type GroupChartModel, type HeldCapability, type HelpWhen, type HistorySectionModel, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, type ListColumn, type ListDisplayModel, type ListModel, type ListQuery, type Literal, type MapSectionModel, type MapView, type NavModel, type NavRecentModel, type NowValue, type OrderByCheck, type OrderByItem, type OrderByParse, type PeriodChartInput, type PeriodChartModel, type RecordKey, type RecordMode, type RecordOf, type RecordWhen, type Ref, type Refs, type RelatedColumnModel, type RelatedModel, type RelationField, type ResolveOptions, type ResolvedAccess, type ResourceBuilder, type ResourceModel, type RoleEntry, type RoleLimit, type Roles, type RolesOptions, type RowFilterOperation, type Rule, type SaveFeedback, type SaveSearchModel, type SearchMatch, type SearchRef, type SearchRefs, type SearchResultModel, type SearchesOfModel, type SectionPresentation, type ShowWhen, type SignInAddress, type SignInPromptModel, type SignInStep, type SignInViewModel, type SortSpec, type Span, type StatusTone, type UndeletedOptions, type UpdatedOptions, type UserMenuItemModel, type UserMenuModel, type UserMenuSource, type Validator, type ViewBuilder, type ViewModel, type ViewProps, accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createWhere, where } from "./filter/where.js";
|
|
|
9
9
|
import { anonymousRole } from "./access/role-entry.js";
|
|
10
10
|
import { accessWarnings, checkRecord, fieldsUsedBy, resolveAccess } from "./access/resolve.js";
|
|
11
11
|
import { resource } from "./resource.js";
|
|
12
|
+
import { isRecordCondition } from "./record-when.js";
|
|
12
13
|
import { formPath, formRoute, readFormAddress } from "./form-address.js";
|
|
13
14
|
import { fieldRef } from "./field-ref.js";
|
|
14
15
|
import { view } from "./view.js";
|
|
@@ -24,4 +25,4 @@ import { rule } from "./access/rule.js";
|
|
|
24
25
|
import { defineRoles } from "./access/roles.js";
|
|
25
26
|
import { pickView } from "./access/pick-view.js";
|
|
26
27
|
import { restrictModel } from "./access/restrict.js";
|
|
27
|
-
export { accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
|
|
28
|
+
export { accessWarnings, addressWords, anonymousRole, appPath, bottomBar, bottomBarErrors, checkFilter, checkOrderBy, checkRecord, createWhere, defineRoles, enumLabel, evaluateFilter, f, fieldRef, fieldsUsedBy, fitsKeyType, formPath, formRoute, imageFormats, isRecordCondition, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readFormAddress, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardPhotosModel, HelpWhen, LayoutItemModel, RelatedModel, SectionPresentation, ShowWhen } from "./model.js";
|
|
1
|
+
import { CardPhotosModel, HelpWhen, LayoutItemModel, RecordWhen, RelatedModel, SectionPresentation, ShowWhen } from "./model.js";
|
|
2
2
|
import { Ref } from "./refs.js";
|
|
3
3
|
import { ComponentRef, ViewProps } from "./view-displays.js";
|
|
4
4
|
//#region src/layout.d.ts
|
|
@@ -31,7 +31,7 @@ export declare const layout: {
|
|
|
31
31
|
help?: string;
|
|
32
32
|
helpWhen?: HelpWhen;
|
|
33
33
|
presentation?: SectionPresentation;
|
|
34
|
-
when?:
|
|
34
|
+
when?: RecordWhen;
|
|
35
35
|
}) => LayoutItemModel;
|
|
36
36
|
/**
|
|
37
37
|
* The record's photos as tiles in the main column, one large and the next four smaller, the last saying how many more
|
|
@@ -48,7 +48,7 @@ export declare const layout: {
|
|
|
48
48
|
}) => LayoutItemModel;
|
|
49
49
|
/** A read-only summary card of fields beside the main column. */
|
|
50
50
|
sidebar: (fields: Ref[], o?: {
|
|
51
|
-
when?:
|
|
51
|
+
when?: RecordWhen;
|
|
52
52
|
}) => LayoutItemModel;
|
|
53
53
|
/** A table of the records of another resource that point at this one, directly or through a join table. */
|
|
54
54
|
related: (title: string, o: Omit<RelatedModel, "kind" | "title">) => LayoutItemModel;
|
package/dist/model.d.ts
CHANGED
|
@@ -288,6 +288,8 @@ export type HelpWhen = 'always' | 'editing';
|
|
|
288
288
|
* [Form and read view](website/src/content/docs/reference/ui-config.mdx#form-and-read-view).
|
|
289
289
|
*/
|
|
290
290
|
export type ShowWhen = 'always' | 'editing' | 'reading';
|
|
291
|
+
/** `ShowWhen`, or an AIP-160 condition over the saved record, as `<Show when>` takes: the item shows while it holds. See "Form and read view" in the UI reference. */
|
|
292
|
+
export type RecordWhen = ShowWhen | (string & {});
|
|
291
293
|
/** How a field's badges are drawn: `arrow` points them right, as on a rating scale. */
|
|
292
294
|
export type BadgeShape = 'arrow';
|
|
293
295
|
/** A field type by the name a plugin registers it under, and the plain data it is given. */
|
|
@@ -640,8 +642,10 @@ export type RelatedModel = {
|
|
|
640
642
|
display?: string;
|
|
641
643
|
/** The text when nothing matches. */
|
|
642
644
|
empty?: string;
|
|
643
|
-
/**
|
|
644
|
-
|
|
645
|
+
/** Leave the section off the page while it has no records. */
|
|
646
|
+
hideEmpty?: boolean;
|
|
647
|
+
/** Whether it shows on the form, the read view or both, or a condition on the saved record that it shows while it holds. */
|
|
648
|
+
when?: RecordWhen;
|
|
645
649
|
};
|
|
646
650
|
/**
|
|
647
651
|
* A project component drawn on the record page where it is listed, in the main column or with `sidebar` in the
|
|
@@ -727,15 +731,15 @@ export type LayoutItemModel = {
|
|
|
727
731
|
* label/value rows; the form edits them as any section's.
|
|
728
732
|
*/
|
|
729
733
|
presentation?: SectionPresentation;
|
|
730
|
-
/** Whether it shows on the form, the read view or both. */
|
|
731
|
-
when?:
|
|
734
|
+
/** Whether it shows on the form, the read view or both, or a condition on the saved record that it shows while it holds. */
|
|
735
|
+
when?: RecordWhen;
|
|
732
736
|
} | {
|
|
733
737
|
/** A read-only summary card beside the main column. */
|
|
734
738
|
kind: 'sidebar';
|
|
735
739
|
/** The fields it shows, in order. */
|
|
736
740
|
fields: string[];
|
|
737
|
-
/** Whether it shows on the form, the read view or both. */
|
|
738
|
-
when?:
|
|
741
|
+
/** Whether it shows on the form, the read view or both, or a condition on the saved record that it shows while it holds. */
|
|
742
|
+
when?: RecordWhen;
|
|
739
743
|
} | RelatedModel | CustomSectionModel | MapSectionModel | GalleryModel | HistorySectionModel | CommentsSectionModel;
|
|
740
744
|
/**
|
|
741
745
|
* A record's photos as tiles in the main column under `title`, one large and the next few smaller, opening a lightbox
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/record-when.ts
|
|
2
|
+
const showModes = [
|
|
3
|
+
"always",
|
|
4
|
+
"editing",
|
|
5
|
+
"reading"
|
|
6
|
+
];
|
|
7
|
+
/** Whether `when` is a condition on the saved record rather than one of the `ShowWhen` modes. */
|
|
8
|
+
const isRecordCondition = (when) => when !== void 0 && !showModes.includes(when);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isRecordCondition };
|