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