@ndla/types-taxonomy 1.0.10 → 1.0.12

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/taxonomy-api.ts CHANGED
@@ -1,99 +1,61 @@
1
1
 
2
- export interface NodePostPut {
3
- nodeId?: string;
4
- /**
5
- * Type of node.
6
- */
7
- nodeType: NodeType;
8
- /**
9
- * ID of content introducing this node. Must be a valid URI, but preferably not a URL.
10
- */
11
- contentUri?: string;
12
- /**
13
- * The name of the node. Required on create.
14
- */
15
- name?: string;
16
- /**
17
- * The node is a root node. Default is false. Only used if present.
18
- */
19
- root?: boolean;
2
+ export interface Connection {
3
+ connectionId: string;
4
+ isPrimary: boolean;
5
+ paths: string[];
6
+ targetId: string;
7
+ type: string;
20
8
  }
21
9
 
22
- export interface ResourcePostPut {
23
- /**
24
- * If specified, set the id to this value. Must start with urn:resource: and be a valid URI. If omitted, an id will be assigned automatically.
25
- */
26
- id?: string;
27
- /**
28
- * The ID of this resource in the system where the content is stored. This ID should be of the form 'urn:<system>:<id>', where <system> is a short identifier for the system, and <id> is the id of this content in that system.
29
- */
30
- contentUri: string;
31
- /**
32
- * The name of the resource
33
- */
10
+ export interface Context {
11
+ id: string;
34
12
  name: string;
13
+ path: string;
35
14
  }
36
15
 
37
- export interface SubjectPostPut {
38
- /**
39
- * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If ommitted, an id will be assigned automatically.
40
- */
16
+ export interface ContextPOST {
41
17
  id: string;
42
- /**
43
- * ID of frontpage connected to this subject. Must be a valid URI, but preferably not a URL.
44
- */
45
- contentUri?: string;
46
- /**
47
- * The name of the subject
48
- */
49
- name: string;
50
18
  }
51
19
 
52
- export interface TopicPostPut {
53
- /**
54
- * If specified, set the id to this value. Must start with urn:topic: and be a valid URI. If omitted, an id will be assigned automatically.
55
- */
56
- id: string;
57
- /**
58
- * ID of article introducing this topic. Must be a valid URI, but preferably not a URL.
59
- */
60
- contentUri: string;
61
- /**
62
- * The name of the topic
63
- */
64
- name: string;
20
+ export interface Metadata {
21
+ customFields: Record<string, string>;
22
+ grepCodes: string[];
23
+ visible: boolean;
65
24
  }
66
25
 
67
- export interface VersionPostPut {
26
+ export interface Node {
27
+ breadcrumbs: string[];
28
+ contentUri?: string;
68
29
  /**
69
- * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If ommitted, an id will be assigned automatically.
30
+ * An id unique for this context.
70
31
  */
32
+ contextId?: string;
33
+ contexts: TaxonomyContext[];
71
34
  id: string;
72
- /**
73
- * If specified, set the name to this value.
74
- */
35
+ metadata: Metadata;
75
36
  name: string;
76
37
  /**
77
- * If specified, set the locked property to this value.
38
+ * The type of node
78
39
  */
79
- locked?: boolean;
80
- }
81
-
82
- export interface Context {
83
- id: string;
40
+ nodeType: NodeType;
84
41
  path: string;
85
- name: string;
42
+ paths: string[];
43
+ relevanceId?: string;
44
+ resourceTypes: ResourceTypeWithConnection[];
45
+ supportedLanguages: string[];
46
+ translations: Translation[];
47
+ url?: string;
86
48
  }
87
49
 
88
- export interface ContextPOST {
89
- id: string;
50
+ export interface NodeChild extends Node {
51
+ connectionId: string;
52
+ isPrimary: boolean;
53
+ parent: string;
54
+ parentId: string;
55
+ rank: number;
90
56
  }
91
57
 
92
58
  export interface NodeConnection {
93
- /**
94
- * Parent id
95
- */
96
- parentId: string;
97
59
  /**
98
60
  * Child id
99
61
  */
@@ -102,6 +64,14 @@ export interface NodeConnection {
102
64
  * Connection id
103
65
  */
104
66
  id: string;
67
+ /**
68
+ * Metadata for entity. Read only.
69
+ */
70
+ metadata: Metadata;
71
+ /**
72
+ * Parent id
73
+ */
74
+ parentId: string;
105
75
  /**
106
76
  * Is this connection primary
107
77
  */
@@ -114,18 +84,14 @@ export interface NodeConnection {
114
84
  * Relevance id
115
85
  */
116
86
  relevanceId?: string;
117
- /**
118
- * Metadata for entity. Read only.
119
- */
120
- metadata: Metadata;
121
87
  }
122
88
 
123
89
  export interface NodeConnectionPOST {
124
- parentId: string;
125
90
  /**
126
91
  * Child id
127
92
  */
128
93
  childId: string;
94
+ parentId: string;
129
95
  /**
130
96
  * If this connection is primary.
131
97
  */
@@ -155,19 +121,39 @@ export interface NodeConnectionPUT {
155
121
  relevanceId?: string;
156
122
  }
157
123
 
158
- export interface NodeResource {
124
+ export interface NodePostPut {
159
125
  /**
160
- * Node id
126
+ * ID of content introducing this node. Must be a valid URI, but preferably not a URL.
161
127
  */
162
- nodeId: string;
128
+ contentUri?: string;
163
129
  /**
164
- * Resource id
130
+ * The name of the node. Required on create.
165
131
  */
166
- resourceId: string;
132
+ name?: string;
133
+ nodeId?: string;
134
+ /**
135
+ * Type of node.
136
+ */
137
+ nodeType: NodeType;
138
+ /**
139
+ * The node is a root node. Default is false. Only used if present.
140
+ */
141
+ root?: boolean;
142
+ }
143
+
144
+ export interface NodeResource {
167
145
  /**
168
146
  * Node resource connection id
169
147
  */
170
148
  id: string;
149
+ /**
150
+ * Metadata for entity. Read only.
151
+ */
152
+ metadata: Metadata;
153
+ /**
154
+ * Node id
155
+ */
156
+ nodeId: string;
171
157
  /**
172
158
  * Primary connection
173
159
  */
@@ -181,9 +167,9 @@ export interface NodeResource {
181
167
  */
182
168
  relevanceId?: string;
183
169
  /**
184
- * Metadata for entity. Read only.
170
+ * Resource id
185
171
  */
186
- metadata: Metadata;
172
+ resourceId: string;
187
173
  }
188
174
 
189
175
  export interface NodeResourcePOST {
@@ -191,10 +177,6 @@ export interface NodeResourcePOST {
191
177
  * Node id
192
178
  */
193
179
  nodeId: string;
194
- /**
195
- * Resource id
196
- */
197
- resourceId: string;
198
180
  /**
199
181
  * Primary connection
200
182
  */
@@ -207,6 +189,10 @@ export interface NodeResourcePOST {
207
189
  * Relevance id
208
190
  */
209
191
  relevanceId?: string;
192
+ /**
193
+ * Resource id
194
+ */
195
+ resourceId: string;
210
196
  }
211
197
 
212
198
  export interface NodeResourcePUT {
@@ -224,6 +210,10 @@ export interface NodeResourcePUT {
224
210
  relevanceId?: string;
225
211
  }
226
212
 
213
+ export interface NodeWithParents extends Node {
214
+ parents: NodeChild[];
215
+ }
216
+
227
217
  export interface Relevance {
228
218
  /**
229
219
  * Specifies if node is core or supplementary
@@ -233,14 +223,14 @@ export interface Relevance {
233
223
  * The name of the relevance
234
224
  */
235
225
  name: string;
236
- /**
237
- * All translations of this relevance
238
- */
239
- translations: Translation[];
240
226
  /**
241
227
  * List of language codes supported by translations
242
228
  */
243
229
  supportedLanguages: string[];
230
+ /**
231
+ * All translations of this relevance
232
+ */
233
+ translations: Translation[];
244
234
  }
245
235
 
246
236
  export interface RelevancePUT {
@@ -261,7 +251,34 @@ export interface ResolvedOldUrl {
261
251
  path: string;
262
252
  }
263
253
 
254
+ export interface ResolvedUrl {
255
+ contentUri: string;
256
+ id: string;
257
+ name: string;
258
+ parents: string[];
259
+ path: string;
260
+ }
261
+
262
+ export interface ResourcePostPut {
263
+ /**
264
+ * The ID of this resource in the system where the content is stored. This ID should be of the form 'urn:<system>:<id>', where <system> is a short identifier for the system, and <id> is the id of this content in that system.
265
+ */
266
+ contentUri: string;
267
+ /**
268
+ * If specified, set the id to this value. Must start with urn:resource: and be a valid URI. If omitted, an id will be assigned automatically.
269
+ */
270
+ id?: string;
271
+ /**
272
+ * The name of the resource
273
+ */
274
+ name: string;
275
+ }
276
+
264
277
  export interface ResourceResourceType {
278
+ /**
279
+ * Resource to resource type connection id
280
+ */
281
+ id: string;
265
282
  /**
266
283
  * Resource type id
267
284
  */
@@ -270,10 +287,6 @@ export interface ResourceResourceType {
270
287
  * Resource type id
271
288
  */
272
289
  resourceTypeId: string;
273
- /**
274
- * Resource to resource type connection id
275
- */
276
- id: string;
277
290
  }
278
291
 
279
292
  export interface ResourceResourceTypePOST {
@@ -297,21 +310,17 @@ export interface ResourceType {
297
310
  * Sub resource types
298
311
  */
299
312
  subtypes: ResourceType[];
300
- /**
301
- * All translations of this resource type
302
- */
303
- translations: Translation[];
304
313
  /**
305
314
  * List of language codes supported by translations
306
315
  */
307
316
  supportedLanguages: string[];
317
+ /**
318
+ * All translations of this resource type
319
+ */
320
+ translations: Translation[];
308
321
  }
309
322
 
310
323
  export interface ResourceTypePUT {
311
- /**
312
- * If specified, the new resource type will be a child of the mentioned resource type.
313
- */
314
- parentId: string;
315
324
  /**
316
325
  * If specified, set the id to this value. Must start with urn:resourcetype: and be a valid URI. If omitted, an id will be assigned automatically.
317
326
  */
@@ -320,23 +329,58 @@ export interface ResourceTypePUT {
320
329
  * The name of the resource type
321
330
  */
322
331
  name: string;
332
+ /**
333
+ * If specified, the new resource type will be a child of the mentioned resource type.
334
+ */
335
+ parentId: string;
323
336
  }
324
337
 
325
- export interface SubjectTopic {
338
+ export interface ResourceTypeWithConnection {
339
+ connectionId: string;
340
+ id: string;
341
+ name: string;
342
+ parentId: string;
326
343
  /**
327
- * Subject id
344
+ * List of language codes supported by translations
328
345
  */
329
- subjectid: string;
346
+ supportedLanguages: string[];
347
+ translations: Translation[];
348
+ }
349
+
350
+ export interface SearchResult<T> {
351
+ page: number;
352
+ pageSize: number;
353
+ results: T[];
354
+ totalCount: number;
355
+ }
356
+
357
+ export interface SearchableTaxonomyResourceType {
358
+ id: string;
359
+ name: Record<string, string>;
360
+ }
361
+
362
+ export interface SubjectPostPut {
330
363
  /**
331
- * Topic id
364
+ * ID of frontpage connected to this subject. Must be a valid URI, but preferably not a URL.
332
365
  */
333
- topicid: string;
366
+ contentUri?: string;
334
367
  /**
335
- * Connection id
368
+ * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If ommitted, an id will be assigned automatically.
336
369
  */
337
370
  id: string;
338
371
  /**
339
- * primary
372
+ * The name of the subject
373
+ */
374
+ name: string;
375
+ }
376
+
377
+ export interface SubjectTopic {
378
+ /**
379
+ * Connection id
380
+ */
381
+ id: string;
382
+ /**
383
+ * primary
340
384
  */
341
385
  primary: boolean;
342
386
  /**
@@ -347,9 +391,6 @@ export interface SubjectTopic {
347
391
  * Relevance id
348
392
  */
349
393
  relevanceId?: string;
350
- }
351
-
352
- export interface SubjectTopicPOST {
353
394
  /**
354
395
  * Subject id
355
396
  */
@@ -358,6 +399,9 @@ export interface SubjectTopicPOST {
358
399
  * Topic id
359
400
  */
360
401
  topicid: string;
402
+ }
403
+
404
+ export interface SubjectTopicPOST {
361
405
  /**
362
406
  * Backwards compatibility: Always true, ignored on insert/update.
363
407
  */
@@ -370,6 +414,14 @@ export interface SubjectTopicPOST {
370
414
  * Relevance id
371
415
  */
372
416
  relevanceId?: string;
417
+ /**
418
+ * Subject id
419
+ */
420
+ subjectid: string;
421
+ /**
422
+ * Topic id
423
+ */
424
+ topicid: string;
373
425
  }
374
426
 
375
427
  export interface SubjectTopicPUT {
@@ -387,15 +439,86 @@ export interface SubjectTopicPUT {
387
439
  relevanceId?: string;
388
440
  }
389
441
 
390
- export interface TopicResource {
442
+ export interface TaxonomyContext {
391
443
  /**
392
- * Topic id
444
+ * A breadcrumb of the names of the context's path
393
445
  */
394
- topicid: string;
446
+ breadcrumbs: Record<string, string[]>;
395
447
  /**
396
- * Resource id
448
+ * Unique id of context based on root + connection
397
449
  */
398
- resourceId: string;
450
+ contextId: string;
451
+ /**
452
+ * Whether a 'standard'-article, 'topic-article'-article or a 'learningpath'
453
+ */
454
+ contextType?: string;
455
+ id: string;
456
+ /**
457
+ * Whether the base connection is marked as active subject
458
+ */
459
+ isActive: boolean;
460
+ /**
461
+ * Whether the base connection is primary or not
462
+ */
463
+ isPrimary: boolean;
464
+ isPrimaryConnection: boolean;
465
+ /**
466
+ * Whether the base connection is visible or not
467
+ */
468
+ isVisible: boolean;
469
+ /**
470
+ * List of all parent topic-ids
471
+ */
472
+ parentIds: string[];
473
+ parentTopicIds: string[];
474
+ /**
475
+ * The context path
476
+ */
477
+ path: string;
478
+ /**
479
+ * The publicId of the node connected via content-uri
480
+ */
481
+ publicId: string;
482
+ /**
483
+ * Name of the relevance of the connection of the base
484
+ */
485
+ relevance: Record<string, string>;
486
+ /**
487
+ * Id of the relevance of the connection of the base
488
+ */
489
+ relevanceId: string;
490
+ /**
491
+ * Resource-types of the base
492
+ */
493
+ resourceTypes: SearchableTaxonomyResourceType[];
494
+ /**
495
+ * The name of the root parent of the context
496
+ */
497
+ root: Record<string, string>;
498
+ /**
499
+ * The publicId of the root parent of the context
500
+ */
501
+ rootId: string;
502
+ subject: Record<string, string>;
503
+ subjectId: string;
504
+ }
505
+
506
+ export interface TopicPostPut {
507
+ /**
508
+ * ID of article introducing this topic. Must be a valid URI, but preferably not a URL.
509
+ */
510
+ contentUri: string;
511
+ /**
512
+ * If specified, set the id to this value. Must start with urn:topic: and be a valid URI. If omitted, an id will be assigned automatically.
513
+ */
514
+ id: string;
515
+ /**
516
+ * The name of the topic
517
+ */
518
+ name: string;
519
+ }
520
+
521
+ export interface TopicResource {
399
522
  /**
400
523
  * Topic resource connection id
401
524
  */
@@ -412,17 +535,17 @@ export interface TopicResource {
412
535
  * Relevance id
413
536
  */
414
537
  relevanceId?: string;
415
- }
416
-
417
- export interface TopicResourcePOST {
418
- /**
419
- * Topic id
420
- */
421
- topicid: string;
422
538
  /**
423
539
  * Resource id
424
540
  */
425
541
  resourceId: string;
542
+ /**
543
+ * Topic id
544
+ */
545
+ topicid: string;
546
+ }
547
+
548
+ export interface TopicResourcePOST {
426
549
  /**
427
550
  * Primary connection
428
551
  */
@@ -435,6 +558,14 @@ export interface TopicResourcePOST {
435
558
  * Relevance id
436
559
  */
437
560
  relevanceId?: string;
561
+ /**
562
+ * Resource id
563
+ */
564
+ resourceId: string;
565
+ /**
566
+ * Topic id
567
+ */
568
+ topicid: string;
438
569
  }
439
570
 
440
571
  export interface TopicResourcePUT {
@@ -453,14 +584,6 @@ export interface TopicResourcePUT {
453
584
  }
454
585
 
455
586
  export interface TopicSubtopic {
456
- /**
457
- * Topic id
458
- */
459
- topicid: string;
460
- /**
461
- * Subtopic id
462
- */
463
- subtopicid: string;
464
587
  /**
465
588
  * Connection id
466
589
  */
@@ -477,17 +600,17 @@ export interface TopicSubtopic {
477
600
  * Relevance id
478
601
  */
479
602
  relevanceId?: string;
480
- }
481
-
482
- export interface TopicSubtopicPOST {
483
- /**
484
- * Topic id
485
- */
486
- topicid: string;
487
603
  /**
488
604
  * Subtopic id
489
605
  */
490
606
  subtopicid: string;
607
+ /**
608
+ * Topic id
609
+ */
610
+ topicid: string;
611
+ }
612
+
613
+ export interface TopicSubtopicPOST {
491
614
  /**
492
615
  * Is this connection primary
493
616
  */
@@ -500,6 +623,14 @@ export interface TopicSubtopicPOST {
500
623
  * Relevance id
501
624
  */
502
625
  relevanceId?: string;
626
+ /**
627
+ * Subtopic id
628
+ */
629
+ subtopicid: string;
630
+ /**
631
+ * Topic id
632
+ */
633
+ topicid: string;
503
634
  }
504
635
 
505
636
  export interface TopicSubtopicPUT {
@@ -517,6 +648,17 @@ export interface TopicSubtopicPUT {
517
648
  relevanceId?: string;
518
649
  }
519
650
 
651
+ export interface Translation {
652
+ /**
653
+ * ISO 639-1 language code
654
+ */
655
+ language: string;
656
+ /**
657
+ * The translated name of the node
658
+ */
659
+ name: string;
660
+ }
661
+
520
662
  export interface TranslationPUT {
521
663
  /**
522
664
  * The translated name of the element. Used wherever translated texts are used.
@@ -525,10 +667,6 @@ export interface TranslationPUT {
525
667
  }
526
668
 
527
669
  export interface UrlMapping {
528
- /**
529
- * URL for resource in old system
530
- */
531
- url: string;
532
670
  /**
533
671
  * Node URN for resource in new system
534
672
  */
@@ -537,177 +675,39 @@ export interface UrlMapping {
537
675
  * Subject URN for resource in new system (optional)
538
676
  */
539
677
  subjectId: string;
540
- }
541
-
542
- export interface SearchableTaxonomyResourceType {
543
- id: string;
544
- name: Record<string, string>;
545
- }
546
-
547
- export interface TaxonomyContext {
548
- /**
549
- * The publicId of the node connected via content-uri
550
- */
551
- publicId: string;
552
- /**
553
- * The publicId of the root parent of the context
554
- */
555
- rootId: string;
556
- /**
557
- * The name of the root parent of the context
558
- */
559
- root: Record<string, string>;
560
- /**
561
- * The context path
562
- */
563
- path: string;
564
- /**
565
- * A breadcrumb of the names of the context's path
566
- */
567
- breadcrumbs: Record<string, string[]>;
568
- /**
569
- * Whether a 'standard'-article, 'topic-article'-article or a 'learningpath'
570
- */
571
- contextType?: string;
572
- /**
573
- * Id of the relevance of the connection of the base
574
- */
575
- relevanceId: string;
576
- /**
577
- * Name of the relevance of the connection of the base
578
- */
579
- relevance: Record<string, string>;
580
- /**
581
- * Resource-types of the base
582
- */
583
- resourceTypes: SearchableTaxonomyResourceType[];
584
- /**
585
- * List of all parent topic-ids
586
- */
587
- parentIds: string[];
588
- /**
589
- * Whether the base connection is primary or not
590
- */
591
- isPrimary: boolean;
592
678
  /**
593
- * Whether the base connection is marked as active subject
594
- */
595
- isActive: boolean;
596
- /**
597
- * Whether the base connection is visible or not
598
- */
599
- isVisible: boolean;
600
- /**
601
- * Unique id of context based on root + connection
679
+ * URL for resource in old system
602
680
  */
603
- contextId: string;
604
- id: string;
605
- subject: Record<string, string>;
606
- parentTopicIds: string[];
607
- subjectId: string;
608
- isPrimaryConnection: boolean;
609
- }
610
-
611
- export interface Connection {
612
- connectionId: string;
613
- targetId: string;
614
- paths: string[];
615
- type: string;
616
- isPrimary: boolean;
617
- }
618
-
619
- export interface Metadata {
620
- grepCodes: string[];
621
- visible: boolean;
622
- customFields: Record<string, string>;
623
- }
624
-
625
- export interface NodeChild extends Node {
626
- parentId: string;
627
- connectionId: string;
628
- rank: number;
629
- parent: string;
630
- isPrimary: boolean;
681
+ url: string;
631
682
  }
632
683
 
633
- export interface Node {
684
+ export interface Version {
685
+ archived?: DateAsString;
686
+ created: DateAsString;
687
+ hash: string;
634
688
  id: string;
635
- name: string;
636
- contentUri?: string;
637
- path: string;
638
- paths: string[];
639
- metadata: Metadata;
640
- relevanceId?: string;
641
- translations: Translation[];
642
- supportedLanguages: string[];
643
- breadcrumbs: string[];
644
- resourceTypes: ResourceTypeWithConnection[];
645
689
  /**
646
- * The type of node
647
- */
648
- nodeType: NodeType;
649
- /**
650
- * An id unique for this context.
690
+ * Is the version locked
651
691
  */
652
- contextId?: string;
653
- url?: string;
654
- contexts: TaxonomyContext[];
655
- }
656
-
657
- export interface NodeWithParents extends Node {
658
- parents: NodeChild[];
659
- }
660
-
661
- export interface ResolvedUrl {
662
- id: string;
663
- contentUri: string;
692
+ locked: boolean;
664
693
  name: string;
665
- parents: string[];
666
- path: string;
694
+ published?: DateAsString;
695
+ versionType: VersionType;
667
696
  }
668
697
 
669
- export interface ResourceTypeWithConnection {
670
- id: string;
671
- parentId: string;
672
- name: string;
673
- translations: Translation[];
698
+ export interface VersionPostPut {
674
699
  /**
675
- * List of language codes supported by translations
700
+ * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If ommitted, an id will be assigned automatically.
676
701
  */
677
- supportedLanguages: string[];
678
- connectionId: string;
679
- }
680
-
681
- export interface SearchResult<T> {
682
- totalCount: number;
683
- page: number;
684
- pageSize: number;
685
- results: T[];
686
- }
687
-
688
- export interface Translation {
702
+ id: string;
689
703
  /**
690
- * The translated name of the node
704
+ * If specified, set the locked property to this value.
691
705
  */
692
- name: string;
706
+ locked?: boolean;
693
707
  /**
694
- * ISO 639-1 language code
708
+ * If specified, set the name to this value.
695
709
  */
696
- language: string;
697
- }
698
-
699
- export interface Version {
700
- id: string;
701
- versionType: VersionType;
702
710
  name: string;
703
- hash: string;
704
- /**
705
- * Is the version locked
706
- */
707
- locked: boolean;
708
- created: DateAsString;
709
- published?: DateAsString;
710
- archived?: DateAsString;
711
711
  }
712
712
 
713
713
  export type DateAsString = string;