yanki 2.0.10 → 2.0.12

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.
@@ -115,8 +115,8 @@ const update2: UpdateOperation<User> = {
115
115
  @category Utilities
116
116
  */
117
117
  type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
118
- ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
119
- : never;
118
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
119
+ : never; // Should never happen
120
120
  //#endregion
121
121
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/required-keys-of.d.ts
122
122
  /**
@@ -150,7 +150,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
150
150
  @category Utilities
151
151
  */
152
152
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
153
- ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
153
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
154
154
  //#endregion
155
155
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
156
156
  /**
@@ -380,7 +380,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
380
380
  @see {@link SimplifyDeep}
381
381
  @category Object
382
382
  */
383
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
383
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
384
384
  //#endregion
385
385
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
386
386
  /**
@@ -505,7 +505,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
505
505
  @see {@link PickIndexSignature}
506
506
  @category Object
507
507
  */
508
- type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
508
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
509
509
  //#endregion
510
510
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/pick-index-signature.d.ts
511
511
  /**
@@ -553,11 +553,11 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
553
553
  @see {@link OmitIndexSignature}
554
554
  @category Object
555
555
  */
556
- type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
556
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
557
557
  //#endregion
558
558
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/merge.d.ts
559
559
  // Merges two objects without worrying about index signatures.
560
- type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
560
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
561
561
  /**
562
562
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
563
563
 
@@ -621,10 +621,9 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
621
621
  @category Object
622
622
  */
623
623
  type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
624
- ? Source extends unknown // For distributing `Source`
625
- ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
626
- : never;
627
- // Should never happen
624
+ ? Source extends unknown // For distributing `Source`
625
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
626
+ : never; // Should never happen
628
627
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
629
628
  //#endregion
630
629
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/object.d.ts
@@ -680,36 +679,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
680
679
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
681
680
  ```
682
681
  */
683
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
684
- ? Result : never;
685
- type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key] }>>>;
686
- /**
687
- Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
688
-
689
- Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
690
-
691
- Use-case: For collapsing unions created using {@link LiteralUnion}.
692
-
693
- @example
694
- ```
695
- import type {LiteralUnion} from 'type-fest';
696
-
697
- type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
698
- //=> string
699
-
700
- type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
701
- //=> number
702
-
703
- type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
704
- //=> `on${string}`
705
-
706
- type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
707
- //=> 'click' | 'change' | `on${string}`
708
-
709
- type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
710
- //=> string | null | undefined
711
- ```
712
- */
682
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
683
+ ) ? Result : never;
684
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
713
685
  //#endregion
714
686
  //#region node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/partial-deep.d.ts
715
687
  /**
@@ -717,26 +689,34 @@ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined
717
689
  */
718
690
  type PartialDeepOptions = {
719
691
  /**
720
- Whether to affect the individual elements of arrays and tuples.
721
- @default false
722
- */
692
+ Whether to affect the individual elements of arrays and tuples.
693
+
694
+ @default false
695
+ */
723
696
  readonly recurseIntoArrays?: boolean;
724
697
  /**
725
- Allows `undefined` values in non-tuple arrays.
726
- - When set to `true`, elements of non-tuple arrays can be `undefined`.
727
- - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
728
- @default false
729
- @example
730
- You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
731
- ```
732
- import type {PartialDeep} from 'type-fest';
733
- type Settings = {
734
- languages: string[];
735
- };
736
- declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
737
- partialSettings.languages = [undefined]; // OK
738
- ```
739
- */
698
+ Allows `undefined` values in non-tuple arrays.
699
+
700
+ - When set to `true`, elements of non-tuple arrays can be `undefined`.
701
+ - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
702
+
703
+ @default false
704
+
705
+ @example
706
+ You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
707
+
708
+ ```
709
+ import type {PartialDeep} from 'type-fest';
710
+
711
+ type Settings = {
712
+ languages: string[];
713
+ };
714
+
715
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
716
+
717
+ partialSettings.languages = [undefined]; // OK
718
+ ```
719
+ */
740
720
  readonly allowUndefinedInNonTupleArrays?: boolean;
741
721
  };
742
722
  type DefaultPartialDeepOptions = {
@@ -798,12 +778,12 @@ partialShape.dimensions = [15]; // OK
798
778
  */
799
779
  type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
800
780
  type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T // For functions with no properties
801
- : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
802
- ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
803
- ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
804
- ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
805
- : T // If they don't opt into array testing, just use the original type
806
- : PartialObjectDeep<T, Options> : unknown;
781
+ : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
782
+ ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
783
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
784
+ ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
785
+ : T // If they don't opt into array testing, just use the original type
786
+ : PartialObjectDeep<T, Options> : unknown;
807
787
  /**
808
788
  Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
809
789
  */
@@ -823,9 +803,9 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
823
803
  /**
824
804
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
825
805
  */
826
- type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
806
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>; };
827
807
  //#endregion
828
- //#region node_modules/.pnpm/yanki-connect@4.0.6/node_modules/yanki-connect/dist/index.d.ts
808
+ //#region node_modules/.pnpm/yanki-connect@4.0.7/node_modules/yanki-connect/dist/index.d.ts
829
809
  //#region src/types/deck.d.ts
830
810
  type DeckStats = {
831
811
  deck_id: number;
@@ -893,7 +873,8 @@ type DeckRequests = Request<'changeDeck', 6, {
893
873
  }, boolean> | Request<'setDeckConfigId', 6, {
894
874
  configId: number;
895
875
  decks: string[];
896
- }, boolean>; //#endregion
876
+ }, boolean>;
877
+ //#endregion
897
878
  //#region src/types/note.d.ts
898
879
  type NoteModel = 'Basic' | 'Basic (and reversed card)' | 'Basic (type in the answer)' | 'Cloze' | (string & {});
899
880
  type NoteMedia = {
@@ -1005,7 +986,8 @@ type NoteRequests = Request<'addNote', 6, {
1005
986
  }> | Request<'updateNoteTags', 6, {
1006
987
  note: number;
1007
988
  tags: string[];
1008
- }>; //#endregion
989
+ }>;
990
+ //#endregion
1009
991
  //#region src/types/graphical.d.ts
1010
992
  type GraphicalRequests = Request<'guiAddCards', 6, {
1011
993
  note: Note;
@@ -1029,7 +1011,8 @@ type GraphicalRequests = Request<'guiAddCards', 6, {
1029
1011
  card: number;
1030
1012
  }, boolean> | Request<'guiSelectedNotes', 6, never, number[]> | Request<'guiSelectNote', 6, {
1031
1013
  note: number;
1032
- }, boolean> | Request<'guiShowAnswer', 6, never, boolean> | Request<'guiShowQuestion', 6, never, boolean> | Request<'guiStartCardTimer', 6, never, true> | Request<'guiUndo', 6, never, boolean>; //#endregion
1014
+ }, boolean> | Request<'guiShowAnswer', 6, never, boolean> | Request<'guiShowQuestion', 6, never, boolean> | Request<'guiStartCardTimer', 6, never, true> | Request<'guiUndo', 6, never, boolean>;
1015
+ //#endregion
1033
1016
  //#region src/types/media.d.ts
1034
1017
  type MediaRequests = Request<'deleteMediaFile', 6, {
1035
1018
  filename: string;
@@ -1043,7 +1026,8 @@ type MediaRequests = Request<'deleteMediaFile', 6, {
1043
1026
  filename: string;
1044
1027
  path?: string;
1045
1028
  url?: string;
1046
- }, string>; //#endregion
1029
+ }, string>;
1030
+ //#endregion
1047
1031
  //#region src/types/miscellaneous.d.ts
1048
1032
  type MiscellaneousRequests = Request<'apiReflect', 6, {
1049
1033
  actions: null | string[];
@@ -1059,8 +1043,8 @@ type MiscellaneousRequests = Request<'apiReflect', 6, {
1059
1043
  path: string;
1060
1044
  }, boolean> | Request<'loadProfile', 6, {
1061
1045
  name: string;
1062
- }, true> | Request<'multi', 6, // Crazy, have to call this experimental
1063
- {
1046
+ }, true> | Request<'multi', 6 // Crazy, have to call this experimental
1047
+ , {
1064
1048
  actions: Array<{
1065
1049
  action: Requests['action'];
1066
1050
  params?: Requests['params'];
@@ -1075,7 +1059,8 @@ type MiscellaneousRequests = Request<'apiReflect', 6, {
1075
1059
  permission: 'granted';
1076
1060
  requireApiKey: boolean;
1077
1061
  version: boolean;
1078
- }> | Request<'sync', 6> | Request<'version', 6, never, number>; //#endregion
1062
+ }> | Request<'sync', 6> | Request<'version', 6, never, number>;
1063
+ //#endregion
1079
1064
  //#region src/types/model.d.ts
1080
1065
  type ModelField = {
1081
1066
  collapsed: boolean;
@@ -1226,7 +1211,8 @@ type ModelRequests = Request<'createModel', 6, ModelToCreate, Model> | Request<'
1226
1211
  Front?: string;
1227
1212
  }>;
1228
1213
  };
1229
- }>; //#endregion
1214
+ }>;
1215
+ //#endregion
1230
1216
  //#region src/types/statistic.d.ts
1231
1217
  type ReviewStatisticTuple = [reviewTime: number, cardID: number, usn: number, buttonPressed: number, newInterval: number, previousInterval: number, newFactor: number, reviewDuration: number, reviewType: number];
1232
1218
  type StatisticRequests = Request<'cardReviews', 6, {
@@ -1239,17 +1225,26 @@ type StatisticRequests = Request<'cardReviews', 6, {
1239
1225
  }, number> | Request<'getNumCardsReviewedByDay', 6, never, Array<[string, number]>> | Request<'getNumCardsReviewedToday', 6, never, number> | Request<'getReviewsOfCards', 6, {
1240
1226
  cards: string[];
1241
1227
  }, Record<string, Array<{
1242
- /** ButtonPressed */ease: number; /** NewFactor */
1243
- factor: number; /** ReviewTime */
1244
- id: number; /** NewInterval */
1245
- ivl: number; /** PreviousInterval */
1246
- lastIvl: number; /** ReviewDuration */
1247
- time: number; /** ReviewType */
1248
- type: number; /** Usn */
1228
+ /** ButtonPressed */
1229
+ ease: number;
1230
+ /** NewFactor */
1231
+ factor: number;
1232
+ /** ReviewTime */
1233
+ id: number;
1234
+ /** NewInterval */
1235
+ ivl: number;
1236
+ /** PreviousInterval */
1237
+ lastIvl: number;
1238
+ /** ReviewDuration */
1239
+ time: number;
1240
+ /** ReviewType */
1241
+ type: number;
1242
+ /** Usn */
1249
1243
  usn: number;
1250
1244
  }>>> | Request<'insertReviews', 6, {
1251
1245
  reviews: ReviewStatisticTuple[];
1252
- }>; //#endregion
1246
+ }>;
1247
+ //#endregion
1253
1248
  //#region src/types/shared.d.ts
1254
1249
  /**
1255
1250
  * Abstract wrapper over an Anki Connect action / response
@@ -1346,7 +1341,8 @@ type CardRequests = Request<'answerCards', 6, {
1346
1341
  card: number;
1347
1342
  }, boolean> | Request<'unsuspend', 6, {
1348
1343
  cards: number[];
1349
- }, boolean>; //#endregion
1344
+ }, boolean>;
1345
+ //#endregion
1350
1346
  //#region src/client.d.ts
1351
1347
  /**
1352
1348
  * Subset of built-in Fetch interface that's actually used by Anki, for ease of
@@ -1533,8 +1529,10 @@ type GlobalOptions = {
1533
1529
  * user-specified file names in other cases.
1534
1530
  */
1535
1531
  maxFilenameLength: number;
1536
- namespace: string; /** Ensures that wiki-style links work correctly */
1537
- obsidianVault: string | undefined; /** Exposed for testing only */
1532
+ namespace: string;
1533
+ /** Ensures that wiki-style links work correctly */
1534
+ obsidianVault: string | undefined;
1535
+ /** Exposed for testing only */
1538
1536
  resolveUrls: boolean;
1539
1537
  /**
1540
1538
  * Whether to treat single newlines in Markdown as line breaks in the
@@ -1546,7 +1544,8 @@ type GlobalOptions = {
1546
1544
  * be equivalent, don't match local notes with "orphaned" remote notes based
1547
1545
  * on content
1548
1546
  */
1549
- strictMatching: boolean; /** Sync image, video, and audio assets to Anki's media storage system */
1547
+ strictMatching: boolean;
1548
+ /** Sync image, video, and audio assets to Anki's media storage system */
1550
1549
  syncMediaAssets: SyncMediaAssets;
1551
1550
  };
1552
1551
  //#endregion
@@ -1595,12 +1594,12 @@ type LocalNote = {
1595
1594
  };
1596
1595
  //#endregion
1597
1596
  //#region src/lib/actions/rename.d.ts
1598
- type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength'
1597
+ type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength' |
1599
1598
  /**
1600
1599
  * Included because this can technically change the content of the "first
1601
1600
  * line" of a card
1602
1601
  */
1603
- | 'strictLineBreaks'>;
1602
+ 'strictLineBreaks'>;
1604
1603
  type RenameFilesResult = {
1605
1604
  dryRun: boolean;
1606
1605
  notes: LocalNote[];