@marianmeres/collection-types 1.1.0 → 1.3.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/collection.d.ts +11 -1
- package/dist/model.d.ts +4 -0
- package/dist/relation.d.ts +6 -0
- package/dist/schema.d.ts +20 -9
- package/dist/utils.d.ts +6 -12
- package/package.json +1 -1
package/dist/collection.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface CollectionDTOIn {
|
|
|
32
32
|
/** Model types allowed in this collection */
|
|
33
33
|
types?: string[];
|
|
34
34
|
/** JSON Schema definitions per model type */
|
|
35
|
-
schemas?: Record<string,
|
|
35
|
+
schemas?: Record<string, PropertyDefinition>;
|
|
36
36
|
/** Default values per model type */
|
|
37
37
|
defaults?: Record<string, UserData>;
|
|
38
38
|
/** User-defined data */
|
|
@@ -59,6 +59,16 @@ export interface CollectionDTOOut extends CollectionDTOIn {
|
|
|
59
59
|
collection_id: UUID;
|
|
60
60
|
/** Project this collection belongs to */
|
|
61
61
|
project_id: UUID;
|
|
62
|
+
/** Unique path identifier (ltree format) */
|
|
63
|
+
path: LtreePath;
|
|
64
|
+
/** Maximum number of models allowed (-1 for unlimited, default -1) */
|
|
65
|
+
cardinality: number;
|
|
66
|
+
/** Model types allowed in this collection (default ["default"]) */
|
|
67
|
+
types: string[];
|
|
68
|
+
/** JSON Schema definitions per model type */
|
|
69
|
+
schemas: Record<string, PropertyDefinition>;
|
|
70
|
+
/** Default values per model type */
|
|
71
|
+
defaults: Record<string, UserData>;
|
|
62
72
|
/** Creation timestamp */
|
|
63
73
|
_created_at: ISODateString;
|
|
64
74
|
/** Last update timestamp */
|
package/dist/model.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface ModelDTOOut extends ModelDTOIn {
|
|
|
50
50
|
model_id: UUID;
|
|
51
51
|
/** Collection this model belongs to */
|
|
52
52
|
collection_id: UUID;
|
|
53
|
+
/** Model type within collection (default "default") */
|
|
54
|
+
type: string;
|
|
53
55
|
/** Auto-generated label from schema _label_source fields */
|
|
54
56
|
_label?: MaybeLocalized<string> | null;
|
|
55
57
|
/** Computed label for hierarchy display */
|
|
@@ -64,6 +66,8 @@ export interface ModelDTOOut extends ModelDTOIn {
|
|
|
64
66
|
* Includes internal fields for search indexing and REST control.
|
|
65
67
|
*/
|
|
66
68
|
export interface ModelDbRow extends ModelDTOOut {
|
|
69
|
+
/** Hierarchy depth (0 = root) */
|
|
70
|
+
depth: number;
|
|
67
71
|
/** @internal Disables REST API access */
|
|
68
72
|
__is_rest_disabled: boolean;
|
|
69
73
|
/** @internal Structured search index data */
|
package/dist/relation.d.ts
CHANGED
|
@@ -48,6 +48,12 @@ export interface RelationTypeDTOIn {
|
|
|
48
48
|
export interface RelationTypeDTOOut extends RelationTypeDTOIn {
|
|
49
49
|
/** Unique relation type identifier */
|
|
50
50
|
_relation_type_id: UUID;
|
|
51
|
+
/** Maximum number of relations allowed (-1 for unlimited, default -1) */
|
|
52
|
+
cardinality: number;
|
|
53
|
+
/** Cardinality on the model side (1 = one-to-many, -1 = many-to-many, default -1) */
|
|
54
|
+
model_cardinality: number;
|
|
55
|
+
/** Cardinality on the related side (default -1) */
|
|
56
|
+
related_cardinality: number;
|
|
51
57
|
/** Creation timestamp */
|
|
52
58
|
_created_at: ISODateString;
|
|
53
59
|
/** Last update timestamp */
|
package/dist/schema.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Schema types for the collection system.
|
|
3
3
|
* Defines JSON Schema extensions and UI configuration.
|
|
4
4
|
*/
|
|
5
|
+
import type { MaybeLocalized } from "./utils.js";
|
|
5
6
|
/** HTML field type for UI rendering */
|
|
6
7
|
export type SchemaHtmlType = "text" | "textarea" | "wysiwyg" | "number" | "boolean" | "select" | "multiselect" | "date" | "datetime" | "time" | "color" | "relation" | "asset" | "json" | "code";
|
|
7
8
|
/** Configuration for relation-type fields in schema */
|
|
@@ -43,21 +44,23 @@ export interface CustomSchemaKeywords {
|
|
|
43
44
|
/** Default value for property */
|
|
44
45
|
_default?: unknown;
|
|
45
46
|
/** UI hint configuration object */
|
|
46
|
-
_html?: SchemaHtmlConfig
|
|
47
|
-
/** Property title for display */
|
|
48
|
-
_title?: string
|
|
49
|
-
/** Property description for display */
|
|
50
|
-
_description?: string
|
|
47
|
+
_html?: SchemaHtmlConfig | Record<string, unknown>;
|
|
48
|
+
/** Property title for display (can be localized) */
|
|
49
|
+
_title?: MaybeLocalized<string>;
|
|
50
|
+
/** Property description for display (can be localized) */
|
|
51
|
+
_description?: MaybeLocalized<string>;
|
|
51
52
|
/** Property used as model label (number, priority 1=highest) */
|
|
52
|
-
_label_source?: number;
|
|
53
|
+
_label_source?: number | boolean;
|
|
53
54
|
/** Allow building hierarchy from label slashes */
|
|
54
55
|
_label_source_allow_build_hierarchy?: boolean;
|
|
55
56
|
/** Path uniqueness constraint */
|
|
56
57
|
_unique?: boolean;
|
|
57
|
-
/** Include in full-text search */
|
|
58
|
-
_searchable?: boolean;
|
|
58
|
+
/** Include in full-text search (boolean or array of locale codes) */
|
|
59
|
+
_searchable?: boolean | string[];
|
|
59
60
|
/** Array of filters to apply before indexing */
|
|
60
|
-
_searchable_filters?: string
|
|
61
|
+
_searchable_filters?: Array<string | {
|
|
62
|
+
name: string;
|
|
63
|
+
}>;
|
|
61
64
|
/** Type ordering */
|
|
62
65
|
_order?: number;
|
|
63
66
|
}
|
|
@@ -78,6 +81,14 @@ export interface PropertyDefinition extends CustomSchemaKeywords {
|
|
|
78
81
|
maxLength?: number;
|
|
79
82
|
pattern?: string;
|
|
80
83
|
default?: unknown;
|
|
84
|
+
/** Additional properties constraint (JSON Schema) */
|
|
85
|
+
additionalProperties?: boolean | PropertyDefinition;
|
|
86
|
+
/** Union type (JSON Schema oneOf) */
|
|
87
|
+
oneOf?: PropertyDefinition[];
|
|
88
|
+
/** Constant value (JSON Schema const) */
|
|
89
|
+
const?: unknown;
|
|
90
|
+
/** Custom: inherit from another type definition */
|
|
91
|
+
__extends?: string;
|
|
81
92
|
}
|
|
82
93
|
/**
|
|
83
94
|
* Model type definition within a collection.
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
* Utility types for the collection system.
|
|
3
3
|
* Includes branded types for compile-time safety and common helper types.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
export type UUID = string
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
export type
|
|
11
|
-
readonly __brand: "ISODateString";
|
|
12
|
-
};
|
|
13
|
-
/** Branded type for PostgreSQL ltree paths */
|
|
14
|
-
export type LtreePath = string & {
|
|
15
|
-
readonly __brand: "LtreePath";
|
|
16
|
-
};
|
|
5
|
+
/** UUID string type */
|
|
6
|
+
export type UUID = string;
|
|
7
|
+
/** ISO 8601 date string type */
|
|
8
|
+
export type ISODateString = string;
|
|
9
|
+
/** PostgreSQL ltree path type */
|
|
10
|
+
export type LtreePath = string;
|
|
17
11
|
/** Value that may be localized with language keys */
|
|
18
12
|
export type MaybeLocalized<T> = T | Record<string, T>;
|
|
19
13
|
/** JSON-compatible primitive */
|