es-git 0.5.0-next.162 → 0.5.0-next.164

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 +370 -0
  2. package/index.js +3 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -1083,6 +1083,28 @@ export declare class Deltas extends Iterator<DiffDelta, void, void> {
1083
1083
  next(value?: void): IteratorResult<DiffDelta, void>
1084
1084
  }
1085
1085
 
1086
+ /**
1087
+ * The result of a `describe` operation on either an `Describe` or a
1088
+ * `Repository`.
1089
+ */
1090
+ export declare class Describe {
1091
+ /**
1092
+ * Prints this describe result, returning the result as a string.
1093
+ *
1094
+ * @category Describe/Methods
1095
+ * @signature
1096
+ * ```ts
1097
+ * class Describe {
1098
+ * format(options?: DescribeFormatOptions | null | undefined): string;
1099
+ * }
1100
+ * ```
1101
+ *
1102
+ * @param {DescribeFormatOptions} [options] - Options for formatting describe.
1103
+ * @returns Formatted string for this describe.
1104
+ */
1105
+ format(options?: DescribeFormatOptions | undefined | null): string
1106
+ }
1107
+
1086
1108
  /**
1087
1109
  * The diff object that contains all individual file deltas.
1088
1110
  *
@@ -1530,6 +1552,23 @@ export declare class GitObject {
1530
1552
  * @returns Returns `null` if the object is not actually a commit.
1531
1553
  */
1532
1554
  asCommit(): Commit | null
1555
+ /**
1556
+ * Describes a commit
1557
+ *
1558
+ * Performs a describe operation on this commitish object.
1559
+ *
1560
+ * @category GitObject/Methods
1561
+ * @signature
1562
+ * ```ts
1563
+ * class Object {
1564
+ * describe(options?: DescribeOptions | null | undefined): Describe;
1565
+ * }
1566
+ * ```
1567
+ *
1568
+ * @param {DescribeOptions} [options] - Options for describe operation.
1569
+ * @returns Instance of describe.
1570
+ */
1571
+ describe(options?: DescribeOptions | undefined | null): Describe
1533
1572
  }
1534
1573
 
1535
1574
  /**
@@ -1895,6 +1934,85 @@ export declare class Mailmap {
1895
1934
  resolveSignature(signature: SignaturePayload): Signature
1896
1935
  }
1897
1936
 
1937
+ /**
1938
+ * A structure representing a [note][1] in git.
1939
+ *
1940
+ * [1]: http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html
1941
+ */
1942
+ export declare class Note {
1943
+ /**
1944
+ * Get the note object's id
1945
+ *
1946
+ * @category Note/Methods
1947
+ * @signature
1948
+ * ```ts
1949
+ * class Note {
1950
+ * id(): string;
1951
+ * }
1952
+ * ```
1953
+ *
1954
+ * @returns The note object's id.
1955
+ */
1956
+ id(): string
1957
+ /**
1958
+ * Get the note author
1959
+ *
1960
+ * @category Note/Methods
1961
+ * @signature
1962
+ * ```ts
1963
+ * class Note {
1964
+ * author(): Signature;
1965
+ * }
1966
+ * ```
1967
+ *
1968
+ * @returns The note author signature.
1969
+ */
1970
+ author(): Signature
1971
+ /**
1972
+ * Get the note committer
1973
+ *
1974
+ * @category Note/Methods
1975
+ * @signature
1976
+ * ```ts
1977
+ * class Note {
1978
+ * committer(): Signature;
1979
+ * }
1980
+ * ```
1981
+ *
1982
+ * @returns The note committer signature.
1983
+ */
1984
+ committer(): Signature
1985
+ /**
1986
+ * Get the note message as a string.
1987
+ *
1988
+ * @category Note/Methods
1989
+ * @signature
1990
+ * ```ts
1991
+ * class Note {
1992
+ * message(): string;
1993
+ * }
1994
+ * ```
1995
+ *
1996
+ * @returns The note message as a string
1997
+ * @throws Throws error if message is not utf-8.
1998
+ */
1999
+ message(): string
2000
+ }
2001
+
2002
+ /**
2003
+ * An iterator over all of the notes within a repository.
2004
+ *
2005
+ * This type extends JavaScript's `Iterator`, and so has the iterator helper
2006
+ * methods. It may extend the upcoming TypeScript `Iterator` class in the future.
2007
+ *
2008
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods
2009
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-6.html#iterator-helper-methods
2010
+ */
2011
+ export declare class Notes extends Iterator<NoteIterItem, void, void> {
2012
+
2013
+ next(value?: void): IteratorResult<NoteIterItem, void>
2014
+ }
2015
+
1898
2016
  /**
1899
2017
  * Representation of a rebase
1900
2018
  * Begin the rebase by iterating the returned `Rebase`
@@ -3218,6 +3336,134 @@ export declare class Repository {
3218
3336
  * @returns Merge analysis result.
3219
3337
  */
