@ossy/types 0.4.0 → 0.4.1

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/build/index.d.ts CHANGED
@@ -1,10 +1,17 @@
1
+ /**
2
+ * One input in a {@link ResourceTemplate}. The `name` is the key used in `Resource.content` for
3
+ * template-backed documents (alongside the editor’s input `type`, e.g. `text`, `textarea`, `richtext`, `select`).
4
+ */
1
5
  interface Field {
6
+ /** Display label; UI may fall back to `name` when omitted. */
2
7
  label?: string;
8
+ /** Key stored in the resource’s `content` object. */
3
9
  name: string;
4
10
  type: string;
5
11
  description?: string;
6
12
  placeholder?: string;
7
13
  required?: boolean;
14
+ /** Allowed values for `select` / multiselect-style field types. */
8
15
  options?: string[];
9
16
  }
10
17
 
@@ -141,23 +148,52 @@ interface Theme {
141
148
  */
142
149
  type ThemeId = 'cloud-light' | 'cloud-dark';
143
150
 
144
- interface Resource<T = any> {
151
+ /**
152
+ * A resource is one item in a workspace tree (folder, structured document, media file, job record, etc.).
153
+ *
154
+ * **Relation to {@link ResourceTemplate}** — For document-like resources, `type` is the template’s
155
+ * `id`. The template’s `fields[].name` values describe the expected keys on `content`. The API also
156
+ * uses native `type` values (e.g. `directory`) and MIME types for binary uploads.
157
+ *
158
+ * @typeParam T — Shape of `content`; for template-backed resources, usually a record keyed by field names.
159
+ */
160
+ interface Resource<T = unknown> {
145
161
  id: string;
146
162
  name: string;
163
+ /** Absolute path prefix for this resource; API normalizes with leading and trailing `/`. */
147
164
  location: string;
165
+ /** Workspace aggregate id this resource belongs to. */
148
166
  belongsTo: string;
167
+ /**
168
+ * Discriminator: resource template id, `directory`, or MIME type (file resources), depending on how the resource was created.
169
+ */
149
170
  type: string;
150
171
  createdBy: string;
151
172
  created: string;
152
173
  lastUpdated: string;
153
174
  content: T;
175
+ /** Present on API-backed media and other resources that support visibility rules. */
176
+ access?: 'public' | 'restricted';
177
+ /** When present (e.g. `['removed']`), the resource is treated as deleted in the event-sourced view. */
178
+ status?: string[];
154
179
  }
155
180
 
181
+ /**
182
+ * Schema for a structured content type in a workspace. Imported via the workspace API and merged
183
+ * with built-in system templates when the API returns a workspace or template list.
184
+ *
185
+ * **Relation to {@link Resource}** — Creating a document resource requires `type` to equal this
186
+ * template’s `id`. Editors and clients use `fields` to render forms; `content` on the resource
187
+ * should align with those field names (by convention; enforcement may vary by API version).
188
+ */
156
189
  interface ResourceTemplate {
190
+ /** Stable identifier; becomes `Resource.type` for instances of this template. */
157
191
  id: string;
158
192
  name: string;
159
193
  description?: string;
160
194
  icon?: string;
195
+ /** Used by built-in templates for UI grouping; optional on custom imports. */
196
+ categoryName?: string;
161
197
  fields: Field[];
162
198
  }
163
199
 
@@ -1,9 +1,16 @@
1
+ /**
2
+ * One input in a {@link ResourceTemplate}. The `name` is the key used in `Resource.content` for
3
+ * template-backed documents (alongside the editor’s input `type`, e.g. `text`, `textarea`, `richtext`, `select`).
4
+ */
1
5
  export interface Field {
6
+ /** Display label; UI may fall back to `name` when omitted. */
2
7
  label?: string;
8
+ /** Key stored in the resource’s `content` object. */
3
9
  name: string;
4
10
  type: string;
5
11
  description?: string;
6
12
  placeholder?: string;
7
13
  required?: boolean;
14
+ /** Allowed values for `select` / multiselect-style field types. */
8
15
  options?: string[];
9
16
  }
@@ -1,11 +1,29 @@
1
- export interface Resource<T = any> {
1
+ /**
2
+ * A resource is one item in a workspace tree (folder, structured document, media file, job record, etc.).
3
+ *
4
+ * **Relation to {@link ResourceTemplate}** — For document-like resources, `type` is the template’s
5
+ * `id`. The template’s `fields[].name` values describe the expected keys on `content`. The API also
6
+ * uses native `type` values (e.g. `directory`) and MIME types for binary uploads.
7
+ *
8
+ * @typeParam T — Shape of `content`; for template-backed resources, usually a record keyed by field names.
9
+ */
10
+ export interface Resource<T = unknown> {
2
11
  id: string;
3
12
  name: string;
13
+ /** Absolute path prefix for this resource; API normalizes with leading and trailing `/`. */
4
14
  location: string;
15
+ /** Workspace aggregate id this resource belongs to. */
5
16
  belongsTo: string;
17
+ /**
18
+ * Discriminator: resource template id, `directory`, or MIME type (file resources), depending on how the resource was created.
19
+ */
6
20
  type: string;
7
21
  createdBy: string;
8
22
  created: string;
9
23
  lastUpdated: string;
10
24
  content: T;
25
+ /** Present on API-backed media and other resources that support visibility rules. */
26
+ access?: 'public' | 'restricted';
27
+ /** When present (e.g. `['removed']`), the resource is treated as deleted in the event-sourced view. */
28
+ status?: string[];
11
29
  }
@@ -1,8 +1,19 @@
1
1
  import { Field } from "./Field";
2
+ /**
3
+ * Schema for a structured content type in a workspace. Imported via the workspace API and merged
4
+ * with built-in system templates when the API returns a workspace or template list.
5
+ *
6
+ * **Relation to {@link Resource}** — Creating a document resource requires `type` to equal this
7
+ * template’s `id`. Editors and clients use `fields` to render forms; `content` on the resource
8
+ * should align with those field names (by convention; enforcement may vary by API version).
9
+ */
2
10
  export interface ResourceTemplate {
11
+ /** Stable identifier; becomes `Resource.type` for instances of this template. */
3
12
  id: string;
4
13
  name: string;
5
14
  description?: string;
6
15
  icon?: string;
16
+ /** Used by built-in templates for UI grouping; optional on custom imports. */
17
+ categoryName?: string;
7
18
  fields: Field[];
8
19
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/types",
3
3
  "description": "Shared TypeScript types for all packages",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "url": "git://github.com/ossy-se/packages/types",
6
6
  "source": "src/index.ts",
7
7
  "module": "build/index.js",
@@ -26,5 +26,5 @@
26
26
  "/build",
27
27
  "README.md"
28
28
  ],
29
- "gitHead": "ed1343d2ac7fa32121aa4b2074a01ac3562a2d75"
29
+ "gitHead": "ce5a41d5ac2ca21450ec2f8a72ab98169ca433b5"
30
30
  }