@twin.org/data-json-ld 0.0.1-next.17 → 0.0.1-next.20

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.
Files changed (40) hide show
  1. package/dist/cjs/index.cjs +136 -117
  2. package/dist/esm/index.mjs +137 -118
  3. package/dist/types/index.d.ts +25 -0
  4. package/dist/types/models/IJsonLdContainerType.d.ts +8 -0
  5. package/dist/types/models/IJsonLdContainerTypeArray.d.ts +9 -0
  6. package/dist/types/models/IJsonLdContextDefinition.d.ts +25 -0
  7. package/dist/types/models/IJsonLdContextDefinitionElement.d.ts +9 -0
  8. package/dist/types/models/IJsonLdContextDefinitionRoot.d.ts +9 -0
  9. package/dist/types/models/IJsonLdDocument.d.ts +2 -204
  10. package/dist/types/models/IJsonLdExpandedTermDefinition.d.ts +28 -0
  11. package/dist/types/models/IJsonLdGraphObject.d.ts +16 -0
  12. package/dist/types/models/IJsonLdIdMap.d.ts +12 -0
  13. package/dist/types/models/IJsonLdIncludedBlock.d.ts +10 -0
  14. package/dist/types/models/IJsonLdIndexMap.d.ts +13 -0
  15. package/dist/types/models/IJsonLdIndexMapItem.d.ts +12 -0
  16. package/dist/types/models/IJsonLdJsonArray.d.ts +9 -0
  17. package/dist/types/models/IJsonLdJsonObject.d.ts +11 -0
  18. package/dist/types/models/IJsonLdJsonPrimitive.d.ts +8 -0
  19. package/dist/types/models/IJsonLdJsonValue.d.ts +11 -0
  20. package/dist/types/models/IJsonLdKeyword.d.ts +42 -0
  21. package/dist/types/models/IJsonLdLanguageMap.d.ts +11 -0
  22. package/dist/types/models/IJsonLdListObject.d.ts +13 -0
  23. package/dist/types/models/IJsonLdListOrSetItem.d.ts +10 -0
  24. package/dist/types/models/IJsonLdNodeObject.d.ts +19 -0
  25. package/dist/types/models/IJsonLdNodePrimitive.d.ts +13 -0
  26. package/dist/types/models/IJsonLdObject.d.ts +24 -0
  27. package/dist/types/models/IJsonLdSetObject.d.ts +13 -0
  28. package/dist/types/models/IJsonLdTypeMap.d.ts +12 -0
  29. package/dist/types/models/IJsonLdValueObject.d.ts +26 -0
  30. package/dist/types/utils/jsonLdProcessor.d.ts +3 -1
  31. package/docs/changelog.md +1 -1
  32. package/docs/reference/index.md +17 -17
  33. package/docs/reference/interfaces/IJsonLdJsonObject.md +2 -0
  34. package/docs/reference/interfaces/IJsonLdNodeObject.md +1 -1
  35. package/docs/reference/type-aliases/IJsonLdContainerType.md +2 -0
  36. package/docs/reference/type-aliases/IJsonLdContainerTypeArray.md +2 -0
  37. package/docs/reference/type-aliases/IJsonLdJsonArray.md +2 -0
  38. package/docs/reference/type-aliases/IJsonLdJsonPrimitive.md +2 -0
  39. package/docs/reference/type-aliases/IJsonLdJsonValue.md +2 -0
  40. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { DataTypeHandlerFactory, DataTypeHelper } from '@twin.org/data-core';
2
- import { Is, GeneralError, ObjectHelper } from '@twin.org/core';
2
+ import { Is, ObjectHelper, GeneralError } from '@twin.org/core';
3
3
  import { FetchHelper, HttpMethod, HeaderTypes, MimeTypes } from '@twin.org/web';
4
4
  import jsonLd from 'jsonld';
5
5
 
@@ -113,6 +113,7 @@ const JsonLdTypes = {
113
113
  };
114
114
 
115
115
  var type$e = "string";
116
+ var description$n = "Helper Types";
116
117
  var JsonLdContainerTypeSchema = {
117
118
  type: type$e,
118
119
  "enum": [
@@ -121,7 +122,8 @@ var JsonLdContainerTypeSchema = {
121
122
  "@id",
122
123
  "@graph",
123
124
  "@type"
124
- ]
125
+ ],
126
+ description: description$n
125
127
  };
126
128
 
