@_linked/shape-ui 2.3.0 → 2.3.2
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/lib/esm/components/AvatarEditor.d.ts +19 -0
- package/lib/esm/components/AvatarEditor.js +6 -0
- package/lib/esm/components/AvatarEditor.js.map +1 -0
- package/lib/esm/components/CheckboxEditor.d.ts +20 -0
- package/lib/esm/components/CheckboxEditor.js +41 -0
- package/lib/esm/components/CheckboxEditor.js.map +1 -0
- package/lib/esm/components/DateEditor.d.ts +19 -0
- package/lib/esm/components/DateEditor.js +22 -0
- package/lib/esm/components/DateEditor.js.map +1 -0
- package/lib/esm/components/RadioButtonEditor.d.ts +22 -0
- package/lib/esm/components/RadioButtonEditor.js +39 -0
- package/lib/esm/components/RadioButtonEditor.js.map +1 -0
- package/lib/esm/components/SelectEditor.d.ts +20 -0
- package/lib/esm/components/SelectEditor.js +30 -0
- package/lib/esm/components/SelectEditor.js.map +1 -0
- package/lib/esm/components/SwitchEditor.d.ts +20 -0
- package/lib/esm/components/SwitchEditor.js +23 -0
- package/lib/esm/components/SwitchEditor.js.map +1 -0
- package/lib/esm/components/TextareaEditor.d.ts +22 -0
- package/lib/esm/components/TextareaEditor.js +15 -0
- package/lib/esm/components/TextareaEditor.js.map +1 -0
- package/lib/esm/components/ToggleEditor.d.ts +21 -0
- package/lib/esm/components/ToggleEditor.js +23 -0
- package/lib/esm/components/ToggleEditor.js.map +1 -0
- package/lib/esm/index.d.ts +10 -0
- package/lib/esm/index.js +24 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/shape/types.d.ts +697 -0
- package/lib/esm/shape/types.js +212 -0
- package/lib/esm/shape/types.js.map +1 -0
- package/package.json +3 -2
- package/src/index.ts +25 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shape Builder Types for Create Now
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for SHACL shapes used in the Shape Builder.
|
|
5
|
+
* Shapes define validation constraints and form generation rules for ontology classes.
|
|
6
|
+
*
|
|
7
|
+
* Key concepts:
|
|
8
|
+
* - NodeShape: Top-level shape targeting a class (sh:targetClass)
|
|
9
|
+
* - PropertyShape: Constraints for a property path within a NodeShape
|
|
10
|
+
* - PropertyGroup: UI organization for form generation (sh:group)
|
|
11
|
+
* - PropertyPath: Simple or complex property paths (sh:path)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Target type for a NodeShape - determines what the shape validates
|
|
15
|
+
*/
|
|
16
|
+
export type ShapeTargetType = 'targetClass' | 'targetNode' | 'targetSubjectsOf' | 'targetObjectsOf';
|
|
17
|
+
/**
|
|
18
|
+
* Node kind constraint (sh:nodeKind)
|
|
19
|
+
*/
|
|
20
|
+
export type NodeKind = 'IRI' | 'Literal' | 'BlankNode' | 'BlankNodeOrIRI' | 'BlankNodeOrLiteral' | 'IRIOrLiteral';
|
|
21
|
+
/**
|
|
22
|
+
* XSD datatypes for literal constraints (sh:datatype)
|
|
23
|
+
*/
|
|
24
|
+
export type ShaclDatatype = 'xsd:string' | 'xsd:integer' | 'xsd:decimal' | 'xsd:float' | 'xsd:double' | 'xsd:boolean' | 'xsd:date' | 'xsd:dateTime' | 'xsd:time' | 'xsd:anyURI' | 'xsd:language' | 'rdf:langString' | 'rdf:HTML';
|
|
25
|
+
/**
|
|
26
|
+
* Mapping from user-friendly types to XSD datatypes
|
|
27
|
+
*/
|
|
28
|
+
export declare const DATATYPE_MAP: Record<string, ShaclDatatype>;
|
|
29
|
+
/**
|
|
30
|
+
* Property path types (SPARQL property paths)
|
|
31
|
+
*/
|
|
32
|
+
export type PropertyPathType = 'predicate' | 'sequence' | 'alternative' | 'inverse' | 'zeroOrMore' | 'oneOrMore' | 'zeroOrOne';
|
|
33
|
+
/**
|
|
34
|
+
* A segment in a property path
|
|
35
|
+
*/
|
|
36
|
+
export interface PropertyPathSegment {
|
|
37
|
+
/** The type of this segment */
|
|
38
|
+
type: PropertyPathType;
|
|
39
|
+
/** For predicate: the property URI */
|
|
40
|
+
predicateUri?: string;
|
|
41
|
+
/** For predicate: human-readable name */
|
|
42
|
+
predicateName?: string;
|
|
43
|
+
/** For predicate: namespace prefix (e.g., "schema", "adms") */
|
|
44
|
+
predicatePrefix?: string;
|
|
45
|
+
/** For sequence/alternative: nested segments */
|
|
46
|
+
segments?: PropertyPathSegment[];
|
|
47
|
+
/** For inverse: the inverted path */
|
|
48
|
+
inversePath?: PropertyPathSegment;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Complete property path definition
|
|
52
|
+
*/
|
|
53
|
+
export interface PropertyPath {
|
|
54
|
+
/** Unique ID for this path */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Human-readable name (e.g., "Friend's Email") */
|
|
57
|
+
name: string;
|
|
58
|
+
/** The root segment of the path */
|
|
59
|
+
root: PropertyPathSegment;
|
|
60
|
+
/** Serialized SPARQL path (e.g., "ex:knows/ex:email") */
|
|
61
|
+
sparqlPath: string;
|
|
62
|
+
/** Serialized Turtle path for SHACL */
|
|
63
|
+
turtlePath: string;
|
|
64
|
+
/** The final property in the path (determines constraints) */
|
|
65
|
+
finalProperty: {
|
|
66
|
+
uri: string;
|
|
67
|
+
name: string;
|
|
68
|
+
propertyType: 'object' | 'datatype';
|
|
69
|
+
rangeClassUri?: string;
|
|
70
|
+
rangeDatatype?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Property Group for organizing properties in forms (sh:PropertyGroup)
|
|
75
|
+
*/
|
|
76
|
+
export interface BuilderPropertyGroup {
|
|
77
|
+
/** Unique ID */
|
|
78
|
+
id: string;
|
|
79
|
+
/** Group name (e.g., "Personal Information") */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Optional description */
|
|
82
|
+
description?: string;
|
|
83
|
+
/** Display order (0-based) */
|
|
84
|
+
order: number;
|
|
85
|
+
/** Is this the default group? */
|
|
86
|
+
isDefault?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Cardinality constraints (sh:minCount, sh:maxCount)
|
|
90
|
+
*/
|
|
91
|
+
export interface CardinalityConstraint {
|
|
92
|
+
/** Minimum count (0 = optional) */
|
|
93
|
+
minCount?: number;
|
|
94
|
+
/** Maximum count (undefined = unlimited) */
|
|
95
|
+
maxCount?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* String-based constraints (for xsd:string, rdf:langString)
|
|
99
|
+
*/
|
|
100
|
+
export interface StringConstraints {
|
|
101
|
+
/** Minimum string length (sh:minLength) */
|
|
102
|
+
minLength?: number;
|
|
103
|
+
/** Maximum string length (sh:maxLength) */
|
|
104
|
+
maxLength?: number;
|
|
105
|
+
/** Regex pattern the value must match (sh:pattern) */
|
|
106
|
+
pattern?: string;
|
|
107
|
+
/** Regex flags for pattern (sh:flags, e.g., "i" for case-insensitive) */
|
|
108
|
+
flags?: string;
|
|
109
|
+
/** Allowed languages (sh:languageIn, e.g., ['en', 'nl']) */
|
|
110
|
+
languageIn?: string[];
|
|
111
|
+
/** Each language can appear only once (sh:uniqueLang) */
|
|
112
|
+
uniqueLang?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Numeric constraints (for xsd:integer, xsd:decimal, etc.)
|
|
116
|
+
*/
|
|
117
|
+
export interface NumericConstraints {
|
|
118
|
+
/** Value must be > this (sh:minExclusive) */
|
|
119
|
+
minExclusive?: number;
|
|
120
|
+
/** Value must be >= this (sh:minInclusive) */
|
|
121
|
+
minInclusive?: number;
|
|
122
|
+
/** Value must be < this (sh:maxExclusive) */
|
|
123
|
+
maxExclusive?: number;
|
|
124
|
+
/** Value must be <= this (sh:maxInclusive) */
|
|
125
|
+
maxInclusive?: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A value that can be a node or literal with datatype/language
|
|
129
|
+
*/
|
|
130
|
+
export interface PropertyValue {
|
|
131
|
+
/** The actual value (URI string or literal value) */
|
|
132
|
+
value: string;
|
|
133
|
+
/** Is this an IRI/URI reference? */
|
|
134
|
+
isUri?: boolean;
|
|
135
|
+
/** For literals: the XSD datatype */
|
|
136
|
+
datatype?: string;
|
|
137
|
+
/** For literals: the language tag */
|
|
138
|
+
language?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Value constraints (sh:in, sh:hasValue, etc.)
|
|
142
|
+
*/
|
|
143
|
+
export interface ValueConstraints {
|
|
144
|
+
/** Value must be one of these (sh:in) */
|
|
145
|
+
inValues?: PropertyValue[];
|
|
146
|
+
/** Must have exactly this value (sh:hasValue) */
|
|
147
|
+
hasValue?: PropertyValue;
|
|
148
|
+
/** Must equal value of another property (sh:equals) */
|
|
149
|
+
equals?: string;
|
|
150
|
+
/** Must not equal value of another property (sh:disjoint) */
|
|
151
|
+
disjoint?: string;
|
|
152
|
+
/** Must be less than value of another property (sh:lessThan) */
|
|
153
|
+
lessThan?: string;
|
|
154
|
+
/** Must be <= value of another property (sh:lessThanOrEquals) */
|
|
155
|
+
lessThanOrEquals?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Qualified Value Shape constraint (sh:qualifiedValueShape)
|
|
159
|
+
* Allows: "At least N values must conform to shape X"
|
|
160
|
+
*/
|
|
161
|
+
export interface QualifiedValueConstraint {
|
|
162
|
+
/** Reference to a shape that values must conform to */
|
|
163
|
+
qualifiedValueShape: string;
|
|
164
|
+
/** Minimum count of values that must conform (sh:qualifiedMinCount) */
|
|
165
|
+
qualifiedMinCount?: number;
|
|
166
|
+
/** Maximum count of values that may conform (sh:qualifiedMaxCount) */
|
|
167
|
+
qualifiedMaxCount?: number;
|
|
168
|
+
/** If true, sibling shapes are considered disjoint (sh:qualifiedValueShapesDisjoint) */
|
|
169
|
+
qualifiedValueShapesDisjoint?: boolean;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Severity levels for validation results (sh:severity)
|
|
173
|
+
*/
|
|
174
|
+
export type ShapeSeverity = 'Violation' | 'Warning' | 'Info';
|
|
175
|
+
/**
|
|
176
|
+
* Localized message for validation results (sh:message)
|
|
177
|
+
*/
|
|
178
|
+
export interface LocalizedMessage {
|
|
179
|
+
/** The message text */
|
|
180
|
+
text: string;
|
|
181
|
+
/** Language tag (e.g., "en", "de", "nl") */
|
|
182
|
+
lang?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Constraints for object properties (owl:ObjectProperty)
|
|
186
|
+
*/
|
|
187
|
+
export interface ObjectPropertyConstraints {
|
|
188
|
+
/** Required rdf:type of the value (sh:class) */
|
|
189
|
+
class?: string;
|
|
190
|
+
/** Reference to a NodeShape for nested validation (sh:node) */
|
|
191
|
+
nodeShape?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Constraints for datatype properties (owl:DatatypeProperty)
|
|
195
|
+
*/
|
|
196
|
+
export interface DatatypePropertyConstraints {
|
|
197
|
+
/** Required XSD datatype (sh:datatype) */
|
|
198
|
+
datatype: ShaclDatatype;
|
|
199
|
+
/** String-specific constraints */
|
|
200
|
+
stringConstraints?: StringConstraints;
|
|
201
|
+
/** Numeric-specific constraints */
|
|
202
|
+
numericConstraints?: NumericConstraints;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* PropertyShape - defines constraints for a single property path
|
|
206
|
+
*/
|
|
207
|
+
export interface BuilderPropertyShape {
|
|
208
|
+
/** Unique ID */
|
|
209
|
+
id: string;
|
|
210
|
+
/** Human-readable name (required because path might be complex) */
|
|
211
|
+
name: string;
|
|
212
|
+
/** Description of what this property represents */
|
|
213
|
+
description?: string;
|
|
214
|
+
/** The property path this shape constrains */
|
|
215
|
+
path: PropertyPath;
|
|
216
|
+
/** Display order within group (sh:order) */
|
|
217
|
+
order: number;
|
|
218
|
+
/** Group this property belongs to (sh:group) */
|
|
219
|
+
groupId: string;
|
|
220
|
+
/**
|
|
221
|
+
* For Object Properties (final property is owl:ObjectProperty):
|
|
222
|
+
* - sh:class - the rdf:type required for the value
|
|
223
|
+
* - OR sh:node - reference to another NodeShape
|
|
224
|
+
*/
|
|
225
|
+
objectConstraints?: ObjectPropertyConstraints;
|
|
226
|
+
/**
|
|
227
|
+
* For Datatype Properties (final property is owl:DatatypeProperty):
|
|
228
|
+
*/
|
|
229
|
+
datatypeConstraints?: DatatypePropertyConstraints;
|
|
230
|
+
/** Node kind constraint (sh:nodeKind, usually inferred from property type) */
|
|
231
|
+
nodeKind?: NodeKind;
|
|
232
|
+
/** Cardinality (sh:minCount, sh:maxCount) */
|
|
233
|
+
cardinality: CardinalityConstraint;
|
|
234
|
+
/** Value constraints (sh:in, sh:hasValue, sh:equals, etc.) */
|
|
235
|
+
valueConstraints?: ValueConstraints;
|
|
236
|
+
/** Qualified value shape constraint (sh:qualifiedValueShape) */
|
|
237
|
+
qualifiedValue?: QualifiedValueConstraint;
|
|
238
|
+
/** Is this property deactivated? (sh:deactivated) */
|
|
239
|
+
deactivated?: boolean;
|
|
240
|
+
/** Severity level for violations (sh:severity, default: Violation) */
|
|
241
|
+
severity?: ShapeSeverity;
|
|
242
|
+
/** Custom validation messages (sh:message) */
|
|
243
|
+
messages?: LocalizedMessage[];
|
|
244
|
+
/** Default value for form generation (sh:defaultValue) */
|
|
245
|
+
defaultValue?: PropertyValue;
|
|
246
|
+
/**
|
|
247
|
+
* Nested property shapes (sh:property on a PropertyShape)
|
|
248
|
+
* Used when the values of this property must have their own property constraints.
|
|
249
|
+
* E.g., an "address" property where the address value must have city, postalCode, etc.
|
|
250
|
+
* Note: This is different from sh:node which references an external shape.
|
|
251
|
+
*/
|
|
252
|
+
nestedPropertyShapes?: BuilderPropertyShape[];
|
|
253
|
+
/** Is this a unique identifier property? */
|
|
254
|
+
isUniqueIdentifier?: boolean;
|
|
255
|
+
/** Is this the primary display property? */
|
|
256
|
+
isPrimaryDisplay?: boolean;
|
|
257
|
+
/** Display priority for compact views (lower = more important) */
|
|
258
|
+
displayPriority?: number;
|
|
259
|
+
/** Visual position in visual builder */
|
|
260
|
+
visualPosition?: {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Boolean logic for combining property shapes
|
|
267
|
+
*/
|
|
268
|
+
export interface LogicalConstraint {
|
|
269
|
+
/** Type of logical operation */
|
|
270
|
+
type: 'and' | 'or' | 'not' | 'xone';
|
|
271
|
+
/** Property shapes or nested shapes involved */
|
|
272
|
+
shapes: string[];
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Display context types for property ordering
|
|
276
|
+
*
|
|
277
|
+
* - single: Show 1 most identifying property (e.g., name badge)
|
|
278
|
+
* - small: Show up to 3 key properties (e.g., compact list item)
|
|
279
|
+
* - card: Show up to 6 summary properties (e.g., card view)
|
|
280
|
+
* - table: Show properties suitable for table columns (unlimited)
|
|
281
|
+
*/
|
|
282
|
+
export type DisplayContext = 'single' | 'small' | 'card' | 'table';
|
|
283
|
+
/**
|
|
284
|
+
* Property display order for a specific context
|
|
285
|
+
*/
|
|
286
|
+
export interface PropertyDisplayOrder {
|
|
287
|
+
/** Property IDs in display order */
|
|
288
|
+
propertyIds: string[];
|
|
289
|
+
/** Whether this uses auto-generated defaults (false = user customized) */
|
|
290
|
+
isAutoGenerated: boolean;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Context-specific property orderings for a shape
|
|
294
|
+
*
|
|
295
|
+
* Each shape can have different property orders for different display contexts.
|
|
296
|
+
* If a context order is not specified or isAutoGenerated is true, the system
|
|
297
|
+
* will compute a sensible default based on property metadata.
|
|
298
|
+
*
|
|
299
|
+
* Auto-generation rules:
|
|
300
|
+
* - single: First required property, or first with highest importance
|
|
301
|
+
* - small: First 2-3 properties by required status, then importance
|
|
302
|
+
* - card: First 4-5 properties for summary display
|
|
303
|
+
* - form: All properties in their default order
|
|
304
|
+
* - table: All non-multiline properties suitable for columns
|
|
305
|
+
*/
|
|
306
|
+
export interface ShapeDisplayOrderings {
|
|
307
|
+
/** Single property display (most identifying property) */
|
|
308
|
+
single?: PropertyDisplayOrder;
|
|
309
|
+
/** Small display (2-3 key properties) */
|
|
310
|
+
small?: PropertyDisplayOrder;
|
|
311
|
+
/** Card display (summary view, 4-5 properties) */
|
|
312
|
+
card?: PropertyDisplayOrder;
|
|
313
|
+
/** Form display (all editable properties) */
|
|
314
|
+
form?: PropertyDisplayOrder;
|
|
315
|
+
/** Table display (column order) */
|
|
316
|
+
table?: PropertyDisplayOrder;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* NodeShape - the top-level shape definition (sh:NodeShape)
|
|
320
|
+
*/
|
|
321
|
+
export interface BuilderNodeShape {
|
|
322
|
+
/** Unique ID (local to builder) */
|
|
323
|
+
id: string;
|
|
324
|
+
/** Full URI of this shape */
|
|
325
|
+
uri: string;
|
|
326
|
+
/** Human-readable name (sh:name or rdfs:label) */
|
|
327
|
+
name: string;
|
|
328
|
+
/** Description (rdfs:comment or sh:description) */
|
|
329
|
+
description?: string;
|
|
330
|
+
/** Current version string (e.g., "1.2.3" or "1.2.3-draft") */
|
|
331
|
+
version: string;
|
|
332
|
+
/** Version status */
|
|
333
|
+
versionStatus: 'draft' | 'published' | 'deprecated' | 'archived';
|
|
334
|
+
/** For deprecated versions: recommended replacement URI */
|
|
335
|
+
supersededBy?: string;
|
|
336
|
+
/** URI this was forked from (if any) */
|
|
337
|
+
forkedFrom?: string;
|
|
338
|
+
/** How this shape targets nodes (sh:targetClass, sh:targetNode, etc.) */
|
|
339
|
+
targetType: ShapeTargetType;
|
|
340
|
+
/** For targetClass: the class URI from ontology (sh:targetClass) */
|
|
341
|
+
targetClass?: string;
|
|
342
|
+
/** For targetNode: specific URIs (sh:targetNode) */
|
|
343
|
+
targetNodes?: string[];
|
|
344
|
+
/** For targetSubjectsOf/targetObjectsOf: the property URI */
|
|
345
|
+
targetProperty?: string;
|
|
346
|
+
/** Property groups (ordered, for form organization) */
|
|
347
|
+
groups: BuilderPropertyGroup[];
|
|
348
|
+
/** Property shapes (ordered within groups) */
|
|
349
|
+
propertyShapes: BuilderPropertyShape[];
|
|
350
|
+
/** Logical constraints combining properties (sh:and, sh:or, sh:not, sh:xone) */
|
|
351
|
+
logicalConstraints?: LogicalConstraint[];
|
|
352
|
+
/** If true, only declared properties are allowed (sh:closed) */
|
|
353
|
+
closed?: boolean;
|
|
354
|
+
/** Properties to ignore when closed (sh:ignoredProperties) */
|
|
355
|
+
ignoredProperties?: string[];
|
|
356
|
+
/** Is this shape deactivated? (sh:deactivated) */
|
|
357
|
+
deactivated?: boolean;
|
|
358
|
+
/** Parent shape URIs this shape extends (conceptual, not SHACL standard) */
|
|
359
|
+
extendsShapes?: string[];
|
|
360
|
+
/** Ontology this shape belongs to */
|
|
361
|
+
ontologyUri: string;
|
|
362
|
+
/** Ontology prefix for generated URIs */
|
|
363
|
+
ontologyPrefix?: string;
|
|
364
|
+
/** Package name for linked.cm URI generation (derived from project name) */
|
|
365
|
+
packageName?: string;
|
|
366
|
+
/** Owner project ID(s) */
|
|
367
|
+
ownerProjectIds?: string[];
|
|
368
|
+
/** Visibility (private/public) */
|
|
369
|
+
visibility?: 'local' | 'shared' | 'public';
|
|
370
|
+
/** License URI (required for public shapes) */
|
|
371
|
+
license?: string;
|
|
372
|
+
/** Created timestamp */
|
|
373
|
+
createdAt: string;
|
|
374
|
+
/** Updated timestamp */
|
|
375
|
+
updatedAt: string;
|
|
376
|
+
/** Visual position in visual builder */
|
|
377
|
+
visualPosition?: {
|
|
378
|
+
x: number;
|
|
379
|
+
y: number;
|
|
380
|
+
};
|
|
381
|
+
/** Icon identifier for the shape */
|
|
382
|
+
icon?: string;
|
|
383
|
+
/** Icon color (hex or named) */
|
|
384
|
+
iconColor?: string;
|
|
385
|
+
/** Feature tier (essential or complete) */
|
|
386
|
+
featureTier?: 'essential' | 'complete';
|
|
387
|
+
/** Search tags/keywords for catalog discovery */
|
|
388
|
+
tags?: string[];
|
|
389
|
+
/** Featured flag for highlighting in catalog */
|
|
390
|
+
featured?: boolean;
|
|
391
|
+
/** Category for catalog organization */
|
|
392
|
+
category?: string;
|
|
393
|
+
/**
|
|
394
|
+
* Context-specific property orderings for different display scenarios.
|
|
395
|
+
* If not specified or isAutoGenerated is true, defaults are computed.
|
|
396
|
+
*/
|
|
397
|
+
displayOrderings?: ShapeDisplayOrderings;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Shape Builder Draft - complete builder state
|
|
401
|
+
* Mirrors OntologyDraft pattern from ontology builder
|
|
402
|
+
*/
|
|
403
|
+
export interface ShapeBuilderDraft {
|
|
404
|
+
/** Unique draft ID */
|
|
405
|
+
id: string;
|
|
406
|
+
/** Associated ontology URI */
|
|
407
|
+
ontologyUri: string;
|
|
408
|
+
/** Associated ontology prefix */
|
|
409
|
+
ontologyPrefix: string;
|
|
410
|
+
/** All node shapes in this draft */
|
|
411
|
+
nodeShapes: BuilderNodeShape[];
|
|
412
|
+
/** Currently selected shape ID (for UI) */
|
|
413
|
+
selectedShapeId?: string;
|
|
414
|
+
/** Draft version for migrations */
|
|
415
|
+
version: number;
|
|
416
|
+
/** Timestamps */
|
|
417
|
+
createdAt: string;
|
|
418
|
+
updatedAt: string;
|
|
419
|
+
}
|
|
420
|
+
/** Current draft version for migrations */
|
|
421
|
+
export declare const CURRENT_SHAPE_DRAFT_VERSION = 1;
|
|
422
|
+
export type ShapeValidationSeverity = 'error' | 'warning' | 'info';
|
|
423
|
+
export interface ShapeValidationIssue {
|
|
424
|
+
severity: ShapeValidationSeverity;
|
|
425
|
+
message: string;
|
|
426
|
+
element?: {
|
|
427
|
+
type: 'nodeShape' | 'propertyShape' | 'group';
|
|
428
|
+
id?: string;
|
|
429
|
+
name?: string;
|
|
430
|
+
};
|
|
431
|
+
field?: string;
|
|
432
|
+
rule: string;
|
|
433
|
+
suggestion?: string;
|
|
434
|
+
autoFixable?: boolean;
|
|
435
|
+
}
|
|
436
|
+
export interface ShapeValidationResult {
|
|
437
|
+
valid: boolean;
|
|
438
|
+
publishable: boolean;
|
|
439
|
+
errorCount: number;
|
|
440
|
+
warningCount: number;
|
|
441
|
+
issues: ShapeValidationIssue[];
|
|
442
|
+
validatedAt: string;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Check if a property shape targets an object property
|
|
446
|
+
*/
|
|
447
|
+
export declare function isObjectPropertyShape(shape: BuilderPropertyShape): boolean;
|
|
448
|
+
/**
|
|
449
|
+
* Check if a property shape targets a datatype property
|
|
450
|
+
*/
|
|
451
|
+
export declare function isDatatypePropertyShape(shape: BuilderPropertyShape): boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Get the effective nodeKind for a property shape
|
|
454
|
+
*/
|
|
455
|
+
export declare function getEffectiveNodeKind(shape: BuilderPropertyShape): NodeKind;
|
|
456
|
+
/**
|
|
457
|
+
* Check if cardinality means "required"
|
|
458
|
+
*/
|
|
459
|
+
export declare function isRequired(cardinality: CardinalityConstraint): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Check if cardinality means "single value"
|
|
462
|
+
*/
|
|
463
|
+
export declare function isSingleValue(cardinality: CardinalityConstraint): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Serialize a PropertyValue to Turtle syntax
|
|
466
|
+
*/
|
|
467
|
+
export declare function serializePropertyValue(value: PropertyValue): string;
|
|
468
|
+
/**
|
|
469
|
+
* Check if datatype is numeric
|
|
470
|
+
*/
|
|
471
|
+
export declare function isNumericDatatype(datatype?: ShaclDatatype): boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Check if datatype is string-based
|
|
474
|
+
*/
|
|
475
|
+
export declare function isStringDatatype(datatype?: ShaclDatatype): boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Simple property path for builder inputs (just the predicate URI)
|
|
478
|
+
* Used for basic cases where we just need a single predicate
|
|
479
|
+
*/
|
|
480
|
+
export interface SimplePropertyPath {
|
|
481
|
+
type: 'predicate';
|
|
482
|
+
predicate: string;
|
|
483
|
+
predicateName?: string;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Simplified property shape for builder forms
|
|
487
|
+
* Flat structure that's easier to work with in forms/hooks
|
|
488
|
+
*/
|
|
489
|
+
export interface SimplePropertyShape {
|
|
490
|
+
id: string;
|
|
491
|
+
uri?: string;
|
|
492
|
+
name: string;
|
|
493
|
+
description?: string;
|
|
494
|
+
/** Simple path (just the predicate URI) */
|
|
495
|
+
path?: SimplePropertyPath;
|
|
496
|
+
/** Display order */
|
|
497
|
+
order?: number;
|
|
498
|
+
/** Group ID */
|
|
499
|
+
groupId?: string;
|
|
500
|
+
minCount?: number;
|
|
501
|
+
maxCount?: number;
|
|
502
|
+
datatype?: string;
|
|
503
|
+
classUri?: string;
|
|
504
|
+
nodeKind?: NodeKind;
|
|
505
|
+
minLength?: number;
|
|
506
|
+
maxLength?: number;
|
|
507
|
+
pattern?: string;
|
|
508
|
+
flags?: string;
|
|
509
|
+
minInclusive?: number;
|
|
510
|
+
maxInclusive?: number;
|
|
511
|
+
minExclusive?: number;
|
|
512
|
+
maxExclusive?: number;
|
|
513
|
+
displayPriority?: number;
|
|
514
|
+
isPrimaryDisplay?: boolean;
|
|
515
|
+
isUniqueIdentifier?: boolean;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Simplified node shape for builder forms
|
|
519
|
+
*/
|
|
520
|
+
export interface SimpleNodeShape {
|
|
521
|
+
id: string;
|
|
522
|
+
uri?: string;
|
|
523
|
+
name: string;
|
|
524
|
+
description?: string;
|
|
525
|
+
version: string;
|
|
526
|
+
versionStatus: 'draft' | 'published' | 'deprecated';
|
|
527
|
+
targetType: ShapeTargetType;
|
|
528
|
+
targetClass?: string;
|
|
529
|
+
groups: BuilderPropertyGroup[];
|
|
530
|
+
propertyShapes: SimplePropertyShape[];
|
|
531
|
+
closed?: boolean;
|
|
532
|
+
ontologyUri: string;
|
|
533
|
+
ontologyPrefix?: string;
|
|
534
|
+
ownerProjectIds?: string[];
|
|
535
|
+
visibility?: 'local' | 'shared' | 'public';
|
|
536
|
+
icon?: string;
|
|
537
|
+
iconColor?: string;
|
|
538
|
+
visualPosition?: {
|
|
539
|
+
x: number;
|
|
540
|
+
y: number;
|
|
541
|
+
};
|
|
542
|
+
createdAt?: string;
|
|
543
|
+
updatedAt?: string;
|
|
544
|
+
featureTier?: 'essential' | 'complete';
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Convert a SimplePropertyShape to a full BuilderPropertyShape
|
|
548
|
+
*/
|
|
549
|
+
export declare function simpleToFullPropertyShape(simple: SimplePropertyShape): BuilderPropertyShape;
|
|
550
|
+
/**
|
|
551
|
+
* Convert a full BuilderPropertyShape to a SimplePropertyShape
|
|
552
|
+
*/
|
|
553
|
+
export declare function fullToSimplePropertyShape(full: BuilderPropertyShape): SimplePropertyShape;
|
|
554
|
+
/**
|
|
555
|
+
* Generate a simple predicate path from a property URI
|
|
556
|
+
*/
|
|
557
|
+
export declare function createSimplePath(propertyUri: string, propertyName?: string, propertyType?: 'object' | 'datatype', rangeClassUri?: string, rangeDatatype?: string): PropertyPath;
|
|
558
|
+
/**
|
|
559
|
+
* Shape status in the registry
|
|
560
|
+
*/
|
|
561
|
+
export type ShapeStatus = 'active' | 'deprecated' | 'draft' | 'archived';
|
|
562
|
+
/**
|
|
563
|
+
* Verification level for shapes
|
|
564
|
+
*/
|
|
565
|
+
export type ShapeVerificationLevel = 'verified' | 'community' | 'unverified';
|
|
566
|
+
/**
|
|
567
|
+
* Shape visibility (openness level)
|
|
568
|
+
* - 'local': Level 1 — lives in app's repo
|
|
569
|
+
* - 'shared': Level 2 — optionally published to npm
|
|
570
|
+
* - 'public': Level 3 — source in Linked org public repo
|
|
571
|
+
*/
|
|
572
|
+
export type ShapeVisibility = 'local' | 'shared' | 'public';
|
|
573
|
+
/**
|
|
574
|
+
* Shape version information
|
|
575
|
+
*
|
|
576
|
+
* URI Strategy:
|
|
577
|
+
* - Base URI: /shapes/{shapeName}Shape (holds metadata + latest release copy)
|
|
578
|
+
* - Version URI: /shapes/{shapeName}Shape/{version} (e.g., /shapes/PersonShape/1.0.0)
|
|
579
|
+
*
|
|
580
|
+
* The base shape always contains:
|
|
581
|
+
* - Metadata (name, description, owner, etc.)
|
|
582
|
+
* - A copy of the latest published version's constraints
|
|
583
|
+
* - Reference to all versions via cnSh:hasVersion
|
|
584
|
+
*/
|
|
585
|
+
export interface ShapeVersion {
|
|
586
|
+
/** SemVer version string (e.g., "1.0.0", "1.2.3-beta") */
|
|
587
|
+
version: string;
|
|
588
|
+
/** Full URI for this version */
|
|
589
|
+
versionUri: string;
|
|
590
|
+
/** Status of this version */
|
|
591
|
+
status: 'draft' | 'published' | 'deprecated' | 'archived';
|
|
592
|
+
/** Release notes for this version */
|
|
593
|
+
releaseNotes?: string;
|
|
594
|
+
/** When this version was published */
|
|
595
|
+
publishedAt?: string;
|
|
596
|
+
/** Who published this version */
|
|
597
|
+
publishedBy?: string;
|
|
598
|
+
/** Is this the latest stable release? */
|
|
599
|
+
isLatest?: boolean;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Shape registry entry for catalog display
|
|
603
|
+
*
|
|
604
|
+
* Represents a shape in the catalog with metadata for discovery.
|
|
605
|
+
* The base URI always holds the latest version's data.
|
|
606
|
+
*/
|
|
607
|
+
export interface ShapeRegistryEntry {
|
|
608
|
+
/** Base URI for the shape (without version) */
|
|
609
|
+
uri: string;
|
|
610
|
+
/** Human-readable name */
|
|
611
|
+
name: string;
|
|
612
|
+
/** Description of what this shape validates */
|
|
613
|
+
description?: string;
|
|
614
|
+
/** Target class this shape validates (sh:targetClass) */
|
|
615
|
+
targetClass?: string;
|
|
616
|
+
/** Prefix of the target ontology */
|
|
617
|
+
ontologyPrefix?: string;
|
|
618
|
+
/** URI of the source ontology */
|
|
619
|
+
ontologyUri?: string;
|
|
620
|
+
/** Keywords/tags for discovery */
|
|
621
|
+
keywords: string[];
|
|
622
|
+
/** Domain categories */
|
|
623
|
+
domain: string[];
|
|
624
|
+
/** Current version (latest published, or draft if none published) */
|
|
625
|
+
version: string;
|
|
626
|
+
/** All available versions */
|
|
627
|
+
versions?: ShapeVersion[];
|
|
628
|
+
/** Maintainer information */
|
|
629
|
+
maintainer: {
|
|
630
|
+
name: string;
|
|
631
|
+
type: 'organization' | 'community' | 'individual' | 'local';
|
|
632
|
+
url?: string;
|
|
633
|
+
};
|
|
634
|
+
/** Current status */
|
|
635
|
+
status: ShapeStatus;
|
|
636
|
+
/** Last updated timestamp */
|
|
637
|
+
lastUpdated: string;
|
|
638
|
+
/** Created timestamp */
|
|
639
|
+
createdAt?: string;
|
|
640
|
+
/** Verification info */
|
|
641
|
+
verification: {
|
|
642
|
+
level: ShapeVerificationLevel;
|
|
643
|
+
verifiedBy?: string[];
|
|
644
|
+
};
|
|
645
|
+
/** Owner project IDs (who can edit) */
|
|
646
|
+
ownerProjectIds?: string[];
|
|
647
|
+
/** Whether this shape is in use in current project */
|
|
648
|
+
inUse?: boolean;
|
|
649
|
+
/** Whether this is a local/project shape */
|
|
650
|
+
isLocal?: boolean;
|
|
651
|
+
/** Whether this shape is owned by current project */
|
|
652
|
+
isOwned?: boolean;
|
|
653
|
+
/** Icon name for UI */
|
|
654
|
+
icon?: string;
|
|
655
|
+
/** Icon color for UI */
|
|
656
|
+
iconColor?: string;
|
|
657
|
+
/** Visibility setting */
|
|
658
|
+
visibility?: ShapeVisibility;
|
|
659
|
+
/** License (required for public shapes) */
|
|
660
|
+
license?: string;
|
|
661
|
+
/** Whether this shape is featured in catalog */
|
|
662
|
+
featured?: boolean;
|
|
663
|
+
/** Tags for filtering */
|
|
664
|
+
tags?: string[];
|
|
665
|
+
/** Stats for discovery */
|
|
666
|
+
stats: {
|
|
667
|
+
/** Number of property shapes defined */
|
|
668
|
+
propertyCount: number;
|
|
669
|
+
/** Number of projects using this shape */
|
|
670
|
+
usageCount: number;
|
|
671
|
+
/** User rating (0-5) */
|
|
672
|
+
rating?: number;
|
|
673
|
+
/** Number of downloads/imports */
|
|
674
|
+
downloadCount?: number;
|
|
675
|
+
/** Number of forks */
|
|
676
|
+
forkCount?: number;
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Filter state for shape catalog
|
|
681
|
+
*/
|
|
682
|
+
export interface ShapeFilterState {
|
|
683
|
+
/** Filter by domain/category */
|
|
684
|
+
domains: string[];
|
|
685
|
+
/** Filter by status */
|
|
686
|
+
status: string[];
|
|
687
|
+
/** Filter by ontology */
|
|
688
|
+
ontology: string[];
|
|
689
|
+
/** Filter by visibility */
|
|
690
|
+
visibility: string[];
|
|
691
|
+
/** Search query */
|
|
692
|
+
searchQuery?: string;
|
|
693
|
+
/** Only show featured shapes */
|
|
694
|
+
featuredOnly?: boolean;
|
|
695
|
+
/** Only show shapes owned by current project */
|
|
696
|
+
ownedOnly?: boolean;
|
|
697
|
+
}
|