@ndla/types-taxonomy 1.0.1

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