127
129
  var anyOf$8 = [
@@ -298,29 +300,42 @@ var anyOf$8 = [
298
300
  maxItems: 2
299
301
  }
300
302
  ];
303
+ var description$m = "Helper Types.";
301
304
  var JsonLdContainerTypeArraySchema = {
302
- anyOf: anyOf$8
305
+ anyOf: anyOf$8,
306
+ description: description$m
303
307
  };
304
308
 
305
309
  var type$d = "object";
306
310
  var properties$6 = {
307
311
  "@base": {
308
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
312
+ type: [
313
+ "string",
314
+ "null"
315
+ ]
309
316
  },
310
317
  "@direction": {
311
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
318
+ type: [
319
+ "string",
320
+ "null"
321
+ ],
322
+ "enum": [
323
+ "ltr",
324
+ "rtl",
325
+ null
326
+ ]
312
327
  },
313
328
  "@import": {
314
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
329
+ type: "string"
315
330
  },
316
331
  "@language": {
317
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
332
+ type: "string"
318
333
  },
319
334
  "@propagate": {
320
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
335
+ type: "boolean"
321
336
  },
322
337
  "@protected": {
323
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
338
+ type: "boolean"
324
339
  },
325
340
  "@type": {
326
341
  type: "object",
@@ -330,7 +345,7 @@ var properties$6 = {
330
345
  "const": "@set"
331
346
  },
332
347
  "@protected": {
333
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
348
+ type: "boolean"
334
349
  }
335
350
  },
336
351
  required: [
@@ -339,10 +354,14 @@ var properties$6 = {
339
354
  additionalProperties: false
340
355
  },
341
356
  "@version": {
342
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
357
+ type: "string",
358
+ "const": "1.1"
343
359
  },
344
360
  "@vocab": {
345
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
361
+ type: [
362
+ "string",
363
+ "null"
364
+ ]
346
365
  }
347
366
  };
348
367
  var additionalProperties$b = {
@@ -358,12 +377,12 @@ var additionalProperties$b = {
358
377
  }
359
378
  ]
360
379
  };
361
- var description$h = "A context definition defines a local context in a node object.";
380
+ var description$l = "A context definition defines a local context in a node object.";
362
381
  var JsonLdContextDefinitionSchema = {
363
382
  type: type$d,
364
383
  properties: properties$6,
365
384
  additionalProperties: additionalProperties$b,
366
- description: description$h
385
+ description: description$l
367
386
  };
368
387
 
369
388
  var anyOf$7 = [
@@ -409,10 +428,10 @@ var anyOf$7 = [
409
428
  additionalProperties: false
410
429
  }
411
430
  ];
412
- var description$g = "A JSON-LD document MUST be valid JSON text as described in [RFC8259], or some format that can be represented in the JSON-LD internal representation that is equivalent to valid JSON text.";
431
+ var description$k = "A JSON-LD document MUST be valid JSON text as described in [RFC8259], or some format that can be represented in the JSON-LD internal representation that is equivalent to valid JSON text.";
413
432
  var JsonLdDocumentSchema = {
414
433
  anyOf: anyOf$7,
415
- description: description$g
434
+ description: description$k
416
435
  };
417
436
 
418
437
  var anyOf$6 = [
@@ -423,7 +442,13 @@ var anyOf$6 = [
423
442
  "@id": {
424
443
  anyOf: [
425
444
  {
426
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
445
+ type: "string"
446
+ },
447
+ {
448
+ type: "array",
449
+ items: {
450
+ type: "string"
451
+ }
427
452
  },
428
453
  {
429
454
  type: "null"
@@ -434,28 +459,64 @@ var anyOf$6 = [
434
459
  type: "string"
435
460
  },
436
461
  "@container": {
437
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
462
+ anyOf: [
463
+ {
464
+ type: "string",
465
+ "const": "@list"
466
+ },
467
+ {
468
+ type: "string",
469
+ "const": "@set"
470
+ },
471
+ {
472
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContainerType"
473
+ },
474
+ {
475
+ type: "array",
476
+ items: {
477
+ anyOf: [
478
+ {
479
+ type: "string",
480
+ "const": "@list"
481
+ },
482
+ {
483
+ type: "string",
484
+ "const": "@set"
485
+ },
486
+ {
487
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContainerType"
488
+ }
489
+ ]
490
+ }
491
+ },
492
+ {
493
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContainerTypeArray"
494
+ },
495
+ {
496
+ type: "null"
497
+ }
498
+ ]
438
499
  },
439
500
  "@type": {
440
501
  type: "string"
441
502
  },
442
503
  "@language": {
443
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
504
+ type: "string"
444
505
  },
445
506
  "@index": {
446
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
507
+ type: "string"
447
508
  },
448
509
  "@context": {
449
510
  $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
450
511
  },
451
512
  "@prefix": {
452
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
513
+ type: "boolean"
453
514
  },
454
515
  "@propagate": {
455
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
516
+ type: "boolean"
456
517
  },
457
518
  "@protected": {
458
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
519
+ type: "boolean"
459
520
  }
460
521
  }
461
522
  },
@@ -464,7 +525,7 @@ var anyOf$6 = [
464
525
  additionalProperties: false,
465
526
  properties: {
466
527
  "@reverse": {
467
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
528
+ type: "string"
468
529
  },
469
530
  "@container": {
470
531
  type: [
@@ -481,22 +542,22 @@ var anyOf$6 = [
481
542
  type: "string"
482
543
  },
483
544
  "@language": {
484
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
545
+ type: "string"
485
546
  },
486
547
  "@index": {
487
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
548
+ type: "string"
488
549
  },
489
550
  "@context": {
490
551
  $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinition"
491
552
  },
492
553
  "@prefix": {
493
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
554
+ type: "boolean"
494
555
  },
495
556
  "@propagate": {
496
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
557
+ type: "boolean"
497
558
  },
498
559
  "@protected": {
499
- $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
560
+ type: "boolean"
500
561
  }
501
562
  },
502
563
  required: [
@@ -504,10 +565,10 @@ var anyOf$6 = [
504
565
  ]
505
566
  }
506
567
  ];
507
- var description$f = "An expanded term definition is used to describe the mapping between a term and its expanded identifier, as well as other properties of the value associated with the term when it is used as key in a node object.";
568
+ var description$j = "An expanded term definition is used to describe the mapping between a term and its expanded identifier, as well as other properties of the value associated with the term when it is used as key in a node object.";
508
569
  var JsonLdExpandedTermDefinitionSchema = {
509
570
  anyOf: anyOf$6,
510
- description: description$f
571
+ description: description$j
511
572
  };
512
573
 
513
574
  var type$c = "object";
@@ -526,47 +587,37 @@ var properties$5 = {
526
587
  ]
527
588
  },
528
589
  "@index": {
529
- type: "string"
590
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
530
591
  },
531
592
  "@id": {
532
- anyOf: [
533
- {
534
- type: "string"
535
- },
536
- {
537
- type: "array",
538
- items: {
539
- type: "string"
540
- }
541
- }
542
- ]
593
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
543
594
  },
544
595
  "@context": {
545
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionRoot"
596
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
546
597
  }
547
598
  };
548
599
  var required$3 = [
549
600
  "@graph"
550
601
  ];
551
602
  var additionalProperties$a = false;
552
- var description$e = "A graph object represents a named graph, which MAY include an explicit graph name.";
603
+ var description$i = "A graph object represents a named graph, which MAY include an explicit graph name.";
553
604
  var JsonLdGraphObjectSchema = {
554
605
  type: type$c,
555
606
  properties: properties$5,
556
607
  required: required$3,
557
608
  additionalProperties: additionalProperties$a,
558
- description: description$e
609
+ description: description$i
559
610
  };
560
611
 
561
612
  var type$b = "object";
562
613
  var additionalProperties$9 = {
563
614
  $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
564
615
  };
565
- var description$d = "An id map is used to associate an IRI with a value that allows easy programmatic access.";
616
+ var description$h = "An id map is used to associate an IRI with a value that allows easy programmatic access.";
566
617
  var JsonLdIdMapSchema = {
567
618
  type: type$b,
568
619
  additionalProperties: additionalProperties$9,
569
- description: description$d
620
+ description: description$h
570
621
  };
571
622
 
572
623
  var anyOf$5 = [
@@ -580,10 +631,10 @@ var anyOf$5 = [
580
631
  }
581
632
  }
582
633
  ];
583
- var description$c = "An included block is used to provide a set of node objects.";
634
+ var description$g = "An included block is used to provide a set of node objects.";
584
635
  var JsonLdIncludedBlockSchema = {
585
636
  anyOf: anyOf$5,
586
- description: description$c
637
+ description: description$g
587
638
  };
588
639
 
589
640
  var type$a = "object";
@@ -600,11 +651,11 @@ var additionalProperties$8 = {
600
651
  }
601
652
  ]
602
653
  };
