@protobase/schema 0.19.8 → 0.19.10

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FileOptions, FileProcessor, FileProcessorInput, ImageFormat, ImageVariant, ImageVariantOptions, imageFormats } from "./files/file-options.js";
2
- import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, GalleryModel, HelpWhen, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, RecordMode, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, SignInPromptModel, SignInViewModel, SortSpec, Span, StatusTone, UserMenuItemModel, UserMenuModel, ViewModel } from "./model.js";
2
+ import { ActionModel, ActionRun, AppAddress, BadgeShape, BottomBarItemModel, BottomBarModel, CardFavoriteModel, CardPhotosModel, ChartGranularity, ChartModel, ChartRange, CheckedFilter, CompareOp, CreateModel, CustomSectionModel, DatePreset, DurationLiteral, DurationUnit, EventModel, EventOperation, ExportModel, FieldFormat, FieldModel, FieldPath, FieldType, FieldViewModel, FieldWidgetModel, FileFieldModel, FilterError, FilterErrorCode, FilterExpr, FilterLayout, FilterOf, FilterValue, FilterWidgetModel, GalleryModel, HelpWhen, JsonValue, KeyValue, LayoutItemModel, ListDisplayModel, ListModel, ListQuery, Literal, MapSectionModel, MapView, NavModel, NavRecentModel, NowValue, OrderByItem, RecordMode, RelatedModel, ResourceModel, SaveFeedback, SaveSearchModel, SearchMatch, SearchResultModel, SearchesOfModel, SectionPresentation, 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";
@@ -37,4 +37,4 @@ import { AccessSource, ResolveOptions, ResolvedAccess, RowFilterOperation, acces
37
37
  import { restrictModel } from "./access/restrict.js";
38
38
  import "./access/index.js";
39
39
  import { AssistantAction, AssistantActionRequest, AssistantCardPart, AssistantDiff, AssistantEvent, AssistantMessage, AssistantMessageRequest, AssistantPart, AssistantState, AssistantStep, AssistantStepState, AssistantTablePart, AssistantTextPart, AssistantTone, AssistantWidgetPart } from "./assistant/protocol.js";
40
- export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, 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 Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, type CompareOp, type ComponentRef, type Constraint, 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 GalleryModel, type Grant, type HeldCapability, type HelpWhen, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, 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 RecordKey, type RecordMode, type RecordOf, type Ref, type Refs, 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 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, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
40
+ export { type Access, type AccessAction, type AccessContext, type AccessFn, type AccessResult, type AccessSource, type AccessUser, 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 Capability, type CapabilityAction, type CapabilityLimit, type CapabilityScope, type CardFavoriteModel, type CardPhotosModel, type ChartGranularity, type ChartModel, type ChartRange, type CheckResult, type CheckedFilter, 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 GalleryModel, type Grant, type HeldCapability, type HelpWhen, type ImageFormat, type ImageVariant, type ImageVariantOptions, type InferRecord, type Issue, type JsonValue, type KeyOf, type KeyRefs, type KeyType, type KeyValue, type LayoutItemModel, 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 RecordKey, type RecordMode, type RecordOf, type Ref, type Refs, 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 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, imageFormats, keyTypes, layout as l, maxBottomBarItems, parseFilter, parseOrderBy, pickView, printFilter, printOrderBy, readAppPath, readSignInAddress, resolveAccess, resource, restrictModel, rule, signInParams, signInPath, signInRoute, signInSteps, userMenu, view, where };
package/dist/model.d.ts CHANGED
@@ -223,6 +223,8 @@ export type FieldViewModel = {
223
223
  format?: FieldFormat;
224
224
  /** A text that runs over several lines: forms edit it in a box that grows with it, and its line breaks show. */
225
225
  multiline?: boolean;
226
+ /** Markdown: forms edit its source with a preview, and it shows rendered, raw HTML as text. */
227
+ markdown?: boolean;
226
228
  /** Text before a number wherever it is shown, such as `€`. */
227
229
  prefix?: string;
228
230
  /** Text after a number wherever it is shown, such as a unit: `m²` shows `120 m²`. */
@@ -845,6 +847,13 @@ export type ViewModel = {
845
847
  searchesOf?: SearchesOfModel;
846
848
  /** Whether the list page offers Export, and the most rows a file holds; offered without a limit when omitted. */
847
849
  export?: false | ExportModel;
850
+ /** The page that creates the resource's records, in place of the create form. */
851
+ create?: CreateModel;
852
+ };
853
+ /** How the resource's records are created (`.create(...)`): a page of the app's own. */
854
+ export type CreateModel = {
855
+ /** The composed page shown at `/<resource>/new`, which the list's New button opens. */
856
+ page: string;
848
857
  };
849
858
  /** The list page's Export (`.export(...)`): how many rows a file may hold. */
850
859
  export type ExportModel = {
@@ -28,6 +28,12 @@ export declare class FieldView<N extends string = string, V = unknown> {
28
28
  * page and cards keep its line breaks. Only a text field takes it.
29
29
  */
30
30
  multiline(): FieldView<N, V>;
31
+ /**
32
+ * Markdown, such as notes: forms edit its source with a Write and Preview switch, and the record page, a page's field
33
+ * blocks and a card's subtitle show it rendered, raw HTML shown as text and links opening in a new tab; the list's
34
+ * table shows its text on one line. Only a text field takes it.
35
+ */
36
+ markdown(): FieldView<N, V>;
31
37
  /** Text before a number wherever it is shown, such as a currency: `.prefix('€')`. */
32
38
  prefix(prefix: string): FieldView<N, V>;
33
39
  /** Text after a number wherever it is shown, such as a unit: `.suffix(' m²')`. */
@@ -34,6 +34,14 @@ var FieldView = class FieldView {
34
34
  multiline() {
35
35
  return this.with({ multiline: true });
36
36
  }
37
+ /**
38
+ * Markdown, such as notes: forms edit its source with a Write and Preview switch, and the record page, a page's field
39
+ * blocks and a card's subtitle show it rendered, raw HTML shown as text and links opening in a new tab; the list's
40
+ * table shows its text on one line. Only a text field takes it.
41
+ */
42
+ markdown() {
43
+ return this.with({ markdown: true });
44
+ }
37
45
  /** Text before a number wherever it is shown, such as a currency: `.prefix('€')`. */
38
46
  prefix(prefix) {
39
47
  return this.with({ prefix });
package/dist/view.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ActionModel, ChartGranularity, ChartRange, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, NavModel, NavRecentModel, RecordMode, ResourceModel, SaveFeedback, SaveSearchModel, SignInPromptModel, ViewModel } from "./model.js";
1
+ import { ActionModel, ChartGranularity, ChartRange, CreateModel, ExportModel, FilterWidgetModel, HelpWhen, LayoutItemModel, ListDisplayModel, NavModel, NavRecentModel, RecordMode, ResourceModel, SaveFeedback, SaveSearchModel, SignInPromptModel, ViewModel } from "./model.js";
2
2
  import { FieldRefs, Ref } from "./refs.js";
3
3
  import { actions } from "./view-actions.js";
4
4
  import { displays } from "./view-displays.js";
@@ -145,6 +145,14 @@ export declare class ViewBuilder<R extends {
145
145
  * positive whole number. See [Exports](website/src/content/docs/reference/ui-config.mdx#exports).
146
146
  */
147
147
  export(options: false | ExportModel): ViewBuilder<R>;
148
+ /**
149
+ * Records are created on `page`, a composed page of the app's own, in place of the create form: `/<resource>/new`
150
+ * shows it with the address's `values`, and the list's New button opens it for whoever may open the page, whatever the
151
+ * resource's `create` access. So the resource's API can refuse creates (`create: never`) while the page creates
152
+ * through an API function. The server refuses a page that does not exist when it starts. See
153
+ * [Create pages](website/src/content/docs/reference/ui-config.mdx#create-pages).
154
+ */
155
+ create(options: CreateModel): ViewBuilder<R>;
148
156
  /**
149
157
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
150
158
  * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
package/dist/view.js CHANGED
@@ -186,6 +186,16 @@ var ViewBuilder = class ViewBuilder {
186
186
  return this.next({ export: options && { ...options } });
187
187
  }
188
188
  /**
189
+ * Records are created on `page`, a composed page of the app's own, in place of the create form: `/<resource>/new`
190
+ * shows it with the address's `values`, and the list's New button opens it for whoever may open the page, whatever the
191
+ * resource's `create` access. So the resource's API can refuse creates (`create: never`) while the page creates
192
+ * through an API function. The server refuses a page that does not exist when it starts. See
193
+ * [Create pages](website/src/content/docs/reference/ui-config.mdx#create-pages).
194
+ */
195
+ create(options) {
196
+ return this.next({ create: { ...options } });
197
+ }
198
+ /**
189
199
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
190
200
  * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
191
201
  * `unseen`, newest first, those new since the user last opened its results marked) and a link to all of them. Throws in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.19.8",
3
+ "version": "0.19.10",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {