New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@changesets/ghcommit

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@changesets/ghcommit - npm Package Compare versions

Comparing version
1.3.0
to
1.3.1
+564
dist/interface-CSlSbqMF.d.mts
type Maybe<T> = T | null;
type InputMaybe<T> = Maybe<T>;
type Exact<T extends {
[key: string]: unknown;
}> = {
[K in keyof T]: T[K];
};
/** All built-in and custom scalars, mapped to their actual values */
type Scalars = {
ID: {
input: string;
output: string;
};
String: {
input: string;
output: string;
};
Boolean: {
input: boolean;
output: boolean;
};
Int: {
input: number;
output: number;
};
Float: {
input: number;
output: number;
};
Base64String: {
input: any;
output: any;
};
BigInt: {
input: any;
output: any;
};
Date: {
input: any;
output: any;
};
DateTime: {
input: any;
output: any;
};
GitObjectID: {
input: any;
output: any;
};
GitSSHRemote: {
input: any;
output: any;
};
GitTimestamp: {
input: any;
output: any;
};
HTML: {
input: any;
output: any;
};
PreciseDateTime: {
input: any;
output: any;
};
URI: {
input: any;
output: any;
};
X509Certificate: {
input: any;
output: any;
};
};
/** A message to include with a new commit */
type CommitMessage = {
/** The body of the message. */
body?: InputMaybe<Scalars['String']['input']>;
/** The headline of the message. */
headline: Scalars['String']['input'];
};
/**
* A git ref for a commit to be appended to.
*
* The ref must be a branch, i.e. its fully qualified name must start
* with `refs/heads/` (although the input is not required to be fully
* qualified).
*
* The Ref may be specified by its global node ID or by the
* `repositoryNameWithOwner` and `branchName`.
*
* ### Examples
*
* Specify a branch using a global node ID:
*
* { "id": "MDM6UmVmMTpyZWZzL2hlYWRzL21haW4=" }
*
* Specify a branch using `repositoryNameWithOwner` and `branchName`:
*
* {
* "repositoryNameWithOwner": "github/graphql-client",
* "branchName": "main"
* }
*
*
*/
type CommittableBranch = {
/** The unqualified name of the branch to append the commit to. */
branchName?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be updated. */
id?: InputMaybe<Scalars['ID']['input']>;
/** The nameWithOwner of the repository to commit to. */
repositoryNameWithOwner?: InputMaybe<Scalars['String']['input']>;
};
/** Autogenerated input type of CreateCommitOnBranch */
type CreateCommitOnBranchInput = {
/** The Ref to be updated. Must be a branch. */
branch: CommittableBranch;
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The git commit oid expected at the head of the branch prior to the commit */
expectedHeadOid: Scalars['GitObjectID']['input'];
/** A description of changes to files in this commit. */
fileChanges?: InputMaybe<FileChanges>;
/** The commit message the be included with the commit. */
message: CommitMessage;
};
/** Autogenerated input type of CreateRef */
type CreateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). */
name: Scalars['String']['input'];
/** The GitObjectID that the new Ref shall target. Must point to a commit. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Repository to create the Ref in. */
repositoryId: Scalars['ID']['input'];
};
/** Autogenerated input type of DeleteRef */
type DeleteRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be deleted. */
refId: Scalars['ID']['input'];
};
/** A command to add a file at the given path with the given contents as part of a commit. Any existing file at that that path will be replaced. */
type FileAddition = {
/** The base64 encoded contents of the file */
contents: Scalars['Base64String']['input'];
/** The path in the repository where the file will be located */
path: Scalars['String']['input'];
};
/**
* A description of a set of changes to a file tree to be made as part of
* a git commit, modeled as zero or more file `additions` and zero or more
* file `deletions`.
*
* Both fields are optional; omitting both will produce a commit with no
* file changes.
*
* `deletions` and `additions` describe changes to files identified
* by their path in the git tree using unix-style path separators, i.e.
* `/`. The root of a git tree is an empty string, so paths are not
* slash-prefixed.
*
* `path` values must be unique across all `additions` and `deletions`
* provided. Any duplication will result in a validation error.
*
* ### Encoding
*
* File contents must be provided in full for each `FileAddition`.
*
* The `contents` of a `FileAddition` must be encoded using RFC 4648
* compliant base64, i.e. correct padding is required and no characters
* outside the standard alphabet may be used. Invalid base64
* encoding will be rejected with a validation error.
*
* The encoded contents may be binary.
*
* For text files, no assumptions are made about the character encoding of
* the file contents (after base64 decoding). No charset transcoding or
* line-ending normalization will be performed; it is the client's
* responsibility to manage the character encoding of files they provide.
* However, for maximum compatibility we recommend using UTF-8 encoding
* and ensuring that all files in a repository use a consistent
* line-ending convention (`\n` or `\r\n`), and that all files end
* with a newline.
*
* ### Modeling file changes
*
* Each of the the five types of conceptual changes that can be made in a
* git commit can be described using the `FileChanges` type as follows:
*
* 1. New file addition: create file `hello world\n` at path `docs/README.txt`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
* 2. Existing file modification: change existing `docs/README.txt` to have new
* content `new content here\n`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("new content here\n")
* }
* ]
* }
*
* 3. Existing file deletion: remove existing file `docs/README.txt`.
* Note that the path is required to exist -- specifying a
* path that does not exist on the given branch will abort the
* commit and return an error.
*
* {
* "deletions" [
* {
* "path": "docs/README.txt"
* }
* ]
* }
*
*
* 4. File rename with no changes: rename `docs/README.txt` with
* previous content `hello world\n` to the same content at
* `newdocs/README.txt`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
*
* 5. File rename with changes: rename `docs/README.txt` with
* previous content `hello world\n` to a file at path
* `newdocs/README.txt` with content `new contents\n`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("new contents\n")
* }
* ]
* }
*
*/
type FileChanges = {
/** File to add or change. */
additions?: InputMaybe<Array<FileAddition>>;
/** Files to delete. */
deletions?: InputMaybe<Array<FileDeletion>>;
};
/** A command to delete the file at the given path as part of a commit. */
type FileDeletion = {
/** The path to delete */
path: Scalars['String']['input'];
};
/** Autogenerated input type of UpdateRef */
type UpdateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** Permit updates of branch Refs that are not fast-forwards? */
force?: InputMaybe<Scalars['Boolean']['input']>;
/** The GitObjectID that the Ref shall be updated to target. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Ref to be updated. */
refId: Scalars['ID']['input'];
};
type GetRepositoryMetadataQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
baseRef: Scalars['String']['input'];
targetRef: Scalars['String']['input'];
}>;
type GetRepositoryMetadataQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
id: string;
baseRef?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
target: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
};
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
targetBranch?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
} | null;
};
type CreateRefMutationVariables = Exact<{
input: CreateRefInput;
}>;
type CreateRefMutation = {
__typename?: 'Mutation';
createRef?: {
__typename?: 'CreateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type UpdateRefMutationVariables = Exact<{
input: UpdateRefInput;
}>;
type UpdateRefMutation = {
__typename?: 'Mutation';
updateRef?: {
__typename?: 'UpdateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type DeleteRefMutationVariables = Exact<{
input: DeleteRefInput;
}>;
type DeleteRefMutation = {
__typename?: 'Mutation';
deleteRef?: {
__typename?: 'DeleteRefPayload';
clientMutationId?: string | null;
} | null;
};
type CreateCommitOnBranchMutationVariables = Exact<{
input: CreateCommitOnBranchInput;
}>;
type CreateCommitOnBranchMutation = {
__typename?: 'Mutation';
createCommitOnBranch?: {
__typename?: 'CreateCommitOnBranchPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type GetRefTreeQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
ref: Scalars['String']['input'];
path: Scalars['String']['input'];
}>;
type GetRefTreeQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
ref?: {
__typename?: 'Ref';
target?: {
__typename?: 'Blob';
} | {
__typename?: 'Commit';
message: string;
tree: {
__typename?: 'Tree';
oid: any;
};
parents: {
__typename?: 'CommitConnection';
nodes?: Array<{
__typename?: 'Commit';
oid: any;
} | null> | null;
};
file?: {
__typename?: 'TreeEntry';
oid: any;
} | null;
} | {
__typename?: 'Tag';
} | {
__typename?: 'Tree';
} | null;
} | null;
} | null;
};
type GitHubClient = {
graphql: <T>(query: string, variables: any) => Promise<T>;
};
declare const getRepositoryMetadata: (o: GitHubClient, v: GetRepositoryMetadataQueryVariables) => Promise<GetRepositoryMetadataQuery["repository"]>;
declare const createRefMutation: (o: GitHubClient, v: CreateRefMutationVariables) => Promise<CreateRefMutation>;
declare const updateRefMutation: (o: GitHubClient, v: UpdateRefMutationVariables) => Promise<UpdateRefMutation>;
declare const deleteRefMutation: (o: GitHubClient, v: DeleteRefMutationVariables) => Promise<DeleteRefMutation>;
declare const createCommitOnBranchQuery: (o: GitHubClient, v: CreateCommitOnBranchMutationVariables) => Promise<CreateCommitOnBranchMutation>;
declare const getRefTreeQuery: (o: GitHubClient, v: GetRefTreeQueryVariables) => Promise<GetRefTreeQuery>;
type queries_GitHubClient = GitHubClient;
declare const queries_createCommitOnBranchQuery: typeof createCommitOnBranchQuery;
declare const queries_createRefMutation: typeof createRefMutation;
declare const queries_deleteRefMutation: typeof deleteRefMutation;
declare const queries_getRefTreeQuery: typeof getRefTreeQuery;
declare const queries_getRepositoryMetadata: typeof getRepositoryMetadata;
declare const queries_updateRefMutation: typeof updateRefMutation;
declare namespace queries {
export { type queries_GitHubClient as GitHubClient, queries_createCommitOnBranchQuery as createCommitOnBranchQuery, queries_createRefMutation as createRefMutation, queries_deleteRefMutation as deleteRefMutation, queries_getRefTreeQuery as getRefTreeQuery, queries_getRepositoryMetadata as getRepositoryMetadata, queries_updateRefMutation as updateRefMutation };
}
interface Logger {
info(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
debug(msg: string): void;
}
type CommitFilesResult = {
refId: string | null;
};
type GitBase = {
branch: string;
} | {
tag: string;
} | {
commit: string;
};
interface CommitFilesBasedArgs {
octokit: GitHubClient;
owner: string;
repo?: string;
/** @deprecated use {@link repo} instead */
repository?: string;
branch: string;
/**
* Push the commit even if the branch exists and does not match what was
* specified as the base.
*/
force?: boolean;
/**
* The commit message
*/
message: string | CommitMessage;
log?: Logger;
}
interface CommitFilesSharedArgsWithBase extends CommitFilesBasedArgs {
/**
* The current branch, tag or commit that the new branch should be based on.
*/
base: GitBase;
}
interface CommitFilesFromBase64Args extends CommitFilesSharedArgsWithBase {
fileChanges: FileChanges;
}
interface CommitFilesFromBuffersArgs extends CommitFilesSharedArgsWithBase {
/**
* The file changes, relative to the repository root, to make to the specified branch.
*/
fileChanges: {
additions?: Array<{
path: string;
contents: Buffer;
}>;
deletions?: string[];
};
}
interface CommitFilesFromDirectoryArgs extends CommitFilesSharedArgsWithBase {
/**
* The directory to consider the root of the repository when calculating
* file paths
*/
workingDirectory?: string;
/**
* The file paths, relative to {@link workingDirectory},
* to add or delete from the branch on GitHub.
*/
fileChanges: {
/** File paths, relative to {@link workingDirectory}, to remove from the repo. */
additions?: string[];
/** File paths, relative to the repository root, to remove from the repo. */
deletions?: string[];
};
}
interface CommitChangesFromRepoArgs extends CommitFilesBasedArgs {
/**
* The base commit to build your changes on-top of.
*
* By default, this commit will be the HEAD of the local repository,
* meaning that if any commits have been made locally and not pushed,
* this command will fail.
*
* To include all changes, this should be set to a commit that is known
* to be in the remote repository (such as the default branch).
*
* If you want to base the changes on a different commit to one checked out,
* make sure that you also pull this commit from the remote.
*
* @default HEAD
*/
base?: {
commit: string;
};
/**
* The root of the repository.
*
* @default process.cwd()
*/
repoDirectory?: string;
}
export { type CommitFilesFromBase64Args as C, type CommitFilesResult as a, type CommitFilesFromDirectoryArgs as b, type CommitChangesFromRepoArgs as c, type CommitFilesFromBuffersArgs as d, queries as q };
type Maybe<T> = T | null;
type InputMaybe<T> = Maybe<T>;
type Exact<T extends {
[key: string]: unknown;
}> = {
[K in keyof T]: T[K];
};
/** All built-in and custom scalars, mapped to their actual values */
type Scalars = {
ID: {
input: string;
output: string;
};
String: {
input: string;
output: string;
};
Boolean: {
input: boolean;
output: boolean;
};
Int: {
input: number;
output: number;
};
Float: {
input: number;
output: number;
};
Base64String: {
input: any;
output: any;
};
BigInt: {
input: any;
output: any;
};
Date: {
input: any;
output: any;
};
DateTime: {
input: any;
output: any;
};
GitObjectID: {
input: any;
output: any;
};
GitSSHRemote: {
input: any;
output: any;
};
GitTimestamp: {
input: any;
output: any;
};
HTML: {
input: any;
output: any;
};
PreciseDateTime: {
input: any;
output: any;
};
URI: {
input: any;
output: any;
};
X509Certificate: {
input: any;
output: any;
};
};
/** A message to include with a new commit */
type CommitMessage = {
/** The body of the message. */
body?: InputMaybe<Scalars['String']['input']>;
/** The headline of the message. */
headline: Scalars['String']['input'];
};
/**
* A git ref for a commit to be appended to.
*
* The ref must be a branch, i.e. its fully qualified name must start
* with `refs/heads/` (although the input is not required to be fully
* qualified).
*
* The Ref may be specified by its global node ID or by the
* `repositoryNameWithOwner` and `branchName`.
*
* ### Examples
*
* Specify a branch using a global node ID:
*
* { "id": "MDM6UmVmMTpyZWZzL2hlYWRzL21haW4=" }
*
* Specify a branch using `repositoryNameWithOwner` and `branchName`:
*
* {
* "repositoryNameWithOwner": "github/graphql-client",
* "branchName": "main"
* }
*
*
*/
type CommittableBranch = {
/** The unqualified name of the branch to append the commit to. */
branchName?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be updated. */
id?: InputMaybe<Scalars['ID']['input']>;
/** The nameWithOwner of the repository to commit to. */
repositoryNameWithOwner?: InputMaybe<Scalars['String']['input']>;
};
/** Autogenerated input type of CreateCommitOnBranch */
type CreateCommitOnBranchInput = {
/** The Ref to be updated. Must be a branch. */
branch: CommittableBranch;
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The git commit oid expected at the head of the branch prior to the commit */
expectedHeadOid: Scalars['GitObjectID']['input'];
/** A description of changes to files in this commit. */
fileChanges?: InputMaybe<FileChanges>;
/** The commit message the be included with the commit. */
message: CommitMessage;
};
/** Autogenerated input type of CreateRef */
type CreateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). */
name: Scalars['String']['input'];
/** The GitObjectID that the new Ref shall target. Must point to a commit. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Repository to create the Ref in. */
repositoryId: Scalars['ID']['input'];
};
/** Autogenerated input type of DeleteRef */
type DeleteRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be deleted. */
refId: Scalars['ID']['input'];
};
/** A command to add a file at the given path with the given contents as part of a commit. Any existing file at that that path will be replaced. */
type FileAddition = {
/** The base64 encoded contents of the file */
contents: Scalars['Base64String']['input'];
/** The path in the repository where the file will be located */
path: Scalars['String']['input'];
};
/**
* A description of a set of changes to a file tree to be made as part of
* a git commit, modeled as zero or more file `additions` and zero or more
* file `deletions`.
*
* Both fields are optional; omitting both will produce a commit with no
* file changes.
*
* `deletions` and `additions` describe changes to files identified
* by their path in the git tree using unix-style path separators, i.e.
* `/`. The root of a git tree is an empty string, so paths are not
* slash-prefixed.
*
* `path` values must be unique across all `additions` and `deletions`
* provided. Any duplication will result in a validation error.
*
* ### Encoding
*
* File contents must be provided in full for each `FileAddition`.
*
* The `contents` of a `FileAddition` must be encoded using RFC 4648
* compliant base64, i.e. correct padding is required and no characters
* outside the standard alphabet may be used. Invalid base64
* encoding will be rejected with a validation error.
*
* The encoded contents may be binary.
*
* For text files, no assumptions are made about the character encoding of
* the file contents (after base64 decoding). No charset transcoding or
* line-ending normalization will be performed; it is the client's
* responsibility to manage the character encoding of files they provide.
* However, for maximum compatibility we recommend using UTF-8 encoding
* and ensuring that all files in a repository use a consistent
* line-ending convention (`\n` or `\r\n`), and that all files end
* with a newline.
*
* ### Modeling file changes
*
* Each of the the five types of conceptual changes that can be made in a
* git commit can be described using the `FileChanges` type as follows:
*
* 1. New file addition: create file `hello world\n` at path `docs/README.txt`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
* 2. Existing file modification: change existing `docs/README.txt` to have new
* content `new content here\n`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("new content here\n")
* }
* ]
* }
*
* 3. Existing file deletion: remove existing file `docs/README.txt`.
* Note that the path is required to exist -- specifying a
* path that does not exist on the given branch will abort the
* commit and return an error.
*
* {
* "deletions" [
* {
* "path": "docs/README.txt"
* }
* ]
* }
*
*
* 4. File rename with no changes: rename `docs/README.txt` with
* previous content `hello world\n` to the same content at
* `newdocs/README.txt`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
*
* 5. File rename with changes: rename `docs/README.txt` with
* previous content `hello world\n` to a file at path
* `newdocs/README.txt` with content `new contents\n`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("new contents\n")
* }
* ]
* }
*
*/
type FileChanges = {
/** File to add or change. */
additions?: InputMaybe<Array<FileAddition>>;
/** Files to delete. */
deletions?: InputMaybe<Array<FileDeletion>>;
};
/** A command to delete the file at the given path as part of a commit. */
type FileDeletion = {
/** The path to delete */
path: Scalars['String']['input'];
};
/** Autogenerated input type of UpdateRef */
type UpdateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** Permit updates of branch Refs that are not fast-forwards? */
force?: InputMaybe<Scalars['Boolean']['input']>;
/** The GitObjectID that the Ref shall be updated to target. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Ref to be updated. */
refId: Scalars['ID']['input'];
};
type GetRepositoryMetadataQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
baseRef: Scalars['String']['input'];
targetRef: Scalars['String']['input'];
}>;
type GetRepositoryMetadataQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
id: string;
baseRef?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
target: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
};
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
targetBranch?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
} | null;
};
type CreateRefMutationVariables = Exact<{
input: CreateRefInput;
}>;
type CreateRefMutation = {
__typename?: 'Mutation';
createRef?: {
__typename?: 'CreateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type UpdateRefMutationVariables = Exact<{
input: UpdateRefInput;
}>;
type UpdateRefMutation = {
__typename?: 'Mutation';
updateRef?: {
__typename?: 'UpdateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type DeleteRefMutationVariables = Exact<{
input: DeleteRefInput;
}>;
type DeleteRefMutation = {
__typename?: 'Mutation';
deleteRef?: {
__typename?: 'DeleteRefPayload';
clientMutationId?: string | null;
} | null;
};
type CreateCommitOnBranchMutationVariables = Exact<{
input: CreateCommitOnBranchInput;
}>;
type CreateCommitOnBranchMutation = {
__typename?: 'Mutation';
createCommitOnBranch?: {
__typename?: 'CreateCommitOnBranchPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type GetRefTreeQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
ref: Scalars['String']['input'];
path: Scalars['String']['input'];
}>;
type GetRefTreeQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
ref?: {
__typename?: 'Ref';
target?: {
__typename?: 'Blob';
} | {
__typename?: 'Commit';
message: string;
tree: {
__typename?: 'Tree';
oid: any;
};
parents: {
__typename?: 'CommitConnection';
nodes?: Array<{
__typename?: 'Commit';
oid: any;
} | null> | null;
};
file?: {
__typename?: 'TreeEntry';
oid: any;
} | null;
} | {
__typename?: 'Tag';
} | {
__typename?: 'Tree';
} | null;
} | null;
} | null;
};
type GitHubClient = {
graphql: <T>(query: string, variables: any) => Promise<T>;
};
declare const getRepositoryMetadata: (o: GitHubClient, v: GetRepositoryMetadataQueryVariables) => Promise<GetRepositoryMetadataQuery["repository"]>;
declare const createRefMutation: (o: GitHubClient, v: CreateRefMutationVariables) => Promise<CreateRefMutation>;
declare const updateRefMutation: (o: GitHubClient, v: UpdateRefMutationVariables) => Promise<UpdateRefMutation>;
declare const deleteRefMutation: (o: GitHubClient, v: DeleteRefMutationVariables) => Promise<DeleteRefMutation>;
declare const createCommitOnBranchQuery: (o: GitHubClient, v: CreateCommitOnBranchMutationVariables) => Promise<CreateCommitOnBranchMutation>;
declare const getRefTreeQuery: (o: GitHubClient, v: GetRefTreeQueryVariables) => Promise<GetRefTreeQuery>;
type queries_GitHubClient = GitHubClient;
declare const queries_createCommitOnBranchQuery: typeof createCommitOnBranchQuery;
declare const queries_createRefMutation: typeof createRefMutation;
declare const queries_deleteRefMutation: typeof deleteRefMutation;
declare const queries_getRefTreeQuery: typeof getRefTreeQuery;
declare const queries_getRepositoryMetadata: typeof getRepositoryMetadata;
declare const queries_updateRefMutation: typeof updateRefMutation;
declare namespace queries {
export { type queries_GitHubClient as GitHubClient, queries_createCommitOnBranchQuery as createCommitOnBranchQuery, queries_createRefMutation as createRefMutation, queries_deleteRefMutation as deleteRefMutation, queries_getRefTreeQuery as getRefTreeQuery, queries_getRepositoryMetadata as getRepositoryMetadata, queries_updateRefMutation as updateRefMutation };
}
interface Logger {
info(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
debug(msg: string): void;
}
type CommitFilesResult = {
refId: string | null;
};
type GitBase = {
branch: string;
} | {
tag: string;
} | {
commit: string;
};
interface CommitFilesBasedArgs {
octokit: GitHubClient;
owner: string;
repo?: string;
/** @deprecated use {@link repo} instead */
repository?: string;
branch: string;
/**
* Push the commit even if the branch exists and does not match what was
* specified as the base.
*/
force?: boolean;
/**
* The commit message
*/
message: string | CommitMessage;
log?: Logger;
}
interface CommitFilesSharedArgsWithBase extends CommitFilesBasedArgs {
/**
* The current branch, tag or commit that the new branch should be based on.
*/
base: GitBase;
}
interface CommitFilesFromBase64Args extends CommitFilesSharedArgsWithBase {
fileChanges: FileChanges;
}
interface CommitFilesFromBuffersArgs extends CommitFilesSharedArgsWithBase {
/**
* The file changes, relative to the repository root, to make to the specified branch.
*/
fileChanges: {
additions?: Array<{
path: string;
contents: Buffer;
}>;
deletions?: string[];
};
}
interface CommitFilesFromDirectoryArgs extends CommitFilesSharedArgsWithBase {
/**
* The directory to consider the root of the repository when calculating
* file paths
*/
workingDirectory?: string;
/**
* The file paths, relative to {@link workingDirectory},
* to add or delete from the branch on GitHub.
*/
fileChanges: {
/** File paths, relative to {@link workingDirectory}, to remove from the repo. */
additions?: string[];
/** File paths, relative to the repository root, to remove from the repo. */
deletions?: string[];
};
}
interface CommitChangesFromRepoArgs extends CommitFilesBasedArgs {
/**
* The base commit to build your changes on-top of.
*
* By default, this commit will be the HEAD of the local repository,
* meaning that if any commits have been made locally and not pushed,
* this command will fail.
*
* To include all changes, this should be set to a commit that is known
* to be in the remote repository (such as the default branch).
*
* If you want to base the changes on a different commit to one checked out,
* make sure that you also pull this commit from the remote.
*
* @default HEAD
*/
base?: {
commit: string;
};
/**
* The root of the repository.
*
* @default process.cwd()
*/
repoDirectory?: string;
}
export { type CommitFilesFromBase64Args as C, type CommitFilesResult as a, type CommitFilesFromDirectoryArgs as b, type CommitChangesFromRepoArgs as c, type CommitFilesFromBuffersArgs as d, queries as q };
+1
-1

@@ -1,2 +0,2 @@

import { C as CommitFilesFromBase64Args, a as CommitFilesResult } from './interface-3kWlutFk.mjs';
import { C as CommitFilesFromBase64Args, a as CommitFilesResult } from './interface-CSlSbqMF.mjs';

@@ -3,0 +3,0 @@ declare const commitFilesFromBase64: ({ octokit, owner, repo, repository, branch, base, force, message, fileChanges, log, }: CommitFilesFromBase64Args) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { C as CommitFilesFromBase64Args, a as CommitFilesResult } from './interface-3kWlutFk.js';
import { C as CommitFilesFromBase64Args, a as CommitFilesResult } from './interface-CSlSbqMF.js';

@@ -3,0 +3,0 @@ declare const commitFilesFromBase64: ({ octokit, owner, repo, repository, branch, base, force, message, fileChanges, log, }: CommitFilesFromBase64Args) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { c as CommitFilesFromDirectoryArgs, a as CommitFilesResult } from './interface-3kWlutFk.mjs';
import { b as CommitFilesFromDirectoryArgs, a as CommitFilesResult } from './interface-CSlSbqMF.mjs';

@@ -3,0 +3,0 @@ declare const commitFilesFromDirectory: ({ workingDirectory, fileChanges, ...otherArgs }: CommitFilesFromDirectoryArgs) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { c as CommitFilesFromDirectoryArgs, a as CommitFilesResult } from './interface-3kWlutFk.js';
import { b as CommitFilesFromDirectoryArgs, a as CommitFilesResult } from './interface-CSlSbqMF.js';

@@ -3,0 +3,0 @@ declare const commitFilesFromDirectory: ({ workingDirectory, fileChanges, ...otherArgs }: CommitFilesFromDirectoryArgs) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { b as CommitChangesFromRepoArgs, a as CommitFilesResult } from './interface-3kWlutFk.mjs';
import { c as CommitChangesFromRepoArgs, a as CommitFilesResult } from './interface-CSlSbqMF.mjs';

@@ -3,0 +3,0 @@ declare const commitChangesFromRepo: ({ base, repoDirectory, log, ...otherArgs }: CommitChangesFromRepoArgs) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { b as CommitChangesFromRepoArgs, a as CommitFilesResult } from './interface-3kWlutFk.js';
import { c as CommitChangesFromRepoArgs, a as CommitFilesResult } from './interface-CSlSbqMF.js';

@@ -3,0 +3,0 @@ declare const commitChangesFromRepo: ({ base, repoDirectory, log, ...otherArgs }: CommitChangesFromRepoArgs) => Promise<CommitFilesResult>;

@@ -1,4 +0,4 @@

export { q as queries } from './interface-3kWlutFk.mjs';
export { q as queries } from './interface-CSlSbqMF.mjs';
export { commitFilesFromBase64 } from './core.mjs';
export { commitChangesFromRepo } from './git.mjs';
export { commitFilesFromDirectory } from './fs.mjs';

@@ -1,4 +0,4 @@

export { q as queries } from './interface-3kWlutFk.js';
export { q as queries } from './interface-CSlSbqMF.js';
export { commitFilesFromBase64 } from './core.js';
export { commitChangesFromRepo } from './git.js';
export { commitFilesFromDirectory } from './fs.js';

@@ -31,4 +31,4 @@ "use strict";

// src/index.ts
var src_exports = {};
__export(src_exports, {
var index_exports = {};
__export(index_exports, {
commitChangesFromRepo: () => commitChangesFromRepo,

@@ -39,3 +39,3 @@ commitFilesFromBase64: () => commitFilesFromBase64,

});
module.exports = __toCommonJS(src_exports);
module.exports = __toCommonJS(index_exports);

@@ -42,0 +42,0 @@ // src/github/graphql/queries.ts

import {
commitFilesFromDirectory
} from "./chunk-2DP5I2RH.mjs";
import {
commitChangesFromRepo
} from "./chunk-BN43Q2NX.mjs";
import {
commitFilesFromDirectory
} from "./chunk-2DP5I2RH.mjs";
import "./chunk-UMPES6AZ.mjs";

@@ -8,0 +8,0 @@ import {

@@ -1,2 +0,2 @@

import { d as CommitFilesFromBuffersArgs, a as CommitFilesResult } from './interface-3kWlutFk.mjs';
import { d as CommitFilesFromBuffersArgs, a as CommitFilesResult } from './interface-CSlSbqMF.mjs';

@@ -3,0 +3,0 @@ declare const commitFilesFromBuffers: ({ fileChanges, ...otherArgs }: CommitFilesFromBuffersArgs) => Promise<CommitFilesResult>;

@@ -1,2 +0,2 @@

import { d as CommitFilesFromBuffersArgs, a as CommitFilesResult } from './interface-3kWlutFk.js';
import { d as CommitFilesFromBuffersArgs, a as CommitFilesResult } from './interface-CSlSbqMF.js';

@@ -3,0 +3,0 @@ declare const commitFilesFromBuffers: ({ fileChanges, ...otherArgs }: CommitFilesFromBuffersArgs) => Promise<CommitFilesResult>;

{
"name": "@changesets/ghcommit",
"version": "1.3.0",
"version": "1.3.1",
"description": "Directly change files on github using the github API, to support GPG signing",

@@ -5,0 +5,0 @@ "keywords": [

type Maybe<T> = T | null;
type InputMaybe<T> = Maybe<T>;
type Exact<T extends {
[key: string]: unknown;
}> = {
[K in keyof T]: T[K];
};
/** All built-in and custom scalars, mapped to their actual values */
type Scalars = {
ID: {
input: string;
output: string;
};
String: {
input: string;
output: string;
};
Boolean: {
input: boolean;
output: boolean;
};
Int: {
input: number;
output: number;
};
Float: {
input: number;
output: number;
};
Base64String: {
input: any;
output: any;
};
BigInt: {
input: any;
output: any;
};
Date: {
input: any;
output: any;
};
DateTime: {
input: any;
output: any;
};
GitObjectID: {
input: any;
output: any;
};
GitSSHRemote: {
input: any;
output: any;
};
GitTimestamp: {
input: any;
output: any;
};
HTML: {
input: any;
output: any;
};
PreciseDateTime: {
input: any;
output: any;
};
URI: {
input: any;
output: any;
};
X509Certificate: {
input: any;
output: any;
};
};
/** A message to include with a new commit */
type CommitMessage = {
/** The body of the message. */
body?: InputMaybe<Scalars['String']['input']>;
/** The headline of the message. */
headline: Scalars['String']['input'];
};
/**
* A git ref for a commit to be appended to.
*
* The ref must be a branch, i.e. its fully qualified name must start
* with `refs/heads/` (although the input is not required to be fully
* qualified).
*
* The Ref may be specified by its global node ID or by the
* `repositoryNameWithOwner` and `branchName`.
*
* ### Examples
*
* Specify a branch using a global node ID:
*
* { "id": "MDM6UmVmMTpyZWZzL2hlYWRzL21haW4=" }
*
* Specify a branch using `repositoryNameWithOwner` and `branchName`:
*
* {
* "repositoryNameWithOwner": "github/graphql-client",
* "branchName": "main"
* }
*
*
*/
type CommittableBranch = {
/** The unqualified name of the branch to append the commit to. */
branchName?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be updated. */
id?: InputMaybe<Scalars['ID']['input']>;
/** The nameWithOwner of the repository to commit to. */
repositoryNameWithOwner?: InputMaybe<Scalars['String']['input']>;
};
/** Autogenerated input type of CreateCommitOnBranch */
type CreateCommitOnBranchInput = {
/** The Ref to be updated. Must be a branch. */
branch: CommittableBranch;
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The git commit oid expected at the head of the branch prior to the commit */
expectedHeadOid: Scalars['GitObjectID']['input'];
/** A description of changes to files in this commit. */
fileChanges?: InputMaybe<FileChanges>;
/** The commit message the be included with the commit. */
message: CommitMessage;
};
/** Autogenerated input type of CreateRef */
type CreateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). */
name: Scalars['String']['input'];
/** The GitObjectID that the new Ref shall target. Must point to a commit. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Repository to create the Ref in. */
repositoryId: Scalars['ID']['input'];
};
/** Autogenerated input type of DeleteRef */
type DeleteRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be deleted. */
refId: Scalars['ID']['input'];
};
/** A command to add a file at the given path with the given contents as part of a commit. Any existing file at that that path will be replaced. */
type FileAddition = {
/** The base64 encoded contents of the file */
contents: Scalars['Base64String']['input'];
/** The path in the repository where the file will be located */
path: Scalars['String']['input'];
};
/**
* A description of a set of changes to a file tree to be made as part of
* a git commit, modeled as zero or more file `additions` and zero or more
* file `deletions`.
*
* Both fields are optional; omitting both will produce a commit with no
* file changes.
*
* `deletions` and `additions` describe changes to files identified
* by their path in the git tree using unix-style path separators, i.e.
* `/`. The root of a git tree is an empty string, so paths are not
* slash-prefixed.
*
* `path` values must be unique across all `additions` and `deletions`
* provided. Any duplication will result in a validation error.
*
* ### Encoding
*
* File contents must be provided in full for each `FileAddition`.
*
* The `contents` of a `FileAddition` must be encoded using RFC 4648
* compliant base64, i.e. correct padding is required and no characters
* outside the standard alphabet may be used. Invalid base64
* encoding will be rejected with a validation error.
*
* The encoded contents may be binary.
*
* For text files, no assumptions are made about the character encoding of
* the file contents (after base64 decoding). No charset transcoding or
* line-ending normalization will be performed; it is the client's
* responsibility to manage the character encoding of files they provide.
* However, for maximum compatibility we recommend using UTF-8 encoding
* and ensuring that all files in a repository use a consistent
* line-ending convention (`\n` or `\r\n`), and that all files end
* with a newline.
*
* ### Modeling file changes
*
* Each of the the five types of conceptual changes that can be made in a
* git commit can be described using the `FileChanges` type as follows:
*
* 1. New file addition: create file `hello world\n` at path `docs/README.txt`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
* 2. Existing file modification: change existing `docs/README.txt` to have new
* content `new content here\n`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("new content here\n")
* }
* ]
* }
*
* 3. Existing file deletion: remove existing file `docs/README.txt`.
* Note that the path is required to exist -- specifying a
* path that does not exist on the given branch will abort the
* commit and return an error.
*
* {
* "deletions" [
* {
* "path": "docs/README.txt"
* }
* ]
* }
*
*
* 4. File rename with no changes: rename `docs/README.txt` with
* previous content `hello world\n` to the same content at
* `newdocs/README.txt`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
*
* 5. File rename with changes: rename `docs/README.txt` with
* previous content `hello world\n` to a file at path
* `newdocs/README.txt` with content `new contents\n`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("new contents\n")
* }
* ]
* }
*
*/
type FileChanges = {
/** File to add or change. */
additions?: InputMaybe<Array<FileAddition>>;
/** Files to delete. */
deletions?: InputMaybe<Array<FileDeletion>>;
};
/** A command to delete the file at the given path as part of a commit. */
type FileDeletion = {
/** The path to delete */
path: Scalars['String']['input'];
};
/** Autogenerated input type of UpdateRef */
type UpdateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** Permit updates of branch Refs that are not fast-forwards? */
force?: InputMaybe<Scalars['Boolean']['input']>;
/** The GitObjectID that the Ref shall be updated to target. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Ref to be updated. */
refId: Scalars['ID']['input'];
};
type GetRepositoryMetadataQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
baseRef: Scalars['String']['input'];
targetRef: Scalars['String']['input'];
}>;
type GetRepositoryMetadataQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
id: string;
baseRef?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
target: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
};
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
targetBranch?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
} | null;
};
type CreateRefMutationVariables = Exact<{
input: CreateRefInput;
}>;
type CreateRefMutation = {
__typename?: 'Mutation';
createRef?: {
__typename?: 'CreateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type UpdateRefMutationVariables = Exact<{
input: UpdateRefInput;
}>;
type UpdateRefMutation = {
__typename?: 'Mutation';
updateRef?: {
__typename?: 'UpdateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type DeleteRefMutationVariables = Exact<{
input: DeleteRefInput;
}>;
type DeleteRefMutation = {
__typename?: 'Mutation';
deleteRef?: {
__typename?: 'DeleteRefPayload';
clientMutationId?: string | null;
} | null;
};
type CreateCommitOnBranchMutationVariables = Exact<{
input: CreateCommitOnBranchInput;
}>;
type CreateCommitOnBranchMutation = {
__typename?: 'Mutation';
createCommitOnBranch?: {
__typename?: 'CreateCommitOnBranchPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type GetRefTreeQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
ref: Scalars['String']['input'];
path: Scalars['String']['input'];
}>;
type GetRefTreeQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
ref?: {
__typename?: 'Ref';
target?: {
__typename?: 'Blob';
} | {
__typename?: 'Commit';
message: string;
tree: {
__typename?: 'Tree';
oid: any;
};
parents: {
__typename?: 'CommitConnection';
nodes?: Array<{
__typename?: 'Commit';
oid: any;
} | null> | null;
};
file?: {
__typename?: 'TreeEntry';
oid: any;
} | null;
} | {
__typename?: 'Tag';
} | {
__typename?: 'Tree';
} | null;
} | null;
} | null;
};
type GitHubClient = {
graphql: <T>(query: string, variables: any) => Promise<T>;
};
declare const getRepositoryMetadata: (o: GitHubClient, v: GetRepositoryMetadataQueryVariables) => Promise<GetRepositoryMetadataQuery["repository"]>;
declare const createRefMutation: (o: GitHubClient, v: CreateRefMutationVariables) => Promise<CreateRefMutation>;
declare const updateRefMutation: (o: GitHubClient, v: UpdateRefMutationVariables) => Promise<UpdateRefMutation>;
declare const deleteRefMutation: (o: GitHubClient, v: DeleteRefMutationVariables) => Promise<DeleteRefMutation>;
declare const createCommitOnBranchQuery: (o: GitHubClient, v: CreateCommitOnBranchMutationVariables) => Promise<CreateCommitOnBranchMutation>;
declare const getRefTreeQuery: (o: GitHubClient, v: GetRefTreeQueryVariables) => Promise<GetRefTreeQuery>;
type queries_GitHubClient = GitHubClient;
declare const queries_createCommitOnBranchQuery: typeof createCommitOnBranchQuery;
declare const queries_createRefMutation: typeof createRefMutation;
declare const queries_deleteRefMutation: typeof deleteRefMutation;
declare const queries_getRefTreeQuery: typeof getRefTreeQuery;
declare const queries_getRepositoryMetadata: typeof getRepositoryMetadata;
declare const queries_updateRefMutation: typeof updateRefMutation;
declare namespace queries {
export { type queries_GitHubClient as GitHubClient, queries_createCommitOnBranchQuery as createCommitOnBranchQuery, queries_createRefMutation as createRefMutation, queries_deleteRefMutation as deleteRefMutation, queries_getRefTreeQuery as getRefTreeQuery, queries_getRepositoryMetadata as getRepositoryMetadata, queries_updateRefMutation as updateRefMutation };
}
interface Logger {
info(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
debug(msg: string): void;
}
type CommitFilesResult = {
refId: string | null;
};
type GitBase = {
branch: string;
} | {
tag: string;
} | {
commit: string;
};
interface CommitFilesBasedArgs {
octokit: GitHubClient;
owner: string;
repo?: string;
/** @deprecated use {@link repo} instead */
repository?: string;
branch: string;
/**
* Push the commit even if the branch exists and does not match what was
* specified as the base.
*/
force?: boolean;
/**
* The commit message
*/
message: string | CommitMessage;
log?: Logger;
}
interface CommitFilesSharedArgsWithBase extends CommitFilesBasedArgs {
/**
* The current branch, tag or commit that the new branch should be based on.
*/
base: GitBase;
}
interface CommitFilesFromBase64Args extends CommitFilesSharedArgsWithBase {
fileChanges: FileChanges;
}
interface CommitFilesFromBuffersArgs extends CommitFilesSharedArgsWithBase {
/**
* The file changes, relative to the repository root, to make to the specified branch.
*/
fileChanges: {
additions?: Array<{
path: string;
contents: Buffer;
}>;
deletions?: string[];
};
}
interface CommitFilesFromDirectoryArgs extends CommitFilesSharedArgsWithBase {
/**
* The directory to consider the root of the repository when calculating
* file paths
*/
workingDirectory?: string;
/**
* The file paths, relative to {@link workingDirectory},
* to add or delete from the branch on GitHub.
*/
fileChanges: {
/** File paths, relative to {@link workingDirectory}, to remove from the repo. */
additions?: string[];
/** File paths, relative to the repository root, to remove from the repo. */
deletions?: string[];
};
}
interface CommitChangesFromRepoArgs extends CommitFilesBasedArgs {
/**
* The base commit to build your changes on-top of.
*
* By default, this commit will be the HEAD of the local repository,
* meaning that if any commits have been made locally and not pushed,
* this command will fail.
*
* To include all changes, this should be set to a commit that is known
* to be in the remote repository (such as the default branch).
*
* If you want to base the changes on a different commit to one checked out,
* make sure that you also pull this commit from the remote.
*
* @default HEAD
*/
base?: {
commit: string;
};
/**
* The root of the repository.
*
* @default process.cwd()
*/
repoDirectory?: string;
}
export { type CommitFilesFromBase64Args as C, type CommitFilesResult as a, type CommitChangesFromRepoArgs as b, type CommitFilesFromDirectoryArgs as c, type CommitFilesFromBuffersArgs as d, queries as q };
type Maybe<T> = T | null;
type InputMaybe<T> = Maybe<T>;
type Exact<T extends {
[key: string]: unknown;
}> = {
[K in keyof T]: T[K];
};
/** All built-in and custom scalars, mapped to their actual values */
type Scalars = {
ID: {
input: string;
output: string;
};
String: {
input: string;
output: string;
};
Boolean: {
input: boolean;
output: boolean;
};
Int: {
input: number;
output: number;
};
Float: {
input: number;
output: number;
};
Base64String: {
input: any;
output: any;
};
BigInt: {
input: any;
output: any;
};
Date: {
input: any;
output: any;
};
DateTime: {
input: any;
output: any;
};
GitObjectID: {
input: any;
output: any;
};
GitSSHRemote: {
input: any;
output: any;
};
GitTimestamp: {
input: any;
output: any;
};
HTML: {
input: any;
output: any;
};
PreciseDateTime: {
input: any;
output: any;
};
URI: {
input: any;
output: any;
};
X509Certificate: {
input: any;
output: any;
};
};
/** A message to include with a new commit */
type CommitMessage = {
/** The body of the message. */
body?: InputMaybe<Scalars['String']['input']>;
/** The headline of the message. */
headline: Scalars['String']['input'];
};
/**
* A git ref for a commit to be appended to.
*
* The ref must be a branch, i.e. its fully qualified name must start
* with `refs/heads/` (although the input is not required to be fully
* qualified).
*
* The Ref may be specified by its global node ID or by the
* `repositoryNameWithOwner` and `branchName`.
*
* ### Examples
*
* Specify a branch using a global node ID:
*
* { "id": "MDM6UmVmMTpyZWZzL2hlYWRzL21haW4=" }
*
* Specify a branch using `repositoryNameWithOwner` and `branchName`:
*
* {
* "repositoryNameWithOwner": "github/graphql-client",
* "branchName": "main"
* }
*
*
*/
type CommittableBranch = {
/** The unqualified name of the branch to append the commit to. */
branchName?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be updated. */
id?: InputMaybe<Scalars['ID']['input']>;
/** The nameWithOwner of the repository to commit to. */
repositoryNameWithOwner?: InputMaybe<Scalars['String']['input']>;
};
/** Autogenerated input type of CreateCommitOnBranch */
type CreateCommitOnBranchInput = {
/** The Ref to be updated. Must be a branch. */
branch: CommittableBranch;
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The git commit oid expected at the head of the branch prior to the commit */
expectedHeadOid: Scalars['GitObjectID']['input'];
/** A description of changes to files in this commit. */
fileChanges?: InputMaybe<FileChanges>;
/** The commit message the be included with the commit. */
message: CommitMessage;
};
/** Autogenerated input type of CreateRef */
type CreateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The fully qualified name of the new Ref (ie: `refs/heads/my_new_branch`). */
name: Scalars['String']['input'];
/** The GitObjectID that the new Ref shall target. Must point to a commit. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Repository to create the Ref in. */
repositoryId: Scalars['ID']['input'];
};
/** Autogenerated input type of DeleteRef */
type DeleteRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** The Node ID of the Ref to be deleted. */
refId: Scalars['ID']['input'];
};
/** A command to add a file at the given path with the given contents as part of a commit. Any existing file at that that path will be replaced. */
type FileAddition = {
/** The base64 encoded contents of the file */
contents: Scalars['Base64String']['input'];
/** The path in the repository where the file will be located */
path: Scalars['String']['input'];
};
/**
* A description of a set of changes to a file tree to be made as part of
* a git commit, modeled as zero or more file `additions` and zero or more
* file `deletions`.
*
* Both fields are optional; omitting both will produce a commit with no
* file changes.
*
* `deletions` and `additions` describe changes to files identified
* by their path in the git tree using unix-style path separators, i.e.
* `/`. The root of a git tree is an empty string, so paths are not
* slash-prefixed.
*
* `path` values must be unique across all `additions` and `deletions`
* provided. Any duplication will result in a validation error.
*
* ### Encoding
*
* File contents must be provided in full for each `FileAddition`.
*
* The `contents` of a `FileAddition` must be encoded using RFC 4648
* compliant base64, i.e. correct padding is required and no characters
* outside the standard alphabet may be used. Invalid base64
* encoding will be rejected with a validation error.
*
* The encoded contents may be binary.
*
* For text files, no assumptions are made about the character encoding of
* the file contents (after base64 decoding). No charset transcoding or
* line-ending normalization will be performed; it is the client's
* responsibility to manage the character encoding of files they provide.
* However, for maximum compatibility we recommend using UTF-8 encoding
* and ensuring that all files in a repository use a consistent
* line-ending convention (`\n` or `\r\n`), and that all files end
* with a newline.
*
* ### Modeling file changes
*
* Each of the the five types of conceptual changes that can be made in a
* git commit can be described using the `FileChanges` type as follows:
*
* 1. New file addition: create file `hello world\n` at path `docs/README.txt`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
* 2. Existing file modification: change existing `docs/README.txt` to have new
* content `new content here\n`:
*
* {
* "additions" [
* {
* "path": "docs/README.txt",
* "contents": base64encode("new content here\n")
* }
* ]
* }
*
* 3. Existing file deletion: remove existing file `docs/README.txt`.
* Note that the path is required to exist -- specifying a
* path that does not exist on the given branch will abort the
* commit and return an error.
*
* {
* "deletions" [
* {
* "path": "docs/README.txt"
* }
* ]
* }
*
*
* 4. File rename with no changes: rename `docs/README.txt` with
* previous content `hello world\n` to the same content at
* `newdocs/README.txt`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("hello world\n")
* }
* ]
* }
*
*
* 5. File rename with changes: rename `docs/README.txt` with
* previous content `hello world\n` to a file at path
* `newdocs/README.txt` with content `new contents\n`:
*
* {
* "deletions" [
* {
* "path": "docs/README.txt",
* }
* ],
* "additions" [
* {
* "path": "newdocs/README.txt",
* "contents": base64encode("new contents\n")
* }
* ]
* }
*
*/
type FileChanges = {
/** File to add or change. */
additions?: InputMaybe<Array<FileAddition>>;
/** Files to delete. */
deletions?: InputMaybe<Array<FileDeletion>>;
};
/** A command to delete the file at the given path as part of a commit. */
type FileDeletion = {
/** The path to delete */
path: Scalars['String']['input'];
};
/** Autogenerated input type of UpdateRef */
type UpdateRefInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** Permit updates of branch Refs that are not fast-forwards? */
force?: InputMaybe<Scalars['Boolean']['input']>;
/** The GitObjectID that the Ref shall be updated to target. */
oid: Scalars['GitObjectID']['input'];
/** The Node ID of the Ref to be updated. */
refId: Scalars['ID']['input'];
};
type GetRepositoryMetadataQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
baseRef: Scalars['String']['input'];
targetRef: Scalars['String']['input'];
}>;
type GetRepositoryMetadataQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
id: string;
baseRef?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
target: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
};
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
targetBranch?: {
__typename?: 'Ref';
id: string;
target?: {
__typename?: 'Blob';
oid: any;
} | {
__typename?: 'Commit';
oid: any;
} | {
__typename?: 'Tag';
oid: any;
} | {
__typename?: 'Tree';
oid: any;
} | null;
} | null;
} | null;
};
type CreateRefMutationVariables = Exact<{
input: CreateRefInput;
}>;
type CreateRefMutation = {
__typename?: 'Mutation';
createRef?: {
__typename?: 'CreateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type UpdateRefMutationVariables = Exact<{
input: UpdateRefInput;
}>;
type UpdateRefMutation = {
__typename?: 'Mutation';
updateRef?: {
__typename?: 'UpdateRefPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type DeleteRefMutationVariables = Exact<{
input: DeleteRefInput;
}>;
type DeleteRefMutation = {
__typename?: 'Mutation';
deleteRef?: {
__typename?: 'DeleteRefPayload';
clientMutationId?: string | null;
} | null;
};
type CreateCommitOnBranchMutationVariables = Exact<{
input: CreateCommitOnBranchInput;
}>;
type CreateCommitOnBranchMutation = {
__typename?: 'Mutation';
createCommitOnBranch?: {
__typename?: 'CreateCommitOnBranchPayload';
ref?: {
__typename?: 'Ref';
id: string;
} | null;
} | null;
};
type GetRefTreeQueryVariables = Exact<{
owner: Scalars['String']['input'];
repo: Scalars['String']['input'];
ref: Scalars['String']['input'];
path: Scalars['String']['input'];
}>;
type GetRefTreeQuery = {
__typename?: 'Query';
repository?: {
__typename?: 'Repository';
ref?: {
__typename?: 'Ref';
target?: {
__typename?: 'Blob';
} | {
__typename?: 'Commit';
message: string;
tree: {
__typename?: 'Tree';
oid: any;
};
parents: {
__typename?: 'CommitConnection';
nodes?: Array<{
__typename?: 'Commit';
oid: any;
} | null> | null;
};
file?: {
__typename?: 'TreeEntry';
oid: any;
} | null;
} | {
__typename?: 'Tag';
} | {
__typename?: 'Tree';
} | null;
} | null;
} | null;
};
type GitHubClient = {
graphql: <T>(query: string, variables: any) => Promise<T>;
};
declare const getRepositoryMetadata: (o: GitHubClient, v: GetRepositoryMetadataQueryVariables) => Promise<GetRepositoryMetadataQuery["repository"]>;
declare const createRefMutation: (o: GitHubClient, v: CreateRefMutationVariables) => Promise<CreateRefMutation>;
declare const updateRefMutation: (o: GitHubClient, v: UpdateRefMutationVariables) => Promise<UpdateRefMutation>;
declare const deleteRefMutation: (o: GitHubClient, v: DeleteRefMutationVariables) => Promise<DeleteRefMutation>;
declare const createCommitOnBranchQuery: (o: GitHubClient, v: CreateCommitOnBranchMutationVariables) => Promise<CreateCommitOnBranchMutation>;
declare const getRefTreeQuery: (o: GitHubClient, v: GetRefTreeQueryVariables) => Promise<GetRefTreeQuery>;
type queries_GitHubClient = GitHubClient;
declare const queries_createCommitOnBranchQuery: typeof createCommitOnBranchQuery;
declare const queries_createRefMutation: typeof createRefMutation;
declare const queries_deleteRefMutation: typeof deleteRefMutation;
declare const queries_getRefTreeQuery: typeof getRefTreeQuery;
declare const queries_getRepositoryMetadata: typeof getRepositoryMetadata;
declare const queries_updateRefMutation: typeof updateRefMutation;
declare namespace queries {
export { type queries_GitHubClient as GitHubClient, queries_createCommitOnBranchQuery as createCommitOnBranchQuery, queries_createRefMutation as createRefMutation, queries_deleteRefMutation as deleteRefMutation, queries_getRefTreeQuery as getRefTreeQuery, queries_getRepositoryMetadata as getRepositoryMetadata, queries_updateRefMutation as updateRefMutation };
}
interface Logger {
info(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
debug(msg: string): void;
}
type CommitFilesResult = {
refId: string | null;
};
type GitBase = {
branch: string;
} | {
tag: string;
} | {
commit: string;
};
interface CommitFilesBasedArgs {
octokit: GitHubClient;
owner: string;
repo?: string;
/** @deprecated use {@link repo} instead */
repository?: string;
branch: string;
/**
* Push the commit even if the branch exists and does not match what was
* specified as the base.
*/
force?: boolean;
/**
* The commit message
*/
message: string | CommitMessage;
log?: Logger;
}
interface CommitFilesSharedArgsWithBase extends CommitFilesBasedArgs {
/**
* The current branch, tag or commit that the new branch should be based on.
*/
base: GitBase;
}
interface CommitFilesFromBase64Args extends CommitFilesSharedArgsWithBase {
fileChanges: FileChanges;
}
interface CommitFilesFromBuffersArgs extends CommitFilesSharedArgsWithBase {
/**
* The file changes, relative to the repository root, to make to the specified branch.
*/
fileChanges: {
additions?: Array<{
path: string;
contents: Buffer;
}>;
deletions?: string[];
};
}
interface CommitFilesFromDirectoryArgs extends CommitFilesSharedArgsWithBase {
/**
* The directory to consider the root of the repository when calculating
* file paths
*/
workingDirectory?: string;
/**
* The file paths, relative to {@link workingDirectory},
* to add or delete from the branch on GitHub.
*/
fileChanges: {
/** File paths, relative to {@link workingDirectory}, to remove from the repo. */
additions?: string[];
/** File paths, relative to the repository root, to remove from the repo. */
deletions?: string[];
};
}
interface CommitChangesFromRepoArgs extends CommitFilesBasedArgs {
/**
* The base commit to build your changes on-top of.
*
* By default, this commit will be the HEAD of the local repository,
* meaning that if any commits have been made locally and not pushed,
* this command will fail.
*
* To include all changes, this should be set to a commit that is known
* to be in the remote repository (such as the default branch).
*
* If you want to base the changes on a different commit to one checked out,
* make sure that you also pull this commit from the remote.
*
* @default HEAD
*/
base?: {
commit: string;
};
/**
* The root of the repository.
*
* @default process.cwd()
*/
repoDirectory?: string;
}
export { type CommitFilesFromBase64Args as C, type CommitFilesResult as a, type CommitChangesFromRepoArgs as b, type CommitFilesFromDirectoryArgs as c, type CommitFilesFromBuffersArgs as d, queries as q };