yanki 1.2.2 → 1.2.3
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/bin/cli.js +1 -1
- package/dist/lib/index.d.ts +510 -490
- package/dist/lib/index.js +1 -1
- package/dist/{sync-files-Bp-PIaPR.js → sync-files-BIoDg54O.js} +136 -136
- package/package.json +14 -14
package/dist/lib/index.d.ts
CHANGED
|
@@ -274,6 +274,23 @@ Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
|
274
274
|
*/
|
|
275
275
|
type BuiltIns = Primitive | void | Date | RegExp;
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
Test if the given function has multiple call signatures.
|
|
279
|
+
|
|
280
|
+
Needed to handle the case of a single call signature with properties.
|
|
281
|
+
|
|
282
|
+
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
283
|
+
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
284
|
+
*/
|
|
285
|
+
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> =
|
|
286
|
+
T extends {(...arguments_: infer A): unknown; (...arguments_: infer B): unknown}
|
|
287
|
+
? B extends A
|
|
288
|
+
? A extends B
|
|
289
|
+
? false
|
|
290
|
+
: true
|
|
291
|
+
: true
|
|
292
|
+
: false;
|
|
293
|
+
|
|
277
294
|
/**
|
|
278
295
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
279
296
|
|
|
@@ -688,16 +705,20 @@ type PartialDeep<T, Options extends PartialDeepOptions = {}> =
|
|
|
688
705
|
|
|
689
706
|
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))
|
|
690
707
|
? T
|
|
691
|
-
:
|
|
692
|
-
?
|
|
693
|
-
: T extends
|
|
694
|
-
?
|
|
695
|
-
: T extends
|
|
696
|
-
?
|
|
697
|
-
: T extends
|
|
698
|
-
?
|
|
699
|
-
: T extends
|
|
700
|
-
?
|
|
708
|
+
: T extends Map<infer KeyType, infer ValueType>
|
|
709
|
+
? PartialMapDeep<KeyType, ValueType, Options>
|
|
710
|
+
: T extends Set<infer ItemType>
|
|
711
|
+
? PartialSetDeep<ItemType, Options>
|
|
712
|
+
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
|
713
|
+
? PartialReadonlyMapDeep<KeyType, ValueType, Options>
|
|
714
|
+
: T extends ReadonlySet<infer ItemType>
|
|
715
|
+
? PartialReadonlySetDeep<ItemType, Options>
|
|
716
|
+
: T extends (...arguments_: any[]) => unknown
|
|
717
|
+
? IsNever<keyof T> extends true
|
|
718
|
+
? T // For functions with no properties
|
|
719
|
+
: HasMultipleCallSignatures<T> extends true
|
|
720
|
+
? T
|
|
721
|
+
: ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options>
|
|
701
722
|
: T extends object
|
|
702
723
|
? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
703
724
|
? Options['recurseIntoArrays'] extends true
|
|
@@ -733,618 +754,616 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
|
|
|
733
754
|
/**
|
|
734
755
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
735
756
|
*/
|
|
736
|
-
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
|
|
737
|
-
|
|
738
|
-
? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType>
|
|
739
|
-
: {}) & ({
|
|
740
|
-
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
741
|
-
});
|
|
742
|
-
|
|
743
|
-
type CardBrowserColumns = 'answer' | 'cardDue' | 'cardEase' | 'cardIvl' | 'cardLapses' | 'cardMod' | 'cardReps' | 'deck' | 'note' | 'noteCrt' | 'noteFld' | 'noteMod' | 'noteTags' | 'question' | 'template' | (string & {});
|
|
744
|
-
type CardValueKeys = 'data' | 'did' | 'due' | 'factor' | 'flags' | 'id' | 'ivl' | 'lapses' | 'left' | 'mod' | 'odid' | 'odue' | 'ord' | 'queue' | 'reps' | 'type' | 'usn';
|
|
745
|
-
type CardInfo = {
|
|
746
|
-
answer: string;
|
|
747
|
-
buttons?: number[];
|
|
748
|
-
cardId: number;
|
|
749
|
-
css: string;
|
|
750
|
-
deckName: string;
|
|
751
|
-
due: number;
|
|
752
|
-
fieldOrder: number;
|
|
753
|
-
fields: Record<string, {
|
|
754
|
-
order: number;
|
|
755
|
-
value: string;
|
|
756
|
-
}>;
|
|
757
|
-
interval: number;
|
|
758
|
-
lapses: number;
|
|
759
|
-
left: number;
|
|
760
|
-
mod: number;
|
|
761
|
-
modelName: string;
|
|
762
|
-
nextReviews: string[];
|
|
763
|
-
note: number;
|
|
764
|
-
ord: number;
|
|
765
|
-
question: string;
|
|
766
|
-
queue: number;
|
|
767
|
-
reps: number;
|
|
768
|
-
template: string;
|
|
769
|
-
type: number;
|
|
757
|
+
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = {
|
|
758
|
+
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
770
759
|
};
|
|
771
|
-
type CardRequests = Request<'answerCards', 6, {
|
|
772
|
-
answers: Array<{
|
|
773
|
-
cardId: number;
|
|
774
|
-
ease: number;
|
|
775
|
-
}>;
|
|
776
|
-
}, boolean[]> | Request<'areDue', 6, {
|
|
777
|
-
cards: number[];
|
|
778
|
-
}, boolean[]> | Request<'areSuspended', 6, {
|
|
779
|
-
cards: number[];
|
|
780
|
-
}, Array<boolean | null>> | Request<'cardsInfo', 6, {
|
|
781
|
-
cards: number[];
|
|
782
|
-
}, CardInfo[]> | Request<'cardsModTime', 6, {
|
|
783
|
-
cards: number[];
|
|
784
|
-
}, {
|
|
785
|
-
cardId: number;
|
|
786
|
-
mod: number;
|
|
787
|
-
}> | Request<'cardsToNotes', 6, {
|
|
788
|
-
cards: number[];
|
|
789
|
-
}, number[]> | Request<'findCards', 6, {
|
|
790
|
-
query: string;
|
|
791
|
-
}, number[]> | Request<'forgetCards', 6, {
|
|
792
|
-
cards: number[];
|
|
793
|
-
}> | Request<'getEaseFactors', 6, {
|
|
794
|
-
cards: number[];
|
|
795
|
-
}, number[]> | Request<'getIntervals', 6, {
|
|
796
|
-
cards: number[];
|
|
797
|
-
complete?: boolean;
|
|
798
|
-
}, number[] | number[][]> | Request<'relearnCards', 6, {
|
|
799
|
-
cards: number[];
|
|
800
|
-
}> | Request<'setDueDate', 6, {
|
|
801
|
-
cards: number[];
|
|
802
|
-
days: string;
|
|
803
|
-
}, boolean> | Request<'setEaseFactors', 6, {
|
|
804
|
-
cards: number[];
|
|
805
|
-
easeFactors: number[];
|
|
806
|
-
}, boolean[]> | Request<'setSpecificValueOfCard', 6, {
|
|
807
|
-
card: number;
|
|
808
|
-
keys: CardValueKeys[];
|
|
809
|
-
newValues: string[];
|
|
810
|
-
}, boolean[]> | Request<'suspend', 6, {
|
|
811
|
-
cards: number[];
|
|
812
|
-
}, boolean> | Request<'suspended', 6, {
|
|
813
|
-
card: number;
|
|
814
|
-
}, boolean> | Request<'unsuspend', 6, {
|
|
815
|
-
cards: number[];
|
|
816
|
-
}, boolean>;
|
|
817
760
|
|
|
761
|
+
//#region src/types/deck.d.ts
|
|
818
762
|
type DeckStats = {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
763
|
+
deck_id: number;
|
|
764
|
+
learn_count: number;
|
|
765
|
+
name: string;
|
|
766
|
+
new_count: number;
|
|
767
|
+
review_count: number;
|
|
768
|
+
total_in_deck: number;
|
|
825
769
|
};
|
|
826
770
|
type DeckConfig = {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
771
|
+
autoplay: boolean;
|
|
772
|
+
dyn: 1 | false;
|
|
773
|
+
id: number;
|
|
774
|
+
lapse: {
|
|
775
|
+
delays: number[];
|
|
776
|
+
leechAction: number;
|
|
777
|
+
leechFails: number;
|
|
778
|
+
minInt: number;
|
|
779
|
+
mult: number;
|
|
780
|
+
};
|
|
781
|
+
maxTaken: number;
|
|
782
|
+
mod: number;
|
|
783
|
+
name: string;
|
|
784
|
+
new: {
|
|
785
|
+
bury: boolean;
|
|
786
|
+
delays: number[];
|
|
787
|
+
initialFactor: number;
|
|
788
|
+
ints: number[];
|
|
789
|
+
order: number;
|
|
790
|
+
perDay: number;
|
|
791
|
+
separate: boolean;
|
|
792
|
+
};
|
|
793
|
+
replayq: boolean;
|
|
794
|
+
rev: {
|
|
795
|
+
bury: boolean;
|
|
796
|
+
ease4: number;
|
|
797
|
+
fuzz: number;
|
|
798
|
+
ivlFct: number;
|
|
799
|
+
maxIvl: number;
|
|
800
|
+
minSpace: number;
|
|
801
|
+
perDay: number;
|
|
802
|
+
};
|
|
803
|
+
timer: number;
|
|
804
|
+
usn: number;
|
|
861
805
|
};
|
|
862
806
|
type DeckRequests = Request<'changeDeck', 6, {
|
|
863
|
-
|
|
864
|
-
|
|
807
|
+
cards: number[];
|
|
808
|
+
deck: string;
|
|
865
809
|
}> | Request<'cloneDeckConfigId', 6, {
|
|
866
|
-
|
|
867
|
-
|
|
810
|
+
cloneFrom: number;
|
|
811
|
+
name: string;
|
|
868
812
|
}, false | number> | Request<'createDeck', 6, {
|
|
869
|
-
|
|
813
|
+
deck: string;
|
|
870
814
|
}, number> | Request<'deckNames', 6, never, string[]> | Request<'deckNamesAndIds', 6, never, Record<string, number>> | Request<'deleteDecks', 6, {
|
|
871
|
-
|
|
872
|
-
|
|
815
|
+
cardsToo: true;
|
|
816
|
+
decks: string[];
|
|
873
817
|
}> | Request<'getDeckConfig', 6, {
|
|
874
|
-
|
|
818
|
+
deck: string;
|
|
875
819
|
}, DeckConfig> | Request<'getDecks', 6, Record<'cards', number[]>, Record<string, number[]>> | Request<'getDeckStats', 6, {
|
|
876
|
-
|
|
820
|
+
decks: string[];
|
|
877
821
|
}, Record<string, DeckStats>> | Request<'removeDeckConfigId', 6, {
|
|
878
|
-
|
|
822
|
+
configId: number;
|
|
879
823
|
}, boolean> | Request<'saveDeckConfig', 6, {
|
|
880
|
-
|
|
824
|
+
config: DeckConfig;
|
|
881
825
|
}, boolean> | Request<'setDeckConfigId', 6, {
|
|
882
|
-
|
|
883
|
-
|
|
826
|
+
configId: number;
|
|
827
|
+
decks: string[];
|
|
884
828
|
}, boolean>;
|
|
885
|
-
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/types/note.d.ts
|
|
886
831
|
type NoteModel = 'Basic' | 'Basic (and reversed card)' | 'Basic (type in the answer)' | 'Cloze' | (string & {});
|
|
887
832
|
type NoteMedia = {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
833
|
+
data?: string;
|
|
834
|
+
fields: string[];
|
|
835
|
+
filename: string;
|
|
836
|
+
path?: string;
|
|
837
|
+
skipHash?: string;
|
|
838
|
+
url?: string;
|
|
894
839
|
};
|
|
895
840
|
type Note = {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
841
|
+
audio?: NoteMedia[];
|
|
842
|
+
deckName: string;
|
|
843
|
+
fields: Record<string, string>;
|
|
844
|
+
modelName: NoteModel;
|
|
845
|
+
picture?: NoteMedia[];
|
|
846
|
+
tags?: string[];
|
|
847
|
+
video?: NoteMedia[];
|
|
903
848
|
};
|
|
904
849
|
type NoteWithCreationOptions = Note & {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
};
|
|
850
|
+
options?: {
|
|
851
|
+
allowDuplicate?: boolean;
|
|
852
|
+
duplicateScope?: 'deck' | (string & {});
|
|
853
|
+
duplicateScopeOptions?: {
|
|
854
|
+
checkAllModels?: boolean;
|
|
855
|
+
checkChildren?: boolean;
|
|
856
|
+
deckName?: null | string;
|
|
913
857
|
};
|
|
858
|
+
};
|
|
914
859
|
};
|
|
915
860
|
type NoteRequests = Request<'addNote', 6, {
|
|
916
|
-
|
|
861
|
+
note: NoteWithCreationOptions;
|
|
917
862
|
}, null | number> | Request<'addNotes', 6, {
|
|
918
|
-
|
|
863
|
+
notes: NoteWithCreationOptions[];
|
|
919
864
|
}, Array<null | string> | null> | Request<'addTags', 6, {
|
|
920
|
-
|
|
921
|
-
|
|
865
|
+
notes: number[];
|
|
866
|
+
tags: string;
|
|
922
867
|
}> | Request<'canAddNotes', 6, {
|
|
923
|
-
|
|
868
|
+
notes: NoteWithCreationOptions[];
|
|
924
869
|
}, boolean[]> | Request<'canAddNotesWithErrorDetail', 6, {
|
|
925
|
-
|
|
870
|
+
notes: NoteWithCreationOptions[];
|
|
926
871
|
}, Array<{
|
|
927
|
-
|
|
928
|
-
|
|
872
|
+
canAdd: false;
|
|
873
|
+
error: string;
|
|
929
874
|
} | {
|
|
930
|
-
|
|
875
|
+
canAdd: true;
|
|
931
876
|
}>> | Request<'clearUnusedTags', 6, never, string[]> | Request<'deleteNotes', 6, {
|
|
932
|
-
|
|
877
|
+
notes: number[];
|
|
933
878
|
}> | Request<'findNotes', 6, {
|
|
934
|
-
|
|
879
|
+
query: string;
|
|
935
880
|
}, number[]> | Request<'getNoteTags', 6, {
|
|
936
|
-
|
|
881
|
+
note: number;
|
|
937
882
|
}, string[]> | Request<'getTags', 6, never, string[]> | Request<'notesInfo', 6, {
|
|
938
|
-
|
|
883
|
+
notes: number[];
|
|
939
884
|
}, Array<{
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
885
|
+
cards: number[];
|
|
886
|
+
fields: Record<string, {
|
|
887
|
+
order: number;
|
|
888
|
+
value: string;
|
|
889
|
+
}>;
|
|
890
|
+
mod: number;
|
|
891
|
+
modelName: string;
|
|
892
|
+
noteId: number;
|
|
893
|
+
profile: string;
|
|
894
|
+
tags: string[];
|
|
950
895
|
}>> | Request<'notesModTime', 6, {
|
|
951
|
-
|
|
896
|
+
notes: number[];
|
|
952
897
|
}, Array<{
|
|
953
|
-
|
|
954
|
-
|
|
898
|
+
mod: number;
|
|
899
|
+
noteId: number;
|
|
955
900
|
}>> | Request<'removeEmptyNotes', 6> | Request<'removeTags', 6, {
|
|
956
|
-
|
|
957
|
-
|
|
901
|
+
notes: number[];
|
|
902
|
+
tags: string;
|
|
958
903
|
}> | Request<'replaceTags', 6, {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
904
|
+
notes: number[];
|
|
905
|
+
replace_with_tag: string;
|
|
906
|
+
tag_to_replace: string;
|
|
962
907
|
}> | Request<'replaceTagsInAllNotes', 6, {
|
|
963
|
-
|
|
964
|
-
|
|
908
|
+
replace_with_tag: string;
|
|
909
|
+
tag_to_replace: string;
|
|
965
910
|
}> | Request<'updateNote', 6, {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
911
|
+
note: {
|
|
912
|
+
audio?: NoteMedia[];
|
|
913
|
+
fields: Record<string, string>;
|
|
914
|
+
id: number;
|
|
915
|
+
picture?: NoteMedia[];
|
|
916
|
+
tags?: string[];
|
|
917
|
+
video?: NoteMedia[];
|
|
918
|
+
} | {
|
|
919
|
+
fields?: Record<string, string>;
|
|
920
|
+
id: number;
|
|
921
|
+
tags: string[];
|
|
922
|
+
};
|
|
978
923
|
}> | Request<'updateNoteFields', 6, {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
924
|
+
note: {
|
|
925
|
+
audio?: NoteMedia[];
|
|
926
|
+
fields: Record<string, string>;
|
|
927
|
+
id: number;
|
|
928
|
+
picture?: NoteMedia[];
|
|
929
|
+
video?: NoteMedia[];
|
|
930
|
+
};
|
|
986
931
|
}> | Request<'updateNoteModel', 6, {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
tags: string[];
|
|
992
|
-
};
|
|
993
|
-
}> | Request<'updateNoteTags', 6, {
|
|
994
|
-
note: number;
|
|
932
|
+
note: {
|
|
933
|
+
fields: Record<string, string>;
|
|
934
|
+
id: number;
|
|
935
|
+
modelName: string;
|
|
995
936
|
tags: string[];
|
|
937
|
+
};
|
|
938
|
+
}> | Request<'updateNoteTags', 6, {
|
|
939
|
+
note: number;
|
|
940
|
+
tags: string[];
|
|
996
941
|
}>;
|
|
997
|
-
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/types/graphical.d.ts
|
|
998
944
|
type GraphicalRequests = Request<'guiAddCards', 6, {
|
|
999
|
-
|
|
945
|
+
note: Note;
|
|
1000
946
|
}, number> | Request<'guiAnswerCard', 6, {
|
|
1001
|
-
|
|
947
|
+
ease: number;
|
|
1002
948
|
}, boolean> | Request<'guiBrowse', 6, {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
949
|
+
query: string;
|
|
950
|
+
reorderCards?: {
|
|
951
|
+
columnId: CardBrowserColumns;
|
|
952
|
+
order: 'ascending' | 'descending';
|
|
953
|
+
};
|
|
1008
954
|
}, number[]> | Request<'guiCheckDatabase', 6, never, true> | Request<'guiCurrentCard', 6, never, CardInfo | null> | Request<'guiDeckBrowser', 6> | Request<'guiDeckOverview', 6, {
|
|
1009
|
-
|
|
955
|
+
name: string;
|
|
1010
956
|
}, boolean> | Request<'guiDeckReview', 6, {
|
|
1011
|
-
|
|
957
|
+
name: string;
|
|
1012
958
|
}, boolean> | Request<'guiEditNote', 6, {
|
|
1013
|
-
|
|
959
|
+
note: number;
|
|
1014
960
|
}> | Request<'guiExitAnki', 6> | Request<'guiImportFile', 6, {
|
|
1015
|
-
|
|
961
|
+
path: string;
|
|
1016
962
|
}> | Request<'guiSelectCard', 6, {
|
|
1017
|
-
|
|
963
|
+
card: number;
|
|
1018
964
|
}, boolean> | Request<'guiSelectedNotes', 6, never, number[]> | Request<'guiSelectNote', 6, {
|
|
1019
|
-
|
|
965
|
+
note: number;
|
|
1020
966
|
}, boolean> | Request<'guiShowAnswer', 6, never, boolean> | Request<'guiShowQuestion', 6, never, boolean> | Request<'guiStartCardTimer', 6, never, true> | Request<'guiUndo', 6, never, boolean>;
|
|
1021
|
-
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/types/media.d.ts
|
|
1022
969
|
type MediaRequests = Request<'deleteMediaFile', 6, {
|
|
1023
|
-
|
|
970
|
+
filename: string;
|
|
1024
971
|
}> | Request<'getMediaDirPath', 6, never, string> | Request<'getMediaFilesNames', 6, {
|
|
1025
|
-
|
|
972
|
+
pattern: string;
|
|
1026
973
|
}, string[]> | Request<'retrieveMediaFile', 6, {
|
|
1027
|
-
|
|
974
|
+
filename: string;
|
|
1028
975
|
}, false | string> | Request<'storeMediaFile', 6, {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
976
|
+
data?: string;
|
|
977
|
+
deleteExisting?: boolean;
|
|
978
|
+
filename: string;
|
|
979
|
+
path?: string;
|
|
980
|
+
url?: string;
|
|
1034
981
|
}, string>;
|
|
1035
|
-
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region src/types/miscellaneous.d.ts
|
|
1036
984
|
type MiscellaneousRequests = Request<'apiReflect', 6, {
|
|
1037
|
-
|
|
1038
|
-
|
|
985
|
+
actions: null | string[];
|
|
986
|
+
scopes: Array<'actions'>;
|
|
1039
987
|
}, {
|
|
1040
|
-
|
|
1041
|
-
|
|
988
|
+
actions: string[];
|
|
989
|
+
scopes: string[];
|
|
1042
990
|
}> | Request<'exportPackage', 6, {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
991
|
+
deck: string;
|
|
992
|
+
includeSched?: boolean;
|
|
993
|
+
path: string;
|
|
1046
994
|
}, boolean> | Request<'getActiveProfile', 6, never, string> | Request<'getProfiles', 6, never, string[]> | Request<'importPackage', 6, {
|
|
1047
|
-
|
|
995
|
+
path: string;
|
|
1048
996
|
}, boolean> | Request<'loadProfile', 6, {
|
|
1049
|
-
|
|
1050
|
-
}, true> | Request<'multi', 6,
|
|
997
|
+
name: string;
|
|
998
|
+
}, true> | Request<'multi', 6,
|
|
999
|
+
// Crazy, have to call this experimental
|
|
1051
1000
|
{
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1001
|
+
actions: Array<{
|
|
1002
|
+
action: Requests['action'];
|
|
1003
|
+
params?: Requests['params'];
|
|
1004
|
+
version?: number;
|
|
1005
|
+
}>;
|
|
1057
1006
|
}, Array<Requests['response'] | {
|
|
1058
|
-
|
|
1059
|
-
|
|
1007
|
+
error: null | string;
|
|
1008
|
+
result: Requests['response'];
|
|
1060
1009
|
}>> | Request<'reloadCollection', 6> | Request<'requestPermission', 6, never, {
|
|
1061
|
-
|
|
1010
|
+
permission: 'denied';
|
|
1062
1011
|
} | {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1012
|
+
permission: 'granted';
|
|
1013
|
+
requireApiKey: boolean;
|
|
1014
|
+
version: boolean;
|
|
1066
1015
|
}> | Request<'sync', 6> | Request<'version', 6, never, number>;
|
|
1067
|
-
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region src/types/model.d.ts
|
|
1068
1018
|
type ModelField = {
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1019
|
+
collapsed: boolean;
|
|
1020
|
+
description: string;
|
|
1021
|
+
excludeFromSearch: boolean;
|
|
1022
|
+
font: string;
|
|
1023
|
+
id: number;
|
|
1024
|
+
name: string;
|
|
1025
|
+
ord: number;
|
|
1026
|
+
plainText: boolean;
|
|
1027
|
+
preventDeletion: boolean;
|
|
1028
|
+
rtl: boolean;
|
|
1029
|
+
size: number;
|
|
1030
|
+
sticky: boolean;
|
|
1031
|
+
tag: null;
|
|
1082
1032
|
};
|
|
1083
1033
|
type ModelTemplate = {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1034
|
+
afmt: string;
|
|
1035
|
+
bafmt: string;
|
|
1036
|
+
bfont: string;
|
|
1037
|
+
bqfmt: string;
|
|
1038
|
+
bsize: number;
|
|
1039
|
+
did: null;
|
|
1040
|
+
id: number;
|
|
1041
|
+
name: string;
|
|
1042
|
+
ord: number;
|
|
1043
|
+
qfmt: string;
|
|
1094
1044
|
};
|
|
1095
1045
|
type Model = {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1046
|
+
css: string;
|
|
1047
|
+
did: null;
|
|
1048
|
+
flds: ModelField[];
|
|
1049
|
+
id: number;
|
|
1050
|
+
latexPost: string;
|
|
1051
|
+
latexPre: string;
|
|
1052
|
+
latexsvg: boolean;
|
|
1053
|
+
mod: number;
|
|
1054
|
+
name: string;
|
|
1055
|
+
originalStockKind: number;
|
|
1056
|
+
req: Array<[number, string, number[]]>;
|
|
1057
|
+
sortf: number;
|
|
1058
|
+
tmpls: ModelTemplate[];
|
|
1059
|
+
type: number;
|
|
1060
|
+
usn: number;
|
|
1111
1061
|
};
|
|
1112
1062
|
type ModelToCreate = {
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1063
|
+
cardTemplates: Array<{
|
|
1064
|
+
[key: string]: string;
|
|
1065
|
+
Back: string;
|
|
1066
|
+
Front: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
css?: string;
|
|
1069
|
+
inOrderFields: string[];
|
|
1070
|
+
isCloze?: boolean;
|
|
1071
|
+
modelName: string;
|
|
1122
1072
|
};
|
|
1123
1073
|
type ModelRequests = Request<'createModel', 6, ModelToCreate, Model> | Request<'findAndReplaceInModels', 6, {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1074
|
+
model: {
|
|
1075
|
+
back: boolean;
|
|
1076
|
+
css: boolean;
|
|
1077
|
+
fieldText: string;
|
|
1078
|
+
front: boolean;
|
|
1079
|
+
modelName: string;
|
|
1080
|
+
replaceText: string;
|
|
1081
|
+
};
|
|
1132
1082
|
}, number> | Request<'findModelsById', 6, {
|
|
1133
|
-
|
|
1083
|
+
modelIds: number[];
|
|
1134
1084
|
}, Model[]> | Request<'findModelsByName', 6, {
|
|
1135
|
-
|
|
1085
|
+
modelNames: string[];
|
|
1136
1086
|
}, Model[]> | Request<'modelFieldAdd', 6, {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1087
|
+
fieldName: string;
|
|
1088
|
+
index: number;
|
|
1089
|
+
modelName: string;
|
|
1140
1090
|
}> | Request<'modelFieldDescriptions', 6, {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1091
|
+
description: string;
|
|
1092
|
+
fieldName: string;
|
|
1093
|
+
modelName: string;
|
|
1144
1094
|
}, boolean> | Request<'modelFieldFonts', 6, {
|
|
1145
|
-
|
|
1095
|
+
modelName: string;
|
|
1146
1096
|
}, Record<string, {
|
|
1147
|
-
|
|
1148
|
-
|
|
1097
|
+
font: string;
|
|
1098
|
+
size: number;
|
|
1149
1099
|
}>> | Request<'modelFieldNames', 6, {
|
|
1150
|
-
|
|
1100
|
+
modelName: string;
|
|
1151
1101
|
}, string[]> | Request<'modelFieldRemove', 6, {
|
|
1152
|
-
|
|
1153
|
-
|
|
1102
|
+
fieldName: string;
|
|
1103
|
+
modelName: string;
|
|
1154
1104
|
}> | Request<'modelFieldRename', 6, {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1105
|
+
modelName: string;
|
|
1106
|
+
newFieldName: string;
|
|
1107
|
+
oldFieldName: string;
|
|
1158
1108
|
}> | Request<'modelFieldReposition', 6, {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1109
|
+
fieldName: string;
|
|
1110
|
+
index: number;
|
|
1111
|
+
modelName: string;
|
|
1162
1112
|
}> | Request<'modelFieldSetDescription', 6, {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1113
|
+
fieldName: string;
|
|
1114
|
+
index: number;
|
|
1115
|
+
modelName: string;
|
|
1166
1116
|
}> | Request<'modelFieldSetFont', 6, {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1117
|
+
fieldName: string;
|
|
1118
|
+
font: string;
|
|
1119
|
+
modelName: string;
|
|
1170
1120
|
}> | Request<'modelFieldSetFontSize', 6, {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1121
|
+
fieldName: string;
|
|
1122
|
+
fontSize: number;
|
|
1123
|
+
modelName: string;
|
|
1174
1124
|
}> | Request<'modelFieldsOnTemplates', 6, {
|
|
1175
|
-
|
|
1125
|
+
modelName: string;
|
|
1176
1126
|
}, Record<string, [string[], string[]]>> | Request<'modelNames', 6, never, string[]> | Request<'modelNamesAndIds', 6, never, Record<string, number>> | Request<'modelStyling', 6, {
|
|
1177
|
-
|
|
1127
|
+
modelName: string;
|
|
1178
1128
|
}, {
|
|
1179
|
-
|
|
1129
|
+
css: string;
|
|
1180
1130
|
}> | Request<'modelTemplateAdd', 6, {
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1131
|
+
modelName: string;
|
|
1132
|
+
template: {
|
|
1133
|
+
[key: string]: string;
|
|
1134
|
+
Back: string;
|
|
1135
|
+
Front: string;
|
|
1136
|
+
};
|
|
1187
1137
|
}> | Request<'modelTemplateRemove', 6, {
|
|
1188
|
-
|
|
1189
|
-
|
|
1138
|
+
modelName: string;
|
|
1139
|
+
templateName: string;
|
|
1190
1140
|
}> | Request<'modelTemplateRename', 6, {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1141
|
+
modelName: string;
|
|
1142
|
+
newTemplateName: string;
|
|
1143
|
+
oldTemplateName: string;
|
|
1194
1144
|
}> | Request<'modelTemplateReposition', 6, {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1145
|
+
index: number;
|
|
1146
|
+
modelName: string;
|
|
1147
|
+
templateName: string;
|
|
1198
1148
|
}> | Request<'modelTemplates', 6, {
|
|
1199
|
-
|
|
1149
|
+
modelName: string;
|
|
1200
1150
|
}, Record<string, {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1151
|
+
[key: string]: string;
|
|
1152
|
+
Back: string;
|
|
1153
|
+
Front: string;
|
|
1204
1154
|
}>> | Request<'updateModelStyling', 6, {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1155
|
+
model: {
|
|
1156
|
+
css: string;
|
|
1157
|
+
name: string;
|
|
1158
|
+
};
|
|
1209
1159
|
}> | Request<'updateModelTemplates', 6, {
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1160
|
+
model: {
|
|
1161
|
+
name: string;
|
|
1162
|
+
templates: Record<string, {
|
|
1163
|
+
Back?: string;
|
|
1164
|
+
Front?: string;
|
|
1165
|
+
}>;
|
|
1166
|
+
};
|
|
1217
1167
|
}>;
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
cardID: number,
|
|
1222
|
-
usn: number,
|
|
1223
|
-
buttonPressed: number,
|
|
1224
|
-
newInterval: number,
|
|
1225
|
-
previousInterval: number,
|
|
1226
|
-
newFactor: number,
|
|
1227
|
-
reviewDuration: number,
|
|
1228
|
-
reviewType: number
|
|
1229
|
-
];
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/types/statistic.d.ts
|
|
1170
|
+
type ReviewStatisticTuple = [reviewTime: number, cardID: number, usn: number, buttonPressed: number, newInterval: number, previousInterval: number, newFactor: number, reviewDuration: number, reviewType: number];
|
|
1230
1171
|
type StatisticRequests = Request<'cardReviews', 6, {
|
|
1231
|
-
|
|
1232
|
-
|
|
1172
|
+
deck: string;
|
|
1173
|
+
startID: number;
|
|
1233
1174
|
}, ReviewStatisticTuple[]> | Request<'getCollectionStatsHTML', 6, {
|
|
1234
|
-
|
|
1175
|
+
wholeCollection: boolean;
|
|
1235
1176
|
}, string> | Request<'getLatestReviewID', 6, {
|
|
1236
|
-
|
|
1177
|
+
deck: string;
|
|
1237
1178
|
}, number> | Request<'getNumCardsReviewedByDay', 6, never, Array<[string, number]>> | Request<'getNumCardsReviewedToday', 6, never, number> | Request<'getReviewsOfCards', 6, {
|
|
1238
|
-
|
|
1179
|
+
cards: string[];
|
|
1239
1180
|
}, Record<string, Array<{
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1181
|
+
/** ButtonPressed */
|
|
1182
|
+
ease: number;
|
|
1183
|
+
/** NewFactor */
|
|
1184
|
+
factor: number;
|
|
1185
|
+
/** ReviewTime */
|
|
1186
|
+
id: number;
|
|
1187
|
+
/** NewInterval */
|
|
1188
|
+
ivl: number;
|
|
1189
|
+
/** PreviousInterval */
|
|
1190
|
+
lastIvl: number;
|
|
1191
|
+
/** ReviewDuration */
|
|
1192
|
+
time: number;
|
|
1193
|
+
/** ReviewType */
|
|
1194
|
+
type: number;
|
|
1195
|
+
/** Usn */
|
|
1196
|
+
usn: number;
|
|
1256
1197
|
}>>> | Request<'insertReviews', 6, {
|
|
1257
|
-
|
|
1198
|
+
reviews: ReviewStatisticTuple[];
|
|
1258
1199
|
}>;
|
|
1259
|
-
|
|
1200
|
+
//#endregion
|
|
1201
|
+
//#region src/types/shared.d.ts
|
|
1260
1202
|
/**
|
|
1261
1203
|
* Abstract wrapper over an Anki Connect action / response
|
|
1262
1204
|
*/
|
|
1263
1205
|
type Request<Action extends string, Version extends AnkiConnectVersion, Params = never, Result = null> = {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1206
|
+
action: Action;
|
|
1207
|
+
params: Params;
|
|
1208
|
+
response: {
|
|
1209
|
+
error: null | string;
|
|
1210
|
+
result: Result;
|
|
1211
|
+
};
|
|
1212
|
+
version: Version;
|
|
1271
1213
|
};
|
|
1272
1214
|
/**
|
|
1273
1215
|
* Requests
|
|
1274
1216
|
*/
|
|
1275
1217
|
type Requests = CardRequests | DeckRequests | GraphicalRequests | MediaRequests | MiscellaneousRequests | ModelRequests | NoteRequests | StatisticRequests;
|
|
1276
1218
|
type AnkiConnectVersion = 6;
|
|
1277
|
-
type ParamsForAction<T extends Requests['action']> = Extract<Requests, {
|
|
1278
|
-
|
|
1219
|
+
type ParamsForAction<T$1 extends Requests['action']> = Extract<Requests, {
|
|
1220
|
+
action: T$1;
|
|
1279
1221
|
}>['params'];
|
|
1280
|
-
|
|
1222
|
+
//#endregion
|
|
1223
|
+
//#region src/types/card.d.ts
|
|
1224
|
+
type CardBrowserColumns = 'answer' | 'cardDue' | 'cardEase' | 'cardIvl' | 'cardLapses' | 'cardMod' | 'cardReps' | 'deck' | 'note' | 'noteCrt' | 'noteFld' | 'noteMod' | 'noteTags' | 'question' | 'template' | (string & {});
|
|
1225
|
+
type CardValueKeys = 'data' | 'did' | 'due' | 'factor' | 'flags' | 'id' | 'ivl' | 'lapses' | 'left' | 'mod' | 'odid' | 'odue' | 'ord' | 'queue' | 'reps' | 'type' | 'usn';
|
|
1226
|
+
type CardInfo = {
|
|
1227
|
+
answer: string;
|
|
1228
|
+
buttons?: number[];
|
|
1229
|
+
cardId: number;
|
|
1230
|
+
css: string;
|
|
1231
|
+
deckName: string;
|
|
1232
|
+
due: number;
|
|
1233
|
+
fieldOrder: number;
|
|
1234
|
+
fields: Record<string, {
|
|
1235
|
+
order: number;
|
|
1236
|
+
value: string;
|
|
1237
|
+
}>;
|
|
1238
|
+
interval: number;
|
|
1239
|
+
lapses: number;
|
|
1240
|
+
left: number;
|
|
1241
|
+
mod: number;
|
|
1242
|
+
modelName: string;
|
|
1243
|
+
nextReviews: string[];
|
|
1244
|
+
note: number;
|
|
1245
|
+
ord: number;
|
|
1246
|
+
question: string;
|
|
1247
|
+
queue: number;
|
|
1248
|
+
reps: number;
|
|
1249
|
+
template: string;
|
|
1250
|
+
type: number;
|
|
1251
|
+
};
|
|
1252
|
+
type CardRequests = Request<'answerCards', 6, {
|
|
1253
|
+
answers: Array<{
|
|
1254
|
+
cardId: number;
|
|
1255
|
+
ease: number;
|
|
1256
|
+
}>;
|
|
1257
|
+
}, boolean[]> | Request<'areDue', 6, {
|
|
1258
|
+
cards: number[];
|
|
1259
|
+
}, boolean[]> | Request<'areSuspended', 6, {
|
|
1260
|
+
cards: number[];
|
|
1261
|
+
}, Array<boolean | null>> | Request<'cardsInfo', 6, {
|
|
1262
|
+
cards: number[];
|
|
1263
|
+
}, CardInfo[]> | Request<'cardsModTime', 6, {
|
|
1264
|
+
cards: number[];
|
|
1265
|
+
}, {
|
|
1266
|
+
cardId: number;
|
|
1267
|
+
mod: number;
|
|
1268
|
+
}> | Request<'cardsToNotes', 6, {
|
|
1269
|
+
cards: number[];
|
|
1270
|
+
}, number[]> | Request<'findCards', 6, {
|
|
1271
|
+
query: string;
|
|
1272
|
+
}, number[]> | Request<'forgetCards', 6, {
|
|
1273
|
+
cards: number[];
|
|
1274
|
+
}> | Request<'getEaseFactors', 6, {
|
|
1275
|
+
cards: number[];
|
|
1276
|
+
}, number[]> | Request<'getIntervals', 6, {
|
|
1277
|
+
cards: number[];
|
|
1278
|
+
complete?: boolean;
|
|
1279
|
+
}, number[] | number[][]> | Request<'relearnCards', 6, {
|
|
1280
|
+
cards: number[];
|
|
1281
|
+
}> | Request<'setDueDate', 6, {
|
|
1282
|
+
cards: number[];
|
|
1283
|
+
days: string;
|
|
1284
|
+
}, boolean> | Request<'setEaseFactors', 6, {
|
|
1285
|
+
cards: number[];
|
|
1286
|
+
easeFactors: number[];
|
|
1287
|
+
}, boolean[]> | Request<'setSpecificValueOfCard', 6, {
|
|
1288
|
+
card: number;
|
|
1289
|
+
keys: CardValueKeys[];
|
|
1290
|
+
newValues: string[];
|
|
1291
|
+
}, boolean[]> | Request<'suspend', 6, {
|
|
1292
|
+
cards: number[];
|
|
1293
|
+
}, boolean> | Request<'suspended', 6, {
|
|
1294
|
+
card: number;
|
|
1295
|
+
}, boolean> | Request<'unsuspend', 6, {
|
|
1296
|
+
cards: number[];
|
|
1297
|
+
}, boolean>;
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region src/client.d.ts
|
|
1281
1300
|
/**
|
|
1282
1301
|
* Subset of built-in Fetch interface that's actually used by Anki, for ease of
|
|
1283
1302
|
* external re-implementation when passing a custom fetch function to
|
|
1284
1303
|
* YankiClient.
|
|
1285
1304
|
*/
|
|
1286
1305
|
type YankiFetchAdapter = (input: string, init?: {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1306
|
+
body?: string;
|
|
1307
|
+
headers?: Record<string, string>;
|
|
1308
|
+
method?: string;
|
|
1309
|
+
mode?: RequestMode;
|
|
1291
1310
|
}) => Promise<undefined | {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1311
|
+
headers: Headers | Record<string, string>;
|
|
1312
|
+
json(): Promise<any>;
|
|
1313
|
+
status: number;
|
|
1295
1314
|
}>;
|
|
1296
1315
|
/** Optional options to pass when instantiating a new YankiConnect instance. */
|
|
1297
1316
|
type YankiConnectOptions = {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1317
|
+
/**
|
|
1318
|
+
* Attempt to open the desktop Anki.app if it's not already running.
|
|
1319
|
+
*
|
|
1320
|
+
* - `true` will always attempt to open Anki _when a request is made_. This
|
|
1321
|
+
* might introduce significant latency on the first launch.
|
|
1322
|
+
* - `false` will never attempt to open Anki. Requests will fail until
|
|
1323
|
+
* something or someone else opens the Anki app.
|
|
1324
|
+
* - `immediately` is a special option that will open Anki when the client is
|
|
1325
|
+
* instantiated.
|
|
1326
|
+
*
|
|
1327
|
+
* The Anki desktop app must be running for the client and the underlying
|
|
1328
|
+
* Anki-Connect service to work.
|
|
1329
|
+
*
|
|
1330
|
+
* Currently supported on macOS only.
|
|
1331
|
+
*
|
|
1332
|
+
* The client does not attempt to close the app.
|
|
1333
|
+
* @default false
|
|
1334
|
+
*/
|
|
1335
|
+
autoLaunch: 'immediately' | boolean;
|
|
1336
|
+
/**
|
|
1337
|
+
* Advanced option to customize the resource fetch implementation used to make requests to Anki-Connect.
|
|
1338
|
+
*
|
|
1339
|
+
* Note that the signature reflects the subset of the built-in Fetch interface that's actually used by yanki-connect.
|
|
1340
|
+
*
|
|
1341
|
+
* The exact signature of this option is subject to change in the future.
|
|
1342
|
+
* @default fetch
|
|
1343
|
+
*/
|
|
1344
|
+
fetchAdapter: undefined | YankiFetchAdapter;
|
|
1345
|
+
/**
|
|
1346
|
+
* Host where the Anki-Connect service is running.
|
|
1347
|
+
* @default 'http://127.0.0.1'
|
|
1348
|
+
*/
|
|
1349
|
+
host: string;
|
|
1350
|
+
/**
|
|
1351
|
+
* Anki-Connect security key (optional)
|
|
1352
|
+
* @default undefined
|
|
1353
|
+
*/
|
|
1354
|
+
key: string | undefined;
|
|
1355
|
+
/**
|
|
1356
|
+
* Port where the Anki-Connect service is running.
|
|
1357
|
+
* @default 8765
|
|
1358
|
+
*/
|
|
1359
|
+
port: number;
|
|
1360
|
+
/**
|
|
1361
|
+
* Anki-Connect API version.
|
|
1362
|
+
*
|
|
1363
|
+
* Only API version 6 is supported for now.
|
|
1364
|
+
* @default 6
|
|
1365
|
+
*/
|
|
1366
|
+
version: AnkiConnectVersion;
|
|
1348
1367
|
};
|
|
1349
1368
|
|
|
1350
1369
|
declare const yankiModels: [{
|
|
@@ -1546,7 +1565,8 @@ type SyncNotesResult = Simplify<Pick<GlobalOptions, 'ankiWeb' | 'dryRun' | 'name
|
|
|
1546
1565
|
* Syncs local notes to Anki.
|
|
1547
1566
|
* @param allLocalNotes All the YankiNotes to sync
|
|
1548
1567
|
* @returns The synced notes (with new IDs where applicable), plus some stats
|
|
1549
|
-
* about the sync
|
|
1568
|
+
* about the sync
|
|
1569
|
+
* @throws {Error} For various reasons...
|
|
1550
1570
|
*/
|
|
1551
1571
|
declare function syncNotes(allLocalNotes: YankiNote[], options?: PartialDeep<SyncNotesOptions>): Promise<SyncNotesResult>;
|
|
1552
1572
|
|