@openally/github.sdk 1.1.0 → 1.1.1

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 (71) hide show
  1. package/dist/api/rawFile.d.ts +20 -0
  2. package/dist/api/rawFile.d.ts.map +1 -0
  3. package/dist/api/rawFile.js +25 -0
  4. package/dist/api/rawFile.js.map +1 -0
  5. package/dist/api/repos.d.ts +21 -0
  6. package/dist/api/repos.d.ts.map +1 -0
  7. package/dist/api/repos.js +32 -0
  8. package/dist/api/repos.js.map +1 -0
  9. package/dist/api/users.d.ts +21 -0
  10. package/dist/api/users.d.ts.map +1 -0
  11. package/dist/api/users.js +20 -0
  12. package/dist/api/users.js.map +1 -0
  13. package/dist/class/ApiEndpoint.d.ts +20 -0
  14. package/dist/class/ApiEndpoint.d.ts.map +1 -0
  15. package/dist/class/ApiEndpoint.js +60 -0
  16. package/dist/class/ApiEndpoint.js.map +1 -0
  17. package/dist/class/GithubClient.d.ts +22 -0
  18. package/dist/class/GithubClient.d.ts.map +1 -0
  19. package/dist/class/GithubClient.js +21 -0
  20. package/dist/class/GithubClient.js.map +1 -0
  21. package/dist/class/HttpLinkParser.d.ts +4 -0
  22. package/dist/class/HttpLinkParser.d.ts.map +1 -0
  23. package/dist/class/HttpLinkParser.js +14 -0
  24. package/dist/class/HttpLinkParser.js.map +1 -0
  25. package/dist/class/createApiProxy.d.ts +2 -0
  26. package/dist/class/createApiProxy.d.ts.map +1 -0
  27. package/dist/class/createApiProxy.js +8 -0
  28. package/dist/class/createApiProxy.js.map +1 -0
  29. package/dist/constants.d.ts +4 -0
  30. package/dist/constants.d.ts.map +1 -0
  31. package/{src/constants.ts → dist/constants.js} +1 -0
  32. package/dist/constants.js.map +1 -0
  33. package/{src/index.ts → dist/index.d.ts} +2 -5
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +5 -0
  36. package/dist/index.js.map +1 -0
  37. package/{src/types.ts → dist/types.d.ts} +14 -27
  38. package/dist/types.d.ts.map +1 -0
  39. package/dist/types.js +2 -0
  40. package/dist/types.js.map +1 -0
  41. package/package.json +5 -2
  42. package/.all-contributorsrc +0 -16
  43. package/.editorconfig +0 -14
  44. package/.github/dependabot.yml +0 -25
  45. package/.github/workflows/codeql.yml +0 -78
  46. package/.github/workflows/node.js.yml +0 -52
  47. package/.github/workflows/publish.yml +0 -29
  48. package/.github/workflows/scorecards.yml +0 -76
  49. package/SECURITY.md +0 -5
  50. package/docs/api/ApiEndpoint.md +0 -66
  51. package/docs/api/GithubClient.md +0 -50
  52. package/docs/api/fetchRawFile.md +0 -106
  53. package/docs/api/repos.md +0 -97
  54. package/docs/api/users.md +0 -76
  55. package/eslint.config.mjs +0 -3
  56. package/src/api/rawFile.ts +0 -73
  57. package/src/api/repos.ts +0 -88
  58. package/src/api/users.ts +0 -51
  59. package/src/class/ApiEndpoint.ts +0 -108
  60. package/src/class/GithubClient.ts +0 -62
  61. package/src/class/HttpLinkParser.ts +0 -17
  62. package/src/class/createApiProxy.ts +0 -9
  63. package/test/ApiEndpoint.spec.ts +0 -362
  64. package/test/GithubClient.spec.ts +0 -185
  65. package/test/HttpLinkParser.spec.ts +0 -78
  66. package/test/createApiProxy.spec.ts +0 -58
  67. package/test/rawFile.spec.ts +0 -382
  68. package/test/repos.spec.ts +0 -221
  69. package/test/tsconfig.json +0 -11
  70. package/test/users.spec.ts +0 -159
  71. package/tsconfig.json +0 -11
