Skip to content

Commit

Permalink
chore: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark committed Oct 28, 2024
2 parents 6a05ff2 + ca805ac commit 7c51d96
Show file tree
Hide file tree
Showing 154 changed files with 3,601 additions and 1,235 deletions.
5 changes: 0 additions & 5 deletions .changeset/late-colts-shout.md

This file was deleted.

3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/ossgg_sidequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: oss.gg hack submission 🕹️
description: "Submit your contribution for the for the oss.gg hackathon"
title: "[oss.gg hackathon]"
labels:
- "🕹️ oss.gg, player submission"
- "🕹️ oss.gg"
- "Needs Approval"
- "player submission"

assignees: []
body:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/pr-alerts-campsite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Campsite PR Alerts

on:
pull_request:
types: [opened, closed, merged, ready_for_review, reopened]

jobs:
post_to_campsite:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Post to Campsite
id: post_to_campsite
run: |
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
STATUS_EMOJI="⚪"
elif [[ "${{ github.event.action }}" == "opened" || "${{ github.event.action }}" == "reopened" || "${{ github.event.action }}" == "ready_for_review" ]]; then
STATUS_EMOJI="🟢"
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
STATUS_EMOJI="🟣"
elif [[ "${{ github.event.action }}" == "closed" ]]; then
STATUS_EMOJI="🔴"
fi
ACTION=${{ github.event.action }}
if [[ "${ACTION}" == "ready_for_review" ]]; then
ACTION="ready for review"
elif [[ "${ACTION}" == "reopened" ]]; then
ACTION="reopened"
elif [[ "${ACTION}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
ACTION="merged"
fi
ESCAPED_TITLE=$(echo "${{ github.event.pull_request.title }}" | jq -Rr @json)
CONTENT="${STATUS_EMOJI} Pull request ${ACTION} by ${{ github.event.pull_request.user.login }}: [#${{ github.event.pull_request.number }} ${ESCAPED_TITLE}](${{ github.event.pull_request.html_url }})"
echo "content=${CONTENT}" >> $GITHUB_OUTPUT
- name: Create Campsite message
uses: campsite/campsite-github-action@v1
with:
api_key: ${{ secrets.CAMPSITE_API_KEY }}
action_type: create_message
thread_id: ${{ secrets.CAMPSITE_PR_ALERTS_THREAD_ID }}
content: ${{ steps.post_to_campsite.outputs.content }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ dist
.dev.vars
.wrangler
.vitest
.react-email
.react-email

.secrets.json
secrets.ts
6 changes: 6 additions & 0 deletions apps/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# api

## 0.1.0

### Minor Changes

- 09d36ad: add /v1/keys.whoami route

## 0.0.14

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.0.14",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "tsc",
Expand All @@ -18,7 +18,7 @@
"@vitest/ui": "^1.6.0",
"typescript": "^5.5.3",
"vitest": "^1.6.0",
"wrangler": "^3.62.0"
"wrangler": "^3.80.5"
},
"dependencies": {
"@axiomhq/js": "1.0.0-rc.2",
Expand All @@ -27,6 +27,7 @@
"@hono/zod-validator": "^0.2.1",
"@planetscale/database": "^1.16.0",
"@unkey/cache": "workspace:^",
"@unkey/clickhouse-zod": "workspace:^",
"@unkey/db": "workspace:^",
"@unkey/encryption": "workspace:^",
"@unkey/error": "workspace:^",
Expand All @@ -36,7 +37,6 @@
"@unkey/logs": "workspace:^",
"@unkey/metrics": "workspace:^",
"@unkey/rbac": "workspace:^",
"@unkey/clickhouse-zod": "workspace:^",
"@unkey/schema": "workspace:^",
"@unkey/worker-logging": "workspace:^",
"hono": "^4.6.3",
Expand Down
9 changes: 9 additions & 0 deletions apps/api/src/pkg/env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { z } from "zod";
import type { MessageBody } from "./key_migration/message";

export const cloudflareRatelimiter = z.custom<{
limit: (opts: { key: string }) => Promise<{ success: boolean }>;
}>((r) => typeof r.limit === "function");

export const zEnv = z.object({
VERSION: z.string().default("unknown"),
DATABASE_HOST: z.string(),
Expand Down Expand Up @@ -42,6 +46,11 @@ export const zEnv = z.object({
return 0;
}
}),
RL_10_60s: cloudflareRatelimiter,
RL_30_60s: cloudflareRatelimiter,
RL_200_60s: cloudflareRatelimiter,
RL_500_10s: cloudflareRatelimiter,
RL_200_10s: cloudflareRatelimiter,
});

export type Env = z.infer<typeof zEnv>;
1 change: 1 addition & 0 deletions apps/api/src/pkg/key_migration/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export async function migrateKey(
expires: message.expires ? new Date(message.expires) : null,
refillInterval: message.refill?.interval,
refillAmount: message.refill?.amount,
refillDay: message.refill?.refillDay,
enabled: message.enabled,
remaining: message.remaining,
ratelimitAsync: message.ratelimit?.async,
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/pkg/key_migration/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type MessageBody = {
permissions?: string[];
expires?: number;
remaining?: number;
refill?: { interval: "daily" | "monthly"; amount: number };
refill?: { interval: "daily" | "monthly"; amount: number; refillDay?: number };
ratelimit?: { async: boolean; limit: number; duration: number };
enabled: boolean;
environment?: string;
Expand Down
Loading

0 comments on commit 7c51d96

Please sign in to comment.