Skip to content

Commit a8baf6b

Browse files
renovate[bot]Create or Update Pull Request Actionkfcampbell
authored
chore(deps): update dependency prettier to v3 (#92)
* chore(deps): update dependency prettier to v3 * style: prettier * Empty commit to trigger test run --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Create or Update Pull Request Action <[email protected]> Co-authored-by: Keegan Campbell <[email protected]>
1 parent 3614557 commit a8baf6b

12 files changed

+39
-39
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const { repository } = await octokit.graphql.paginate(
5555
}
5656
}
5757
}
58-
}`
58+
}`,
5959
);
6060

6161
console.log(`Found ${repository.issues.nodes.length} issues!`);
@@ -95,7 +95,7 @@ const pageIterator = octokit.graphql.paginate.iterator(
9595
}
9696
}
9797
}
98-
}`
98+
}`,
9999
);
100100

101101
for await (const response of pageIterator) {
@@ -127,7 +127,7 @@ await octokit.graphql.paginate(
127127
`,
128128
{
129129
organization: "octokit",
130-
}
130+
},
131131
);
132132
```
133133

@@ -153,7 +153,7 @@ await octokit.graphql.paginate(
153153
{
154154
organization: "octokit",
155155
cursor: "initialValue",
156-
}
156+
},
157157
);
158158
```
159159

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"glob": "^10.2.6",
4040
"jest": "^29.0.0",
4141
"npm-run-all": "^4.1.5",
42-
"prettier": "2.8.8",
42+
"prettier": "3.0.0",
4343
"semantic-release-plugin-update-version-in-files": "^1.0.0",
4444
"ts-jest": "^29.0.0",
4545
"typescript": "^5.0.0"

src/errors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import type { CursorValue, PageInfoContext } from "./page-info";
33
// Todo: Add link to explanation
44
const generateMessage = (path: string[], cursorValue: CursorValue): string =>
55
`The cursor at "${path.join(
6-
","
6+
",",
77
)}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
88

99
class MissingCursorChange extends Error {
1010
override name = "MissingCursorChangeError";
1111

1212
constructor(
1313
readonly pageInfo: PageInfoContext,
14-
readonly cursorValue: CursorValue
14+
readonly cursorValue: CursorValue,
1515
) {
1616
super(generateMessage(pageInfo.pathInQuery, cursorValue));
1717

@@ -29,8 +29,8 @@ class MissingPageInfo extends Error {
2929
`No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
3030
response,
3131
null,
32-
2
33-
)}`
32+
2,
33+
)}`,
3434
);
3535

3636
if (Error.captureStackTrace) {

src/iterator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { MissingCursorChange } from "./errors";
66
const createIterator = (octokit: Octokit) => {
77
return <ResponseType = any>(
88
query: string,
9-
initialParameters: Record<string, any> = {}
9+
initialParameters: Record<string, any> = {},
1010
) => {
1111
let nextPageExists = true;
1212
let parameters = { ...initialParameters };
@@ -18,7 +18,7 @@ const createIterator = (octokit: Octokit) => {
1818

1919
const response = await octokit.graphql<ResponseType>(
2020
query,
21-
parameters
21+
parameters,
2222
);
2323

2424
const pageInfoContext = extractPageInfos(response);

src/merge-responses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { findPaginatedResourcePath, get, set } from "./object-helpers";
22

33
const mergeResponses = <ResponseType extends object = any>(
44
response1: ResponseType,
5-
response2: ResponseType
5+
response2: ResponseType,
66
): ResponseType => {
77
if (Object.keys(response1).length === 0) {
88
return Object.assign(response1, response2);

src/object-helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const isObject = (value: any) =>
66
function findPaginatedResourcePath(responseData: any): string[] {
77
const paginatedResourcePath = deepFindPathToProperty(
88
responseData,
9-
"pageInfo"
9+
"pageInfo",
1010
);
1111
if (paginatedResourcePath.length === 0) {
1212
throw new MissingPageInfo(responseData);
@@ -17,7 +17,7 @@ function findPaginatedResourcePath(responseData: any): string[] {
1717
const deepFindPathToProperty = (
1818
object: any,
1919
searchProp: string,
20-
path: string[] = []
20+
path: string[] = [],
2121
): string[] => {
2222
for (const key of Object.keys(object)) {
2323
const currentPath = [...path, key];
@@ -31,7 +31,7 @@ const deepFindPathToProperty = (
3131
const result = deepFindPathToProperty(
3232
currentValue,
3333
searchProp,
34-
currentPath
34+
currentPath,
3535
);
3636
if (result.length > 0) {
3737
return result;

src/page-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type PageInfoContext = {
1818
};
1919

2020
const isForwardSearch = (
21-
givenPageInfo: PageInfo
21+
givenPageInfo: PageInfo,
2222
): givenPageInfo is PageInfoForward => {
2323
return givenPageInfo.hasOwnProperty("hasNextPage");
2424
};

src/paginate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const createPaginate = (octokit: Octokit) => {
66
const iterator = createIterator(octokit);
77
return async <ResponseType extends object = any>(
88
query: string,
9-
initialParameters: Record<string, any> = {}
9+
initialParameters: Record<string, any> = {},
1010
): Promise<ResponseType> => {
1111
let mergedResponse: ResponseType = {} as ResponseType;
1212
for await (const response of iterator<ResponseType>(
1313
query,
14-
initialParameters
14+
initialParameters,
1515
)) {
1616
mergedResponse = mergeResponses<ResponseType>(mergedResponse, response);
1717
}

test/paginate-graphql.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const PatchedOctokit = Octokit.plugin(paginateGraphql);
66
const token = process.env.E2E_GITHUB_TOKEN;
77
if (!token) {
88
throw new Error(
9-
"Executing the E2E Tests requires you to pass a GitHub Token as an environment variable named E2E_GITHUB_TOKEN"
9+
"Executing the E2E Tests requires you to pass a GitHub Token as an environment variable named E2E_GITHUB_TOKEN",
1010
);
1111
}
1212

@@ -30,7 +30,7 @@ describe("paginate-graphql-js E2E Test", () => {
3030
}
3131
}
3232
}
33-
}`
33+
}`,
3434
);
3535
expect(result).toBeDefined();
3636
expect(result.repository.repositoryTopics.nodes).toHaveLength(3);
@@ -55,7 +55,7 @@ describe("paginate-graphql-js E2E Test", () => {
5555
}
5656
}
5757
}
58-
}`
58+
}`,
5959
);
6060

6161
let iterations = 0;

test/paginate.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe("pagination", () => {
118118
}
119119
}
120120
`,
121-
{ cursor: "initialValue", organization: "octokit" }
121+
{ cursor: "initialValue", organization: "octokit" },
122122
);
123123