3220
3338
  analyzeMergeForRef(ourRef: Reference, theirHeads: Array<AnnotatedCommit>): MergeAnalysisResult
3339
+ /**
3340
+ * Add a note for an object
3341
+ *
3342
+ * The `notesRef` argument is the canonical name of the reference to use,
3343
+ * defaulting to "refs/notes/commits". If `force` is specified then
3344
+ * previous notes are overwritten.
3345
+ *
3346
+ * @category Repository/Methods
3347
+ * @signature
3348
+ * ```ts
3349
+ * class Repository {
3350
+ * note(oid: string, note: string, options?: CreateNoteOptions | null | undefined): string;
3351
+ * }
3352
+ * ```
3353
+ *
3354
+ * @param {string} oid - OID of the git object to decorate.
3355
+ * @param {string} note - Content of the note to add for object oid.
3356
+ * @param {CreateNoteOptions} [options] - Options for creating note.
3357
+ * @returns OID for the note.
3358
+ */
3359
+ note(oid: string, note: string, options?: CreateNoteOptions | undefined | null): string
3360
+ /**
3361
+ * Get the default notes reference for this repository
3362
+ *
3363
+ * @category Repository/Methods
3364
+ * @signature
3365
+ * ```ts
3366
+ * class Repository {
3367
+ * noteDefaultRef(): string;
3368
+ * }
3369
+ * ```
3370
+ *
3371
+ * @returns The default notes reference.
3372
+ */
3373
+ noteDefaultRef(): string
3374
+ /**
3375
+ * Creates a new iterator for notes in this repository.
3376
+ *
3377
+ * The `notesRef` argument is the canonical name of the reference to use,
3378
+ * defaulting to "refs/notes/commits".
3379
+ *
3380
+ * @category Repository/Methods
3381
+ * @signature
3382
+ * ```ts
3383
+ * class Repository {
3384
+ * notes(notesRef?: string | null | undefined): Notes;
3385
+ * }
3386
+ * ```
3387
+ *
3388
+ * @param {string} [notesRef] - The canonical name of the reference to use.
3389
+ * @returns Iterator of all notes. The iterator returned yields pairs of `[string, string]`
3390
+ * where first element is the id of the note and the second id is the id the note is annotating.
3391
+ *
3392
+ * @example
3393
+ * ```ts
3394
+ * import { openRepository } from 'es-git';
3395
+ *
3396
+ * const repo = await openRepository('.');
3397
+ * for (const { noteId, annotatedId } of repo.notes()) {
3398
+ * const note = repo.getNote(noteId);
3399
+ * const commit = repo.getCommit(annotatedId);
3400
+ * }
3401
+ * ```
3402
+ */
3403
+ notes(notesRef?: string | undefined | null): Notes
3404
+ /**
3405
+ * Read the note for an object.
3406
+ *
3407
+ * The `notesRef` argument is the canonical name of the reference to use,
3408
+ * defaulting to "refs/notes/commits".
3409
+ *
3410
+ * The id specified is the Oid of the git object to read the note from.
3411
+ *
3412
+ * @category Repository/Methods
3413
+ * @signature
3414
+ * ```ts
3415
+ * class Repository {
3416
+ * getNote(id: string, options?: FindNoteOptions | null | undefined): Note;
3417
+ * }
3418
+ * ```
3419
+ *
3420
+ * @param {string} id - OID of the git object to read the note from.
3421
+ * @param {FindNoteOptions} [options] - Options for finding note.
3422
+ * @returns Instance of the note.
3423
+ * @throws Throws error if note does not exists.
3424
+ */
3425
+ getNote(id: string, options?: FindNoteOptions | undefined | null): Note
3426
+ /**
3427
+ * Read the note for an object.
3428
+ *
3429
+ * The `notesRef` argument is the canonical name of the reference to use,
3430
+ * defaulting to "refs/notes/commits".
3431
+ *
3432
+ * The id specified is the Oid of the git object to read the note from.
3433
+ *
3434
+ * @category Repository/Methods
3435
+ * @signature
3436
+ * ```ts
3437
+ * class Repository {
3438
+ * findNote(id: string, options?: FindNoteOptions | null | undefined): Note | null;
3439
+ * }
3440
+ * ```
3441
+ *
3442
+ * @param {string} id - OID of the git object to read the note from.
3443
+ * @param {FindNoteOptions} [options] - Options for finding note.
3444
+ * @returns Instance of the note. If does not exists, returns `null`.
3445
+ */
3446
+ findNote(id: string, options?: FindNoteOptions | undefined | null): Note | null
3447
+ /**
3448
+ * Remove the note for an object.
3449
+ *
3450
+ * The `notesRef` argument is the canonical name of the reference to use,
3451
+ * defaulting to "refs/notes/commits".
3452
+ *
3453
+ * The id specified is the Oid of the git object to remove the note from.
3454
+ *
3455
+ * @category Repository/Methods
3456
+ * @signature
3457
+ * ```ts
3458
+ * class Repository {
3459
+ * deleteNote(id: string, options?: DeleteNoteOptions | null | undefined): void;
3460
+ * }
3461
+ * ```
3462
+ *
3463
+ * @param {string} id - OID of the git object to remove the note from.
3464
+ * @param {DeleteNoteOptions} [options] - Options for deleting note.
3465
+ */
3466
+ deleteNote(id: string, options?: DeleteNoteOptions | undefined | null): void
3221
3467
  /**
3222
3468
  * Lookup a reference to one of the objects in a repository.
3223
3469
  *
@@ -4338,6 +4584,25 @@ export declare class Repository {
4338
4584
  * @returns If it does not exist, returns `null`.
4339
4585
  */