603
- var description$b = "An index map allows keys that have no semantic meaning, but should be preserved regardless, to be used in JSON-LD documents.";
654
+ var description$f = "An index map allows keys that have no semantic meaning, but should be preserved regardless, to be used in JSON-LD documents.";
604
655
  var JsonLdIndexMapSchema = {
605
656
  type: type$a,
606
657
  additionalProperties: additionalProperties$8,
607
- description: description$b
658
+ description: description$f
608
659
  };
609
660
 
610
661
  var anyOf$4 = [
@@ -633,19 +684,21 @@ var anyOf$4 = [
633
684
  $ref: "https://schema.twindev.org/json-ld/JsonLdSetObject"
634
685
  }
635
686
  ];
636
- var description$a = "The items that can be stored in an index map.";
687
+ var description$e = "The items that can be stored in an index map.";
637
688
  var JsonLdIndexMapItemSchema = {
638
689
  anyOf: anyOf$4,
639
- description: description$a
690
+ description: description$e
640
691
  };
641
692
 
642
693
  var type$9 = "array";
643
694
  var items = {
644
695
  $ref: "https://schema.twindev.org/json-ld/JsonLdJsonValue"
645
696
  };
697
+ var description$d = "JSON Type for array.";
646
698
  var JsonLdJsonArraySchema = {
647
699
  type: type$9,
648
- items: items
700
+ items: items,
701
+ description: description$d
649
702
  };
650
703
 
651
704
  var type$8 = "object";
@@ -660,9 +713,11 @@ var additionalProperties$7 = {
660
713
  }
661
714
  ]
662
715
  };
716
+ var description$c = "JSON Type for object.";
663
717
  var JsonLdJsonObjectSchema = {
664
718
  type: type$8,
665
- additionalProperties: additionalProperties$7
719
+ additionalProperties: additionalProperties$7,
720
+ description: description$c
666
721
  };
667
722
 
