@ndla/types-taxonomy 1.0.33 → 1.0.35

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/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ node = "22.15"
package/package.json CHANGED
@@ -17,5 +17,6 @@
17
17
  "devDependencies": {
18
18
  "typescript": "^5.0.2"
19
19
  },
20
- "version": "1.0.33"
20
+ "version": "1.0.35",
21
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
21
22
  }
package/taxonomy-api.ts CHANGED
@@ -37,6 +37,10 @@ export interface Node {
37
37
  * An id unique for this context.
38
38
  */
39
39
  contextId?: string;
40
+ /**
41
+ * A list of all contextids this node has ever had
42
+ */
43
+ contextids: string[];
40
44
  contexts: TaxonomyContext[];
41
45
  /**
42
46
  * A number representing the average grade of all children nodes recursively.
@@ -148,7 +152,7 @@ export interface NodePostPut {
148
152
  /**
149
153
  * The language used at create time. Used to set default translation.
150
154
  */
151
- language?: string;
155
+ language: string;
152
156
  /**
153
157
  * The name of the node. Required on create.
154
158
  */
@@ -259,11 +263,11 @@ export interface NodeSearchBody {
259
263
  /**
260
264
  * Include all contexts
261
265
  */
262
- includeContexts?: boolean;
266
+ includeContexts: boolean;
263
267
  /**
264
268
  * ISO-639-1 language code
265
269
  */
266
- language?: string;
270
+ language: string;
267
271
  /**
268
272
  * Filter by nodeType
269
273
  */
@@ -324,6 +328,7 @@ export interface ResolvedOldUrl {
324
328
 
325
329
  export interface ResolvedUrl {
326
330
  contentUri: string;
331
+ exactMatch: boolean;
327
332
  id: string;
328
333
  name: string;
329
334
  parents: string[];
@@ -429,6 +434,7 @@ export interface SearchResult<T> {
429
434
  export interface SearchableTaxonomyResourceType {
430
435
  id: string;
431
436
  name: Record<string, string>;
437
+ parentId?: string;
432
438
  }
433
439
 
434
440
  export interface SubjectPostPut {
@@ -553,7 +559,7 @@ export interface TaxonomyContext {
553
559
  */
554
560
  parentIds: string[];
555
561
  /**
556
- * List of all parents to this context
562
+ * List of all parents to this context. Empty if node is fetched as child
557
563
  */
558
564
  parents: TaxonomyCrumb[];
559
565
  /**
@@ -811,7 +817,7 @@ export interface Version {
811
817
 
812
818
  export interface VersionPostPut {
813
819
  /**
814
- * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If omitted, an id will be assigned automatically.
820
+ * If specified, set the id to this value. Must start with urn:version: and be a valid URI. If ommitted, an id will be assigned automatically.
815
821
  */
816
822
  id?: string;
817
823
  /**
@@ -1,783 +0,0 @@
1
- export interface Connection {
2
- connectionId: string;
3
- isPrimary: boolean;
4
- paths: string[];
5
- targetId: string;
6
- type: string;
7
- }
8
- export interface Context {
9
- id: string;
10
- name: string;
11
- path: string;
12
- }
13
- export interface ContextPOST {
14
- id: string;
15
- }
16
- export interface GradeAverage {
17
- averageValue: number;
18
- count: number;
19
- }
20
- export interface Metadata {
21
- customFields: Record<string, string>;
22
- grepCodes: string[];
23
- visible: boolean;
24
- }
25
- export interface Node {
26
- baseName: string;
27
- breadcrumbs: string[];
28
- contentUri?: string;
29
- context?: TaxonomyContext;
30
- /**
31
- * An id unique for this context.
32
- */
33
- contextId?: string;
34
- contexts: TaxonomyContext[];
35
- /**
36
- * A number representing the average grade of all children nodes recursively.
37
- */
38
- gradeAverage?: GradeAverage;
39
- id: string;
40
- language: string;
41
- metadata: Metadata;
42
- name: string;
43
- /**
44
- * The type of node
45
- */
46
- nodeType: NodeType;
47
- path?: string;
48
- paths: string[];
49
- /**
50
- * Quality evaluation of the article
51
- */
52
- qualityEvaluation?: QualityEvaluation;
53
- relevanceId?: string;
54
- resourceTypes: ResourceTypeWithConnection[];
55
- supportedLanguages: string[];
56
- translations: Translation[];
57
- url?: string;
58
- }
59
- export interface NodeChild extends Node {
60
- connectionId: string;
61
- isPrimary: boolean;
62
- parentId: string;
63
- rank: number;
64
- }
65
- export interface NodeConnection {
66
- /**
67
- * Child id
68
- */
69
- childId: string;
70
- /**
71
- * Connection id
72
- */
73
- id: string;
74
- /**
75
- * Metadata for entity. Read only.
76
- */
77
- metadata: Metadata;
78
- /**
79
- * Parent id
80
- */
81
- parentId: string;
82
- /**
83
- * Is this connection primary
84
- */
85
- primary: boolean;
86
- /**
87
- * Order in which subtopic is sorted for the topic
88
- */
89
- rank: number;
90
- /**
91
- * Relevance id
92
- */
93
- relevanceId?: string;
94
- }
95
- export interface NodeConnectionPOST {
96
- /**
97
- * Child id
98
- */
99
- childId: string;
100
- parentId: string;
101
- /**
102
- * If this connection is primary.
103
- */
104
- primary?: boolean;
105
- /**
106
- * Order in which to sort the child for the parent
107
- */
108
- rank?: number;
109
- /**
110
- * Relevance id
111
- */
112
- relevanceId?: string;
113
- }
114
- export interface NodeConnectionPUT {
115
- /**
116
- * If this connection is primary.
117
- */
118
- primary?: boolean;
119
- /**
120
- * Order in which subtopic is sorted for the topic
121
- */
122
- rank?: number;
123
- /**
124
- * Relevance id
125
- */
126
- relevanceId?: string;
127
- }
128
- export interface NodePostPut {
129
- /**
130
- * ID of content introducing this node. Must be a valid URI, but preferably not a URL.
131
- */
132
- contentUri?: string;
133
- /**
134
- * The node is the root in a context. Default is false. Only used if present.
135
- */
136
- context?: boolean;
137
- /**
138
- * The language used at create time. Used to set default translation.
139
- */
140
- language?: string;
141
- /**
142
- * The name of the node. Required on create.
143
- */
144
- name?: string;
145
- nodeId?: string;
146
- /**
147
- * Type of node.
148
- */
149
- nodeType: NodeType;
150
- /**
151
- * The quality evaluation of the node. Consist of a score from 1 to 5 and a comment.
152
- */
153
- qualityEvaluation?: QualityEvaluation | null;
154
- /**
155
- * The node is a root node. Default is false. Only used if present.
156
- * @deprecated
157
- */
158
- root?: boolean;
159
- /**
160
- * The node is visible. Default is true.
161
- */
162
- visible?: boolean;
163
- }
164
- export interface NodeResource {
165
- /**
166
- * Node resource connection id
167
- */
168
- id: string;
169
- /**
170
- * Metadata for entity. Read only.
171
- */
172
- metadata: Metadata;
173
- /**
174
- * Node id
175
- */
176
- nodeId: string;
177
- /**
178
- * Primary connection
179
- */
180
- primary: boolean;
181
- /**
182
- * Order in which the resource is sorted for the node
183
- */
184
- rank: number;
185
- /**
186
- * Relevance id
187
- */
188
- relevanceId?: string;
189
- /**
190
- * Resource id
191
- */
192
- resourceId: string;
193
- }
194
- export interface NodeResourcePOST {
195
- /**
196
- * Node id
197
- */
198
- nodeId: string;
199
- /**
200
- * Primary connection
201
- */
202
- primary?: boolean;
203
- /**
204
- * Order in which resource is sorted for the node
205
- */
206
- rank?: number;
207
- /**
208
- * Relevance id
209
- */
210
- relevanceId?: string;
211
- /**
212
- * Resource id
213
- */
214
- resourceId: string;
215
- }
216
- export interface NodeResourcePUT {
217
- /**
218
- * Primary connection
219
- */
220
- primary?: boolean;
221
- /**
222
- * Order in which the resource will be sorted for this node.
223
- */
224
- rank?: number;
225
- /**
226
- * Relevance id
227
- */
228
- relevanceId?: string;
229
- }
230
- export interface NodeSearchBody {
231
- /**
232
- * ContentURIs to fetch for query
233
- */
234
- contentUris?: string[];
235
- customFields?: Record<string, string>;
236
- /**
237
- * Filter out programme contexts
238
- */
239
- filterProgrammes: boolean;
240
- /**
241
- * Ids to fetch for query
242
- */
243
- ids?: string[];
244
- /**
245
- * Include all contexts
246
- */
247
- includeContexts?: boolean;
248
- /**
249
- * ISO-639-1 language code
250
- */
251
- language?: string;
252
- /**
253
- * Filter by nodeType
254
- */
255
- nodeType?: NodeType[];
256
- /**
257
- * Which page to fetch
258
- */
259
- page: number;
260
- /**
261
- * How many results to return per page
262
- */
263
- pageSize: number;
264
- /**
265
- * Id to parent id in context.
266
- */
267
- parentId?: string;
268
- /**
269
- * Query to search names
270
- */
271
- query?: string;
272
- /**
273
- * Id to root id in context.
274
- */
275
- rootId?: string;
276
- }
277
- export interface NodeWithParents extends Node {
278
- parents: NodeChild[];
279
- }
280
- export interface QualityEvaluation {
281
- grade: Grade;
282
- note?: string;
283
- }
284
- export interface Relevance {
285
- /**
286
- * Specifies if node is core or supplementary
287
- */
288
- id: string;
289
- /**
290
- * The name of the relevance
291
- */
292
- name: string;
293
- /**
294
- * List of language codes supported by translations
295
- */
296
- supportedLanguages: string[];
297
- translations: Translation[];
298
- }
299
- export interface ResolvedOldUrl {
300
- /**
301
- * URL path for resource
302
- */
303
- path: string;
304
- }
305
- export interface ResolvedUrl {
306
- contentUri: string;
307
- id: string;
308
- name: string;
309
- parents: string[];
310
- path: string;
311
- url: string;
312
- }
313
- export interface ResourcePostPut {
314
- /**
315
- * 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.
316
- */
317
- contentUri: string;
318
- /**
319
- * 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.
320
- */
321
- id?: string;
322
- /**
323
- * The name of the resource
324
- */
325
- name: string;
326
- }
327
- export interface ResourceResourceType {
328
- /**
329
- * Resource to resource type connection id
330
- */
331
- id: string;
332
- /**
333
- * Resource type id
334
- */
335
- resourceId: string;
336
- /**
337
- * Resource type id
338
- */
339
- resourceTypeId: string;
340
- }
341
- export interface ResourceResourceTypePOST {
342
- /**
343
- * Resource id
344
- */
345
- resourceId: string;
346
- /**
347
- * Resource type id
348
- */
349
- resourceTypeId: string;
350
- }
351
- export interface ResourceType {
352
- id: string;
353
- /**
354
- * The name of the resource type
355
- */
356
- name: string;
357
- /**
358
- * Sub resource types
359
- */
360
- subtypes?: ResourceType[];
361
- /**
362
- * List of language codes supported by translations
363
- */
364
- supportedLanguages: string[];
365
- /**
366
- * All translations of this resource type
367
- */
368
- translations: Translation[];
369
- }
370
- export interface ResourceTypePUT {
371
- /**
372
- * 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.
373
- */
374
- id: string;
375
- /**
376
- * The name of the resource type
377
- */
378
- name: string;
379
- /**
380
- * If specified, the new resource type will be a child of the mentioned resource type.
381
- */
382
- parentId: string;
383
- }
384
- export interface ResourceTypeWithConnection {
385
- connectionId: string;
386
- id: string;
387
- name: string;
388
- parentId?: string;
389
- /**
390
- * List of language codes supported by translations
391
- */
392
- supportedLanguages: string[];
393
- translations: Translation[];
394
- }
395
- export interface SearchResult<T> {
396
- page: number;
397
- pageSize: number;
398
- results: T[];
399
- totalCount: number;
400
- }
401
- export interface SearchableTaxonomyResourceType {
402
- id: string;
403
- name: Record<string, string>;
404
- }
405
- export interface SubjectPostPut {
406
- /**
407
- * ID of frontpage connected to this subject. Must be a valid URI, but preferably not a URL.
408
- */
409
- contentUri?: string;
410
- /**
411
- * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If omitted, an id will be assigned automatically.
412
- */
413
- id?: string;
414
- /**
415
- * The name of the subject
416
- */
417
- name: string;
418
- }
419
- export interface SubjectTopic {
420
- /**
421
- * Connection id
422
- */
423
- id: string;
424
- /**
425
- * primary
426
- */
427
- primary: boolean;
428
- /**
429
- * Order in which the topic is sorted under the subject
430
- */
431
- rank: number;
432
- /**
433
- * Relevance id
434
- */
435
- relevanceId?: string;
436
- /**
437
- * Subject id
438
- */
439
- subjectid: string;
440
- /**
441
- * Topic id
442
- */
443
- topicid: string;
444
- }
445
- export interface SubjectTopicPOST {
446
- /**
447
- * Backwards compatibility: Always true, ignored on insert/update.
448
- */
449
- primary?: boolean;
450
- /**
451
- * Order in which the topic should be sorted for the topic
452
- */
453
- rank?: number;
454
- /**
455
- * Relevance id
456
- */
457
- relevanceId?: string;
458
- /**
459
- * Subject id
460
- */
461
- subjectid: string;
462
- /**
463
- * Topic id
464
- */
465
- topicid: string;
466
- }
467
- export interface SubjectTopicPUT {
468
- /**
469
- * If true, set this subject as the primary subject for this topic. This will replace any other primary subject for this topic. You must have one primary subject, so it is not allowed to set the currently primary subject to not be primary any more.
470
- */
471
- primary?: boolean;
472
- /**
473
- * Order in which the topic should be sorted for the subject
474
- */
475
- rank?: number;
476
- /**
477
- * Relevance id
478
- */
479
- relevanceId?: string;
480
- }
481
- export interface TaxonomyContext {
482
- /**
483
- * A breadcrumb of the names of the context's parents
484
- */
485
- breadcrumbs: Record<string, string[]>;
486
- /**
487
- * The id of the parent connection object
488
- */
489
- connectionId: string;
490
- /**
491
- * Unique id of context based on root + parent connection
492
- */
493
- contextId: string;
494
- /**
495
- * Whether a 'standard'-article, 'topic-article'-article or a 'learningpath'
496
- */
497
- contextType?: string;
498
- /**
499
- * The publicId of the node connected via content-uri
500
- */
501
- id: string;
502
- /**
503
- * Whether the parent connection is marked as active
504
- */
505
- isActive: boolean;
506
- /**
507
- * Whether the parent connection is primary or not
508
- */
509
- isPrimary: boolean;
510
- /**
511
- * Whether the parent connection is visible or not
512
- */
513
- isVisible: boolean;
514
- /**
515
- * List of all parent contextIds
516
- */
517
- parentContextIds: string[];
518
- /**
519
- * List of all parent ids
520
- */
521
- parentIds: string[];
522
- /**
523
- * List of all parents to this context
524
- */
525
- parents: TaxonomyCrumb[];
526
- /**
527
- * The context path
528
- */
529
- path: string;
530
- /**
531
- * The publicId of the node connected via content-uri
532
- */
533
- publicId: string;
534
- /**
535
- * The rank of the parent connection object
536
- */
537
- rank: number;
538
- /**
539
- * Name of the relevance of the parent connection
540
- */
541
- relevance: Record<string, string>;
542
- /**
543
- * Id of the relevance of the parent connection
544
- */
545
- relevanceId: string;
546
- /**
547
- * Resource-types of the node
548
- */
549
- resourceTypes: SearchableTaxonomyResourceType[];
550
- /**
551
- * The name of the root parent of the context
552
- */
553
- root: Record<string, string>;
554
- /**
555
- * The publicId of the root parent of the context
556
- */
557
- rootId: string;
558
- /**
559
- * Pretty-url of this particular context
560
- */
561
- url: string;
562
- }
563
- export interface TaxonomyCrumb {
564
- /**
565
- * Unique id of context based on root + parent connection
566
- */
567
- contextId: string;
568
- /**
569
- * The publicId of the node
570
- */
571
- id: string;
572
- /**
573
- * The name of the node
574
- */
575
- name: Record<string, string>;
576
- /**
577
- * The context path
578
- */
579
- path: string;
580
- /**
581
- * The context url
582
- */
583
- url: string;
584
- }
585
- export interface TopicPostPut {
586
- /**
587
- * ID of article introducing this topic. Must be a valid URI, but preferably not a URL.
588
- */
589
- contentUri: string;
590
- /**
591
- * 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.
592
- */
593
- id?: string;
594
- /**
595
- * The name of the topic
596
- */
597
- name: string;
598
- }
599
- export interface TopicResource {
600
- /**
601
- * Topic resource connection id
602
- */
603
- id: string;
604
- /**
605
- * Primary connection
606
- */
607
- primary: boolean;
608
- /**
609
- * Order in which the resource is sorted for the topic
610
- */
611
- rank: number;
612
- /**
613
- * Relevance id
614
- */
615
- relevanceId?: string;
616
- /**
617
- * Resource id
618
- */
619
- resourceId: string;
620
- /**
621
- * Topic id
622
- */
623
- topicid: string;
624
- }
625
- export interface TopicResourcePOST {
626
- /**
627
- * Primary connection
628
- */
629
- primary?: boolean;
630
- /**
631
- * Order in which resource is sorted for the topic
632
- */
633
- rank?: number;
634
- /**
635
- * Relevance id
636
- */
637
- relevanceId?: string;
638
- /**
639
- * Resource id
640
- */
641
- resourceId: string;
642
- /**
643
- * Topic id
644
- */
645
- topicid: string;
646
- }
647
- export interface TopicResourcePUT {
648
- /**
649
- * Primary connection
650
- */
651
- primary?: boolean;
652
- /**
653
- * Order in which the resource will be sorted for this topic.
654
- */
655
- rank?: number;
656
- /**
657
- * Relevance id
658
- */
659
- relevanceId?: string;
660
- }
661
- export interface TopicSubtopic {
662
- /**
663
- * Connection id
664
- */
665
- id: string;
666
- /**
667
- * Backwards compatibility: Always true. Ignored on insert/update
668
- */
669
- primary: boolean;
670
- /**
671
- * Order in which subtopic is sorted for the topic
672
- */
673
- rank: number;
674
- /**
675
- * Relevance id
676
- */
677
- relevanceId?: string;
678
- /**
679
- * Subtopic id
680
- */
681
- subtopicid: string;
682
- /**
683
- * Topic id
684
- */
685
- topicid: string;
686
- }
687
- export interface TopicSubtopicPOST {
688
- /**
689
- * Is this connection primary
690
- */
691
- primary?: boolean;
692
- /**
693
- * Order in which to sort the subtopic for the topic
694
- */
695
- rank?: number;
696
- /**
697
- * Relevance id
698
- */
699
- relevanceId?: string;
700
- /**
701
- * Subtopic id
702
- */
703
- subtopicid: string;
704
- /**
705
- * Topic id
706
- */
707
- topicid: string;
708
- }
709
- export interface TopicSubtopicPUT {
710
- /**
711
- * Is this connection primary
712
- */
713
- primary?: boolean;
714
- /**
715
- * Order in which subtopic is sorted for the topic
716
- */
717
- rank?: number;
718
- /**
719
- * Relevance id
720
- */
721
- relevanceId?: string;
722
- }
723
- export interface Translation {
724
- /**
725
- * ISO 639-1 language code
726
- */
727
- language: string;
728
- /**
729
- * The translated name of the node
730
- */
731
- name: string;
732
- }
733
- export interface TranslationPUT {
734
- /**
735
- * The translated name of the element. Used wherever translated texts are used.
736
- */
737
- name: string;
738
- }
739
- export interface UrlMapping {
740
- /**
741
- * Node URN for resource in new system
742
- */
743
- nodeId: string;
744
- /**
745
- * Subject URN for resource in new system (optional)
746
- */
747
- subjectId: string;
748
- /**
749
- * URL for resource in old system
750
- */
751
- url: string;
752
- }
753
- export interface Version {
754
- archived?: DateAsString;
755
- created: DateAsString;
756
- hash: string;
757
- id: string;
758
- /**
759
- * Is the version locked
760
- */
761
- locked: boolean;
762
- name: string;
763
- published?: DateAsString;
764
- versionType: VersionType;
765
- }
766
- export interface VersionPostPut {
767
- /**
768
- * If specified, set the id to this value. Must start with urn:subject: and be a valid URI. If omitted, an id will be assigned automatically.
769
- */
770
- id?: string;
771
- /**
772
- * If specified, set the locked property to this value.
773
- */
774
- locked?: boolean;
775
- /**
776
- * If specified, set the name to this value.
777
- */
778
- name: string;
779
- }
780
- export type DateAsString = string;
781
- export type Grade = 1 | 2 | 3 | 4 | 5;
782
- export type NodeType = "NODE" | "SUBJECT" | "TOPIC" | "RESOURCE" | "PROGRAMME";
783
- export type VersionType = "BETA" | "PUBLISHED" | "ARCHIVED";
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=taxonomy-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"taxonomy-api.js","sourceRoot":"","sources":["../taxonomy-api.ts"],"names":[],"mappings":""}