1 | var fs = require('fs');
|
2 | var path = require('path');
|
3 |
|
4 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
5 |
|
6 | var fs__default = _interopDefaultLegacy(fs);
|
7 | var path__default = _interopDefaultLegacy(path);
|
8 |
|
9 | function _extends() {
|
10 | _extends = Object.assign || function (target) {
|
11 | for (var i = 1; i < arguments.length; i++) {
|
12 | var source = arguments[i];
|
13 |
|
14 | for (var key in source) {
|
15 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
16 | target[key] = source[key];
|
17 | }
|
18 | }
|
19 | }
|
20 |
|
21 | return target;
|
22 | };
|
23 |
|
24 | return _extends.apply(this, arguments);
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 | const compact = o => Object.entries(o).reduce((compactedO, [k, v]) => v === undefined ? compactedO : _extends({}, compactedO, {
|
30 | [k]: v
|
31 | }), {});
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | const entity = (props = {}) => _extends({}, compact(props), {
|
40 | type: 'Entity'
|
41 | });
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | const cite = props => _extends({}, compact(props), {
|
49 | type: 'Cite'
|
50 | });
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | const citeGroup = props => _extends({}, compact(props), {
|
58 | type: 'CiteGroup'
|
59 | });
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | const code = props => _extends({}, compact(props), {
|
67 | type: 'Code'
|
68 | });
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | const codeBlock = props => _extends({}, compact(props), {
|
76 | type: 'CodeBlock'
|
77 | });
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | const codeExecutable = props => _extends({}, compact(props), {
|
85 | type: 'CodeExecutable'
|
86 | });
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | const codeChunk = props => _extends({}, compact(props), {
|
94 | type: 'CodeChunk'
|
95 | });
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | const codeExpression = props => _extends({}, compact(props), {
|
103 | type: 'CodeExpression'
|
104 | });
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | const codeFragment = props => _extends({}, compact(props), {
|
112 | type: 'CodeFragment'
|
113 | });
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | const codeError = props => _extends({}, compact(props), {
|
121 | type: 'CodeError'
|
122 | });
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | const date = props => _extends({}, compact(props), {
|
130 | type: 'Date'
|
131 | });
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | const mark = props => _extends({}, compact(props), {
|
139 | type: 'Mark'
|
140 | });
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 | const del = props => _extends({}, compact(props), {
|
148 | type: 'Delete'
|
149 | });
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | const emphasis = props => _extends({}, compact(props), {
|
157 | type: 'Emphasis'
|
158 | });
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | const thing = (props = {}) => _extends({}, compact(props), {
|
166 | type: 'Thing'
|
167 | });
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | const brand = props => _extends({}, compact(props), {
|
175 | type: 'Brand'
|
176 | });
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | const contactPoint = (props = {}) => _extends({}, compact(props), {
|
184 | type: 'ContactPoint'
|
185 | });
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | const creativeWork = (props = {}) => _extends({}, compact(props), {
|
193 | type: 'CreativeWork'
|
194 | });
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 | const article = (props = {}) => _extends({}, compact(props), {
|
202 | type: 'Article'
|
203 | });
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | const claim = props => _extends({}, compact(props), {
|
211 | type: 'Claim'
|
212 | });
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 | const collection = props => _extends({}, compact(props), {
|
220 | type: 'Collection'
|
221 | });
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 | const comment = (props = {}) => _extends({}, compact(props), {
|
229 | type: 'Comment'
|
230 | });
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 | const datatable = props => _extends({}, compact(props), {
|
238 | type: 'Datatable'
|
239 | });
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 | const mediaObject = props => _extends({}, compact(props), {
|
247 | type: 'MediaObject'
|
248 | });
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 | const audioObject = props => _extends({}, compact(props), {
|
256 | type: 'AudioObject'
|
257 | });
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 | const datatableColumn = props => _extends({}, compact(props), {
|
265 | type: 'DatatableColumn'
|
266 | });
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 | const definedTerm = props => _extends({}, compact(props), {
|
274 | type: 'DefinedTerm'
|
275 | });
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | const validator = (props = {}) => _extends({}, compact(props), {
|
283 | type: 'Validator'
|
284 | });
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 | const arrayValidator = (props = {}) => _extends({}, compact(props), {
|
292 | type: 'ArrayValidator'
|
293 | });
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 | const booleanValidator = (props = {}) => _extends({}, compact(props), {
|
301 | type: 'BooleanValidator'
|
302 | });
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 | const constantValidator = (props = {}) => _extends({}, compact(props), {
|
310 | type: 'ConstantValidator'
|
311 | });
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 | const enumValidator = (props = {}) => _extends({}, compact(props), {
|
319 | type: 'EnumValidator'
|
320 | });
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 | const enumeration = (props = {}) => _extends({}, compact(props), {
|
328 | type: 'Enumeration'
|
329 | });
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 | const figure = (props = {}) => _extends({}, compact(props), {
|
337 | type: 'Figure'
|
338 | });
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 | const function_ = (props = {}) => _extends({}, compact(props), {
|
346 | type: 'Function'
|
347 | });
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 | const grant = (props = {}) => _extends({}, compact(props), {
|
355 | type: 'Grant'
|
356 | });
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 | const heading = props => _extends({}, compact(props), {
|
364 | type: 'Heading'
|
365 | });
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 | const imageObject = props => _extends({}, compact(props), {
|
373 | type: 'ImageObject'
|
374 | });
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 | const include = props => _extends({}, compact(props), {
|
382 | type: 'Include'
|
383 | });
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 | const integerValidator = (props = {}) => _extends({}, compact(props), {
|
391 | type: 'IntegerValidator'
|
392 | });
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | const link = props => _extends({}, compact(props), {
|
400 | type: 'Link'
|
401 | });
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | const list = props => _extends({}, compact(props), {
|
409 | type: 'List'
|
410 | });
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | const listItem = (props = {}) => _extends({}, compact(props), {
|
418 | type: 'ListItem'
|
419 | });
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 | const math = props => _extends({}, compact(props), {
|
427 | type: 'Math'
|
428 | });
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 | const mathBlock = props => _extends({}, compact(props), {
|
436 | type: 'MathBlock'
|
437 | });
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 | const mathFragment = props => _extends({}, compact(props), {
|
445 | type: 'MathFragment'
|
446 | });
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 | const monetaryGrant = (props = {}) => _extends({}, compact(props), {
|
454 | type: 'MonetaryGrant'
|
455 | });
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 | const nontextualAnnotation = props => _extends({}, compact(props), {
|
463 | type: 'NontextualAnnotation'
|
464 | });
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 | const note = props => _extends({}, compact(props), {
|
472 | type: 'Note'
|
473 | });
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 | const numberValidator = (props = {}) => _extends({}, compact(props), {
|
481 | type: 'NumberValidator'
|
482 | });
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 | const organization = (props = {}) => _extends({}, compact(props), {
|
490 | type: 'Organization'
|
491 | });
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 | const paragraph = props => _extends({}, compact(props), {
|
499 | type: 'Paragraph'
|
500 | });
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 | const parameter = props => _extends({}, compact(props), {
|
508 | type: 'Parameter'
|
509 | });
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 | const periodical = (props = {}) => _extends({}, compact(props), {
|
517 | type: 'Periodical'
|
518 | });
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 | const person = (props = {}) => _extends({}, compact(props), {
|
526 | type: 'Person'
|
527 | });
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | const postalAddress = (props = {}) => _extends({}, compact(props), {
|
535 | type: 'PostalAddress'
|
536 | });
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 | const product = (props = {}) => _extends({}, compact(props), {
|
544 | type: 'Product'
|
545 | });
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 | const propertyValue = props => _extends({}, compact(props), {
|
553 | type: 'PropertyValue'
|
554 | });
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 | const publicationIssue = (props = {}) => _extends({}, compact(props), {
|
562 | type: 'PublicationIssue'
|
563 | });
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 | const publicationVolume = (props = {}) => _extends({}, compact(props), {
|
571 | type: 'PublicationVolume'
|
572 | });
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 | const quote = props => _extends({}, compact(props), {
|
580 | type: 'Quote'
|
581 | });
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | const quoteBlock = props => _extends({}, compact(props), {
|
589 | type: 'QuoteBlock'
|
590 | });
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 | const review = (props = {}) => _extends({}, compact(props), {
|
598 | type: 'Review'
|
599 | });
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 | const softwareApplication = (props = {}) => _extends({}, compact(props), {
|
607 | type: 'SoftwareApplication'
|
608 | });
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 | const softwareEnvironment = props => _extends({}, compact(props), {
|
616 | type: 'SoftwareEnvironment'
|
617 | });
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 | const softwareSession = (props = {}) => _extends({}, compact(props), {
|
625 | type: 'SoftwareSession'
|
626 | });
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 | const softwareSourceCode = (props = {}) => _extends({}, compact(props), {
|
634 | type: 'SoftwareSourceCode'
|
635 | });
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 | const stringValidator = (props = {}) => _extends({}, compact(props), {
|
643 | type: 'StringValidator'
|
644 | });
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | const strong = props => _extends({}, compact(props), {
|
652 | type: 'Strong'
|
653 | });
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 | const subscript = props => _extends({}, compact(props), {
|
661 | type: 'Subscript'
|
662 | });
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 | const superscript = props => _extends({}, compact(props), {
|
670 | type: 'Superscript'
|
671 | });
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 | const table = props => _extends({}, compact(props), {
|
679 | type: 'Table'
|
680 | });
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 | const tableCell = (props = {}) => _extends({}, compact(props), {
|
688 | type: 'TableCell'
|
689 | });
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | const tableRow = props => _extends({}, compact(props), {
|
697 | type: 'TableRow'
|
698 | });
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | const thematicBreak = (props = {}) => _extends({}, compact(props), {
|
706 | type: 'ThematicBreak'
|
707 | });
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 | const tupleValidator = (props = {}) => _extends({}, compact(props), {
|
715 | type: 'TupleValidator'
|
716 | });
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 | const variable = props => _extends({}, compact(props), {
|
724 | type: 'Variable'
|
725 | });
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 | const videoObject = props => _extends({}, compact(props), {
|
733 | type: 'VideoObject'
|
734 | });
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 | const volumeMount = props => _extends({}, compact(props), {
|
742 | type: 'VolumeMount'
|
743 | });
|
744 |
|
745 |
|
746 |
|
747 |
|
748 | exports.CitationIntentEnumeration = void 0;
|
749 |
|
750 | (function (CitationIntentEnumeration) {
|
751 | |
752 |
|
753 |
|
754 | CitationIntentEnumeration["AgreesWith"] = "AgreesWith";
|
755 | |
756 |
|
757 |
|
758 |
|
759 | CitationIntentEnumeration["CitesAsAuthority"] = "CitesAsAuthority";
|
760 | |
761 |
|
762 |
|
763 |
|
764 | CitationIntentEnumeration["CitesAsDataSource"] = "CitesAsDataSource";
|
765 | |
766 |
|
767 |
|
768 |
|
769 | CitationIntentEnumeration["CitesAsEvidence"] = "CitesAsEvidence";
|
770 | |
771 |
|
772 |
|
773 |
|
774 | CitationIntentEnumeration["CitesAsMetadataDocument"] = "CitesAsMetadataDocument";
|
775 | |
776 |
|
777 |
|
778 |
|
779 | CitationIntentEnumeration["CitesAsPotentialSolution"] = "CitesAsPotentialSolution";
|
780 | |
781 |
|
782 |
|
783 |
|
784 | CitationIntentEnumeration["CitesAsRecommendedReading"] = "CitesAsRecommendedReading";
|
785 | |
786 |
|
787 |
|
788 |
|
789 | CitationIntentEnumeration["CitesAsRelated"] = "CitesAsRelated";
|
790 | |
791 |
|
792 |
|
793 |
|
794 | CitationIntentEnumeration["CitesAsSourceDocument"] = "CitesAsSourceDocument";
|
795 | |
796 |
|
797 |
|
798 |
|
799 | CitationIntentEnumeration["CitesForInformation"] = "CitesForInformation";
|
800 | |
801 |
|
802 |
|
803 |
|
804 | CitationIntentEnumeration["Compiles"] = "Compiles";
|
805 | |
806 |
|
807 |
|
808 |
|
809 | CitationIntentEnumeration["Confirms"] = "Confirms";
|
810 | |
811 |
|
812 |
|
813 |
|
814 | CitationIntentEnumeration["ContainsAssertionFrom"] = "ContainsAssertionFrom";
|
815 | |
816 |
|
817 |
|
818 |
|
819 | CitationIntentEnumeration["Corrects"] = "Corrects";
|
820 | |
821 |
|
822 |
|
823 |
|
824 | CitationIntentEnumeration["Credits"] = "Credits";
|
825 | |
826 |
|
827 |
|
828 |
|
829 | CitationIntentEnumeration["Critiques"] = "Critiques";
|
830 | |
831 |
|
832 |
|
833 |
|
834 | CitationIntentEnumeration["Derides"] = "Derides";
|
835 | |
836 |
|
837 |
|
838 |
|
839 | CitationIntentEnumeration["Describes"] = "Describes";
|
840 | |
841 |
|
842 |
|
843 |
|
844 | CitationIntentEnumeration["DisagreesWith"] = "DisagreesWith";
|
845 | |
846 |
|
847 |
|
848 |
|
849 | CitationIntentEnumeration["Discusses"] = "Discusses";
|
850 | |
851 |
|
852 |
|
853 |
|
854 | CitationIntentEnumeration["Disputes"] = "Disputes";
|
855 | |
856 |
|
857 |
|
858 |
|
859 | CitationIntentEnumeration["Documents"] = "Documents";
|
860 | |
861 |
|
862 |
|
863 |
|
864 | CitationIntentEnumeration["Extends"] = "Extends";
|
865 | |
866 |
|
867 |
|
868 |
|
869 | CitationIntentEnumeration["GivesBackgroundTo"] = "GivesBackgroundTo";
|
870 | |
871 |
|
872 |
|
873 |
|
874 | CitationIntentEnumeration["GivesSupportTo"] = "GivesSupportTo";
|
875 | |
876 |
|
877 |
|
878 |
|
879 | CitationIntentEnumeration["HasReplyFrom"] = "HasReplyFrom";
|
880 | |
881 |
|
882 |
|
883 |
|
884 | CitationIntentEnumeration["IncludesExcerptFrom"] = "IncludesExcerptFrom";
|
885 | |
886 |
|
887 |
|
888 |
|
889 | CitationIntentEnumeration["IncludesQuotationFrom"] = "IncludesQuotationFrom";
|
890 | |
891 |
|
892 |
|
893 |
|
894 | CitationIntentEnumeration["IsAgreedWithBy"] = "IsAgreedWithBy";
|
895 | |
896 |
|
897 |
|
898 |
|
899 | CitationIntentEnumeration["IsCitedAsAuthorityBy"] = "IsCitedAsAuthorityBy";
|
900 | |
901 |
|
902 |
|
903 |
|
904 | CitationIntentEnumeration["IsCitedAsDataSourceBy"] = "IsCitedAsDataSourceBy";
|
905 | |
906 |
|
907 |
|
908 |
|
909 | CitationIntentEnumeration["IsCitedAsEvidenceBy"] = "IsCitedAsEvidenceBy";
|
910 | |
911 |
|
912 |
|
913 |
|
914 | CitationIntentEnumeration["IsCitedAsMetadataDocumentBy"] = "IsCitedAsMetadataDocumentBy";
|
915 | |
916 |
|
917 |
|
918 |
|
919 | CitationIntentEnumeration["IsCitedAsPontentialSolutionBy"] = "IsCitedAsPontentialSolutionBy";
|
920 | |
921 |
|
922 |
|
923 |
|
924 | CitationIntentEnumeration["IsCitedAsRecommendedReadingBy"] = "IsCitedAsRecommendedReadingBy";
|
925 | |
926 |
|
927 |
|
928 |
|
929 | CitationIntentEnumeration["IsCitedAsRelatedBy"] = "IsCitedAsRelatedBy";
|
930 | |
931 |
|
932 |
|
933 |
|
934 | CitationIntentEnumeration["IsCitedAsSourceDocumentBy"] = "IsCitedAsSourceDocumentBy";
|
935 | |
936 |
|
937 |
|
938 |
|
939 | CitationIntentEnumeration["IsCitedBy"] = "IsCitedBy";
|
940 | |
941 |
|
942 |
|
943 |
|
944 | CitationIntentEnumeration["IsCitedForInformationBy"] = "IsCitedForInformationBy";
|
945 | |
946 |
|
947 |
|
948 |
|
949 | CitationIntentEnumeration["IsCompiledBy"] = "IsCompiledBy";
|
950 | |
951 |
|
952 |
|
953 |
|
954 | CitationIntentEnumeration["IsConfirmedBy"] = "IsConfirmedBy";
|
955 | |
956 |
|
957 |
|
958 |
|
959 | CitationIntentEnumeration["IsCorrectedBy"] = "IsCorrectedBy";
|
960 | |
961 |
|
962 |
|
963 |
|
964 | CitationIntentEnumeration["IsCreditedBy"] = "IsCreditedBy";
|
965 | |
966 |
|
967 |
|
968 |
|
969 | CitationIntentEnumeration["IsCritiquedBy"] = "IsCritiquedBy";
|
970 | |
971 |
|
972 |
|
973 |
|
974 | CitationIntentEnumeration["IsDeridedBy"] = "IsDeridedBy";
|
975 | |
976 |
|
977 |
|
978 |
|
979 | CitationIntentEnumeration["IsDescribedBy"] = "IsDescribedBy";
|
980 | |
981 |
|
982 |
|
983 |
|
984 | CitationIntentEnumeration["IsDisagreedWithBy"] = "IsDisagreedWithBy";
|
985 | |
986 |
|
987 |
|
988 |
|
989 | CitationIntentEnumeration["IsDiscussedBy"] = "IsDiscussedBy";
|
990 | |
991 |
|
992 |
|
993 |
|
994 | CitationIntentEnumeration["IsDisputedBy"] = "IsDisputedBy";
|
995 | |
996 |
|
997 |
|
998 |
|
999 | CitationIntentEnumeration["IsDocumentedBy"] = "IsDocumentedBy";
|
1000 | |
1001 |
|
1002 |
|
1003 |
|
1004 | CitationIntentEnumeration["IsExtendedBy"] = "IsExtendedBy";
|
1005 | |
1006 |
|
1007 |
|
1008 |
|
1009 | CitationIntentEnumeration["IsLinkedToBy"] = "IsLinkedToBy";
|
1010 | |
1011 |
|
1012 |
|
1013 |
|
1014 | CitationIntentEnumeration["IsParodiedBy"] = "IsParodiedBy";
|
1015 | |
1016 |
|
1017 |
|
1018 |
|
1019 | CitationIntentEnumeration["IsPlagiarizedBy"] = "IsPlagiarizedBy";
|
1020 | |
1021 |
|
1022 |
|
1023 |
|
1024 | CitationIntentEnumeration["IsQualifiedBy"] = "IsQualifiedBy";
|
1025 | |
1026 |
|
1027 |
|
1028 |
|
1029 | CitationIntentEnumeration["IsRefutedBy"] = "IsRefutedBy";
|
1030 | |
1031 |
|
1032 |
|
1033 |
|
1034 | CitationIntentEnumeration["IsRetractedBy"] = "IsRetractedBy";
|
1035 | |
1036 |
|
1037 |
|
1038 |
|
1039 | CitationIntentEnumeration["IsReviewedBy"] = "IsReviewedBy";
|
1040 | |
1041 |
|
1042 |
|
1043 |
|
1044 | CitationIntentEnumeration["IsRidiculedBy"] = "IsRidiculedBy";
|
1045 | |
1046 |
|
1047 |
|
1048 |
|
1049 | CitationIntentEnumeration["IsSpeculatedOnBy"] = "IsSpeculatedOnBy";
|
1050 | |
1051 |
|
1052 |
|
1053 |
|
1054 | CitationIntentEnumeration["IsSupportedBy"] = "IsSupportedBy";
|
1055 | |
1056 |
|
1057 |
|
1058 |
|
1059 | CitationIntentEnumeration["IsUpdatedBy"] = "IsUpdatedBy";
|
1060 | |
1061 |
|
1062 |
|
1063 |
|
1064 | CitationIntentEnumeration["Likes"] = "Likes";
|
1065 | |
1066 |
|
1067 |
|
1068 |
|
1069 | CitationIntentEnumeration["LinksTo"] = "LinksTo";
|
1070 | |
1071 |
|
1072 |
|
1073 |
|
1074 | CitationIntentEnumeration["ObtainsBackgroundFrom"] = "ObtainsBackgroundFrom";
|
1075 | |
1076 |
|
1077 |
|
1078 |
|
1079 | CitationIntentEnumeration["ObtainsSupportFrom"] = "ObtainsSupportFrom";
|
1080 | |
1081 |
|
1082 |
|
1083 |
|
1084 | CitationIntentEnumeration["Parodies"] = "Parodies";
|
1085 | |
1086 |
|
1087 |
|
1088 |
|
1089 | CitationIntentEnumeration["Plagiarizes"] = "Plagiarizes";
|
1090 | |
1091 |
|
1092 |
|
1093 |
|
1094 | CitationIntentEnumeration["ProvidesAssertionFor"] = "ProvidesAssertionFor";
|
1095 | |
1096 |
|
1097 |
|
1098 |
|
1099 | CitationIntentEnumeration["ProvidesConclusionsFor"] = "ProvidesConclusionsFor";
|
1100 | |
1101 |
|
1102 |
|
1103 |
|
1104 | CitationIntentEnumeration["ProvidesDataFor"] = "ProvidesDataFor";
|
1105 | |
1106 |
|
1107 |
|
1108 |
|
1109 | CitationIntentEnumeration["ProvidesExcerptFor"] = "ProvidesExcerptFor";
|
1110 | |
1111 |
|
1112 |
|
1113 |
|
1114 | CitationIntentEnumeration["ProvidesMethodFor"] = "ProvidesMethodFor";
|
1115 | |
1116 |
|
1117 |
|
1118 |
|
1119 | CitationIntentEnumeration["ProvidesQuotationFor"] = "ProvidesQuotationFor";
|
1120 | |
1121 |
|
1122 |
|
1123 |
|
1124 | CitationIntentEnumeration["Qualifies"] = "Qualifies";
|
1125 | |
1126 |
|
1127 |
|
1128 |
|
1129 | CitationIntentEnumeration["Refutes"] = "Refutes";
|
1130 | |
1131 |
|
1132 |
|
1133 |
|
1134 | CitationIntentEnumeration["RepliesTo"] = "RepliesTo";
|
1135 | |
1136 |
|
1137 |
|
1138 |
|
1139 | CitationIntentEnumeration["Retracts"] = "Retracts";
|
1140 | |
1141 |
|
1142 |
|
1143 |
|
1144 | CitationIntentEnumeration["Reviews"] = "Reviews";
|
1145 | |
1146 |
|
1147 |
|
1148 |
|
1149 | CitationIntentEnumeration["Ridicules"] = "Ridicules";
|
1150 | |
1151 |
|
1152 |
|
1153 |
|
1154 | CitationIntentEnumeration["SharesAuthorInstitutionWith"] = "SharesAuthorInstitutionWith";
|
1155 | |
1156 |
|
1157 |
|
1158 |
|
1159 | CitationIntentEnumeration["SharesAuthorWith"] = "SharesAuthorWith";
|
1160 | |
1161 |
|
1162 |
|
1163 |
|
1164 | CitationIntentEnumeration["SharesFundingAgencyWith"] = "SharesFundingAgencyWith";
|
1165 | |
1166 |
|
1167 |
|
1168 |
|
1169 | CitationIntentEnumeration["SharesJournalWith"] = "SharesJournalWith";
|
1170 | |
1171 |
|
1172 |
|
1173 |
|
1174 | CitationIntentEnumeration["SharesPublicationVenueWith"] = "SharesPublicationVenueWith";
|
1175 | |
1176 |
|
1177 |
|
1178 |
|
1179 | CitationIntentEnumeration["SpeculatesOn"] = "SpeculatesOn";
|
1180 | |
1181 |
|
1182 |
|
1183 |
|
1184 | CitationIntentEnumeration["Supports"] = "Supports";
|
1185 | |
1186 |
|
1187 |
|
1188 |
|
1189 | CitationIntentEnumeration["Updates"] = "Updates";
|
1190 | |
1191 |
|
1192 |
|
1193 |
|
1194 | CitationIntentEnumeration["UsesConclusionsFrom"] = "UsesConclusionsFrom";
|
1195 | |
1196 |
|
1197 |
|
1198 |
|
1199 | CitationIntentEnumeration["UsesDataFrom"] = "UsesDataFrom";
|
1200 | |
1201 |
|
1202 |
|
1203 |
|
1204 | CitationIntentEnumeration["UsesMethodIn"] = "UsesMethodIn";
|
1205 | })(exports.CitationIntentEnumeration || (exports.CitationIntentEnumeration = {}));
|
1206 |
|
1207 | const codeExecutableTypes = {
|
1208 | CodeExecutable: 'CodeExecutable',
|
1209 | CodeChunk: 'CodeChunk',
|
1210 | CodeExpression: 'CodeExpression'
|
1211 | };
|
1212 | const codeTypes = {
|
1213 | Code: 'Code',
|
1214 | CodeBlock: 'CodeBlock',
|
1215 | CodeChunk: 'CodeChunk',
|
1216 | CodeExecutable: 'CodeExecutable',
|
1217 | CodeExpression: 'CodeExpression',
|
1218 | CodeFragment: 'CodeFragment'
|
1219 | };
|
1220 | const contactPointTypes = {
|
1221 | ContactPoint: 'ContactPoint',
|
1222 | PostalAddress: 'PostalAddress'
|
1223 | };
|
1224 | const creativeWorkTypes = {
|
1225 | CreativeWork: 'CreativeWork',
|
1226 | Article: 'Article',
|
1227 | AudioObject: 'AudioObject',
|
1228 | Claim: 'Claim',
|
1229 | Collection: 'Collection',
|
1230 | Comment: 'Comment',
|
1231 | Datatable: 'Datatable',
|
1232 | Figure: 'Figure',
|
1233 | ImageObject: 'ImageObject',
|
1234 | MediaObject: 'MediaObject',
|
1235 | Periodical: 'Periodical',
|
1236 | PublicationIssue: 'PublicationIssue',
|
1237 | PublicationVolume: 'PublicationVolume',
|
1238 | Review: 'Review',
|
1239 | SoftwareApplication: 'SoftwareApplication',
|
1240 | SoftwareSourceCode: 'SoftwareSourceCode',
|
1241 | Table: 'Table',
|
1242 | VideoObject: 'VideoObject'
|
1243 | };
|
1244 | const entityTypes = {
|
1245 | Entity: 'Entity',
|
1246 | ArrayValidator: 'ArrayValidator',
|
1247 | Article: 'Article',
|
1248 | AudioObject: 'AudioObject',
|
1249 | BooleanValidator: 'BooleanValidator',
|
1250 | Brand: 'Brand',
|
1251 | CitationIntentEnumeration: 'CitationIntentEnumeration',
|
1252 | Cite: 'Cite',
|
1253 | CiteGroup: 'CiteGroup',
|
1254 | Claim: 'Claim',
|
1255 | Code: 'Code',
|
1256 | CodeBlock: 'CodeBlock',
|
1257 | CodeChunk: 'CodeChunk',
|
1258 | CodeError: 'CodeError',
|
1259 | CodeExecutable: 'CodeExecutable',
|
1260 | CodeExpression: 'CodeExpression',
|
1261 | CodeFragment: 'CodeFragment',
|
1262 | Collection: 'Collection',
|
1263 | Comment: 'Comment',
|
1264 | ConstantValidator: 'ConstantValidator',
|
1265 | ContactPoint: 'ContactPoint',
|
1266 | CreativeWork: 'CreativeWork',
|
1267 | Datatable: 'Datatable',
|
1268 | DatatableColumn: 'DatatableColumn',
|
1269 | Date: 'Date',
|
1270 | DefinedTerm: 'DefinedTerm',
|
1271 | Delete: 'Delete',
|
1272 | Emphasis: 'Emphasis',
|
1273 | EnumValidator: 'EnumValidator',
|
1274 | Enumeration: 'Enumeration',
|
1275 | Figure: 'Figure',
|
1276 | Function: 'Function',
|
1277 | Grant: 'Grant',
|
1278 | Heading: 'Heading',
|
1279 | ImageObject: 'ImageObject',
|
1280 | Include: 'Include',
|
1281 | IntegerValidator: 'IntegerValidator',
|
1282 | Link: 'Link',
|
1283 | List: 'List',
|
1284 | ListItem: 'ListItem',
|
1285 | Mark: 'Mark',
|
1286 | Math: 'Math',
|
1287 | MathBlock: 'MathBlock',
|
1288 | MathFragment: 'MathFragment',
|
1289 | MediaObject: 'MediaObject',
|
1290 | MonetaryGrant: 'MonetaryGrant',
|
1291 | NontextualAnnotation: 'NontextualAnnotation',
|
1292 | Note: 'Note',
|
1293 | NumberValidator: 'NumberValidator',
|
1294 | Organization: 'Organization',
|
1295 | Paragraph: 'Paragraph',
|
1296 | Parameter: 'Parameter',
|
1297 | Periodical: 'Periodical',
|
1298 | Person: 'Person',
|
1299 | PostalAddress: 'PostalAddress',
|
1300 | Product: 'Product',
|
1301 | PropertyValue: 'PropertyValue',
|
1302 | PublicationIssue: 'PublicationIssue',
|
1303 | PublicationVolume: 'PublicationVolume',
|
1304 | Quote: 'Quote',
|
1305 | QuoteBlock: 'QuoteBlock',
|
1306 | Review: 'Review',
|
1307 | SoftwareApplication: 'SoftwareApplication',
|
1308 | SoftwareEnvironment: 'SoftwareEnvironment',
|
1309 | SoftwareSession: 'SoftwareSession',
|
1310 | SoftwareSourceCode: 'SoftwareSourceCode',
|
1311 | StringValidator: 'StringValidator',
|
1312 | Strong: 'Strong',
|
1313 | Subscript: 'Subscript',
|
1314 | Superscript: 'Superscript',
|
1315 | Table: 'Table',
|
1316 | TableCell: 'TableCell',
|
1317 | TableRow: 'TableRow',
|
1318 | ThematicBreak: 'ThematicBreak',
|
1319 | Thing: 'Thing',
|
1320 | TupleValidator: 'TupleValidator',
|
1321 | Validator: 'Validator',
|
1322 | Variable: 'Variable',
|
1323 | VideoObject: 'VideoObject',
|
1324 | VolumeMount: 'VolumeMount'
|
1325 | };
|
1326 | const enumerationTypes = {
|
1327 | Enumeration: 'Enumeration',
|
1328 | CitationIntentEnumeration: 'CitationIntentEnumeration'
|
1329 | };
|
1330 | const grantTypes = {
|
1331 | Grant: 'Grant',
|
1332 | MonetaryGrant: 'MonetaryGrant'
|
1333 | };
|
1334 | const markTypes = {
|
1335 | Mark: 'Mark',
|
1336 | Delete: 'Delete',
|
1337 | Emphasis: 'Emphasis',
|
1338 | NontextualAnnotation: 'NontextualAnnotation',
|
1339 | Quote: 'Quote',
|
1340 | Strong: 'Strong',
|
1341 | Subscript: 'Subscript',
|
1342 | Superscript: 'Superscript'
|
1343 | };
|
1344 | const mathTypes = {
|
1345 | Math: 'Math',
|
1346 | MathBlock: 'MathBlock',
|
1347 | MathFragment: 'MathFragment'
|
1348 | };
|
1349 | const mediaObjectTypes = {
|
1350 | MediaObject: 'MediaObject',
|
1351 | AudioObject: 'AudioObject',
|
1352 | ImageObject: 'ImageObject',
|
1353 | VideoObject: 'VideoObject'
|
1354 | };
|
1355 | const thingTypes = {
|
1356 | Thing: 'Thing',
|
1357 | Article: 'Article',
|
1358 | AudioObject: 'AudioObject',
|
1359 | Brand: 'Brand',
|
1360 | CitationIntentEnumeration: 'CitationIntentEnumeration',
|
1361 | Claim: 'Claim',
|
1362 | Collection: 'Collection',
|
1363 | Comment: 'Comment',
|
1364 | ContactPoint: 'ContactPoint',
|
1365 | CreativeWork: 'CreativeWork',
|
1366 | Datatable: 'Datatable',
|
1367 | DatatableColumn: 'DatatableColumn',
|
1368 | DefinedTerm: 'DefinedTerm',
|
1369 | Enumeration: 'Enumeration',
|
1370 | Figure: 'Figure',
|
1371 | Grant: 'Grant',
|
1372 | ImageObject: 'ImageObject',
|
1373 | ListItem: 'ListItem',
|
1374 | MediaObject: 'MediaObject',
|
1375 | MonetaryGrant: 'MonetaryGrant',
|
1376 | Organization: 'Organization',
|
1377 | Periodical: 'Periodical',
|
1378 | Person: 'Person',
|
1379 | PostalAddress: 'PostalAddress',
|
1380 | Product: 'Product',
|
1381 | PropertyValue: 'PropertyValue',
|
1382 | PublicationIssue: 'PublicationIssue',
|
1383 | PublicationVolume: 'PublicationVolume',
|
1384 | Review: 'Review',
|
1385 | SoftwareApplication: 'SoftwareApplication',
|
1386 | SoftwareEnvironment: 'SoftwareEnvironment',
|
1387 | SoftwareSession: 'SoftwareSession',
|
1388 | SoftwareSourceCode: 'SoftwareSourceCode',
|
1389 | Table: 'Table',
|
1390 | VideoObject: 'VideoObject',
|
1391 | VolumeMount: 'VolumeMount'
|
1392 | };
|
1393 | const validatorTypes = {
|
1394 | Validator: 'Validator',
|
1395 | ArrayValidator: 'ArrayValidator',
|
1396 | BooleanValidator: 'BooleanValidator',
|
1397 | ConstantValidator: 'ConstantValidator',
|
1398 | EnumValidator: 'EnumValidator',
|
1399 | IntegerValidator: 'IntegerValidator',
|
1400 | NumberValidator: 'NumberValidator',
|
1401 | StringValidator: 'StringValidator',
|
1402 | TupleValidator: 'TupleValidator'
|
1403 | };
|
1404 | const blockContentTypes = {
|
1405 | Claim: 'Claim',
|
1406 | CodeBlock: 'CodeBlock',
|
1407 | CodeChunk: 'CodeChunk',
|
1408 | Collection: 'Collection',
|
1409 | Figure: 'Figure',
|
1410 | Heading: 'Heading',
|
1411 | Include: 'Include',
|
1412 | List: 'List',
|
1413 | MathBlock: 'MathBlock',
|
1414 | Paragraph: 'Paragraph',
|
1415 | QuoteBlock: 'QuoteBlock',
|
1416 | Table: 'Table',
|
1417 | ThematicBreak: 'ThematicBreak'
|
1418 | };
|
1419 | const inlineContentTypes = {
|
1420 | AudioObject: 'AudioObject',
|
1421 | Cite: 'Cite',
|
1422 | CiteGroup: 'CiteGroup',
|
1423 | CodeExpression: 'CodeExpression',
|
1424 | CodeFragment: 'CodeFragment',
|
1425 | Delete: 'Delete',
|
1426 | Emphasis: 'Emphasis',
|
1427 | ImageObject: 'ImageObject',
|
1428 | Link: 'Link',
|
1429 | MathFragment: 'MathFragment',
|
1430 | NontextualAnnotation: 'NontextualAnnotation',
|
1431 | Note: 'Note',
|
1432 | Parameter: 'Parameter',
|
1433 | Quote: 'Quote',
|
1434 | Strong: 'Strong',
|
1435 | Subscript: 'Subscript',
|
1436 | Superscript: 'Superscript',
|
1437 | VideoObject: 'VideoObject'
|
1438 | };
|
1439 | const unions = {
|
1440 | CodeExecutableTypes: codeExecutableTypes,
|
1441 | CodeTypes: codeTypes,
|
1442 | ContactPointTypes: contactPointTypes,
|
1443 | CreativeWorkTypes: creativeWorkTypes,
|
1444 | EntityTypes: entityTypes,
|
1445 | EnumerationTypes: enumerationTypes,
|
1446 | GrantTypes: grantTypes,
|
1447 | MarkTypes: markTypes,
|
1448 | MathTypes: mathTypes,
|
1449 | MediaObjectTypes: mediaObjectTypes,
|
1450 | ThingTypes: thingTypes,
|
1451 | ValidatorTypes: validatorTypes,
|
1452 | BlockContent: blockContentTypes,
|
1453 | InlineContent: inlineContentTypes
|
1454 | };
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | const isInTypeMap = typeMap => node => isEntity(node) ? Object.keys(typeMap).includes(node.type) : false;
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 | const isPrimitive = node => {
|
1471 | const type = typeof node;
|
1472 | if (node === null) return true;
|
1473 | if (type === 'boolean') return true;
|
1474 | if (type === 'number') return true;
|
1475 | if (type === 'string') return true;
|
1476 | if (Array.isArray(node)) return true;
|
1477 | if (type === 'object' && !Object.prototype.hasOwnProperty.call(node, 'type')) return true;
|
1478 | return false;
|
1479 | };
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 | const isEntity = node => {
|
1485 | if (node === null || node === undefined) return false;
|
1486 | return Object.prototype.hasOwnProperty.call(node, 'type');
|
1487 | };
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 | const isA = (type, node) => isEntity(node) && node.type === type;
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 | const isType = type => node => isA(type, node);
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 | const isIn = (union, node) => isEntity(node) && node.type in unions[union];
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 | const isMember = type => node => isIn(type, node);
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 | const isInlineContent = node => isPrimitive(node) || isIn('InlineContent', node);
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 | const isBlockContent = node => isIn('BlockContent', node);
|
1531 |
|
1532 | var version$1 = "1.17.0";
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 | const version = version$1;
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 | const versionMajor = version.split('.')[0];
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 | const versionMinor = version.split('.').slice(0, 2).join('.');
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 | let CONTEXT;
|
1554 |
|
1555 |
|
1556 | const termToId = {};
|
1557 | const idToTerm = {};
|
1558 |
|
1559 | function initMaps() {
|
1560 | const context = jsonLdContext();
|
1561 |
|
1562 | for (const [term, value] of Object.entries(context)) {
|
1563 | if (typeof value === 'string' && !term.startsWith('@')) {
|
1564 | termToId[term] = value;
|
1565 | idToTerm[value] = term;
|
1566 | } else if (typeof value === 'object') {
|
1567 | const id = value['@id'];
|
1568 | termToId[term] = id;
|
1569 | idToTerm[id] = term;
|
1570 | }
|
1571 | }
|
1572 | }
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 | function jsonLdUrl(term = '') {
|
1588 | return `https://schema.stenci.la/v${versionMajor}/jsonld/${term}`;
|
1589 | }
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 | function jsonLdContext() {
|
1595 | if (CONTEXT === undefined) {
|
1596 | const json = fs__default["default"].readFileSync(path__default["default"].join(__dirname, ...(__filename.endsWith('.ts') ? ['..', '..', 'public'] : []), 'stencila.jsonld'), 'utf8');
|
1597 |
|
1598 | CONTEXT = JSON.parse(json)['@context'];
|
1599 | }
|
1600 |
|
1601 | return CONTEXT;
|
1602 | }
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 | function jsonLdTermUrl(term) {
|
1620 | if (Object.keys(termToId).length === 0) initMaps();
|
1621 | const id = termToId[term];
|
1622 | if (id === undefined) return undefined;
|
1623 | const [prefix, name] = id.split(':');
|
1624 | const context = jsonLdContext();
|
1625 | const base = context[prefix];
|
1626 | if (base === undefined) return undefined;
|
1627 | return `${base.toString()}${name}`;
|
1628 | }
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 | function jsonLdTermName(url) {
|
1639 | if (Object.keys(idToTerm).length === 0) initMaps();
|
1640 |
|
1641 | const {
|
1642 | hash,
|
1643 | pathname
|
1644 | } = new URL(url);
|
1645 | const term = hash !== '' ? hash.slice(1) : pathname.split('/').pop();
|
1646 | const baseUrl = url.replace(new RegExp(`${term != null ? term : ''}$`), '');
|
1647 |
|
1648 | const prefix = idToTerm[baseUrl];
|
1649 | if (prefix === undefined) return undefined;
|
1650 |
|
1651 | return idToTerm[`${prefix}:${term != null ? term : 'undefined'}`];
|
1652 | }
|
1653 |
|
1654 | let SCHEMAS = {};
|
1655 |
|
1656 | let PROPERTIES = {};
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 | async function jsonSchemas() {
|
1662 | if (Object.keys(SCHEMAS).length === 0) {
|
1663 | const dir = path__default["default"].join(__dirname, ...(__filename.endsWith('.ts') ? ['..', '..', 'public'] : []));
|
1664 | const files = await new Promise((resolve, reject) => fs__default["default"].readdir(dir, 'utf8', (error, files) => error !== null ? reject(error) : resolve(files)));
|
1665 | const schemaFiles = files.filter(filename => filename.endsWith('.schema.json'));
|
1666 | const promises = schemaFiles.map(async file => {
|
1667 | const json = await new Promise((resolve, reject) => fs__default["default"].readFile(path__default["default"].join(dir, file), 'utf8', (error, content) => error !== null ? reject(error) : resolve(content)));
|
1668 | return JSON.parse(json);
|
1669 | });
|
1670 | const schemas = await Promise.all(promises);
|
1671 | SCHEMAS = schemas.reduce((prev, schema) => {
|
1672 | const {
|
1673 | title
|
1674 | } = schema;
|
1675 | return title === undefined ? prev : _extends({}, prev, {
|
1676 | [title]: schema
|
1677 | });
|
1678 | }, {});
|
1679 | }
|
1680 |
|
1681 | return SCHEMAS;
|
1682 | }
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | async function jsonSchemaTypes() {
|
1688 | const schemas = await jsonSchemas();
|
1689 | return Object.keys(schemas);
|
1690 | }
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 | async function jsonSchemaProperties() {
|
1700 | if (Object.keys(PROPERTIES).length === 0) {
|
1701 | const schemas = await jsonSchemas();
|
1702 |
|
1703 | const props = Object.values(schemas).reduce((prev, type) => {
|
1704 | const {
|
1705 | title = '',
|
1706 | properties = {}
|
1707 | } = type;
|
1708 | Object.entries(properties).forEach(([name, prop]) => {
|
1709 | const {
|
1710 | '@id': id = '',
|
1711 | isArray = false,
|
1712 | isPlural = false
|
1713 | } = prop;
|
1714 | const existing = prev[name];
|
1715 |
|
1716 | if (existing === undefined) {
|
1717 | prev[name] = {
|
1718 | name,
|
1719 | id,
|
1720 | domainIncludes: [title],
|
1721 | isArray,
|
1722 | isPlural
|
1723 | };
|
1724 | } else {
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 | const message = `${title}.${name} differs to that on ${existing.domainIncludes.join(', ')}`;
|
1730 | if (id !== existing.id) throw new Error(`${message}: @id ${id}`);
|
1731 | if (isPlural !== existing.isPlural) throw new Error(`${message}: isPlural ${isPlural.toString()}`);
|
1732 |
|
1733 | existing.domainIncludes.push(title);
|
1734 | }
|
1735 | });
|
1736 | return prev;
|
1737 | }, {});
|
1738 |
|
1739 | PROPERTIES = Object.keys(props).sort().reduce((prev, key) => _extends({}, prev, {
|
1740 | [key]: props[key]
|
1741 | }), {});
|
1742 | }
|
1743 |
|
1744 | return PROPERTIES;
|
1745 | }
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 | const nodeType = node => {
|
1754 | if (node === null) return 'Null';
|
1755 | if (typeof node === 'boolean') return 'Boolean';
|
1756 | if (typeof node === 'number') return 'Number';
|
1757 | if (typeof node === 'string') return 'String';
|
1758 | if (Array.isArray(node)) return 'Array';
|
1759 | if (isEntity(node)) return node.type;
|
1760 | return 'Object';
|
1761 | };
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 | function microdataUrl(type = '') {
|
1771 | return `https://schema.stenci.la/${type}`;
|
1772 | }
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 | function microdataItem(node, id) {
|
1786 | const itemtype = microdataItemtype(nodeType(node));
|
1787 | const itemidAttr = id !== undefined ? {
|
1788 | itemid: `#${id}`
|
1789 | } : {};
|
1790 | if (itemtype !== undefined && !isPrimitive(node)) return _extends({
|
1791 | itemscope: '',
|
1792 | itemtype
|
1793 | }, itemidAttr);else if (typeof node !== 'string') return _extends({
|
1794 | 'itemtype': itemtype
|
1795 | }, itemidAttr);else return itemidAttr;
|
1796 | }
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 | function microdataItemtype(type) {
|
1804 | var _jsonLdTermUrl;
|
1805 |
|
1806 | return (_jsonLdTermUrl = jsonLdTermUrl(type)) == null ? void 0 : _jsonLdTermUrl.replace(jsonLdUrl(), microdataUrl());
|
1807 | }
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 | function microdataType(itemtype) {
|
1815 | return jsonLdTermName(itemtype.replace(microdataUrl(), jsonLdUrl()));
|
1816 | }
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 | function microdataProperty(property, role, id) {
|
1827 | const [prefix, name = ''] = microdataItemprop(property, role);
|
1828 | const key = prefix === 'schema' ? 'itemprop' : 'data-prop';
|
1829 | const itemrefAttr = id !== undefined ? {
|
1830 | itemref: id
|
1831 | } : {};
|
1832 | return _extends({
|
1833 | [key]: name
|
1834 | }, itemrefAttr);
|
1835 | }
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 | function microdataItemprop(property, role) {
|
1853 | if (role === 'array') return ['stencila', property];
|
1854 | const context = jsonLdContext();
|
1855 | const mapping = context[property];
|
1856 | if (mapping === undefined) return [undefined, undefined];
|
1857 | if (typeof mapping === 'string') return [undefined, mapping];
|
1858 | const id = mapping['@id'];
|
1859 | let [prefix, name] = id.split(':');
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 | if (role === 'item' && prefix === 'stencila' && name.endsWith('s')) name = name.slice(0, -1);
|
1866 | return [prefix, name];
|
1867 | }
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 | function microdata(node, property, role, id) {
|
1878 | return _extends({}, role !== 'array' ? microdataItem(node, property === undefined ? id : undefined) : {}, property !== undefined ? microdataProperty(property, role, id) : {});
|
1879 | }
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 | function microdataRoot() {
|
1893 | return {
|
1894 | 'data-root': ''
|
1895 | };
|
1896 | }
|
1897 |
|
1898 | exports.arrayValidator = arrayValidator;
|
1899 | exports.article = article;
|
1900 | exports.audioObject = audioObject;
|
1901 | exports.blockContentTypes = blockContentTypes;
|
1902 | exports.booleanValidator = booleanValidator;
|
1903 | exports.brand = brand;
|
1904 | exports.cite = cite;
|
1905 | exports.citeGroup = citeGroup;
|
1906 | exports.claim = claim;
|
1907 | exports.code = code;
|
1908 | exports.codeBlock = codeBlock;
|
1909 | exports.codeChunk = codeChunk;
|
1910 | exports.codeError = codeError;
|
1911 | exports.codeExecutable = codeExecutable;
|
1912 | exports.codeExecutableTypes = codeExecutableTypes;
|
1913 | exports.codeExpression = codeExpression;
|
1914 | exports.codeFragment = codeFragment;
|
1915 | exports.codeTypes = codeTypes;
|
1916 | exports.collection = collection;
|
1917 | exports.comment = comment;
|
1918 | exports.constantValidator = constantValidator;
|
1919 | exports.contactPoint = contactPoint;
|
1920 | exports.contactPointTypes = contactPointTypes;
|
1921 | exports.creativeWork = creativeWork;
|
1922 | exports.creativeWorkTypes = creativeWorkTypes;
|
1923 | exports.datatable = datatable;
|
1924 | exports.datatableColumn = datatableColumn;
|
1925 | exports.date = date;
|
1926 | exports.definedTerm = definedTerm;
|
1927 | exports.del = del;
|
1928 | exports.emphasis = emphasis;
|
1929 | exports.entity = entity;
|
1930 | exports.entityTypes = entityTypes;
|
1931 | exports.enumValidator = enumValidator;
|
1932 | exports.enumeration = enumeration;
|
1933 | exports.enumerationTypes = enumerationTypes;
|
1934 | exports.figure = figure;
|
1935 | exports.function_ = function_;
|
1936 | exports.grant = grant;
|
1937 | exports.grantTypes = grantTypes;
|
1938 | exports.heading = heading;
|
1939 | exports.imageObject = imageObject;
|
1940 | exports.include = include;
|
1941 | exports.inlineContentTypes = inlineContentTypes;
|
1942 | exports.integerValidator = integerValidator;
|
1943 | exports.isA = isA;
|
1944 | exports.isBlockContent = isBlockContent;
|
1945 | exports.isEntity = isEntity;
|
1946 | exports.isIn = isIn;
|
1947 | exports.isInTypeMap = isInTypeMap;
|
1948 | exports.isInlineContent = isInlineContent;
|
1949 | exports.isMember = isMember;
|
1950 | exports.isPrimitive = isPrimitive;
|
1951 | exports.isType = isType;
|
1952 | exports.jsonLdContext = jsonLdContext;
|
1953 | exports.jsonLdTermName = jsonLdTermName;
|
1954 | exports.jsonLdTermUrl = jsonLdTermUrl;
|
1955 | exports.jsonLdUrl = jsonLdUrl;
|
1956 | exports.jsonSchemaProperties = jsonSchemaProperties;
|
1957 | exports.jsonSchemaTypes = jsonSchemaTypes;
|
1958 | exports.jsonSchemas = jsonSchemas;
|
1959 | exports.link = link;
|
1960 | exports.list = list;
|
1961 | exports.listItem = listItem;
|
1962 | exports.mark = mark;
|
1963 | exports.markTypes = markTypes;
|
1964 | exports.math = math;
|
1965 | exports.mathBlock = mathBlock;
|
1966 | exports.mathFragment = mathFragment;
|
1967 | exports.mathTypes = mathTypes;
|
1968 | exports.mediaObject = mediaObject;
|
1969 | exports.mediaObjectTypes = mediaObjectTypes;
|
1970 | exports.microdata = microdata;
|
1971 | exports.microdataItem = microdataItem;
|
1972 | exports.microdataItemprop = microdataItemprop;
|
1973 | exports.microdataItemtype = microdataItemtype;
|
1974 | exports.microdataProperty = microdataProperty;
|
1975 | exports.microdataRoot = microdataRoot;
|
1976 | exports.microdataType = microdataType;
|
1977 | exports.microdataUrl = microdataUrl;
|
1978 | exports.monetaryGrant = monetaryGrant;
|
1979 | exports.nodeType = nodeType;
|
1980 | exports.nontextualAnnotation = nontextualAnnotation;
|
1981 | exports.note = note;
|
1982 | exports.numberValidator = numberValidator;
|
1983 | exports.organization = organization;
|
1984 | exports.paragraph = paragraph;
|
1985 | exports.parameter = parameter;
|
1986 | exports.periodical = periodical;
|
1987 | exports.person = person;
|
1988 | exports.postalAddress = postalAddress;
|
1989 | exports.product = product;
|
1990 | exports.propertyValue = propertyValue;
|
1991 | exports.publicationIssue = publicationIssue;
|
1992 | exports.publicationVolume = publicationVolume;
|
1993 | exports.quote = quote;
|
1994 | exports.quoteBlock = quoteBlock;
|
1995 | exports.review = review;
|
1996 | exports.softwareApplication = softwareApplication;
|
1997 | exports.softwareEnvironment = softwareEnvironment;
|
1998 | exports.softwareSession = softwareSession;
|
1999 | exports.softwareSourceCode = softwareSourceCode;
|
2000 | exports.stringValidator = stringValidator;
|
2001 | exports.strong = strong;
|
2002 | exports.subscript = subscript;
|
2003 | exports.superscript = superscript;
|
2004 | exports.table = table;
|
2005 | exports.tableCell = tableCell;
|
2006 | exports.tableRow = tableRow;
|
2007 | exports.thematicBreak = thematicBreak;
|
2008 | exports.thing = thing;
|
2009 | exports.thingTypes = thingTypes;
|
2010 | exports.tupleValidator = tupleValidator;
|
2011 | exports.unions = unions;
|
2012 | exports.validator = validator;
|
2013 | exports.validatorTypes = validatorTypes;
|
2014 | exports.variable = variable;
|
2015 | exports.version = version;
|
2016 | exports.versionMajor = versionMajor;
|
2017 | exports.versionMinor = versionMinor;
|
2018 | exports.videoObject = videoObject;
|
2019 | exports.volumeMount = volumeMount;
|
2020 |
|