yanki 2.0.4 → 2.0.5

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.
@@ -1,4 +1,4 @@
1
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/primitive.d.ts
1
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/primitive.d.ts
2
2
  /**
3
3
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
4
4
 
@@ -6,7 +6,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
6
6
  */
7
7
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
8
8
  //#endregion
9
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-any.d.ts
9
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-any.d.ts
10
10
  /**
11
11
  Returns a boolean for whether the given type is `any`.
12
12
 
@@ -37,7 +37,7 @@ const anyA = get(anyObject, 'a');
37
37
  */
38
38
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
39
39
  //#endregion
40
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-optional-key-of.d.ts
40
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-optional-key-of.d.ts
41
41
  /**
42
42
  Returns a boolean for whether the given key is an optional key of type.
43
43
 
@@ -80,7 +80,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
80
80
  */
81
81
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
82
82
  //#endregion
83
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/optional-keys-of.d.ts
83
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/optional-keys-of.d.ts
84
84
  /**
85
85
  Extract all optional keys from the given type.
86
86
 
@@ -118,7 +118,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
118
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
119
  : never;
120
120
  //#endregion
121
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/required-keys-of.d.ts
121
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/required-keys-of.d.ts
122
122
  /**
123
123
  Extract all required keys from the given type.
124
124
 
@@ -152,7 +152,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
152
152
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
153
153
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
154
154
  //#endregion
155
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-never.d.ts
155
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-never.d.ts
156
156
  /**
157
157
  Returns a boolean for whether the given type is `never`.
158
158
 
@@ -208,7 +208,7 @@ type B = IsTrueFixed<never>;
208
208
  */
209
209
  type IsNever<T> = [T] extends [never] ? true : false;
210
210
  //#endregion
211
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/if.d.ts
211
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/if.d.ts
212
212
  /**
213
213
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
214
214
 
@@ -303,7 +303,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
303
303
  */
304
304
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
305
305
  //#endregion
306
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/type.d.ts
306
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/type.d.ts
307
307
  /**
308
308
  Matches any primitive, `void`, `Date`, or `RegExp` value.
309
309
  */
@@ -321,7 +321,7 @@ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T
321
321
  (...arguments_: infer B): unknown;
322
322
  } ? B extends A ? A extends B ? false : true : true : false;
323
323
  //#endregion
324
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/simplify.d.ts
324
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/simplify.d.ts
325
325
  /**
326
326
  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.
327
327
 
@@ -382,7 +382,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
382
382
  */
383
383
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
384
384
  //#endregion
385
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-equal.d.ts
385
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-equal.d.ts
386
386
  /**
387
387
  Returns a boolean for whether the two given types are equal.
388
388
 
@@ -413,7 +413,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
413
413
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
414
414
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
415
415
  //#endregion
416
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/omit-index-signature.d.ts
416
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/omit-index-signature.d.ts
417
417
  /**
418
418
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
419
419
 
@@ -507,7 +507,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
507
507
  */
508
508
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
509
509
  //#endregion
510
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/pick-index-signature.d.ts
510
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/pick-index-signature.d.ts
511
511
  /**
512
512
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
513
513
 
@@ -555,7 +555,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
555
555
  */
556
556
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
557
557
  //#endregion
558
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/merge.d.ts
558
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/merge.d.ts
559
559
  // Merges two objects without worrying about index signatures.
560
560
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
561
561
  /**
@@ -627,7 +627,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
627
627
  // Should never happen
628
628
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
629
629
  //#endregion
630
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/object.d.ts
630
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/object.d.ts
631
631
  /**
632
632
  Merges user specified options with default options.
633
633
 
@@ -682,7 +682,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
682
682
  */
683
683
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
684
684
  //#endregion
685
- //#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/partial-deep.d.ts
685
+ //#region node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/partial-deep.d.ts
686
686
  /**
687
687
  @see {@link PartialDeep}
688
688
  */
@@ -715,12 +715,14 @@ type DefaultPartialDeepOptions = {
715
715
  allowUndefinedInNonTupleArrays: false;
716
716
  };
717
717
  /**
718
- Create a type from another type with all keys and nested keys set to optional.
718
+ Create a deeply optional version of another type.
719
719
 
720
720
  Use-cases:
721
721
  - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
722
722
  - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
723
723
 
724
+ Use [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) if you only need one level deep.
725
+
724
726
  @example
725
727
  ```
726
728
  import type {PartialDeep} from 'type-fest';
@@ -794,7 +796,7 @@ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for
794
796
  */
795
797
  type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
796
798
  //#endregion
