@wopr-network/platform-core 0.1.0 → 1.0.0

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.
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on:
4
+ merge_group:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ permissions: {}
11
+
12
+ jobs:
13
+ ci:
14
+ permissions:
15
+ contents: read
16
+ pull-requests: write
17
+ runs-on: [self-hosted, Linux, X64]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: pnpm/action-setup@v4
22
+
23
+ - uses: actions/setup-node@v4
24
+ with:
25
+ node-version: "24"
26
+ cache: "pnpm"
27
+
28
+ - run: pnpm install --frozen-lockfile
29
+
30
+ - name: Lint and Type Check
31
+ run: pnpm check
32
+
33
+ - name: Build
34
+ run: pnpm build
35
+
36
+ - name: Test
37
+ run: pnpm test -- --coverage
38
+
39
+ - name: Coverage Report
40
+ if: github.event_name == 'pull_request'
41
+ uses: davelosert/vitest-coverage-report-action@v2
42
+ with:
43
+ json-summary-path: coverage/coverage-summary.json
@@ -0,0 +1,11 @@
1
+ name: Dependabot Auto-Merge
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ jobs:
8
+ auto-merge:
9
+ uses: wopr-network/.github/.github/workflows/dependabot-auto-merge.yml@main
10
+ secrets: inherit
11
+
@@ -0,0 +1,12 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ release:
10
+ uses: wopr-network/.github/.github/workflows/release.yml@main
11
+ secrets:
12
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.pr_agent.toml ADDED
@@ -0,0 +1,10 @@
1
+ [github_app]
2
+ pr_commands = [
3
+ "/describe",
4
+ "/review",
5
+ "/improve",
6
+ ]
7
+ push_commands = [
8
+ "/review",
9
+ "/improve",
10
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopr-network/platform-core",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,6 +45,7 @@
45
45
  "@trpc/server": "^11.12.0",
46
46
  "@types/node": "^25.4.0",
47
47
  "@types/pg": "^8.18.0",
48
+ "@wopr-network/semantic-release-config": "^1.0.0",
48
49
  "better-auth": "^1.5.4",
49
50
  "drizzle-kit": "^0.31.9",
50
51
  "drizzle-orm": "^0.45.1",
@@ -60,5 +61,12 @@
60
61
  "winston": "^3.19.0",
61
62
  "zod": "^4.3.6"
62
63
  },
64
+ "release": {
65
+ "extends": "@wopr-network/semantic-release-config"
66
+ },
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "https://github.com/wopr-network/platform-core.git"
70
+ },
63
71
  "packageManager": "pnpm@10.31.0"
64
72
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,62 +0,0 @@
1
- import { Hono } from "hono";
2
- import { beforeEach, describe, expect, it } from "vitest";
3
- import { requireEmailVerified } from "./require-verified.js";
4
- describe("requireEmailVerified middleware", () => {
5
- let verifiedUsers;
6
- let app;
7
- beforeEach(() => {
8
- verifiedUsers = new Set();
9
- const middleware = requireEmailVerified({
10
- isVerified: async (userId) => verifiedUsers.has(userId),
11
- });
12
- app = new Hono();
13
- // Simulate session auth middleware setting user context
14
- app.use("/test/*", async (c, next) => {
15
- const authMethod = (c.req.header("X-Auth-Method") || "session");
16
- const userId = c.req.header("X-User-Id") || "user-1";
17
- c.set("authMethod", authMethod);
18
- c.set("user", { id: userId, roles: ["user"] });
19
- return next();
20
- });
21
- app.use("/test/*", middleware);
22
- app.post("/test/create", (c) => c.json({ ok: true }));
23
- // Route without auth context — use a plain Hono app for this
24
- const noauthApp = new Hono();
25
- noauthApp.use("/noauth/*", middleware);
26
- noauthApp.post("/noauth/create", (c) => c.json({ ok: true }));
27
- // Mount the noauth app into the main app
28
- app.route("/", noauthApp);
29
- });
30
- it("should block session-authenticated users without verified email", async () => {
31
- const res = await app.request("/test/create", {
32
- method: "POST",
33
- headers: { "X-Auth-Method": "session", "X-User-Id": "user-1" },
34
- });
35
- expect(res.status).toBe(403);
36
- const body = await res.json();
37
- expect(body.code).toBe("EMAIL_NOT_VERIFIED");
38
- });
39
- it("should allow session-authenticated users with verified email", async () => {
40
- verifiedUsers.add("user-1");
41
- const res = await app.request("/test/create", {
42
- method: "POST",
43
- headers: { "X-Auth-Method": "session", "X-User-Id": "user-1" },
44
- });
45
- expect(res.status).toBe(200);
46
- const body = await res.json();
47
- expect(body.ok).toBe(true);
48
- });
49
- it("should always allow API token auth", async () => {
50
- const res = await app.request("/test/create", {
51
- method: "POST",
52
- headers: { "X-Auth-Method": "api_key", "X-User-Id": "token:write" },
53
- });
54
- expect(res.status).toBe(200);
55
- const body = await res.json();
56
- expect(body.ok).toBe(true);
57
- });
58
- it("should pass through when no auth context is set", async () => {
59
- const res = await app.request("/noauth/create", { method: "POST" });
60
- expect(res.status).toBe(200);
61
- });
62
- });