4340
4586
  findTree(oid: string): Tree | null
4587
+ /**
4588
+ * Describes a commit
4589
+ *
4590
+ * Performs a describe operation on the current commit and the worktree.
4591
+ * After performing a describe on `HEAD`, a status is run and description is
4592
+ * considered to be dirty if there are.
4593
+ *
4594
+ * @category Repository/Methods
4595
+ * @signature
4596
+ * ```ts
4597
+ * class Repository {
4598
+ * describe(options?: DescribeOptions | null | undefined): Describe;
4599
+ * }
4600
+ * ```
4601
+ *
4602
+ * @param {DescribeOptions} [options] - Options for describe operation.
4603
+ * @returns Instance of describe.
4604
+ */
4605
+ describe(options?: DescribeOptions | undefined | null): Describe
4341
4606
  }
4342
4607
 
4343
4608
  /**
@@ -5734,6 +5999,31 @@ export interface CreateLightweightTagOptions {
5734
5999
  */
5735
6000
  export declare function createMailmapFromBuffer(content: string): Mailmap
5736
6001
 
6002
+ export interface CreateNoteOptions {
6003
+ /**
6004
+ * Signature of the notes commit author.
6005
+ *
6006
+ * If not provided, the default signature of the repository will be used.
6007
+ * If there is no default signature set for the repository, an error will occur.
6008
+ */
6009
+ author?: SignaturePayload
6010
+ /**
6011
+ * Signature of the notes commit commiter.
6012
+ *
6013
+ * If not provided, the default signature of the repository will be used.
6014
+ * If there is no default signature set for the repository, an error will occur.
6015
+ */
6016
+ committer?: SignaturePayload
6017
+ /**
6018
+ * canonical name of the reference to use.
6019
+ *
6020
+ * Defaults to "refs/notes/commits".
6021
+ */
6022
+ notesRef?: string
6023
+ /** Overwrite existing note. */
6024
+ force?: boolean
6025
+ }
6026
+
5737
6027
  export interface CreateRemoteOptions {
5738
6028
  fetchRefspec?: string
5739
6029
  }
