Skip to content

Commit 4181860

Browse files
committed
Merge branch 'main' into store-data-manager
2 parents 554fd96 + 867aa8e commit 4181860

File tree

103 files changed

+3499
-4726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3499
-4726
lines changed

.github/workflows/deploy-worker/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ runs:
5656
using: 'composite'
5757
steps:
5858
- name: Build worker
59-
if: ${{ inputs.build && inputs.changed == 'true' }}
59+
if: ${{ (inputs.build && inputs.changed == 'true') || inputs.mode == 'production' }}
6060
shell: bash
6161
run: ${{ inputs.build }}
6262
env:
@@ -66,7 +66,7 @@ runs:
6666
BUILD_AWS_PREFIX: ${{ inputs.BUILD_AWS_PREFIX }}
6767

6868
- name: Get worker deploy command
69-
if: inputs.changed == 'true'
69+
if: inputs.changed == 'true' || inputs.mode == 'production'
7070
id: command
7171
shell: bash
7272
run: |
@@ -79,7 +79,7 @@ runs:
7979
echo "command=$DEPLOY_COMMAND" >> $GITHUB_OUTPUT
8080
8181
- name: Deploy Worker
82-
if: inputs.changed == 'true'
82+
if: inputs.changed == 'true' || inputs.mode == 'production'
8383
id: deploy
8484
uses: cloudflare/wrangler-action@v3
8585
with:

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
#region Summary
122122
- name: Create Job summary
123123
if: always()
124-
uses: actions/github-script@v7
124+
uses: actions/github-script@v8
125125
id: summary
126126
with:
127127
script: |
@@ -166,7 +166,7 @@ jobs:
166166
- name: Create deploy comment
167167
if: github.event_name == 'pull_request'
168168
continue-on-error: true
169-
uses: edumserrano/find-create-or-update-comment@v2
169+
uses: edumserrano/find-create-or-update-comment@v3
170170
with:
171171
issue-number: ${{ github.event.pull_request.number }}
172172
body-includes: '<!-- worker-deploy-summary -->'

.github/workflows/pr-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Typecheck
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
- uses: ./.github/workflows/setup
2323
- run: pnpm typecheck
2424

@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout code
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
3131
- name: Environment setup
3232
uses: ./.github/workflows/setup
3333
- name: Check lint
@@ -38,7 +38,7 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Checkout code
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
4242
- name: Environment setup
4343
uses: ./.github/workflows/setup
4444
- name: Check format

.github/workflows/pr-title-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
name: Check PR Title
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: amannn/action-semantic-pull-request@v5
16+
- uses: amannn/action-semantic-pull-request@v6
1717
env:
1818
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ runs:
77

88
steps:
99
- name: Setup NodeJS
10-
uses: actions/setup-node@v4
10+
uses: actions/setup-node@v6
1111
with: { node-version-file: .nvmrc }
1212

1313
- name: Install PNPM

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ dist
4646
!cdn/dist/.gitkeep
4747
build
4848
.cache
49+
50+
# macOS
51+
.DS_Store
52+
53+
# React Router
54+
.react-router/

api/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Publisher Tools - API
2+
3+
This package contains the Hono-based API server that powers the Publisher Tools. It runs on Cloudflare Workers and is responsible for fetching tool configurations, handling Open Payments, and managing probabilistic revenue sharing.
4+
5+
## Endpoints
6+
7+
The API exposes endpoints related to the following functionalities:
8+
9+
- **Tool Configuration:** Handles fetching the configuration for the monetization tools (see `src/routes/get-config.ts`).
10+
- **Payments:** Manages the Open Payments flow (see `src/routes/payment.ts`).
11+
- **Probabilistic Revshare:** Handles logic related to probabilistic revenue sharing (see `src/routes/probabilistic-revshare.ts`).
12+
13+
## Development
14+
15+
To run the API server for local development, you can use the `dev` script from the project root:
16+
17+
```sh
18+
pnpm -C api dev
19+
```
20+
21+
This will start the Cloudflare Wrangler development server, which automatically reloads on file changes.

api/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"scripts": {
55
"predev": "node -e \"require('fs').copyFileSync('../.dev.vars', '.dev.vars');\"",
6-
"dev": "wrangler dev",
6+
"dev": "wrangler dev --persist-to ../.wrangler",
77
"build": "wrangler deploy --dry-run --outdir dist",
88
"preview": "wrangler dev",
99
"typecheck": "tsc --noEmit",
@@ -14,23 +14,24 @@
1414
"license": "ISC",
1515
"description": "",
1616
"dependencies": {
17-
"@hono/zod-validator": "^0.7.3",
17+
"@hono/zod-validator": "^0.7.5",
1818
"@interledger/open-payments": "^7.1.3",
19-
"@noble/ed25519": "^2.3.0",
19+
"@noble/ed25519": "^3.0.0",
2020
"@paralleldrive/cuid2": "^2.2.2",
2121
"@shared/config-storage-service": "workspace:^",
2222
"@shared/probabilistic-revenue-share": "workspace:^",
2323
"@shared/utils": "workspace:^",
2424
"hono": "^4.9.8",
2525
"http-message-signatures": "^1.0.4",
2626
"httpbis-digest-headers": "^1.0.0",
27-
"zod": "^3.25.76"
27+
"zod": "^4.1.13"
2828
},
2929
"types": "./src/types.ts",
3030
"devDependencies": {
31-
"@shared/types": "workspace:^",
31+
"@cloudflare/workers-types": "^4.20251011.0",
3232
"@shared/defines": "workspace:^",
33-
"typescript": "5.9.2",
33+
"@shared/types": "workspace:^",
34+
"typescript": "5.9.3",
3435
"wrangler": "^4.40.0"
3536
}
3637
}

api/src/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { cors } from 'hono/cors'
33
import { HTTPException } from 'hono/http-exception'
44
import { ZodError } from 'zod'
55
import { serializeError } from './utils/utils.js'
6+
import type { KVNamespace } from '@cloudflare/workers-types'
67

78
export type Env = {
89
AWS_ACCESS_KEY_ID: string
@@ -11,6 +12,7 @@ export type Env = {
1112
OP_WALLET_ADDRESS: string
1213
OP_PRIVATE_KEY: string
1314
OP_KEY_ID: string
15+
PUBLISHER_TOOLS_KV: KVNamespace
1416
}
1517

1618
export const app = new Hono<{ Bindings: Env }>()
@@ -44,7 +46,7 @@ app.onError((error, c) => {
4446
message: 'Validation failed',
4547
code: 'VALIDATION_ERROR',
4648
details: {
47-
issues: error.errors.map((err) => ({
49+
issues: error.issues.map((err) => ({
4850
path: err.path.join('.'),
4951
message: err.message,
5052
code: err.code

api/src/routes/get-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { zValidator } from '@hono/zod-validator'
22
import { HTTPException } from 'hono/http-exception'
3-
import { z } from 'zod'
3+
import z from 'zod'
44
import { ConfigStorageService } from '@shared/config-storage-service'
55
import { AWS_PREFIX } from '@shared/defines'
66
import { PROFILE_IDS, TOOLS } from '@shared/types'
@@ -26,7 +26,7 @@ app.get(
2626
zValidator(
2727
'query',
2828
z.object({
29-
wa: z.string().url(),
29+
wa: z.url(),
3030
profile: z.enum(PROFILE_IDS)
3131
})
3232
),

0 commit comments

Comments
 (0)