@notation/factory-github 0.5.0 → 0.5.2
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/lib/app.ts +13 -0
- package/package.json +3 -3
package/lib/app.ts
CHANGED
|
@@ -172,6 +172,19 @@ export const appSlug = async (id: string): Promise<string> => {
|
|
|
172
172
|
return slug;
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* The App's owner, and whether the App is public. Only the owner can install a
|
|
177
|
+
* private App. GitHub only shows a private App to a request that's signed in.
|
|
178
|
+
*/
|
|
179
|
+
export const appVisibility = async (slug: string): Promise<{ owner: string; public: boolean }> => {
|
|
180
|
+
const path = `/apps/${encodeURIComponent(slug)}`;
|
|
181
|
+
const app = await github<{ owner: { login: string } }>("GET", path, await ghToken());
|
|
182
|
+
const anonymous = await fetch(`${GITHUB_API}${path}`, {
|
|
183
|
+
headers: { accept: "application/vnd.github+json", "user-agent": "notation-factory" },
|
|
184
|
+
});
|
|
185
|
+
return { owner: app.owner.login, public: anonymous.ok };
|
|
186
|
+
};
|
|
187
|
+
|
|
175
188
|
/** Reads the App by its id, which fails if the App is gone. The lookup needs your gh login or GH_TOKEN. */
|
|
176
189
|
export const readApp = async (key: { id: string }): Promise<{ id: string; clientId: string }> => {
|
|
177
190
|
const slug = await appSlug(key.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notation/factory-github",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"author": "Daniel Grant",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"valibot": "^1.1.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@notation/factory": "^0.5.
|
|
35
|
+
"@notation/factory": "^0.5.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@notation/factory": "0.5.
|
|
38
|
+
"@notation/factory": "0.5.2"
|
|
39
39
|
}
|
|
40
40
|
}
|