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