es-git 0.5.0-next.170 → 0.5.0-next.171

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.
Files changed (3) hide show
  1. package/index.d.ts +244 -0
  2. package/index.js +3 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -2374,6 +2374,200 @@ export declare class Reference {
2374
2374
  rename(newName: string, options?: RenameReferenceOptions | undefined | null): Reference
2375
2375
  }
2376
2376
 
2377
+ /** A class to represent a git reflog. */
2378
+ export declare class Reflog {
2379
+ /**
2380
+ * Append a new entry to the reflog.
2381
+ *
2382
+ * @category Reflog/Methods
2383
+ *
2384
+ * @signature
2385
+ * ```ts
2386
+ * class Reflog {
2387
+ * append(newOid: string, committer: Signature, msg?: string | null | undefined): void;
2388
+ * }
2389
+ * ```
2390
+ *
2391
+ * @param {string} newOid - New object ID (SHA1) for this reflog entry.
2392
+ * @param {Signature} committer - Committer signature for this reflog entry.
2393
+ * @param {string} [msg] - Optional message for this reflog entry.
2394
+ * @throws Throws error if the OID is invalid or if appending fails.
2395
+ */
2396
+ append(newOid: string, committer: Signature, msg?: string | undefined | null): void
2397
+ /**
2398
+ * Remove an entry from the reflog.
2399
+ *
2400
+ * @category Reflog/Methods
2401
+ *
2402
+ * @signature
2403
+ * ```ts
2404
+ * class Reflog {
2405
+ * remove(i: number, rewritePreviousEntry?: boolean): void;
2406
+ * }
2407
+ * ```
2408
+ *
2409
+ * @param {number} i - Index of the entry to remove.
2410
+ * @param {boolean} [rewritePreviousEntry] - Whether to rewrite the previous entry. Defaults to 'false'.
2411
+ * @throws Throws error if the index is invalid or if removal fails.
2412
+ */
2413
+ remove(i: number, rewritePreviousEntry?: boolean | undefined | null): void
2414
+ /**
2415
+ * Get a reflog entry by index.
2416
+ *
2417
+ * @category Reflog/Methods
2418
+ *
2419
+ * @signature
2420
+ * ```ts
2421
+ * class Reflog {
2422
+ * get(i: number): ReflogEntry | null;
2423
+ * }
2424
+ * ```
2425
+ *
2426
+ * @param {number} i - Index of the entry to get.
2427
+ * @returns Reflog entry at the given index. Returns `null` if the index is out of bounds.
2428
+ */
2429
+ get(i: number): ReflogEntry | null
2430
+ /**
2431
+ * Get the number of entries in the reflog.
2432
+ *
2433
+ * @category Reflog/Methods
2434
+ *
2435
+ * @signature
2436
+ * ```ts
2437
+ * class Reflog {
2438
+ * len(): number;
2439
+ * }
2440
+ * ```
2441
+ *
2442
+ * @returns Number of entries in the reflog.
2443
+ */
2444
+ len(): number
2445
+ /**
2446
+ * Check if the reflog is empty.
2447
+ *
2448
+ * @category Reflog/Methods
2449
+ *
2450
+ * @signature
2451
+ * ```ts
2452
+ * class Reflog {
2453
+ * isEmpty(): boolean;
2454
+ * }
2455
+ * ```
2456
+ *
2457
+ * @returns `true` if the reflog is empty, `false` otherwise.
2458
+ */
2459
+ isEmpty(): boolean
2460
+ /**
2461
+ * Create an iterator over the entries in the reflog.
2462
+ *
2463
+ * @category Reflog/Methods
2464
+ *
2465
+ * @signature
2466
+ * ```ts
2467
+ * class Reflog {
2468
+ * iter(): ReflogIter;
2469
+ * }
2470
+ * ```
2471
+ *
2472
+ * @returns Iterator over the reflog entries.
2473
+ */
2474
+ iter(): ReflogIter
2475
+ /**
2476
+ * Write the reflog to disk.
2477
+ *
2478
+ * @category Reflog/Methods
2479
+ *
2480
+ * @signature
2481
+ * ```ts
2482
+ * class Reflog {
2483
+ * write(): void;
2484
+ * }
2485
+ * ```
2486
+ *
2487
+ * @throws Throws error if writing fails.
2488
+ */
2489
+ write(): void
2490
+ }
2491
+
2492
+ /** A class to represent a git reflog entry. */
2493
+ export declare class ReflogEntry {
2494
+ /**
2495
+ * Get the committer of this reflog entry.
2496
+ *
2497
+ * @category ReflogEntry/Methods
2498
+ *
2499
+ * @signature
2500
+ * ```ts
2501
+ * class ReflogEntry {
2502
+ * committer(): Signature;
2503
+ * }
2504
+ * ```
2505
+ *
2506
+ * @returns Committer signature of this reflog entry.
2507
+ */
2508
+ committer(): Signature
2509
+ /**
2510
+ * Get the new object ID (SHA1) of this reflog entry.
2511
+ *
2512
+ * @category ReflogEntry/Methods
2513
+ *
2514
+ * @signature
2515
+ * ```ts
2516
+ * class ReflogEntry {
2517
+ * idNew(): string;
2518
+ * }
2519
+ * ```
2520
+ *
2521
+ * @returns New object ID (SHA1) of this reflog entry.
2522
+ */
2523
+ idNew(): string
2524
+ /**
2525
+ * Get the old object ID (SHA1) of this reflog entry.
2526
+ *
2527
+ * @category ReflogEntry/Methods
2528
+ *
2529
+ * @signature
2530
+ * ```ts
2531
+ * class ReflogEntry {
2532
+ * idOld(): string;
2533
+ * }
2534
+ * ```
2535
+ *
2536
+ * @returns Old object ID (SHA1) of this reflog entry.
2537
+ */
2538
+ idOld(): string
2539
+ /**
2540
+ * Get the message of this reflog entry.
2541
+ *
2542
+ * @category ReflogEntry/Methods
2543
+ *
2544
+ * @signature
2545
+ * ```ts
2546
+ * class ReflogEntry {
2547
+ * message(): string | null;
2548
+ * }
2549
+ * ```
2550
+ *
2551
+ * @returns Message of this reflog entry. Returns `null` if no message is present.
2552
+ * @throws Throws error if the message is not valid utf-8.
2553
+ */
2554
+ message(): string | null
2555
+ }
2556
+
2557
+ /**
2558
+ * An iterator over the entries in a reflog.
2559
+ *
2560
+ * This type extends JavaScript's `Iterator`, and so has the iterator helper
2561
+ * methods. It may extend the upcoming TypeScript `Iterator` class in the future.
2562
+ *
2563
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods
2564
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-6.html#iterator-helper-methods
2565
+ */
2566
+ export declare class ReflogIter extends Iterator<ReflogEntry, void, void> {
2567
+
2568
+ next(value?: void): IteratorResult<ReflogEntry, void>
2569
+ }
2570
+
2377
2571
  /**
2378
2572
  * A class representing a [remote][1] of a git repository.
2379
2573
  *
@@ -3785,6 +3979,56 @@ export declare class Repository {
3785
3979
  * ```
3786
3980
  */