124124
expect(getPassedVariablesForCall(1)).toEqual({
@@ -225,7 +225,7 @@ describe("pagination", () => {
225225
}
226226
}
227227
}
228-
}`
228+
}`,
229229
);
230230

231231
expect(getCallCount()).toBe(2);
@@ -258,7 +258,7 @@ describe("pagination", () => {
258258
}
259259
}
260260
}
261-
}`
261+
}`,
262262
);
263263

264264
const allIssues: any[] = [];
@@ -305,13 +305,13 @@ describe("pagination", () => {
305305
}
306306
}
307307
}
308-
}`
308+
}`,
309309
);
310310
throw new Error("Should not succeed!");
311311
} catch (err: any) {
312312
expect(err).toBeInstanceOf(MissingCursorChange);
313313
expect(err.message).toMatch(
314-
/The cursor at "repository.issues" did not change its value "endCursor1".*/
314+
/The cursor at "repository.issues" did not change its value "endCursor1".*/,
315315
);
316316
}
317317
});
@@ -349,8 +349,8 @@ describe("pagination", () => {
349349
`No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
350350
response,
351351
null,
352-
2
353-
)}`
352+
2,
353+
)}`,
354354
);
355355
}
356356
});
@@ -389,7 +389,7 @@ describe("pagination", () => {
389389
.catch((error) => {
390390
expect(error.message).toEqual(
391391
"Request failed due to following response errors:\n" +
392-
" - Field 'bioHtml' doesn't exist on type 'User'"
392+
" - Field 'bioHtml' doesn't exist on type 'User'",
393393
);
394394
expect(error.errors).toStrictEqual(mockResponse.errors);
395395
expect(error.request.query).toEqual(query);

test/testHelpers/mock-octokit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const MockOctokit = ({ responses = [{}] }: { responses?: any[] } = {}) => {
1616
callCount = callCount + 1;
1717
return { data: responses.shift() };
1818
},
19-
{ repeat: responses.length }
19+
{ repeat: responses.length },
2020
);
2121

2222
const octokit = new PatchedOctokit({

0 commit comments

Comments
 (0)