797
- //#region node_modules/.pnpm/yanki-connect@4.0.2/node_modules/yanki-connect/dist/index.d.ts
799
+ //#region node_modules/.pnpm/yanki-connect@4.0.3/node_modules/yanki-connect/dist/index.d.ts
798
800
  //#region src/types/deck.d.ts
799
801
  type DeckStats = {
800
802
  deck_id: number;
@@ -1338,11 +1340,11 @@ type YankiConnectOptions = {
1338
1340
  * Attempt to open the desktop Anki.app if it's not already running.
1339
1341
  *
1340
1342
  * - `true` will always attempt to open Anki _when a request is made_. This
1341
- * might introduce significant latency on the first launch.
1342
- * - `false` will never attempt to open Anki. Requests will fail until
1343
- * something or someone else opens the Anki app.
1344
- * - `immediately` is a special option that will open Anki when the client is
1345
- * instantiated.
1343
+ * might introduce significant latency on the first launch.
1344
+ * - `false` will never attempt to open Anki. Requests will fail until something
1345
+ * or someone else opens the Anki app.
1346
+ * - `immediately` is a special option that will open Anki when the client is
1347
+ * instantiated.
1346
1348
  *
1347
1349
  * The Anki desktop app must be running for the client and the underlying
1348
1350
  * Anki-Connect service to work.
@@ -1350,30 +1352,37 @@ type YankiConnectOptions = {
1350
1352
  * Currently supported on macOS only.
1351
1353
  *
1352
1354
  * The client does not attempt to close the app.
1355
+ *
1353
1356
  * @default false
1354
1357
  */
1355
1358
  autoLaunch: 'immediately' | boolean;
1356
1359
  /**
1357
- * Advanced option to customize the resource fetch implementation used to make requests to Anki-Connect.
1360
+ * Advanced option to customize the resource fetch implementation used to make
1361
+ * requests to Anki-Connect.
1358
1362
  *
1359
- * Note that the signature reflects the subset of the built-in Fetch interface that's actually used by yanki-connect.
1363
+ * Note that the signature reflects the subset of the built-in Fetch interface
1364
+ * that's actually used by yanki-connect.
1360
1365
  *
1361
1366
  * The exact signature of this option is subject to change in the future.
1367
+ *
1362
1368
  * @default fetch
1363
1369
  */
1364
1370
  fetchAdapter: undefined | YankiFetchAdapter;
1365
1371
  /**
1366
1372
  * Host where the Anki-Connect service is running.
1373
+ *
1367
1374
  * @default 'http://127.0.0.1'
1368
1375
  */
1369
1376
  host: string;
1370
1377
  /**
1371
1378
  * Anki-Connect security key (optional)
1379
+ *
1372
1380
  * @default undefined
1373
1381
  */
1374
1382
  key: string | undefined;
1375
1383
  /**
1376
1384
  * Port where the Anki-Connect service is running.
1385
+ *
1377
1386
  * @default 8765
1378
1387
  */
1379
1388
  port: number;
@@ -1381,6 +1390,7 @@ type YankiConnectOptions = {
1381
1390
  * Anki-Connect API version.
1382
1391
  *
1383
1392
  * Only API version 6 is supported for now.
1393
+ *
1384
1394
  * @default 6
1385
1395
  */
1386
1396
  version: AnkiConnectVersion;
@@ -1467,20 +1477,32 @@ type GlobalOptions = {
1467
1477
  * invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync"
1468
1478
  * button in the Anki app.
1469
1479
  */
1470
- ankiWeb: boolean; /** Override where "/" should resolve to... useful in Obsidian to set the vault path as the "root" */
1471
- basePath: string | undefined; /** Run Anki's "Check Database" command after sync updates that might produce card corruption */
1480
+ ankiWeb: boolean;
1481
+ /**
1482
+ * Override where "/" should resolve to... useful in Obsidian to set the vault
1483
+ * path as the "root"
1484
+ */
1485
+ basePath: string | undefined;
1486
+ /**
1487
+ * Run Anki's "Check Database" command after sync updates that might produce
1488
+ * card corruption
1489
+ */
1472
1490
  checkDatabase: boolean;
1473
1491
  cwd: string;
1474
1492
  dryRun: boolean;
1475
1493
  /**
1476
1494
  * Exposed for Obsidian, currently only used for getting URL content hashes
1477
- * and inferring MIME types of URLs without extensions.
1478
- * Note that ankiConnectOptions ALSO has a fetch adapter option specifically
1479
- * for communicating with Anki-Connect.
1495
+ * and inferring MIME types of URLs without extensions. Note that
1496
+ * ankiConnectOptions ALSO has a fetch adapter option specifically for
1497
+ * communicating with Anki-Connect.
1480
1498
  */
1481
1499
  fetchAdapter: FetchAdapter | undefined;
1482
1500
  fileAdapter: FileAdapter | undefined;
1483
- manageFilenames: ManageFilenames; /** Only applies if manageFilenames is `true`. Will _not_ truncate user-specified file names in other cases. */
1501
+ manageFilenames: ManageFilenames;
1502
+ /**
1503
+ * Only applies if manageFilenames is `true`. Will _not_ truncate
1504
+ * user-specified file names in other cases.
1505
+ */
1484
1506
  maxFilenameLength: number;
1485
1507
  namespace: string; /** Ensures that wiki-style links work correctly */
1486
1508
  obsidianVault: string | undefined; /** Exposed for testing only */
@@ -1489,7 +1511,12 @@ type GlobalOptions = {
1489
1511
  * Whether to treat single newlines in Markdown as line breaks in the
1490
1512
  * resulting HTML (Obsidian has an application-level setting for this)
1491
1513
  */
1492
- strictLineBreaks: boolean; /** Only consider exact noteId matches between the local and remote copies to be equivalent, don't match local notes with "orphaned" remote notes based on content */
1514
+ strictLineBreaks: boolean;
1515
+ /**
1516
+ * Only consider exact noteId matches between the local and remote copies to
1517
+ * be equivalent, don't match local notes with "orphaned" remote notes based
1518
+ * on content
1519
+ */
1493
1520
  strictMatching: boolean; /** Sync image, video, and audio assets to Anki's media storage system */
1494
1521
  syncMediaAssets: SyncMediaAssets;
1495
1522
  };
@@ -1507,8 +1534,10 @@ type CleanResult = Simplify<Pick<GlobalOptions, 'ankiWeb' | 'dryRun' | 'namespac
1507
1534
  * Deletes all remote notes in Anki associated with the given namespace.
1508
1535
  *
1509
1536
  * Use with significant caution. Mostly useful for testing.
1537
+ *
1510
1538
  * @returns The IDs of the notes that were deleted
1511
- * @throws {Error} If Anki is unreachable or another error occurs during deletion.
1539
+ * @throws {Error} If Anki is unreachable or another error occurs during
1540
+ * deletion.
1512
1541
  */
1513
1542
  declare function cleanNotes(options?: PartialDeep<CleanOptions>): Promise<CleanResult>;
1514
1543
  declare function formatCleanResult(result: CleanResult, verbose?: boolean): string;
@@ -1537,7 +1566,12 @@ type LocalNote = {
1537
1566
  };
1538
1567
  //#endregion
1539
1568
  //#region src/lib/actions/rename.d.ts
1540
- type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength' /** Included because this can technically change the content of the "first line" of a card */ | 'strictLineBreaks'>;
1569
+ type RenameNotesOptions = Pick<GlobalOptions, 'dryRun' | 'fileAdapter' | 'manageFilenames' | 'maxFilenameLength'
1570
+ /**
1571
+ * Included because this can technically change the content of the "first
1572
+ * line" of a card
1573
+ */
1574
+ | 'strictLineBreaks'>;
1541
1575
  type RenameFilesResult = {
1542
1576
  dryRun: boolean;
1543
1577
  notes: LocalNote[];
@@ -1584,9 +1618,11 @@ type SyncNotesResult = Simplify<Pick<GlobalOptions, 'ankiWeb' | 'dryRun' | 'name
1584
1618
  }>;
1585
1619
  /**
1586
1620
  * Syncs local notes to Anki.
1621
+ *
1587
1622
  * @param allLocalNotes All the YankiNotes to sync
1623
+ *
1588
1624
  * @returns The synced notes (with new IDs where applicable), plus some stats
1589
- * about the sync
1625
+ * about the sync
1590
1626
  * @throws {Error} For various reasons...
1591
1627
  */
1592
1628
  declare function syncNotes(allLocalNotes: YankiNote[], options?: PartialDeep<SyncNotesOptions>): Promise<SyncNotesResult>;
@@ -1608,9 +1644,11 @@ type SyncFilesResult = Simplify<Omit<SyncNotesResult, 'synced'> & {
1608
1644
  *
1609
1645
  * Most importantly, it updates the note IDs in the frontmatter of the local
1610
1646
  * files.
1647
+ *
1611
1648
  * @param allLocalFilePaths Array of paths to the local markdown files
1649
+ *
1612
1650
  * @returns The synced files (with new IDs where applicable), plus some stats
1613
- * about the sync
1651
+ * about the sync
1614
1652
  * @throws {Error} If syncing fails or file operations encounter an error.
1615
1653
  */
1616
1654
  declare function syncFiles(allLocalFilePaths: string[], options?: PartialDeep<SyncFilesOptions>): Promise<SyncFilesResult>;