@ossy/types 0.3.2 → 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
|
|
|
@@ -87,34 +94,22 @@ interface ColorPalette {
|
|
|
87
94
|
} | undefined;
|
|
88
95
|
}
|
|
89
96
|
/**
|
|
90
|
-
* Surface definitions
|
|
97
|
+
* Surface definitions — flat preview strings (docs / tooling).
|
|
98
|
+
* Aligns with `surfaces` keys: base, primary, accent.
|
|
91
99
|
*/
|
|
92
100
|
interface SurfaceDefinitions {
|
|
93
|
-
primary?: CssValue;
|
|
94
|
-
secondary?: CssValue;
|
|
95
101
|
base?: CssValue;
|
|
102
|
+
primary?: CssValue;
|
|
96
103
|
accent?: CssValue;
|
|
97
|
-
'radial-gradient'?: CssValue;
|
|
98
|
-
'linear-gradient'?: CssValue;
|
|
99
|
-
decorated?: CssValue;
|
|
100
104
|
[key: string]: CssValue | undefined;
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
|
-
* Surfaces
|
|
104
|
-
*
|
|
107
|
+
* Surfaces — named variants for `[data-surface="…"]`.
|
|
108
|
+
* Canonical set: base, primary, accent.
|
|
105
109
|
*/
|
|
106
110
|
interface SurfacesMap {
|
|
107
111
|
base?: SurfaceVariant;
|
|
108
112
|
primary?: SurfaceVariant;
|
|
109
|
-
secondary?: SurfaceVariant;
|
|
110
|
-
decorated?: SurfaceVariant;
|
|
111
|
-
'alt-primary'?: SurfaceVariant;
|
|
112
|
-
'alt-secondary'?: SurfaceVariant;
|
|
113
|
-
'radial-gradient'?: SurfaceVariant;
|
|
114
|
-
'linear-gradient'?: SurfaceVariant;
|
|
115
|
-
'alt-glass'?: SurfaceVariant;
|
|
116
|
-
info?: SurfaceVariant;
|
|
117
|
-
danger?: SurfaceVariant;
|
|
118
113
|
accent?: SurfaceVariant;
|
|
119
114
|
[key: string]: SurfaceVariant | undefined;
|
|
120
115
|
}
|
|
@@ -153,23 +148,52 @@ interface Theme {
|
|
|
153
148
|
*/
|
|
154
149
|
type ThemeId = 'cloud-light' | 'cloud-dark';
|
|
155
150
|
|
|
156
|
-
|
|
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> {
|
|
157
161
|
id: string;
|
|
158
162
|
name: string;
|
|
163
|
+
/** Absolute path prefix for this resource; API normalizes with leading and trailing `/`. */
|
|
159
164
|
location: string;
|
|
165
|
+
/** Workspace aggregate id this resource belongs to. */
|
|
160
166
|
belongsTo: string;
|
|
167
|
+
/**
|
|
168
|
+
* Discriminator: resource template id, `directory`, or MIME type (file resources), depending on how the resource was created.
|
|
169
|
+
*/
|
|
161
170
|
type: string;
|
|
162
171
|
createdBy: string;
|
|
163
172
|
created: string;
|
|
164
173
|
lastUpdated: string;
|
|
165
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[];
|
|
166
179
|
}
|
|
167
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
|
+
*/
|
|
168
189
|
interface ResourceTemplate {
|
|
190
|
+
/** Stable identifier; becomes `Resource.type` for instances of this template. */
|
|
169
191
|
id: string;
|
|
170
192
|
name: string;
|
|
171
193
|
description?: string;
|
|
172
194
|
icon?: string;
|
|
195
|
+
/** Used by built-in templates for UI grouping; optional on custom imports. */
|
|
196
|
+
categoryName?: string;
|
|
173
197
|
fields: Field[];
|
|
174
198
|
}
|
|
175
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
|
-
|
|
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
|
}
|
|
@@ -77,34 +77,22 @@ export interface ColorPalette {
|
|
|
77
77
|
} | undefined;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Surface definitions
|
|
80
|
+
* Surface definitions — flat preview strings (docs / tooling).
|
|
81
|
+
* Aligns with `surfaces` keys: base, primary, accent.
|
|
81
82
|
*/
|
|
82
83
|
export interface SurfaceDefinitions {
|
|
83
|
-
primary?: CssValue;
|
|
84
|
-
secondary?: CssValue;
|
|
85
84
|
base?: CssValue;
|
|
85
|
+
primary?: CssValue;
|
|
86
86
|
accent?: CssValue;
|
|
87
|
-
'radial-gradient'?: CssValue;
|
|
88
|
-
'linear-gradient'?: CssValue;
|
|
89
|
-
decorated?: CssValue;
|
|
90
87
|
[key: string]: CssValue | undefined;
|
|
91
88
|
}
|
|
92
89
|
/**
|
|
93
|
-
* Surfaces
|
|
94
|
-
*
|
|
90
|
+
* Surfaces — named variants for `[data-surface="…"]`.
|
|
91
|
+
* Canonical set: base, primary, accent.
|
|
95
92
|
*/
|
|
96
93
|
export interface SurfacesMap {
|
|
97
94
|
base?: SurfaceVariant;
|
|
98
95
|
primary?: SurfaceVariant;
|
|
99
|
-
secondary?: SurfaceVariant;
|
|
100
|
-
decorated?: SurfaceVariant;
|
|
101
|
-
'alt-primary'?: SurfaceVariant;
|
|
102
|
-
'alt-secondary'?: SurfaceVariant;
|
|
103
|
-
'radial-gradient'?: SurfaceVariant;
|
|
104
|
-
'linear-gradient'?: SurfaceVariant;
|
|
105
|
-
'alt-glass'?: SurfaceVariant;
|
|
106
|
-
info?: SurfaceVariant;
|
|
107
|
-
danger?: SurfaceVariant;
|
|
108
96
|
accent?: SurfaceVariant;
|
|
109
97
|
[key: string]: SurfaceVariant | undefined;
|
|
110
98
|
}
|
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
|
+
"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": "
|
|
29
|
+
"gitHead": "ce5a41d5ac2ca21450ec2f8a72ab98169ca433b5"
|
|
30
30
|
}
|