@gitbook/api 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -388,17 +388,17 @@ export interface CommentReply {
388
388
  location: string;
389
389
  };
390
390
  }
391
- export declare type Document = MarkdownDocument | JSONDocument | object;
391
+ export declare type Document = MarkdownDocument | {
392
+ document: JSONDocument;
393
+ } | object;
392
394
  export interface MarkdownDocument {
393
395
  /** Content of the document formatted as markdown */
394
396
  markdown: string;
395
397
  }
396
398
  export interface JSONDocument {
397
- document: {
398
- object: 'document';
399
- data: object;
400
- nodes: DocumentBlocksTopLevels[];
401
- };
399
+ object: 'document';
400
+ data: object;
401
+ nodes: DocumentBlocksTopLevels[];
402
402
  }
403
403
  export declare type DocumentBlocksEssentials = DocumentBlockParagraph | DocumentBlockHeading | DocumentBlockListOrdered | DocumentBlockListUnordered | DocumentBlockListTasks | DocumentBlockDivider;
404
404
  export declare type DocumentBlocksTopLevels = DocumentBlocksEssentials | DocumentBlockQuote | DocumentBlockHint | DocumentBlockImages | DocumentBlockFile | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockCode | DocumentBlockMath | DocumentBlockExpandable | DocumentBlockTabs | DocumentBlockTable | DocumentBlockSwagger | DocumentBlockContentRef | DocumentBlockIntegration;
@@ -419,31 +419,40 @@ export interface DocumentTextLeaf {
419
419
  text: string;
420
420
  marks: DocumentTextMark[];
421
421
  }
422
- export declare type DocumentTextMark = {
422
+ export interface DocumentMarkBold {
423
423
  object: 'mark';
424
- } & ({
425
424
  type: 'bold';
426
- } | {
425
+ }
426
+ export interface DocumentMarkItalic {
427
+ object: 'mark';
427
428
  type: 'italic';
428
- } | {
429
+ }
430
+ export interface DocumentMarkCode {
431
+ object: 'mark';
429
432
  type: 'code';
430
- } | {
433
+ }
434
+ export interface DocumentMarkStrikethrough {
435
+ object: 'mark';
431
436
  type: 'strikethrough';
432
- } | {
437
+ }
438
+ export interface DocumentMarkColor {
439
+ object: 'mark';
433
440
  type: 'color';
434
441
  data: {
435
442
  text: 'default' | 'green' | 'blue' | 'red' | 'orange' | 'yellow' | 'purple';
436
443
  background: 'default' | 'green' | 'blue' | 'red' | 'orange' | 'yellow' | 'purple';
437
444
  };
438
- });
445
+ }
446
+ export declare type DocumentTextMark = DocumentMarkBold | DocumentMarkItalic | DocumentMarkCode | DocumentMarkStrikethrough | DocumentMarkColor;
439
447
  export interface DocumentInlineLink {
440
448
  object: 'inline';
441
449
  type: 'link';
442
450
  key?: string;
443
- nodes: DocumentNodeText[];
451
+ nodes: (DocumentNodeText | DocumentInlineImage)[];
444
452
  data: {
445
453
  ref: ContentRef;
446
454
  };
455
+ isVoid?: false;
447
456
  }
448
457
  export interface DocumentInlineMath {
449
458
  object: 'inline';
@@ -493,31 +502,38 @@ export interface DocumentInlineAnnotation {
493
502
  nodes: (DocumentBlocksEssentials | DocumentBlockCode)[];
494
503
  })[];
495
504
  isVoid: true;
505
+ nodes: DocumentNodeText[];
506
+ data?: object;
496
507
  }
497
- export declare type DocumentInlinesRich = DocumentInlineImage;
508
+ export declare type DocumentInlinesRich = DocumentNodeText | DocumentInlineLink | DocumentInlineEmoji | DocumentInlineMath | DocumentInlineImage | DocumentInlineAnnotation | DocumentInlineMention;
498
509
  export interface DocumentBlockParagraph {
499
510
  object: 'block';
500
511
  type: 'paragraph';
501
512
  key?: string;
502
- nodes: any[];
513
+ nodes: DocumentInlinesRich[];
514
+ isVoid?: false;
515
+ data?: object;
503
516
  }
