@marianmeres/collection-types 2.0.0 → 2.1.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.
- package/dist/inbox.d.ts +54 -0
- package/dist/inbox.js +10 -0
- package/dist/mod.d.ts +1 -0
- package/dist/mod.js +2 -0
- package/dist/schema.d.ts +20 -2
- package/package.json +1 -1
package/dist/inbox.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbox message type definitions for the `@marianmeres/stack-inbox` notification inbox.
|
|
3
|
+
*
|
|
4
|
+
* Usage with Model:
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import type { Model, InboxMessageData } from "@marianmeres/collection-types";
|
|
7
|
+
* type InboxMessageModel = Model<InboxMessageData>;
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
/** Discriminator for how a message's content is rendered. */
|
|
11
|
+
export type InboxContentType = "typed" | "freeform";
|
|
12
|
+
/** Origin of a message. */
|
|
13
|
+
export type InboxSenderKind = "system" | "user";
|
|
14
|
+
/** Relative importance; reserved for future prioritized/pinned rendering. */
|
|
15
|
+
export type InboxPriority = "low" | "normal" | "high";
|
|
16
|
+
/**
|
|
17
|
+
* One recipient's own copy of a notification (denormalized model). The collection
|
|
18
|
+
* is owner-scoped: `owner_id` (a collection column, NOT a data field) is the
|
|
19
|
+
* recipient account id. Broadcasts materialize one row per recipient, all sharing
|
|
20
|
+
* the same `broadcast_id`.
|
|
21
|
+
*/
|
|
22
|
+
export interface InboxMessageData {
|
|
23
|
+
/**
|
|
24
|
+
* "typed" => render from i18n `template` + `template_data`;
|
|
25
|
+
* "freeform" => show `title`/`body` verbatim.
|
|
26
|
+
*/
|
|
27
|
+
content_type: InboxContentType;
|
|
28
|
+
/** i18n key base, e.g. "order_processed" → console renders `inbox.msg.order_processed.{title,body}`. */
|
|
29
|
+
template?: string;
|
|
30
|
+
/** Interpolation values for the typed template. */
|
|
31
|
+
template_data?: Record<string, unknown>;
|
|
32
|
+
/** Freeform title (as authored). */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Freeform body (as authored). */
|
|
35
|
+
body?: string;
|
|
36
|
+
/** Author's language tag (display hint only; freeform is not translated). */
|
|
37
|
+
lang?: string;
|
|
38
|
+
/** Sender account id; `null` for system-originated messages. */
|
|
39
|
+
sender_id?: string | null;
|
|
40
|
+
/** "system" (automated) or "user" (a person sent it). */
|
|
41
|
+
sender_kind: InboxSenderKind;
|
|
42
|
+
/** Groups all per-recipient copies of one logical send (recall/edit seam). */
|
|
43
|
+
broadcast_id?: string | null;
|
|
44
|
+
/** Reserved; minimal use in v1. */
|
|
45
|
+
priority?: InboxPriority;
|
|
46
|
+
/** Optional auto-expiry (ISO 8601). Expired messages are hidden from the inbox. */
|
|
47
|
+
expires_at?: string | null;
|
|
48
|
+
/** ISO timestamp when the recipient marked it read; null/absent = unread. */
|
|
49
|
+
read_at?: string | null;
|
|
50
|
+
/** ISO timestamp when the recipient archived it; null/absent = in the inbox. */
|
|
51
|
+
archived_at?: string | null;
|
|
52
|
+
/** Index signature for `Model<T>` compatibility. */
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
package/dist/inbox.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbox message type definitions for the `@marianmeres/stack-inbox` notification inbox.
|
|
3
|
+
*
|
|
4
|
+
* Usage with Model:
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import type { Model, InboxMessageData } from "@marianmeres/collection-types";
|
|
7
|
+
* type InboxMessageModel = Model<InboxMessageData>;
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/dist/mod.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export * from "./country.js";
|
|
|
47
47
|
export * from "./template.js";
|
|
48
48
|
export * from "./email.js";
|
|
49
49
|
export * from "./example.js";
|
|
50
|
+
export * from "./inbox.js";
|
|
50
51
|
export * from "./schema-builder.js";
|
|
51
52
|
export * from "./navigation.js";
|
|
52
53
|
export * from "./form-routes.js";
|
package/dist/mod.js
CHANGED
|
@@ -63,6 +63,8 @@ export * from "./template.js";
|
|
|
63
63
|
export * from "./email.js";
|
|
64
64
|
// Example domain types (reference implementation)
|
|
65
65
|
export * from "./example.js";
|
|
66
|
+
// Inbox domain types (notification inbox)
|
|
67
|
+
export * from "./inbox.js";
|
|
66
68
|
// Schema builder utilities (type-safe schema definitions)
|
|
67
69
|
export * from "./schema-builder.js";
|
|
68
70
|
// Navigation types (admin UI)
|
package/dist/schema.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { MaybeLocalized } from "./utils.js";
|
|
6
6
|
/** HTML field type for UI rendering */
|
|
7
|
-
export type SchemaHtmlType = "text" | "textarea" | "wysiwyg" | "markdown" | "number" | "boolean" | "checkbox" | "parent" | "object" | "select" | "multiselect" | "date" | "datetime" | "time" | "color" | "relation" | "asset" | "json" | "code" | "keyvalues" | "password";
|
|
7
|
+
export type SchemaHtmlType = "text" | "textarea" | "wysiwyg" | "markdown" | "number" | "money" | "boolean" | "checkbox" | "parent" | "object" | "select" | "multiselect" | "date" | "datetime" | "time" | "color" | "relation" | "asset" | "json" | "code" | "keyvalues" | "password";
|
|
8
8
|
/** Configuration for relation-type fields in schema */
|
|
9
9
|
export interface RelationTypeConfig {
|
|
10
10
|
relation_type: string;
|
|
@@ -37,12 +37,30 @@ export interface KeyValuesConfig {
|
|
|
37
37
|
addLabel?: string;
|
|
38
38
|
emptyMessage?: string;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration for `money` fields (`_html.type: "money"`).
|
|
42
|
+
*
|
|
43
|
+
* The value is stored as an INTEGER number of minor units (e.g. cents) — the
|
|
44
|
+
* JSON Schema `type` should be `"integer"`. The UI displays/edits it as a major
|
|
45
|
+
* unit decimal (e.g. dollars): display = stored / `scale`, input = entered *
|
|
46
|
+
* `scale` (rounded). Keeping this in the schema makes "this field is money"
|
|
47
|
+
* authoritative for every surface (list display, form input, import transform)
|
|
48
|
+
* instead of guessing from the field name.
|
|
49
|
+
*/
|
|
50
|
+
export interface MoneyConfig {
|
|
51
|
+
/** Minor units per major unit. Default 100 (cents → dollars). */
|
|
52
|
+
scale?: number;
|
|
53
|
+
/** Decimal places to display. Default 2. */
|
|
54
|
+
decimals?: number;
|
|
55
|
+
/** Optional ISO currency code, for surfaces that render a symbol (e.g. "USD"). */
|
|
56
|
+
currency?: string;
|
|
57
|
+
}
|
|
40
58
|
/** Configuration for _html schema keyword */
|
|
41
59
|
export interface SchemaHtmlConfig {
|
|
42
60
|
/** Field type for UI rendering */
|
|
43
61
|
type?: SchemaHtmlType;
|
|
44
62
|
/** Type-specific configuration */
|
|
45
|
-
_type_config?: RelationTypeConfig | AssetTypeConfig | SelectConfig | KeyValuesConfig;
|
|
63
|
+
_type_config?: RelationTypeConfig | AssetTypeConfig | SelectConfig | KeyValuesConfig | MoneyConfig;
|
|
46
64
|
/** Display label (can be localized) */
|
|
47
65
|
label?: MaybeLocalized<string>;
|
|
48
66
|
/** Display description (can be localized) */
|