@marianmeres/collection-types 1.35.0 → 1.36.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/README.md +1 -1
- package/dist/collection.d.ts +14 -0
- package/dist/model.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -174,7 +174,7 @@ const schemas = {
|
|
|
174
174
|
5. Keep index signature for Model<T> compatibility
|
|
175
175
|
6. Re-export types from stack package mod.ts
|
|
176
176
|
|
|
177
|
-
See `
|
|
177
|
+
See `packages/stack-example/README.md` for comprehensive examples.
|
|
178
178
|
|
|
179
179
|
## License
|
|
180
180
|
|
package/dist/collection.d.ts
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { UUID, ISODateString, LtreePath, UserData } from "./utils.js";
|
|
6
6
|
import type { PropertyDefinition } from "./schema.js";
|
|
7
|
+
/**
|
|
8
|
+
* Defines how ownership (`owner_id`) behaves for a collection.
|
|
9
|
+
*
|
|
10
|
+
* - `null` — not owner-scoped (default, current behavior)
|
|
11
|
+
* - `"optional"` — owner_id can be set but isn't required
|
|
12
|
+
* - `"required"` — owner_id must be set on every model in this collection
|
|
13
|
+
* - `"auto"` — owner_id is automatically set from request context on create
|
|
14
|
+
* (and required — reject creates without it)
|
|
15
|
+
*/
|
|
16
|
+
export type OwnerIdMode = "optional" | "required" | "auto" | null;
|
|
7
17
|
/**
|
|
8
18
|
* Definition for a folder within a collection.
|
|
9
19
|
* Folders organize models hierarchically.
|
|
@@ -50,6 +60,8 @@ export interface CollectionDTOIn {
|
|
|
50
60
|
folders?: Record<string, FolderDefinition>;
|
|
51
61
|
/** Tag definitions per model type */
|
|
52
62
|
tags?: Record<string, Record<string, TagDefinition>>;
|
|
63
|
+
/** Ownership mode for models in this collection */
|
|
64
|
+
owner_id_mode?: OwnerIdMode;
|
|
53
65
|
}
|
|
54
66
|
/**
|
|
55
67
|
* Output DTO for collection responses.
|
|
@@ -74,6 +86,8 @@ export interface CollectionDTOOut extends CollectionDTOIn {
|
|
|
74
86
|
_created_at: ISODateString;
|
|
75
87
|
/** Last update timestamp */
|
|
76
88
|
_updated_at: ISODateString;
|
|
89
|
+
/** Ownership mode for models in this collection (default null = not owner-scoped) */
|
|
90
|
+
owner_id_mode: OwnerIdMode;
|
|
77
91
|
}
|
|
78
92
|
/**
|
|
79
93
|
* Full database row representation of a collection.
|
package/dist/model.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface ModelDTOIn {
|
|
|
32
32
|
is_starred?: boolean;
|
|
33
33
|
/** Whether model is enabled/active */
|
|
34
34
|
is_enabled?: boolean;
|
|
35
|
+
/** Owner identifier (account model_id). Weak reference, no FK constraint. */
|
|
36
|
+
owner_id?: string | null;
|
|
35
37
|
/** Color flags */
|
|
36
38
|
red?: boolean;
|
|
37
39
|
orange?: boolean;
|
|
@@ -62,6 +64,8 @@ export interface ModelDTOOut extends ModelDTOIn {
|
|
|
62
64
|
_created_at: ISODateString;
|
|
63
65
|
/** Last update timestamp */
|
|
64
66
|
_updated_at: ISODateString;
|
|
67
|
+
/** Owner identifier (account model_id), null if not owner-scoped */
|
|
68
|
+
owner_id: string | null;
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
67
71
|
* Full database row representation of a model.
|