668
723
  var type$7 = [
@@ -671,8 +726,10 @@ var type$7 = [
671
726
  "boolean",
672
727
  "null"
673
728
  ];
729
+ var description$b = "JSON Primitive.";
674
730
  var JsonLdJsonPrimitiveSchema = {
675
- type: type$7
731
+ type: type$7,
732
+ description: description$b
676
733
  };
677
734
 
678
735
  var anyOf$3 = [
@@ -686,8 +743,10 @@ var anyOf$3 = [
686
743
  $ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
687
744
  }
688
745
  ];
746
+ var description$a = "JSON Value.";
689
747
  var JsonLdJsonValueSchema = {
690
- anyOf: anyOf$3
748
+ anyOf: anyOf$3,
749
+ description: description$a
691
750
  };
692
751
 
693
752
  var type$6 = "object";
@@ -932,20 +991,10 @@ var JsonLdLanguageMapSchema = {
932
991
  var type$4 = "object";
933
992
  var properties$3 = {
934
993
  "@list": {
935
- anyOf: [
936
- {
937
- $ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
938
- },
939
- {
940
- type: "array",
941
- items: {
942
- $ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
943
- }
944
- }
945
- ]
994
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
946
995
  },
947
996
  "@index": {
948
- type: "string"
997
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
949
998
  }
950
999
  };
951
1000
  var required$1 = [
@@ -1015,23 +1064,13 @@ var additionalProperties$3 = {
1015
1064
  };
1016
1065
  var properties$2 = {
1017
1066
  "@context": {
1018
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionRoot"
1067
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1019
1068
  },
1020
1069
  "@id": {
1021
- anyOf: [
1022
- {
1023
- type: "string"
1024
- },
1025
- {
1026
- type: "array",
1027
- items: {
1028
- type: "string"
1029
- }
1030
- }
1031
- ]
1070
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1032
1071
  },
1033
1072
  "@included": {
1034
- $ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
1073
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1035
1074
  },
1036
1075
  "@graph": {
1037
1076
  anyOf: [
@@ -1062,12 +1101,12 @@ var properties$2 = {
1062
1101
  "@type": {
1063
1102
  anyOf: [
1064
1103
  {
1065
- type: "string"
1104
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1066
1105
  },
1067
1106
  {
1068
1107
  type: "array",
1069
1108
  items: {
1070
- type: "string"
1109
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1071
1110
  }
1072
1111
  }
1073
1112
  ]
@@ -1075,11 +1114,11 @@ var properties$2 = {
1075
1114
  "@reverse": {
1076
1115
  type: "object",
1077
1116
  additionalProperties: {
1078
- type: "string"
1117
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1079
1118
  }
1080
1119
  },
1081
1120
  "@index": {
1082
- type: "string"
1121
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1083
1122
  }
1084
1123
  };
1085
1124
  var description$5 = "A node object represents zero or more properties of a node in the graph serialized by the JSON-LD document.";
@@ -1128,23 +1167,13 @@ var JsonLdNodePrimitiveSchema = {
1128
1167
  var type$2 = "object";
1129
1168
  var properties$1 = {
1130
1169
  "@context": {
1131
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionRoot"
1170
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1132
1171
  },
1133
1172
  "@id": {
1134
- anyOf: [
1135
- {
1136
- type: "string"
1137
- },
1138
- {
1139
- type: "array",
1140
- items: {
1141
- type: "string"
1142
- }
1143
- }
1144
- ]
1173
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1145
1174
  },
1146
1175
  "@included": {
1147
- $ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
1176
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1148
1177
  },
1149
1178
  "@graph": {
1150
1179
  anyOf: [
@@ -1175,12 +1204,12 @@ var properties$1 = {
1175
1204
  "@type": {
1176
1205
  anyOf: [
1177
1206
  {
1178
- type: "string"
1207
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1179
1208
  },
1180
1209
  {
1181
1210
  type: "array",
1182
1211
  items: {
1183
- type: "string"
1212
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1184
1213
  }
1185
1214
  }
1186
1215
  ]
@@ -1188,11 +1217,11 @@ var properties$1 = {
1188
1217
  "@reverse": {
1189
1218
  type: "object",
1190
1219
  additionalProperties: {
1191
- type: "string"
1220
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1192
1221
  }
1193
1222
  },
1194
1223
  "@index": {
1195
- type: "string"
1224
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1196
1225
  }
1197
1226
  };
1198
1227
  var additionalProperties$2 = false;
@@ -1207,20 +1236,10 @@ var JsonLdObjectSchema = {
1207
1236
  var type$1 = "object";
1208
1237
  var properties = {
1209
1238
  "@set": {
1210
- anyOf: [
1211
- {
1212
- $ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
1213
- },
1214
- {
1215
- type: "array",
1216
- items: {
1217
- $ref: "https://schema.twindev.org/json-ld/JsonLdListOrSetItem"
1218
- }
1219
- }
1220
- ]
1239
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1221
1240
  },
1222
1241
  "@index": {
1223
- type: "string"
1242
+ $ref: "https://schema.twindev.org/json-ld/JsonLdKeyword"
1224
1243
  }
1225
1244
  };
1226
1245
  var required = [
@@ -1536,7 +1555,7 @@ class JsonLdProcessor {
1536
1555
  context = JsonLdProcessor.gatherContexts(document, context);
1537
1556
  }
1538
1557
  }
1539
- const compacted = await jsonLd.compact(document, context, {
1558
+ const compacted = await jsonLd.compact(ObjectHelper.removeEmptyProperties(document), context, {
1540
1559
  documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1541
1560
  });
1542
1561
  return compacted;
@@ -1560,7 +1579,7 @@ class JsonLdProcessor {
1560
1579
  */
1561
1580
  static async expand(compacted) {
1562
1581
  try {
1563
- const expanded = await jsonLd.expand(compacted, {
1582
+ const expanded = await jsonLd.expand(ObjectHelper.removeEmptyProperties(compacted), {
1564
1583
  documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1565
1584
  });
1566
1585
  return expanded;
@@ -1,5 +1,30 @@
1
1
  export * from "./dataTypes/jsonLdDataTypes";
2
+ export * from "./models/IJsonLdContainerType";
3
+ export * from "./models/IJsonLdContainerTypeArray";
4
+ export * from "./models/IJsonLdContextDefinition";
5
+ export * from "./models/IJsonLdContextDefinitionElement";
6
+ export * from "./models/IJsonLdContextDefinitionRoot";
2
7
  export * from "./models/IJsonLdDocument";
8
+ export * from "./models/IJsonLdExpandedTermDefinition";
9
+ export * from "./models/IJsonLdGraphObject";
10
+ export * from "./models/IJsonLdIdMap";
11
+ export * from "./models/IJsonLdIncludedBlock";
12
+ export * from "./models/IJsonLdIndexMap";
13
+ export * from "./models/IJsonLdIndexMapItem";
14
+ export * from "./models/IJsonLdJsonArray";
15
+ export * from "./models/IJsonLdJsonObject";
16
+ export * from "./models/IJsonLdJsonPrimitive";
17
+ export * from "./models/IJsonLdJsonValue";
18
+ export * from "./models/IJsonLdKeyword";
19
+ export * from "./models/IJsonLdLanguageMap";
20
+ export * from "./models/IJsonLdListObject";
21
+ export * from "./models/IJsonLdListOrSetItem";
22
+ export * from "./models/IJsonLdNodeObject";
23
+ export * from "./models/IJsonLdNodePrimitive";
24
+ export * from "./models/IJsonLdObject";
25
+ export * from "./models/IJsonLdSetObject";
26
+ export * from "./models/IJsonLdTypeMap";
27
+ export * from "./models/IJsonLdValueObject";
3
28
  export * from "./models/jsonLdTypes";
4
29
  export * from "./utils/jsonLdHelper";
5
30
  export * from "./utils/jsonLdProcessor";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
3
+ * that are used in other packages cannot understand some of the types e.g. OrArray
4
+ */
5
+ /**
6
+ * Helper Types
7
+ */
8
+ export type IJsonLdContainerType = "@language" | "@index" | "@id" | "@graph" | "@type";
@@ -0,0 +1,9 @@
1
+ import type { IJsonLdContainerType } from "./IJsonLdContainerType";
2
+ /**
3
+ * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
+ * that are used in other packages cannot understand some of the types e.g. OrArray
5
+ */
6
+ /**
7
+ * Helper Types.
8
+ */
9
+ export type IJsonLdContainerTypeArray = ["@graph", "@id"] | ["@id", "@graph"] | ["@set", "@graph", "@id"] | ["@set", "@id", "@graph"] | ["@graph", "@set", "@id"] | ["@id", "@set", "@graph"] | ["@graph", "@id", "@set"] | ["@id", "@graph", "@set"] | ["@set", IJsonLdContainerType] | [IJsonLdContainerType, "@set"];
@@ -0,0 +1,25 @@
1
+ import type { IJsonLdExpandedTermDefinition } from "./IJsonLdExpandedTermDefinition";
2
+ import type { IJsonLdKeyword } from "./IJsonLdKeyword";
3
+ /**
4
+ * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
5
+ * that are used in other packages cannot understand some of the types e.g. OrArray
6
+ */
7
+ /**
8
+ * A context definition defines a local context in a node object.
9
+ * @see https://www.w3.org/TR/json-ld11/#context-definitions
10
+ */
11
+ export interface IJsonLdContextDefinition {
12
+ [key: string]: null | string | IJsonLdExpandedTermDefinition | IJsonLdContextDefinition[keyof IJsonLdContextDefinition];
13
+ "@base"?: IJsonLdKeyword["@base"] | undefined;
14
+ "@direction"?: IJsonLdKeyword["@direction"] | undefined;
15
+ "@import"?: IJsonLdKeyword["@import"] | undefined;
16
+ "@language"?: IJsonLdKeyword["@language"] | undefined;
17
+ "@propagate"?: IJsonLdKeyword["@propagate"] | undefined;
18
+ "@protected"?: IJsonLdKeyword["@protected"] | undefined;
19
+ "@type"?: {
20
+ "@container": "@set";
21
+ "@protected"?: IJsonLdKeyword["@protected"] | undefined;
22
+ } | undefined;
23
+ "@version"?: IJsonLdKeyword["@version"] | undefined;
24
+ "@vocab"?: IJsonLdKeyword["@vocab"] | undefined;
25
+ }
@@ -0,0 +1,9 @@
1
+ import type { IJsonLdContextDefinition } from "./IJsonLdContextDefinition";
2
+ /**
3
+ * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
+ * that are used in other packages cannot understand some of the types e.g. OrArray
5
+ */
6
+ /**
7
+ * A context definition element is used to define the types of a context definition.
8
+ */
9
+ export type IJsonLdContextDefinitionElement = null | string | IJsonLdContextDefinition;
@@ -0,0 +1,9 @@
1
+ import type { IJsonLdContextDefinitionElement } from "./IJsonLdContextDefinitionElement";
2
+ /**
3
+ * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators
4
+ * that are used in other packages cannot understand some of the types e.g. OrArray
5
+ */
6
+ /**
7
+ * A context definition root is used to define the root of a context definition.
8
+ */
9
+ export type IJsonLdContextDefinitionRoot = IJsonLdContextDefinitionElement | IJsonLdContextDefinitionElement[];