@vizamodo/pkg-runtime-primitives 1.1.2 → 1.1.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.
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { getGithubInstallationToken } from "./github-app-token";
|
|
2
2
|
import { getCachedOrFetch, wrapResult } from "@vizamodo/edge-cache-core";
|
|
3
|
-
export async function
|
|
4
|
-
const {
|
|
5
|
-
const
|
|
6
|
-
if (!owner) {
|
|
7
|
-
throw new Error(`invalid_repo_format: ${repo}`);
|
|
8
|
-
}
|
|
9
|
-
const key = `gh-token:${owner}`;
|
|
3
|
+
export async function getInstallationTokenCached(params) {
|
|
4
|
+
const { installationId, appPrivateKey, appId, forceRefresh } = params;
|
|
5
|
+
const key = `gh-token:${appId}:${installationId}`;
|
|
10
6
|
const token = await getCachedOrFetch(key, async () => {
|
|
11
7
|
const { token, expiresAt } = await getGithubInstallationToken(installationId, appPrivateKey, appId);
|
|
12
8
|
// use wrapResult pattern to let cache derive TTL from expiresAt
|
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export * from "./github/list-workflow-runs";
|
|
|
11
11
|
export * from "./github/put-secret";
|
|
12
12
|
export * from "./github/put-var";
|
|
13
13
|
export * from "./github/github-headers";
|
|
14
|
+
export * from "./github/github-env";
|
|
14
15
|
export * from "./runtime/retry-once";
|
|
15
16
|
export * from "./types/github";
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./github/list-workflow-runs";
|
|
|
14
14
|
export * from "./github/put-secret";
|
|
15
15
|
export * from "./github/put-var";
|
|
16
16
|
export * from "./github/github-headers";
|
|
17
|
+
export * from "./github/github-env";
|
|
17
18
|
// Runtime
|
|
18
19
|
export * from "./runtime/retry-once";
|
|
19
20
|
// Types
|
package/package.json
CHANGED