@marianmeres/collection-types 1.41.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/adapter.d.ts CHANGED
@@ -36,8 +36,8 @@ export interface AdapterOptions {
36
36
  postInitSql: string;
37
37
  /** Custom SQL for userland initialization */
38
38
  customPreInitSql: string;
39
- /** Foreign key constraint to project table */
40
- projectIdFk: null | {
39
+ /** Foreign key constraint to the tenant table */
40
+ tenantIdFk: null | {
41
41
  table: string;
42
42
  column: string;
43
43
  };
@@ -9,7 +9,7 @@
9
9
  * - Level 2: Page (shown as items within expanded group)
10
10
  * - Level 3: Tab (optional, within a page)
11
11
  *
12
- * URL Pattern: #/p/{projectId}/{areaId}/{groupId}/{pageId}?/{tabPath}?
12
+ * URL Pattern: #/t/{tenantId}/{areaId}/{groupId}/{pageId}?/{tabPath}?
13
13
  *
14
14
  * @module area-pages/types
15
15
  */
@@ -21,7 +21,7 @@ import type { MaybeLocalized } from "./utils.js";
21
21
  export interface AreaPageTab {
22
22
  /**
23
23
  * Unique path segment for this tab.
24
- * Used in URL: #/p/{projectId}/{area}/{groupId}/{pageId}/{path}
24
+ * Used in URL: #/t/{tenantId}/{area}/{groupId}/{pageId}/{path}
25
25
  */
26
26
  path: string;
27
27
  /**
@@ -56,7 +56,7 @@ export interface AreaPageTab {
56
56
  export interface AreaPageDef {
57
57
  /**
58
58
  * Unique identifier for this page within the group.
59
- * Used in URL: #/p/{projectId}/{area}/{groupId}/{id}
59
+ * Used in URL: #/t/{tenantId}/{area}/{groupId}/{id}
60
60
  * Must match directory name: src/routes/{area}/pages/{groupId}/{id}/
61
61
  */
62
62
  id: string;
@@ -123,7 +123,7 @@ export interface AreaPageGroupNavMeta {
123
123
  export interface AreaPageGroupDef {
124
124
  /**
125
125
  * Unique identifier for this group.
126
- * Used in URL: #/p/{projectId}/{area}/{id}
126
+ * Used in URL: #/t/{tenantId}/{area}/{id}
127
127
  * Must match directory name: src/routes/{area}/pages/{id}/
128
128
  */
129
129
  id: string;
@@ -9,7 +9,7 @@
9
9
  * - Level 2: Page (shown as items within expanded group)
10
10
  * - Level 3: Tab (optional, within a page)
11
11
  *
12
- * URL Pattern: #/p/{projectId}/{areaId}/{groupId}/{pageId}?/{tabPath}?
12
+ * URL Pattern: #/t/{tenantId}/{areaId}/{groupId}/{pageId}?/{tabPath}?
13
13
  *
14
14
  * @module area-pages/types
15
15
  */
@@ -70,8 +70,8 @@ export interface CollectionDTOIn {
70
70
  export interface CollectionDTOOut extends CollectionDTOIn {
71
71
  /** Unique collection identifier */
72
72
  collection_id: UUID;
73
- /** Project this collection belongs to */
74
- project_id: UUID;
73
+ /** Tenant this collection belongs to */
74
+ tenant_id: string;
75
75
  /** Unique path identifier (ltree format) */
76
76
  path: LtreePath;
77
77
  /** Maximum number of models allowed (-1 for unlimited, default -1) */
@@ -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)
@@ -17,8 +17,8 @@ import type { UUID, ISODateString, UserData } from "./utils.js";
17
17
  * ```
18
18
  */
19
19
  export interface RelationTypeDTOIn {
20
- /** Project identifier */
21
- project_id?: UUID;
20
+ /** Tenant identifier */
21
+ tenant_id?: string;
22
22
  /** Unique relation type name (business key) */
23
23
  relation_type?: string;
24
24
  /** Collection ID of the "from" models */
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" | "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) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/collection-types",
3
- "version": "1.41.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "main": "dist/mod.js",
6
6
  "types": "dist/mod.d.ts",