@unveil/vk 1.0.0-beta.1 → 1.0.0-beta.4
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.
- package/README.md +3 -6
- package/dist/index.d.mts +5 -8
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -33,17 +33,14 @@ console.log(eventsCount); // how many events we actually got back
|
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
analyze(username, {
|
|
36
|
-
provider: "
|
|
36
|
+
provider: "github", // "github" (default) is the only provider for now
|
|
37
37
|
token: "ghp_...", // provider token. Optional, but strongly recommended
|
|
38
38
|
showEvents: true, // return the raw events too. Off by default
|
|
39
39
|
});
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
`provider` picks where the account lives
|
|
43
|
-
|
|
44
|
-
AT Protocol). Leave it out and it is GitHub. GitLab.com only returns a user's
|
|
45
|
-
sign-up date to authenticated requests, so `gitlab` needs a token. Tangled
|
|
46
|
-
records are public and no token is sent.
|
|
42
|
+
`provider` picks where the account lives. Only `github` (api.github.com) is
|
|
43
|
+
supported right now, and it is the default, so you can leave it out.
|
|
47
44
|
|
|
48
45
|
`token` is sent as `Authorization: Bearer`. Without it you are on the unauthenticated
|
|
49
46
|
rate limit, which is 60 requests per hour for the whole IP — and each `analyze`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CodebergActivity } from "@unveil/identity/providers/codeberg";
|
|
1
|
+
import { IdentityReport } from "@unveil/identity/report";
|
|
3
2
|
import { GitHubEvent } from "@unveil/identity/providers/github";
|
|
4
|
-
import { GitLabEvent } from "@unveil/identity/providers/gitlab";
|
|
5
|
-
import { TangledRecord } from "@unveil/identity/providers/tangled";
|
|
6
3
|
//#region src/http.d.ts
|
|
7
4
|
declare class ProviderError extends Error {
|
|
8
5
|
readonly status: number;
|
|
@@ -11,19 +8,19 @@ declare class ProviderError extends Error {
|
|
|
11
8
|
}
|
|
12
9
|
//#endregion
|
|
13
10
|
//#region src/index.d.ts
|
|
14
|
-
type Provider = "github"
|
|
15
|
-
type ProviderEvent = GitHubEvent
|
|
11
|
+
type Provider = "github";
|
|
12
|
+
type ProviderEvent = GitHubEvent;
|
|
16
13
|
type AnalyzeOptions = {
|
|
17
14
|
token?: string;
|
|
18
15
|
showEvents?: boolean;
|
|
19
16
|
provider?: Provider;
|
|
20
17
|
};
|
|
21
18
|
type AnalyzeReturn = {
|
|
22
|
-
|
|
19
|
+
report: IdentityReport;
|
|
23
20
|
events: ProviderEvent[];
|
|
24
21
|
eventsCount: number;
|
|
25
22
|
userId?: number | string;
|
|
26
23
|
};
|
|
27
24
|
declare function analyze(username: string, options?: AnalyzeOptions): Promise<AnalyzeReturn>;
|
|
28
25
|
//#endregion
|
|
29
|
-
export { AnalyzeOptions, AnalyzeReturn, type
|
|
26
|
+
export { AnalyzeOptions, AnalyzeReturn, type GitHubEvent, type IdentityReport, Provider, ProviderError, ProviderEvent, analyze };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{report as e}from"@unveil/identity/report";import{fromGitHub as t}from"@unveil/identity/providers/github";function n(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))n.set(e,String(r));return`${e}?${n}`}var r=class extends Error{status;url;constructor(e,t,n){super(e),this.name=`ProviderError`,this.status=t,this.url=n}};async function i(e){try{let t=await e.json();if(t?.message)return t.message}catch{}return`${e.status} ${e.statusText}`}async function a(e,t={}){let n=await fetch(e,{headers:t});if(!n.ok)throw new r(await i(n),n.status,e);return n}async function o(e,t){return await(await a(e,t)).json()}async function s(e,t,n){let r=Array.from({length:e},(e,r)=>o(t(r+1),n));return(await Promise.all(r)).flat()}function c(e,t={}){return e?{...t,Authorization:`Bearer ${e}`}:t}const l=`https://api.github.com`;async function u(e,r){let i=encodeURIComponent(e),a=c(r,{Accept:`application/vnd.github+json`,"X-GitHub-Api-Version":`2022-11-28`,"User-Agent":`unveil-vk`}),u=await o(`${l}/users/${i}`,a),d=await s(3,e=>n(`${l}/users/${i}/events/public`,{per_page:100,page:e}),a);return{input:t({user:u,events:d}),events:d,userId:u.id}}const d={github:u};async function f(t,n){let r=n?.provider??`github`,i=d[r],{input:a,events:o,userId:s}=await i(t,n?.token);return{report:e(a),userId:s,events:n?.showEvents?o:[],eventsCount:o.length}}export{r as ProviderError,f as analyze};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unveil/vk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Fetch GitHub account activity and analyze it for automation patterns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@biomejs/biome": "^2.5.6",
|
|
39
39
|
"@types/node": "^26.1.2",
|
|
40
|
-
"@unveil/identity": "3.0.0-beta.
|
|
40
|
+
"@unveil/identity": "3.0.0-beta.4",
|
|
41
41
|
"publint": "^0.3.22",
|
|
42
42
|
"tsdown": "^0.22.14",
|
|
43
43
|
"typescript": "^6.0.3",
|
|
44
44
|
"vitest": "^4.1.10"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@unveil/identity": "^3.0.0-beta.
|
|
47
|
+
"@unveil/identity": "^3.0.0-beta.4"
|
|
48
48
|
}
|
|
49
49
|
}
|