3787
3981
  getReference(name: string): Reference
3982
+ /**
3983
+ * Lookup a reflog by its name.
3984
+ *
3985
+ * @category Repository/Methods
3986
+ *
3987
+ * @signature
3988
+ * ```ts
3989
+ * class Repository {
3990
+ * reflog(name: string): Reflog;
3991
+ * }
3992
+ * ```
3993
+ *
3994
+ * @param {string} name - Name of the reference whose reflog to lookup (e.g., "HEAD", "refs/heads/main").
3995
+ * @returns Reflog instance for the given reference name.
3996
+ * @throws Throws error if the reflog does not exist or cannot be opened.
3997
+ */
3998
+ reflog(name: string): Reflog
3999
+ /**
4000
+ * Rename a reflog.
4001
+ *
4002
+ * @category Repository/Methods
4003
+ *
4004
+ * @signature
4005
+ * ```ts
4006
+ * class Repository {
4007
+ * reflogRename(oldName: string, newName: string): void;
4008
+ * }
4009
+ * ```
4010
+ *
4011
+ * @param {string} oldName - Old name of the reference.
4012
+ * @param {string} newName - New name of the reference.
4013
+ * @throws Throws error if renaming fails.
4014
+ */
4015
+ reflogRename(oldName: string, newName: string): void
4016
+ /**
4017
+ * Delete a reflog.
4018
+ *
4019
+ * @category Repository/Methods
4020
+ *
4021
+ * @signature
4022
+ * ```ts
4023
+ * class Repository {
4024
+ * reflogDelete(name: string): void;
4025
+ * }
4026
+ * ```
4027
+ *
4028
+ * @param {string} name - Name of the reference whose reflog to delete.
4029
+ * @throws Throws error if deletion fails.
4030
+ */
4031
+ reflogDelete(name: string): void
3788
4032
  /**
3789
4033
  * List all remotes for a given repository
3790
4034
  *
package/index.js CHANGED
@@ -596,6 +596,9 @@ module.exports.Note = nativeBinding.Note
596
596
  module.exports.Notes = nativeBinding.Notes
597
597
  module.exports.Rebase = nativeBinding.Rebase
598
598
  module.exports.Reference = nativeBinding.Reference
599
+ module.exports.Reflog = nativeBinding.Reflog
600
+ module.exports.ReflogEntry = nativeBinding.ReflogEntry
601
+ module.exports.ReflogIter = nativeBinding.ReflogIter
599
602
  module.exports.Remote = nativeBinding.Remote
600
603
  module.exports.Repository = nativeBinding.Repository
601
604
  module.exports.Revwalk = nativeBinding.Revwalk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.5.0-next.170+131625d",
3
+ "version": "0.5.0-next.171+f871f1e",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -54,15 +54,15 @@
54
54
  "vitest": "^3.0.5"
55
55
  },
56
56
  "optionalDependencies": {
57
- "es-git-darwin-x64": "0.5.0-next.170+131625d",
58
- "es-git-darwin-arm64": "0.5.0-next.170+131625d",
59
- "es-git-win32-x64-msvc": "0.5.0-next.170+131625d",
60
- "es-git-win32-arm64-msvc": "0.5.0-next.170+131625d",
61
- "es-git-linux-x64-gnu": "0.5.0-next.170+131625d",
62
- "es-git-linux-x64-musl": "0.5.0-next.170+131625d",
63
- "es-git-android-arm64": "0.5.0-next.170+131625d",
64
- "es-git-linux-arm64-gnu": "0.5.0-next.170+131625d",
65
- "es-git-linux-arm64-musl": "0.5.0-next.170+131625d",
66
- "es-git-android-arm-eabi": "0.5.0-next.170+131625d"
57
+ "es-git-darwin-x64": "0.5.0-next.171+f871f1e",
58
+ "es-git-darwin-arm64": "0.5.0-next.171+f871f1e",
59
+ "es-git-win32-x64-msvc": "0.5.0-next.171+f871f1e",
60
+ "es-git-win32-arm64-msvc": "0.5.0-next.171+f871f1e",
61
+ "es-git-linux-x64-gnu": "0.5.0-next.171+f871f1e",
62
+ "es-git-linux-x64-musl": "0.5.0-next.171+f871f1e",
63
+ "es-git-android-arm64": "0.5.0-next.171+f871f1e",
64
+ "es-git-linux-arm64-gnu": "0.5.0-next.171+f871f1e",
65
+ "es-git-linux-arm64-musl": "0.5.0-next.171+f871f1e",
66
+ "es-git-android-arm-eabi": "0.5.0-next.171+f871f1e"
67
67
  }
68
68
  }