@@ -0,0 +1,20 @@
1
+ import type { RequestConfig } from "../types.ts";
2
+ export interface FetchRawFileOptions extends RequestConfig {
3
+ /**
4
+ * Branch, tag, or commit SHA.
5
+ * @default "HEAD"
6
+ */
7
+ ref?: string;
8
+ }
9
+ export type FetchRawFileClientOptions = Omit<FetchRawFileOptions, "token" | "userAgent">;
10
+ export type RawFileParser<T> = "json" | ((content: string) => T);
11
+ export declare function fetchRawFile(repository: `${string}/${string}`, filePath: string, options?: FetchRawFileOptions & {
12
+ parser?: undefined;
13
+ }): Promise<string>;
14
+ export declare function fetchRawFile<T = unknown>(repository: `${string}/${string}`, filePath: string, options: FetchRawFileOptions & {
15
+ parser: "json";
16
+ }): Promise<T>;
17
+ export declare function fetchRawFile<T>(repository: `${string}/${string}`, filePath: string, options: FetchRawFileOptions & {
18
+ parser: (content: string) => T;
19
+ }): Promise<T>;
20
+ //# sourceMappingURL=rawFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawFile.d.ts","sourceRoot":"","sources":["../../src/api/rawFile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC;AACzF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC;AAEjE,wBAAgB,YAAY,CAC1B,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC;CAAE,GACtD,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EACtC,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mBAAmB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;CAAE,GACjD,OAAO,CAAC,CAAC,CAAC,CAAC;AACd,wBAAgB,YAAY,CAAC,CAAC,EAC5B,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mBAAmB,GAAG;IAAE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC;CAAE,GACjE,OAAO,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ // Import Internal Dependencies
2
+ import { DEFAULT_USER_AGENT, GITHUB_RAW_API } from "../constants.js";
3
+ // CONSTANTS
4
+ const kDefaultRef = "HEAD";
5
+ export async function fetchRawFile(repository, filePath, options = {}) {
6
+ const { ref = kDefaultRef, token, userAgent = DEFAULT_USER_AGENT, parser } = options;
7
+ const url = new URL(`${repository}/${ref}/${filePath}`, GITHUB_RAW_API);
8
+ const headers = {
9
+ "User-Agent": userAgent,
10
+ ...(typeof token === "string" ? { Authorization: `token ${token}` } : {})
11
+ };
12
+ const response = await fetch(url, { headers });
13
+ if (!response.ok) {
14
+ throw new Error(`Failed to fetch raw file '${filePath}' from ${repository}@${ref}: HTTP ${response.status}`);
15
+ }
16
+ const content = await response.text();
17
+ if (parser === "json") {
18
+ return JSON.parse(content);
19
+ }
20
+ if (typeof parser === "function") {
21
+ return parser(content);
22
+ }
23
+ return content;
24
+ }
25
+ //# sourceMappingURL=rawFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawFile.js","sourceRoot":"","sources":["../../src/api/rawFile.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB,YAAY;AACZ,MAAM,WAAW,GAAG,MAAM,CAAC;AA4B3B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,UAAiC,EACjC,QAAgB,EAChB,UAAgE,EAAE;IAElE,MAAM,EACJ,GAAG,GAAG,WAAW,EACjB,KAAK,EACL,SAAS,GAAG,kBAAkB,EAC9B,MAAM,EACP,GAAG,OAAO,CAAC;IAEZ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,UAAU,IAAI,GAAG,IAAI,QAAQ,EAAE,EAAE,cAAc,CAAC,CAAC;IACxE,MAAM,OAAO,GAA2B;QACtC,YAAY,EAAE,SAAS;QACvB,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAE/C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,UAAU,UAAU,IAAI,GAAG,UAAU,QAAQ,CAAC,MAAM,EAAE,CAC5F,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;IAClC,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ApiEndpoint } from "../class/ApiEndpoint.ts";
2
+ import type { Tag, PullRequest, Issue, Commit, Workflow, WorkflowRun, Job, Artifact, RequestConfig } from "../types.ts";
3
+ type RepoEndpointMethods = {
4
+ tags: () => ApiEndpoint<Tag>;
5
+ pulls: () => ApiEndpoint<PullRequest>;
6
+ issues: () => ApiEndpoint<Issue>;
7
+ commits: () => ApiEndpoint<Commit>;
8
+ workflows: () => ApiEndpoint<Workflow>;
9
+ workflowRuns: (workflowId: string | number) => ApiEndpoint<WorkflowRun>;
10
+ runJobs: (runId: number) => ApiEndpoint<Job>;
11
+ runArtifacts: (runId: number) => ApiEndpoint<Artifact>;
12
+ };
13
+ export type ReposProxy = {
14
+ [owner: string]: {
15
+ [repo: string]: RepoEndpointMethods;
16
+ };
17
+ };
18
+ export declare function createReposProxy(config?: RequestConfig): ReposProxy;
19
+ export declare const repos: ReposProxy;
20
+ export {};
21
+ //# sourceMappingURL=repos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/api/repos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EACV,GAAG,EACH,WAAW,EACX,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,GAAG,EACH,QAAQ,EAKR,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,KAAK,WAAW,CAAC,WAAW,CAAC,CAAC;IACxE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,KAAK,EAAE,MAAM,GAAG;QACf,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAC;KACrC,CAAC;CACH,CAAC;AA2CF,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE,aAAkB,GACzB,UAAU,CAMZ;AAED,eAAO,MAAM,KAAK,YAAqB,CAAC"}
@@ -0,0 +1,32 @@
1
+ // Import Internal Dependencies
2
+ import { ApiEndpoint } from "../class/ApiEndpoint.js";
3
+ import { createApiProxy } from "../class/createApiProxy.js";
4
+ function createRepoProxy(owner, repo, config = {}) {
5
+ return {
6
+ tags: () => new ApiEndpoint(`/repos/${owner}/${repo}/tags`, config),
7
+ pulls: () => new ApiEndpoint(`/repos/${owner}/${repo}/pulls`, config),
8
+ issues: () => new ApiEndpoint(`/repos/${owner}/${repo}/issues`, config),
9
+ commits: () => new ApiEndpoint(`/repos/${owner}/${repo}/commits`, config),
10
+ workflows: () => new ApiEndpoint(`/repos/${owner}/${repo}/actions/workflows`, {
11
+ ...config,
12
+ extractor: (raw) => raw.workflows
13
+ }),
14
+ workflowRuns: (workflowId) => new ApiEndpoint(`/repos/${owner}/${repo}/actions/workflows/${workflowId}/runs`, {
15
+ ...config,
16
+ extractor: (raw) => raw.workflow_runs
17
+ }),
18
+ runJobs: (runId) => new ApiEndpoint(`/repos/${owner}/${repo}/actions/runs/${runId}/jobs`, {
19
+ ...config,
20
+ extractor: (raw) => raw.jobs
21
+ }),
22
+ runArtifacts: (runId) => new ApiEndpoint(`/repos/${owner}/${repo}/actions/runs/${runId}/artifacts`, {
23
+ ...config,
24
+ extractor: (raw) => raw.artifacts
25
+ })
26
+ };
27
+ }
28
+ export function createReposProxy(config = {}) {
29
+ return createApiProxy((owner) => createApiProxy((repo) => createRepoProxy(owner, repo, config)));
30
+ }
31
+ export const repos = createReposProxy();
32
+ //# sourceMappingURL=repos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repos.js","sourceRoot":"","sources":["../../src/api/repos.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAkC5D,SAAS,eAAe,CACtB,KAAa,EACb,IAAY,EACZ,SAAwB,EAAE;IAE1B,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ACrD,CACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,SAAwB,EAAE;IAE1B,OAAO,cAAc,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CACvB,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAC/C,CACY,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ApiEndpoint } from "../class/ApiEndpoint.ts";
2
+ import type { UserOrg, UserRepo, UserGist, UserFollower, UserFollowing, UserStarred, RequestConfig } from "../types.ts";
3
+ declare const kUserEndpointResponseMap: {
4
+ orgs: UserOrg;
5
+ repos: UserRepo;
6
+ gists: UserGist;
7
+ followers: UserFollower;
8
+ following: UserFollowing;
9
+ starred: UserStarred;
10
+ };
11
+ type UserEndpoint = keyof typeof kUserEndpointResponseMap;
12
+ type UserEndpointMethods = {
13
+ [K in UserEndpoint]: () => ApiEndpoint<typeof kUserEndpointResponseMap[K]>;
14
+ };
15
+ export type UsersProxy = {
16
+ [username: string]: UserEndpointMethods;
17
+ };
18
+ export declare function createUsersProxy(config?: RequestConfig): UsersProxy;
19
+ export declare const users: UsersProxy;
20
+ export {};
21
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/api/users.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,QAAA,MAAM,wBAAwB;UAChB,OAAO;WACN,QAAQ;WACR,QAAQ;eACJ,YAAY;eACZ,aAAa;aACf,WAAW;CAC3B,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,OAAO,wBAAwB,CAAC;AAC1D,KAAK,mBAAmB,GAAG;KACxB,CAAC,IAAI,YAAY,GAAG,MAAM,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;CAC3E,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACzC,CAAC;AAaF,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE,aAAkB,GACzB,UAAU,CAIZ;AAED,eAAO,MAAM,KAAK,YAAqB,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Import Internal Dependencies
2
+ import { ApiEndpoint } from "../class/ApiEndpoint.js";
3
+ import { createApiProxy } from "../class/createApiProxy.js";
4
+ // CONSTANTS
5
+ const kUserEndpointResponseMap = {
6
+ orgs: {},
7
+ repos: {},
8
+ gists: {},
9
+ followers: {},
10
+ following: {},
11
+ starred: {}
12
+ };
13
+ function createUserProxy(username, config = {}) {
14
+ return Object.fromEntries(Object.keys(kUserEndpointResponseMap).map((endpoint) => [endpoint, () => new ApiEndpoint(`/users/${username}/${endpoint}`, config)]));
15
+ }
16
+ export function createUsersProxy(config = {}) {
17
+ return createApiProxy((username) => createUserProxy(username, config));
18
+ }
19
+ export const users = createUsersProxy();
20
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/api/users.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAW5D,YAAY;AACZ,MAAM,wBAAwB,GAAG;IAC/B,IAAI,EAAE,EAAa;IACnB,KAAK,EAAE,EAAc;IACrB,KAAK,EAAE,EAAc;IACrB,SAAS,EAAE,EAAkB;IAC7B,SAAS,EAAE,EAAmB;IAC9B,OAAO,EAAE,EAAiB;CAC3B,CAAC;AAUF,SAAS,eAAe,CACtB,QAAgB,EAChB,SAAwB,EAAE;IAE1B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,GAAG,CACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,WAAW,CAAC,UAAU,QAAQ,IAAI,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,CAC1F,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,SAAwB,EAAE;IAE1B,OAAO,cAAc,CACnB,CAAC,QAAQ,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,CAClC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { RequestConfig } from "../types.ts";
2
+ export interface ApiEndpointOptions<T> extends RequestConfig {
3
+ /**
4
+ * By default, the raw response from the GitHub API is returned as-is.
5
+ * You can provide a custom extractor function to transform the raw response
6
+ * into an array of type T.
7
+ */
8
+ extractor?: (raw: any) => T[];
9
+ }
10
+ export declare class ApiEndpoint<T> {
11
+ #private;
12
+ constructor(apiEndpoint: string | URL, options?: ApiEndpointOptions<T>);
13
+ setBearerToken(token: string): this;
14
+ setAgent(userAgent: string): this;
15
+ iterate(): AsyncIterableIterator<T>;
16
+ [Symbol.asyncIterator](): AsyncIterableIterator<T>;
17
+ all(): Promise<T[]>;
18
+ then<TResult1 = T[], TResult2 = never>(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
19
+ }
20
+ //# sourceMappingURL=ApiEndpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiEndpoint.d.ts","sourceRoot":"","sources":["../../src/class/ApiEndpoint.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,aAAa;IAC1D;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;CAC/B;AAED,qBAAa,WAAW,CAAC,CAAC;;gBAStB,WAAW,EAAE,MAAM,GAAG,GAAG,EACzB,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM;IAcrC,cAAc,CACZ,KAAK,EAAE,MAAM,GACZ,IAAI;IAMP,QAAQ,CACN,SAAS,EAAE,MAAM,GAChB,IAAI;IAkCA,OAAO,IAAI,qBAAqB,CAAC,CAAC,CAAC;IAQ1C,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC;IAIlD,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC;IAInB,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,KAAK,EACnC,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,EACvE,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,GACtE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;CAGhC"}
@@ -0,0 +1,60 @@
1
+ // Import Internal Dependencies
2
+ import { HttpLinkParser } from "./HttpLinkParser.js";
3
+ import { DEFAULT_USER_AGENT, GITHUB_API } from "../constants.js";
4
+ export class ApiEndpoint {
5
+ #userAgent;
6
+ #bearerToken;
7
+ #nextURL = null;
8
+ #apiEndpoint;
9
+ #extractor;
10
+ constructor(apiEndpoint, options = {}) {
11
+ const { userAgent = DEFAULT_USER_AGENT, token, extractor = ((raw) => raw) } = options;
12
+ this.#userAgent = userAgent;
13
+ this.#bearerToken = token;
14
+ this.#apiEndpoint = apiEndpoint;
15
+ this.#extractor = extractor;
16
+ }
17
+ setBearerToken(token) {
18
+ this.#bearerToken = token;
19
+ return this;
20
+ }
21
+ setAgent(userAgent) {
22
+ this.#userAgent = userAgent;
23
+ return this;
24
+ }
25
+ async #next() {
26
+ const headers = {
27
+ "User-Agent": this.#userAgent,
28
+ Accept: "application/vnd.github.v3.raw",
29
+ ...(typeof this.#bearerToken === "string" ?
30
+ { Authorization: `token ${this.#bearerToken}` } :
31
+ {})
32
+ };
33
+ const url = this.#nextURL === null ?
34
+ new URL(this.#apiEndpoint, GITHUB_API) :
35
+ new URL(this.#nextURL, GITHUB_API);
36
+ const response = await fetch(url, { headers });
37
+ const rawData = await response.json();
38
+ const linkHeader = response.headers.get("link");
39
+ this.#nextURL = linkHeader
40
+ ? HttpLinkParser.parse(linkHeader).get("next") ?? null
41
+ : null;
42
+ return this.#extractor(rawData);
43
+ }
44
+ async *iterate() {
45
+ do {
46
+ const pageResults = await this.#next();
47
+ yield* pageResults;
48
+ } while (this.#nextURL !== null);
49
+ }
50
+ [Symbol.asyncIterator]() {
51
+ return this.iterate();
52
+ }
53
+ all() {
54
+ return Array.fromAsync(this.iterate());
55
+ }
56
+ then(onfulfilled, onrejected) {
57
+ return this.all().then(onfulfilled, onrejected);
58
+ }
59
+ }
60
+ //# sourceMappingURL=ApiEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiEndpoint.js","sourceRoot":"","sources":["../../src/class/ApiEndpoint.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACX,MAAM,iBAAiB,CAAC;AAYzB,MAAM,OAAO,WAAW;IACtB,UAAU,CAAS;IACnB,YAAY,CAAU;IAEtB,QAAQ,GA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CAAC,IAAI,EAAE,CAAC;QAEtC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,UAAU;YACxB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI;YACtD,CAAC,CAAC,IAAI,CAAC;QAET,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAA,CAAE,OAAO;QACZ,GAAG,CAAC;YACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAEvC,KAAK,CAAC,CAAC,WAAW,CAAC;QACrB,CAAC,QAAQ,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;IACnC,CAAC;IAED,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,GAAG;QACD,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,CACF,WAAuE,EACvE,UAAuE;QAEvE,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import { type UsersProxy } from "../api/users.ts";
2
+ import { type ReposProxy } from "../api/repos.ts";
3
+ import { type FetchRawFileClientOptions } from "../api/rawFile.ts";
4
+ import type { RequestConfig } from "../types.ts";
5
+ export interface GithubClientOptions extends RequestConfig {
6
+ }
7
+ export declare class GithubClient {
8
+ #private;
9
+ readonly users: UsersProxy;
10
+ readonly repos: ReposProxy;
11
+ constructor(options?: GithubClientOptions);
12
+ fetchRawFile(repository: `${string}/${string}`, filePath: string, options?: FetchRawFileClientOptions & {
13
+ parser?: undefined;
14
+ }): Promise<string>;
15
+ fetchRawFile<T = unknown>(repository: `${string}/${string}`, filePath: string, options: FetchRawFileClientOptions & {
16
+ parser: "json";
17
+ }): Promise<T>;
18
+ fetchRawFile<T>(repository: `${string}/${string}`, filePath: string, options: FetchRawFileClientOptions & {
19
+ parser: (content: string) => T;
20
+ }): Promise<T>;
21
+ }
22
+ //# sourceMappingURL=GithubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GithubClient.d.ts","sourceRoot":"","sources":["../../src/class/GithubClient.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,aAAa;CAAG;AAE7D,qBAAa,YAAY;;IACvB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;gBAIzB,OAAO,GAAE,mBAAwB;IAWnC,YAAY,CACV,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,yBAAyB,GAAG;QAAE,MAAM,CAAC,EAAE,SAAS,CAAC;KAAE,GAC5D,OAAO,CAAC,MAAM,CAAC;IAClB,YAAY,CAAC,CAAC,GAAG,OAAO,EACtB,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,yBAAyB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;KAAE,GACvD,OAAO,CAAC,CAAC,CAAC;IACb,YAAY,CAAC,CAAC,EACZ,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,yBAAyB,GAAG;QAAE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC;KAAE,GACvE,OAAO,CAAC,CAAC,CAAC;CAYd"}
@@ -0,0 +1,21 @@
1
+ // Import Internal Dependencies
2
+ import { createUsersProxy } from "../api/users.js";
3
+ import { createReposProxy } from "../api/repos.js";
4
+ import { fetchRawFile } from "../api/rawFile.js";
5
+ export class GithubClient {
6
+ users;
7
+ repos;
8
+ #config;
9
+ constructor(options = {}) {
10
+ this.#config = {
11
+ token: options.token,
12
+ userAgent: options.userAgent
13
+ };
14
+ this.users = createUsersProxy(this.#config);
15
+ this.repos = createReposProxy(this.#config);
16
+ }
17
+ fetchRawFile(repository, filePath, options = {}) {
18
+ return fetchRawFile(repository, filePath, { ...this.#config, ...options });
19
+ }
20
+ }
21
+ //# sourceMappingURL=GithubClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GithubClient.js","sourceRoot":"","sources":["../../src/class/GithubClient.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EACL,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAK3B,MAAM,OAAO,YAAY;IACd,KAAK,CAAa;IAClB,KAAK,CAAa;IAC3B,OAAO,CAAgB;IAEvB,YACE,UAA+B,EAAE;QAEjC,IAAI,CAAC,OAAO,GAAG;YACb,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAiBD,YAAY,CACV,UAAiC,EACjC,QAAgB,EAChB,UAAsE,EAAE;QAExE,OAAO,YAAY,CACjB,UAAU,EACV,QAAQ,EACR,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAS,CACvC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export declare class HttpLinkParser {
2
+ static parse(headerValue: string): Map<string, string>;
3
+ }
4
+ //# sourceMappingURL=HttpLinkParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpLinkParser.d.ts","sourceRoot":"","sources":["../../src/class/HttpLinkParser.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,KAAK,CACV,WAAW,EAAE,MAAM,GAClB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAavB"}
@@ -0,0 +1,14 @@
1
+ export class HttpLinkParser {
2
+ static parse(headerValue) {
3
+ const result = new Map();
4
+ for (const part of headerValue.split(", ")) {
5
+ const urlMatch = part.match(/^<([^>]+)>/);
6
+ const relMatch = part.match(/rel="([^"]+)"/);
7
+ if (urlMatch && relMatch) {
8
+ result.set(relMatch[1], urlMatch[1]);
9
+ }
10
+ }
11
+ return result;
12
+ }
13
+ }
14
+ //# sourceMappingURL=HttpLinkParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpLinkParser.js","sourceRoot":"","sources":["../../src/class/HttpLinkParser.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IACzB,MAAM,CAAC,KAAK,CACV,WAAmB;QAEnB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;QAEzC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC7C,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBACzB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare function createApiProxy<T>(factory: (key: string) => T): Record<string, T>;
2
+ //# sourceMappingURL=createApiProxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createApiProxy.d.ts","sourceRoot":"","sources":["../../src/class/createApiProxy.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAMnB"}
@@ -0,0 +1,8 @@
1
+ export function createApiProxy(factory) {
2
+ return new Proxy(Object.create(null), {
3
+ get(_, key) {
4
+ return factory(key);
5
+ }
6
+ });
7
+ }
8
+ //# sourceMappingURL=createApiProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createApiProxy.js","sourceRoot":"","sources":["../../src/class/createApiProxy.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAC5B,OAA2B;IAE3B,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACpC,GAAG,CAAC,CAAC,EAAE,GAAW;YAChB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;KACF,CAAsB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_USER_AGENT = "@openally/github.sdk/1.0.0";
2
+ export declare const GITHUB_API: import("node:url").URL;
3
+ export declare const GITHUB_RAW_API: import("node:url").URL;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,+BAA+B,CAAC;AAC/D,eAAO,MAAM,UAAU,wBAAqC,CAAC;AAC7D,eAAO,MAAM,cAAc,wBAAgD,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export const DEFAULT_USER_AGENT = "@openally/github.sdk/1.0.0";
2
2
  export const GITHUB_API = new URL("https://api.github.com/");
3
3
  export const GITHUB_RAW_API = new URL("https://raw.githubusercontent.com/");
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAC/D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,oCAAoC,CAAC,CAAC"}
@@ -1,9 +1,6 @@
1
1
  export * from "./api/users.ts";
2
2
  export * from "./api/repos.ts";
3
- export {
4
- fetchRawFile,
5
- type FetchRawFileOptions
6
- } from "./api/rawFile.ts";
3
+ export { fetchRawFile, type FetchRawFileOptions } from "./api/rawFile.ts";
7
4
  export * from "./class/GithubClient.ts";
8
5
  export type { RequestConfig } from "./types.ts";
9
-
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./api/users.js";
2
+ export * from "./api/repos.js";
3
+ export { fetchRawFile } from "./api/rawFile.js";
4
+ export * from "./class/GithubClient.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,YAAY,EAEb,MAAM,kBAAkB,CAAC;AAC1B,cAAc,yBAAyB,CAAC"}
@@ -1,45 +1,32 @@
1
- // Import Third-party Dependencies
2
1
  import type { Endpoints } from "@octokit/types";
3
-
4
2
  export interface RequestConfig {
5
- /**
6
- * A personal access token is required to access private resources,
7
- * and to increase the rate limit for unauthenticated requests.
8
- */
9
- token?: string;
10
- /**
11
- * @default "@openally/github.sdk/1.0.0"
12
- * @see https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#user-agent
13
- */
14
- userAgent?: string;
3
+ /**
4
+ * A personal access token is required to access private resources,
5
+ * and to increase the rate limit for unauthenticated requests.
6
+ */
7
+ token?: string;
8
+ /**
9
+ * @default "@openally/github.sdk/1.0.0"
10
+ * @see https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#user-agent
11
+ */
12
+ userAgent?: string;
15
13
  }
16
-
17
- // --- Repo entity types ---
18
14
  export type Tag = Endpoints["GET /repos/{owner}/{repo}/tags"]["response"]["data"][number];
19
15
  export type PullRequest = Endpoints["GET /repos/{owner}/{repo}/pulls"]["response"]["data"][number];
20
16
  export type Issue = Endpoints["GET /repos/{owner}/{repo}/issues"]["response"]["data"][number];
21
17
  export type Commit = Endpoints["GET /repos/{owner}/{repo}/commits"]["response"]["data"][number];
22
18
  export type Workflow = Endpoints["GET /repos/{owner}/{repo}/actions/workflows"]["response"]["data"]["workflows"][number];
23
- export type WorkflowRun = Endpoints[
24
- "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
25
- ]["response"]["data"]["workflow_runs"][number];
19
+ export type WorkflowRun = Endpoints["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"]["response"]["data"]["workflow_runs"][number];
26
20
  export type Job = Endpoints["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"]["response"]["data"]["jobs"][number];
27
- export type Artifact = Endpoints[
28
- "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"
29
- ]["response"]["data"]["artifacts"][number];
30
-
31
- // Extractor response types (envelope objects returned by the GitHub API)
21
+ export type Artifact = Endpoints["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"]["response"]["data"]["artifacts"][number];
32
22
  export type WorkflowsResponse = Endpoints["GET /repos/{owner}/{repo}/actions/workflows"]["response"]["data"];
33
- export type WorkflowRunsResponse = Endpoints[
34
- "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
35
- ]["response"]["data"];
23
+ export type WorkflowRunsResponse = Endpoints["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"]["response"]["data"];
36
24
  export type JobsResponse = Endpoints["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"]["response"]["data"];
37
25
  export type ArtifactsResponse = Endpoints["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"]["response"]["data"];
38
-
39
- // --- User entity types ---
40
26
  export type UserOrg = Endpoints["GET /users/{username}/orgs"]["response"]["data"][number];
41
27
  export type UserRepo = Endpoints["GET /users/{username}/repos"]["response"]["data"][number];
42
28
  export type UserGist = Endpoints["GET /users/{username}/gists"]["response"]["data"][number];
43
29
  export type UserFollower = Endpoints["GET /users/{username}/followers"]["response"]["data"][number];
44
30
  export type UserFollowing = Endpoints["GET /users/{username}/following"]["response"]["data"][number];
45
31
  export type UserStarred = Endpoints["GET /users/{username}/starred"]["response"]["data"][number];
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/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.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openally/github.sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Opiniated Node.js Github SDK",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -30,6 +30,9 @@
30
30
  "nodejs",
31
31
  "typescript"
32
32
  ],
33
+ "files": [
34
+ "dist"
35
+ ],
33
36
  "author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
34
37
  "license": "MIT",
35
38
  "bugs": {
@@ -39,7 +42,7 @@
39
42
  "devDependencies": {
40
43
  "@openally/config.eslint": "^2.2.0",
41
44
  "@openally/config.typescript": "^1.2.1",
42
- "@types/node": "25.3.1",
45
+ "@types/node": "25.3.3",
43
46
  "c8": "^11.0.0",
44
47
  "typescript": "^5.9.3",
45
48
  "undici": "7.22.0"
@@ -1,16 +0,0 @@
1
- {
2
- "files": [
3
- "README.md"
4
- ],
5
- "imageSize": 100,
6
- "commit": false,
7
- "contributors": [],
8
- "contributorsPerLine": 7,
9
- "projectName": "github.sdk",
10
- "projectOwner": "OpenAlly",
11
- "repoType": "github",
12
- "repoHost": "https://github.com",
13
- "skipCi": true,
14
- "commitType": "docs",
15
- "commitConvention": "angular"
16
- }
package/.editorconfig DELETED
@@ -1,14 +0,0 @@
1
- # Editor configuration, see https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- indent_style = space
7
- indent_size = 2
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
- end_of_line = lf
11
-
12
- [*.md]
13
- max_line_length = off
14
- trim_trailing_whitespace = false
@@ -1,25 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: github-actions
4
- directory: /
5
- schedule:
6
- interval: monthly
7
- cooldown:
8
- default-days: 5
9
- groups:
10
- github-actions:
11
- patterns:
12
- - "*"
13
-
14
- - package-ecosystem: npm
15
- directory: /
16
- versioning-strategy: widen
17
- schedule:
18
- interval: weekly
19
- cooldown:
20
- default-days: 5
21
- groups:
22
- dependencies:
23
- dependency-type: "production"
24
- development-dependencies:
25
- dependency-type: "development"