@@ -5811,6 +6101,29 @@ export type CredentialType = 'Default'|
5811
6101
  'SSHKey'|
5812
6102
  'Plain';
5813
6103
 
6104
+ export interface DeleteNoteOptions {
6105
+ /**
6106
+ * Signature of the notes commit author.
6107
+ *
6108
+ * If not provided, the default signature of the repository will be used.
6109
+ * If there is no default signature set for the repository, an error will occur.
6110
+ */
6111
+ author?: SignaturePayload
6112
+ /**
6113
+ * Signature of the notes commit commiter.
6114
+ *
6115
+ * If not provided, the default signature of the repository will be used.
6116
+ * If there is no default signature set for the repository, an error will occur.
6117
+ */
6118
+ committer?: SignaturePayload
6119
+ /**
6120
+ * canonical name of the reference to use.
6121
+ *
6122
+ * Defaults to "refs/notes/commits".
6123
+ */
6124
+ notesRef?: string
6125
+ }
6126
+
5814
6127
  /**
5815
6128
  * - `Unmodified` : No changes.
5816
6129
  * - `Added` : Entry does not exist in an old version.
@@ -5836,6 +6149,54 @@ export type DeltaType = 'Unmodified'|
5836
6149
  'Unreadable'|
5837
6150
  'Conflicted';
5838
6151
 
6152
+ export interface DescribeFormatOptions {
6153
+ /**
6154
+ * Sets the size of the abbreviated commit id to use.
6155
+ *
6156
+ * The value is the lower bound for the length of the abbreviated string,
6157
+ * and the default is 7.
6158
+ */
6159
+ abbreviatedSize?: number
6160
+ /**
6161
+ * Sets whether or not the long format is used even when a shorter name
6162
+ * could be used.
6163
+ */
6164
+ alwaysUseLongFormat?: boolean
6165
+ /**
6166
+ * If the workdir is dirty and this is set, this string will be appended to
6167
+ * the description string.
6168
+ */
6169
+ dirtySuffix?: string
6170
+ }
6171
+
6172
+ export interface DescribeOptions {
6173
+ maxCandidatesTags?: number
6174
+ /**
6175
+ * Sets the reference lookup strategy
6176
+ *
6177
+ * This behaves like the `--tags` option to git-describe.
6178
+ */
6179
+ describeTags?: boolean
6180
+ /**
6181
+ * Sets the reference lookup strategy
6182
+ *
6183
+ * This behaves like the `--all` option to git-describe.
6184
+ */
6185
+ describeAll?: boolean
6186
+ /**
6187
+ * Indicates when calculating the distance from the matching tag or
6188
+ * reference whether to only walk down the first-parent ancestry.
6189
+ */
6190
+ onlyFollowFirstParent?: boolean
6191
+ /**
6192
+ * If no matching tag or reference is found whether a describe option would
6193
+ * normally fail. This option indicates, however, that it will instead fall
6194
+ * back to showing the full id of the commit.
6195
+ */
6196
+ showCommitOidAsFallback?: boolean
6197
+ pattern?: string
6198
+ }
6199
+
5839
6200
  export interface DiffFindOptions {
5840
6201
  /** Look for renames? */
5841
6202
  renames?: boolean
@@ -6250,6 +6611,10 @@ export type FileMode = 'Unreadable'|
6250
6611
  */
6251
6612
  export declare function findGlobalConfigPath(): string | null
6252
6613
 
6614
+ export interface FindNoteOptions {
6615
+ notesRef?: string
6616
+ }
6617
+
6253
6618
  /**
6254
6619
  * Locate the path to the system configuration file.
6255
6620
  *
@@ -6722,6 +7087,11 @@ export interface MergePreference {
6722
7087
  */
6723
7088
  export declare function normalizeReferenceName(refname: string, format?: number | undefined | null): string | null
6724
7089
 
7090
+ export interface NoteIterItem {
7091
+ noteId: string
7092
+ annotatedId: string
7093
+ }
7094
+
6725
7095
  /**
6726
7096
  * - `Any` : Any kind of git object
6727
7097
  * - `Commit` : An object which corresponds to a git commit
package/index.js CHANGED
@@ -583,6 +583,7 @@ module.exports.Commit = nativeBinding.Commit
583
583
  module.exports.Config = nativeBinding.Config
584
584
  module.exports.ConfigEntries = nativeBinding.ConfigEntries
585
585
  module.exports.Deltas = nativeBinding.Deltas
586
+ module.exports.Describe = nativeBinding.Describe
586
587
  module.exports.Diff = nativeBinding.Diff
587
588
  module.exports.DiffDelta = nativeBinding.DiffDelta
588
589
  module.exports.DiffFile = nativeBinding.DiffFile
@@ -591,6 +592,8 @@ module.exports.GitObject = nativeBinding.GitObject
591
592
  module.exports.Index = nativeBinding.Index
592
593
  module.exports.IndexEntries = nativeBinding.IndexEntries
593
594
  module.exports.Mailmap = nativeBinding.Mailmap
595
+ module.exports.Note = nativeBinding.Note
596
+ module.exports.Notes = nativeBinding.Notes
594
597
  module.exports.Rebase = nativeBinding.Rebase
595
598
  module.exports.Reference = nativeBinding.Reference
596
599
  module.exports.Remote = nativeBinding.Remote
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.5.0-next.162+202d872",
3
+ "version": "0.5.0-next.164+3f0c3d0",
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.162+202d872",
58
- "es-git-darwin-arm64": "0.5.0-next.162+202d872",
59
- "es-git-win32-x64-msvc": "0.5.0-next.162+202d872",
60
- "es-git-win32-arm64-msvc": "0.5.0-next.162+202d872",
61
- "es-git-linux-x64-gnu": "0.5.0-next.162+202d872",
62
- "es-git-linux-x64-musl": "0.5.0-next.162+202d872",
63
- "es-git-android-arm64": "0.5.0-next.162+202d872",
64
- "es-git-linux-arm64-gnu": "0.5.0-next.162+202d872",
65
- "es-git-linux-arm64-musl": "0.5.0-next.162+202d872",
66
- "es-git-android-arm-eabi": "0.5.0-next.162+202d872"
57
+ "es-git-darwin-x64": "0.5.0-next.164+3f0c3d0",
58
+ "es-git-darwin-arm64": "0.5.0-next.164+3f0c3d0",
59
+ "es-git-win32-x64-msvc": "0.5.0-next.164+3f0c3d0",
60
+ "es-git-win32-arm64-msvc": "0.5.0-next.164+3f0c3d0",
61
+ "es-git-linux-x64-gnu": "0.5.0-next.164+3f0c3d0",
62
+ "es-git-linux-x64-musl": "0.5.0-next.164+3f0c3d0",
63
+ "es-git-android-arm64": "0.5.0-next.164+3f0c3d0",
64
+ "es-git-linux-arm64-gnu": "0.5.0-next.164+3f0c3d0",
65
+ "es-git-linux-arm64-musl": "0.5.0-next.164+3f0c3d0",
66
+ "es-git-android-arm-eabi": "0.5.0-next.164+3f0c3d0"
67
67
  }
68
68
  }