@ndla/types-taxonomy 1.0.11 → 1.0.13

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