504
517
  export interface DocumentBlockHeading {
505
518
  object: 'block';
506
519
  type: 'heading-1' | 'heading-2' | 'heading-3';
507
520
  key?: string;
508
- nodes: (DocumentNodeText | DocumentInlineLink | DocumentInlineEmoji | DocumentInlineMath | DocumentInlineImage | DocumentInlineAnnotation | DocumentInlineMention)[];
521
+ nodes: DocumentInlinesRich[];
509
522
  data: {
510
523
  id?: string;
511
524
  };
512
525
  meta?: {
513
526
  id: string;
514
527
  };
528
+ isVoid?: false;
515
529
  }
516
530
  export interface DocumentBlockQuote {
517
531
  object: 'block';
518
- type: 'quote';
532
+ type: 'blockquote';
519
533
  key?: string;
520
534
  nodes: (DocumentBlocksEssentials | DocumentBlockQuote)[];
535
+ isVoid?: false;
536
+ data?: object;
521
537
  }
522
538
  export interface DocumentBlockHint {
523
539
  object: 'block';
@@ -527,12 +543,15 @@ export interface DocumentBlockHint {
527
543
  style: 'info' | 'warning' | 'danger' | 'success';
528
544
  };
529
545
  nodes: DocumentBlocksEssentials[];
546
+ isVoid?: false;
530
547
  }
531
548
  export interface DocumentBlockListUnordered {
532
549
  object: 'block';
533
550
  type: 'list-unordered';
534
551
  key?: string;
535
552
  nodes: DocumentBlockListItem[];
553
+ data?: object;
554
+ isVoid?: false;
536
555
  }
537
556
  export interface DocumentBlockListOrdered {
538
557
  object: 'block';
@@ -542,18 +561,23 @@ export interface DocumentBlockListOrdered {
542
561
  start?: number;
543
562
  };
544
563
  nodes: DocumentBlockListItem[];
564
+ isVoid?: false;
545
565
  }
546
566
  export interface DocumentBlockListTasks {
547
567
  object: 'block';
548
568
  type: 'list-tasks';
549
569
  key?: string;
550
570
  nodes: DocumentBlockTaskListItem[];
571
+ isVoid?: false;
572
+ data?: object;
551
573
  }
552
574
  export interface DocumentBlockListItem {
553
575
  object: 'block';
554
576
  type: 'list-item';
555
577
  key?: string;
556
578
  nodes: DocumentBlocksEssentials[];
579
+ isVoid?: false;
580
+ data?: object;
557
581
  }
