@theholocron/github-client 1.58.0-alpha.54 → 1.58.0-alpha.55

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/dist/index.d.mts CHANGED
@@ -1042,11 +1042,22 @@ interface GitHubAppInstallation {
1042
1042
  permissions: Record<string, string>;
1043
1043
  /** The events delivered to this installation. */
1044
1044
  events: string[];
1045
+ /** Whether the installation is suspended: GitHub then sends it no webhooks and refuses its tokens. */
1046
+ suspended: boolean;
1045
1047
  }
1046
1048
  /** The App this JWT identifies: its slug, owner and the permissions and events it asks for now. */
1047
1049
  export declare function getApp(creds: GitHubAppCredentials, opts?: Pick<GitHubClientOptions, "baseUrl" | "fetch">): Promise<GitHubApp>;
1048
1050
  /** Every installation of the App this JWT identifies, with what each has accepted. Reads all pages. */
1049
1051
  export declare function listAppInstallations(creds: GitHubAppCredentials, opts?: Pick<GitHubClientOptions, "baseUrl" | "fetch">): Promise<GitHubAppInstallation[]>;
1052
+ /**
1053
+ * Suspends an installation of the App this JWT identifies (`PUT /app/installations/{id}/suspended`): GitHub sends it no
1054
+ * webhooks and refuses its tokens until it is unsuspended. Idempotent. Needs only the App's own JWT.
1055
+ *
1056
+ * https://docs.github.com/en/rest/apps/apps#suspend-an-app-installation
1057
+ */
1058
+ export declare function suspendAppInstallation(creds: GitHubAppCredentials, installationId: number, opts?: Pick<GitHubClientOptions, "baseUrl" | "fetch">): Promise<void>;
1059
+ /** Undoes {@link suspendAppInstallation} (`DELETE /app/installations/{id}/suspended`). Idempotent. */
1060
+ export declare function unsuspendAppInstallation(creds: GitHubAppCredentials, installationId: number, opts?: Pick<GitHubClientOptions, "baseUrl" | "fetch">): Promise<void>;
1050
1061
  /** One delivery of a webhook event to the App, as `GET /app/hook/deliveries` reports it. */
1051
1062
  interface GitHubAppDelivery {
1052
1063
  /** The delivery's id, which a redelivery is asked for by. */
package/dist/index.mjs CHANGED
@@ -1204,11 +1204,25 @@ async function listAppInstallations(creds, opts = {}) {
1204
1204
  id: Number(raw.id),
1205
1205
  account: account(raw.account),
1206
1206
  permissions: raw.permissions ?? {},
1207
- events: raw.events ?? []
1207
+ events: raw.events ?? [],
1208
+ suspended: typeof raw.suspended_at === "string"
1208
1209
  });
1209
1210
  if (raws.length < PAGE_SIZE) return installations;
1210
1211
  }
1211
1212
  }
1213
+ /**
1214
+ * Suspends an installation of the App this JWT identifies (`PUT /app/installations/{id}/suspended`): GitHub sends it no
1215
+ * webhooks and refuses its tokens until it is unsuspended. Idempotent. Needs only the App's own JWT.
1216
+ *
1217
+ * https://docs.github.com/en/rest/apps/apps#suspend-an-app-installation
1218
+ */
1219
+ async function suspendAppInstallation(creds, installationId, opts = {}) {
1220
+ await appFetch(creds, `/app/installations/${installationId}/suspended`, opts, "PUT");
1221
+ }
1222
+ /** Undoes {@link suspendAppInstallation} (`DELETE /app/installations/{id}/suspended`). Idempotent. */
1223
+ async function unsuspendAppInstallation(creds, installationId, opts = {}) {
1224
+ await appFetch(creds, `/app/installations/${installationId}/suspended`, opts, "DELETE");
1225
+ }
1212
1226
  const DELIVERY_PAGES = 10;
1213
1227
  /** The `cursor` of the `rel="next"` link of a `Link` header, `undefined` when there is none. */
1214
1228
  function nextCursor(link) {
@@ -1327,4 +1341,4 @@ function createGitHubClient(opts) {
1327
1341
  workflows: workflows(rest)
1328
1342
  };
1329
1343
  }
1330
- export { MAX_CHECK_RUN_ANNOTATIONS, createAppJWT, createGitHubClient, createInstallationClient, getApp, getInstallationAccessToken, listAppDeliveries, listAppInstallations, parseGitHubWebhookHeaders, parseTokenExpiration, redeliverAppDelivery, verifyGitHubWebhookSignature };
1344
+ export { MAX_CHECK_RUN_ANNOTATIONS, createAppJWT, createGitHubClient, createInstallationClient, getApp, getInstallationAccessToken, listAppDeliveries, listAppInstallations, parseGitHubWebhookHeaders, parseTokenExpiration, redeliverAppDelivery, suspendAppInstallation, unsuspendAppInstallation, verifyGitHubWebhookSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.58.0-alpha.54",
3
+ "version": "1.58.0-alpha.55",
4
4
  "description": "A TypeScript client for the GitHub REST API",
5
5
  "keywords": [
6
6
  "github",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/http-client": "^1.58.0-alpha.54",
35
+ "@theholocron/http-client": "^1.58.0-alpha.55",
36
36
  "@theholocron/observability": "^0.7.0-alpha.6"
37
37
  },
38
38
  "devDependencies": {
@@ -45,9 +45,9 @@
45
45
  "tsdown": "^0.23.7",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "^5.1.0",
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.22",
48
49
  "@theholocron/tsconfig": "^8.9.0-alpha.22",
49
50
  "@theholocron/tsdown-config": "^8.9.0-alpha.22",
50
- "@theholocron/eslint-config": "^8.9.0-alpha.22",
51
51
  "@theholocron/vitest-config": "^8.9.0-alpha.22"
52
52
  },
53
53
  "engines": {