@app-vitals/agent-lib 1.20.1 → 1.21.0

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/admin-types.ts CHANGED
@@ -3448,7 +3448,7 @@ export interface paths {
3448
3448
  put?: never;
3449
3449
  /**
3450
3450
  * Install an agent's App on an organization
3451
- * @description Admin-only. Resolves the agent's stored GH_APP_SLUG, looks the App up through the public GET /apps/{slug} to get its client id, and installs it on the org with the installer App. 422 for an agent with no slug and for a private App (not visible to the public lookup); 409 when the installer App is not configured.
3451
+ * @description Admin-only. Uses the agent's stored GH_APP_CLIENT_ID when set; otherwise resolves the stored GH_APP_SLUG and looks the App up through the public GET /apps/{slug} to get its client id. Installs it on the org with the installer App. 422 for an agent with neither a stored client id nor a slug, and for a private App (not visible to the public lookup) with no stored client id; 409 when the installer App is not configured.
3452
3452
  */
3453
3453
  post: {
3454
3454
  parameters: {
@@ -4950,6 +4950,8 @@ export interface components {
4950
4950
  GithubEnterpriseOrgs: {
4951
4951
  configured: boolean;
4952
4952
  agentAppSlug?: string | null;
4953
+ /** @description Why the agent's App cannot be installed through the enterprise API (private App with no stored GH_APP_CLIENT_ID, or no App at all). Null when it can; present only with agentId. */
4954
+ agentAppReason?: string | null;
4953
4955
  orgs: {
4954
4956
  id: number;
4955
4957
  login: string;
@@ -0,0 +1,35 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import { readFileSync } from "node:fs";
3
+
4
+ const spec = JSON.parse(
5
+ readFileSync(
6
+ new URL("../admin/openapi.platform.json", import.meta.url),
7
+ "utf8",
8
+ ),
9
+ ) as { paths: Record<string, unknown> };
10
+
11
+ /** Top-level keys of the generated `paths` interface (4-space-indented quoted keys). */
12
+ function generatedPathKeys(): Set<string> {
13
+ const src = readFileSync(new URL("./admin-types.ts", import.meta.url), "utf8");
14
+ const start = src.indexOf("export interface paths {");
15
+ const end = src.indexOf("\n}\n", start);
16
+ const body = src.slice(start, end);
17
+ return new Set(
18
+ [...body.matchAll(/^ {4}"([^"]+)": \{$/gm)].map((m) => m[1] as string),
19
+ );
20
+ }
21
+
22
+ describe("lib/admin-types.ts", () => {
23
+ it("has every path in admin/openapi.platform.json as a key of the paths interface", () => {
24
+ const generated = generatedPathKeys();
25
+ const missing = Object.keys(spec.paths).filter((p) => !generated.has(p));
26
+ expect(
27
+ missing,
28
+ `paths missing from lib/admin-types.ts: run \`bun run generate:admin-types\``,
29
+ ).toEqual([]);
30
+ });
31
+
32
+ it("parses a non-empty set of generated paths", () => {
33
+ expect(generatedPathKeys().size).toBeGreaterThan(0);
34
+ });
35
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",