@marianmeres/collection-types 1.2.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 +2 -2
- package/dist/schema.d.ts +20 -9
- 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 */
|
|
@@ -66,7 +66,7 @@ export interface CollectionDTOOut extends CollectionDTOIn {
|
|
|
66
66
|
/** Model types allowed in this collection (default ["default"]) */
|
|
67
67
|
types: string[];
|
|
68
68
|
/** JSON Schema definitions per model type */
|
|
69
|
-
schemas: Record<string,
|
|
69
|
+
schemas: Record<string, PropertyDefinition>;
|
|
70
70
|
/** Default values per model type */
|
|
71
71
|
defaults: Record<string, UserData>;
|
|
72
72
|
/** Creation 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.
|