From 5c0d7b58c1672c4713e2a57c356c59a1107333f3 Mon Sep 17 00:00:00 2001 From: Eyal Keren Date: Wed, 3 Jan 2024 00:20:28 +0200 Subject: [PATCH] fix(github): mts to js files (#48) * fix(github): mts to js files * fix(github): mts to js files * fix(github): mts to js files --- github/lib.w | 2 +- github/package.json | 2 +- github/probot/adapter.w | 2 +- github/probot/{probot.mts => probot.js} | 9 ++------- 4 files changed, 5 insertions(+), 10 deletions(-) rename github/probot/{probot.mts => probot.js} (76%) diff --git a/github/lib.w b/github/lib.w index 23216818..1d005f91 100644 --- a/github/lib.w +++ b/github/lib.w @@ -27,7 +27,7 @@ pub class ProbotApp { var onPullRequestOpenedHandler: inflight (probot.PullRequestOpenedContext): void; var onPullRequestReopenedHandler: inflight (probot.PullRequestOpenedContext): void; - extern "./probot/probot.mts" pub static inflight createGithubAppJwt(appId: str, privateKey: str): str; + extern "./probot/probot.js" pub static inflight createGithubAppJwt(appId: str, privateKey: str): str; new(props: ProbotAppProps) { this.appId = props.appId; diff --git a/github/package.json b/github/package.json index 73ba790c..0edaeea3 100644 --- a/github/package.json +++ b/github/package.json @@ -1,7 +1,7 @@ { "name": "@winglibs/github", "description": "A Wing library for GitHub Probot", - "version": "0.0.1", + "version": "0.0.2", "author": { "name": "Elad Cohen", "email": "eladc@wing.cloud" diff --git a/github/probot/adapter.w b/github/probot/adapter.w index 9d2320fc..33966454 100644 --- a/github/probot/adapter.w +++ b/github/probot/adapter.w @@ -15,7 +15,7 @@ pub struct CreateAdapterOptions { } pub class ProbotAdapter { - extern "./probot.mts" pub static inflight createProbotAdapter(options: CreateAdapterOptions): probot.ProbotInstance; + extern "./probot.js" pub static inflight createProbotAdapter(options: CreateAdapterOptions): probot.ProbotInstance; pub appId: cloud.Secret; pub privateKey: cloud.Secret; diff --git a/github/probot/probot.mts b/github/probot/probot.js similarity index 76% rename from github/probot/probot.mts rename to github/probot/probot.js index 8a448fbe..8b37a735 100644 --- a/github/probot/probot.mts +++ b/github/probot/probot.js @@ -1,14 +1,9 @@ import { createProbot } from "@probot/adapter-aws-lambda-serverless"; import jwt from "jsonwebtoken"; -export interface CreateProbotAdapterOptions { - appId: number; - privateKey: string; - webhookSecret: string; -} export const createProbotAdapter = async ( - options: CreateProbotAdapterOptions, + options, ) => { const probot = createProbot({ overrides: { @@ -23,7 +18,7 @@ export const createProbotAdapter = async ( return probot; }; -export const createGithubAppJwt = async (appId: string, privateKey: string) => { +export const createGithubAppJwt = async (appId, privateKey) => { const now = Math.floor(Date.now() / 1000) - 30; const expiration = now + 60 * 10; // JWT expiration time (10 minute maximum)