558
582
  export declare type DocumentBlockTaskListItem = DocumentBlockListItem & {
559
583
  data: {
@@ -630,6 +654,7 @@ export interface DocumentBlockCode {
630
654
  fullWidth?: boolean;
631
655
  };
632
656
  nodes: DocumentBlockCodeLine[];
657
+ isVoid?: false;
633
658
  }
634
659
  export interface DocumentBlockCodeLine {
635
660
  object: 'block';
@@ -639,6 +664,7 @@ export interface DocumentBlockCodeLine {
639
664
  data: {
640
665
  highlighted?: boolean;
641
666
  };
667
+ isVoid?: false;
642
668
  }
643
669
  export interface DocumentBlockMath {
644
670
  object: 'block';
@@ -654,6 +680,7 @@ export interface DocumentBlockExpandable {
654
680
  type: 'expandable';
655
681
  key?: string;
656
682
  isVoid: true;
683
+ data: object;
657
684
  fragments: ((DocumentNodeFragment & {
658
685
  fragment: 'expandable-title';
659
686
  type: 'expandable-title';
@@ -672,6 +699,8 @@ export interface DocumentBlockTabs {
672
699
  type: 'tabs';
673
700
  key?: string;
674
701
  nodes: DocumentBlockTabsItem[];
702
+ isVoid?: false;
703
+ data?: object;
675
704
  }
676
705
  export interface DocumentBlockSwagger {
677
706
  object: 'block';
@@ -791,6 +820,7 @@ export interface DocumentBlockTabsItem {
791
820
  meta?: {
792
821
  id: string;
793
822
  };
823
+ isVoid?: false;
794
824
  }
795
825
  export interface DocumentBlockContentRef {
796
826
  object: 'block';
@@ -820,6 +850,7 @@ export interface DocumentBlockDivider {
820
850
  type: 'divider';
821
851
  key?: string;
822
852
  isVoid: true;
853
+ data: object;
823
854
  }
824
855
  export declare type ContentRef = ContentRefFile | ContentRefURL | ContentRefPage | ContentRefAnchor | ContentRefUser | ContentRefCollection | ContentRefSpace;
825
856
  export interface ContentRefURL {
@@ -896,12 +927,7 @@ export interface RevisionBase {
896
927
  pages: RevisionPage[];
897
928
  files: RevisionFile[];
898
929
  /** Metadata about a potential associated git commit. */
899
- git?: {
900
- oid: string;
901
- message: string;
902
- createdByGitBook: boolean;
903
- url?: string;
904
- };
930
+ git?: GitSyncCommit;
905
931
  urls: {
906
932
  app: string;
907
933
  published?: string;
@@ -928,6 +954,10 @@ export interface RevisionPageBase {
928
954
  id: string;
929
955
  /** Title of the page */
930
956
  title: string;
957
+ /** When the page was first created. Only present if page has been edited at least once. */
958
+ createdAt?: Date;
959
+ /** When the page was last edited. Only present if page has been edited at least once. */
960
+ updatedAt?: Date;
931
961
  }
932
962
  export declare type RevisionPageDocument = RevisionPageBase & Document & {
933
963
  kind: 'sheet';
@@ -936,6 +966,7 @@ export declare type RevisionPageDocument = RevisionPageBase & Document & {
936
966
  path: string;
937
967
  description?: string;
938
968
  pages: (RevisionPageDocument | RevisionPageLink)[];
969
+ git?: GitSyncBlob;
939
970
  };
940
971
  export declare type RevisionPageGroup = RevisionPageBase & {
941
972
  kind: 'group';
@@ -954,6 +985,13 @@ export interface RevisionFile {
954
985
  name: string;
955
986
  contentType: string;
956
987
  downloadURL: string;
988
+ size: number;
989
+ /** For images, it contains the dimensions of it. */
990
+ dimensions?: {
991
+ width: number;
992
+ height: number;
993
+ };
994
+ git?: GitSyncBlob;
957
995
  }
958
996
  export declare enum ImportContentSource {
959
997
  Website = "website",
@@ -1002,6 +1040,24 @@ export declare enum GitSyncOperationState {
1002
1040
  Failure = "failure",
1003
1041
  Success = "success"
1004
1042
  }
1043
+ export interface GitSyncCommit {
1044
+ /** SHA for the commit */
1045
+ oid: string;
1046
+ /** Message describing the purpose of the commit */
1047
+ message: string;
1048
+ /** If true, the Git commit was generated by an export from GitBook */
1049
+ createdByGitBook: boolean;
1050
+ /** URL of the commit in the GitSync provider */
1051
+ url?: string;
1052
+ /** Original name of the ref where the commit originated from */
1053
+ ref?: string;
1054
+ }
1055
+ export interface GitSyncBlob {
1056
+ /** SHA for the blob */
1057
+ oid: string;
1058
+ /** Path of the blob in the Git tree */
1059
+ path: string;
1060
+ }
1005
1061
  export interface Organization {
1006
1062
  /** Type of Object, always equals to "organization" */
1007
1063
  object: 'organization';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "version": "0.11.1",
7
+ "version": "0.12.0",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",