@marianmeres/collection-types 1.3.0 → 1.5.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/AGENTS.md +100 -0
- package/dist/model.d.ts +2 -2
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -44,3 +44,103 @@ deno check src/mod.ts # Type check
|
|
|
44
44
|
- All exports have JSDoc comments
|
|
45
45
|
- Flat file structure (no subdirectories in src/)
|
|
46
46
|
- Formatting: tabs, 4-space indent width, 90 char line width
|
|
47
|
+
|
|
48
|
+
## Type Hierarchy
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Model: ModelDTOIn → ModelDTOOut → ModelDbRow → Model<TData>
|
|
52
|
+
Collection: CollectionDTOIn → CollectionDTOOut → CollectionDbRow (= Collection)
|
|
53
|
+
RelationType: RelationTypeDTOIn → RelationTypeDTOOut → RelationTypeDbRow (= RelationType)
|
|
54
|
+
Relation: RelationDTOIn → RelationDTOOut → RelationDbRow (= Relation)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Type Catalog
|
|
58
|
+
|
|
59
|
+
### utils.ts - Branded Types & Helpers
|
|
60
|
+
|
|
61
|
+
| Type | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `UUID` | String type for UUIDs |
|
|
64
|
+
| `ISODateString` | String type for ISO 8601 dates |
|
|
65
|
+
| `LtreePath` | String type for PostgreSQL ltree paths |
|
|
66
|
+
| `MaybeLocalized<T>` | `T \| Record<string, T>` for localized values |
|
|
67
|
+
| `JsonPrimitive` | `string \| number \| boolean \| null` |
|
|
68
|
+
| `JsonObject` | `{ [key: string]: JsonValue }` |
|
|
69
|
+
| `JsonArray` | `JsonValue[]` |
|
|
70
|
+
| `JsonValue` | `JsonPrimitive \| JsonObject \| JsonArray` |
|
|
71
|
+
| `UserData` | `Record<string, unknown>` for flexible data |
|
|
72
|
+
| `Brand<T, B>` | Helper for creating branded types |
|
|
73
|
+
|
|
74
|
+
### model.ts - Model Entity Types
|
|
75
|
+
|
|
76
|
+
| Type | Description |
|
|
77
|
+
|------|-------------|
|
|
78
|
+
| `ModelDTOIn` | Input DTO (type, parent_id, path, folder, tags, data, meta, flags) |
|
|
79
|
+
| `ModelDTOOut` | + model_id, collection_id, depth, _label, _created_at, _updated_at |
|
|
80
|
+
| `ModelDbRow` | + __is_rest_disabled, __searchable, __searchable2, __hierarchy_path |
|
|
81
|
+
| `ModelUpsertData` | + __relations__ for relation upserts |
|
|
82
|
+
| `Model<TData>` | Generic type with typed data field |
|
|
83
|
+
|
|
84
|
+
### collection.ts - Collection Container Types
|
|
85
|
+
|
|
86
|
+
| Type | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| `FolderDefinition` | Folder config (label, description, color) |
|
|
89
|
+
| `TagDefinition` | Tag config (label, color) |
|
|
90
|
+
| `CollectionDTOIn` | Input DTO (path, cardinality, types, schemas, defaults, folders, tags) |
|
|
91
|
+
| `CollectionDTOOut` | + collection_id, project_id, _created_at, _updated_at |
|
|
92
|
+
| `CollectionDbRow` | + __is_rest_disabled |
|
|
93
|
+
| `Collection` | Alias for CollectionDbRow |
|
|
94
|
+
|
|
95
|
+
### relation.ts - Relationship Types
|
|
96
|
+
|
|
97
|
+
| Type | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `RelationTypeDTOIn` | Input DTO (relation_type, model_collection_id, related_collection_id) |
|
|
100
|
+
| `RelationTypeDTOOut` | + _relation_type_id, cardinality fields, timestamps |
|
|
101
|
+
| `RelationTypeDbRow` | + __is_rest_disabled |
|
|
102
|
+
| `RelationType` | Alias for RelationTypeDbRow |
|
|
103
|
+
| `RelationDTOIn` | Input DTO (related_id, weak_related_id, sort_order, flags, meta) |
|
|
104
|
+
| `RelationDTOOut` | + relation_id, _relation_type_id, model_id, timestamps |
|
|
105
|
+
| `RelationDbRow` | Equals RelationDTOOut |
|
|
106
|
+
| `Relation` | Alias for RelationDbRow |
|
|
107
|
+
|
|
108
|
+
### schema.ts - JSON Schema Extensions
|
|
109
|
+
|
|
110
|
+
| Type | Description |
|
|
111
|
+
|------|-------------|
|
|
112
|
+
| `SchemaHtmlType` | Union: text, textarea, wysiwyg, number, boolean, select, multiselect, date, datetime, time, color, relation, asset, json, code |
|
|
113
|
+
| `RelationTypeConfig` | Config for relation fields (relation_type, domain, entity, cardinality) |
|
|
114
|
+
| `AssetTypeConfig` | Config for asset fields (accept, maxSize, variants) |
|
|
115
|
+
| `SelectConfig` | Config for select fields (options array) |
|
|
116
|
+
| `SchemaHtmlConfig` | HTML field config (type, _type_config, rows, placeholder, help, readonly, hidden) |
|
|
117
|
+
| `CustomSchemaKeywords` | Custom keywords (_default, _html, _title, _description, _label_source, _unique, _searchable, _order) |
|
|
118
|
+
| `PropertyDefinition` | JSON Schema + custom keywords |
|
|
119
|
+
| `ModelDefinition` | Model type schema (properties, required) |
|
|
120
|
+
|
|
121
|
+
### api.ts - API & Query Types
|
|
122
|
+
|
|
123
|
+
| Type | Description |
|
|
124
|
+
|------|-------------|
|
|
125
|
+
| `PaginationMeta` | Pagination info (limit, offset, total, hasMore) |
|
|
126
|
+
| `ApiResponse<T>` | Generic response wrapper (data, meta) |
|
|
127
|
+
| `ApiListResponse<T>` | List response with pagination and included relations |
|
|
128
|
+
| `QueryOperator` | Filter operators: eq, neq, gt, gte, lt, lte, like, nlike, match, nmatch, is, nis, in, nin, ltree, ancestor, descendant |
|
|
129
|
+
| `QueryCondition` | Single filter condition (field, operator, value) |
|
|
130
|
+
| `QuerySyntax` | Query params (where, search, order, asc, limit, offset) |
|
|
131
|
+
|
|
132
|
+
### asset.ts - File Attachment Types
|
|
133
|
+
|
|
134
|
+
| Type | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `AssetVariant` | Asset variant (name, width, height, format, url) |
|
|
137
|
+
| `AssetData` | Asset metadata (filename, mimetype, size, url, variants, metadata) |
|
|
138
|
+
| `ModelAsset` | Asset attached to model (asset_id, model_id, field_name, sort_order, data, timestamps) |
|
|
139
|
+
|
|
140
|
+
### adapter.ts - Database Adapter Types
|
|
141
|
+
|
|
142
|
+
| Type | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `DbQueryResult<T>` | Query result (rows, rowCount) |
|
|
145
|
+
| `QueryProvider` | DB interface (type: "pg" \| "sqlite", query, each) |
|
|
146
|
+
| `AdapterOptions` | Adapter config (tablePrefix, preInitSql, postInitSql, projectIdFk, resetAll) |
|
package/dist/model.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export interface ModelDTOOut extends ModelDTOIn {
|
|
|
52
52
|
collection_id: UUID;
|
|
53
53
|
/** Model type within collection (default "default") */
|
|
54
54
|
type: string;
|
|
55
|
+
/** Hierarchy depth (0 = root) */
|
|
56
|
+
depth: number;
|
|
55
57
|
/** Auto-generated label from schema _label_source fields */
|
|
56
58
|
_label?: MaybeLocalized<string> | null;
|
|
57
59
|
/** Computed label for hierarchy display */
|
|
@@ -66,8 +68,6 @@ export interface ModelDTOOut extends ModelDTOIn {
|
|
|
66
68
|
* Includes internal fields for search indexing and REST control.
|
|
67
69
|
*/
|
|
68
70
|
export interface ModelDbRow extends ModelDTOOut {
|
|
69
|
-
/** Hierarchy depth (0 = root) */
|
|
70
|
-
depth: number;
|
|
71
71
|
/** @internal Disables REST API access */
|
|
72
72
|
__is_rest_disabled: boolean;
|
|
73
73
|
/** @internal Structured search index data */
|