Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0646a5ab1 | ||
|
|
9a5adb832e | ||
|
|
3200d38194 | ||
|
|
f447bd7e72 | ||
|
|
a833cf4790 | ||
|
|
352fbce768 | ||
|
|
1831e7e5d8 | ||
|
|
0f43baacf0 | ||
|
|
ef669ec812 | ||
|
|
138f26c8e8 | ||
|
|
a64f73cf13 | ||
|
|
038bdb7c62 | ||
|
|
915d1a006d | ||
|
|
cdad4dc776 | ||
|
|
f75b416aa8 | ||
|
|
d35e62857f | ||
|
|
cf029fc88f | ||
|
|
57a2dc74d6 | ||
|
|
b06c330d02 | ||
|
|
8ca4bdd9fa |
No files matched your search
@@ -2,10 +2,8 @@
|
||||
description: Cloud edition implementation details, PostgreSQL Row-Level Security (RLS) isolation, cross-subdomain auth, and cryptographic license keys.
|
||||
paths:
|
||||
- "src/lib/auth*"
|
||||
- "src/lib/auth/**/*"
|
||||
- "src/app/api/auth/**/*"
|
||||
- "src/core/auth.ts"
|
||||
- "src/core/storage.ts"
|
||||
- "src/core/tenant.ts"
|
||||
---
|
||||
|
||||
> **SUPERSEDED by ADR-003** (`docs/architecture/decisions/adr-0003-shared-identity-and-ecosystem-auth-host.md`).
|
||||
@@ -177,13 +175,15 @@ DATABASE_URL=postgresql://...
|
||||
|
||||
## Edition Adapters
|
||||
|
||||
Three thin files are all that differs between editions — everything else is edition-unaware:
|
||||
Three thin adapter modules provide all edition-specific behaviour -- everything else is edition-unaware:
|
||||
|
||||
| Adapter | Local | Cloud | Demo |
|
||||
|---|---|---|---|
|
||||
| `src/core/auth.ts` | Auth.js `Credentials` (bcrypt + PostgreSQL) | Auth.js `@auth/supabase-adapter` | Disabled |
|
||||
| `src/core/storage.ts` | `fs.writeFile()` to `data/` | Supabase Storage SDK | Read-only |
|
||||
| `src/core/tenant.ts` | No-op (single tenant) | Sets `app.tenant_id` for RLS | No-op |
|
||||
| `src/lib/auth.ts` | Auth.js `Credentials` (bcrypt + PostgreSQL) | Auth.js `@auth/supabase-adapter` | Disabled |
|
||||
| Storage adapter (planned) | `fs.writeFile()` to `data/` | Supabase Storage SDK | Read-only |
|
||||
| Tenant adapter (planned) | No-op (single tenant) | Sets `app.tenant_id` for RLS | No-op |
|
||||
|
||||
> The storage and tenant adapters listed above are planned for the Cloud edition build-out and are not yet implemented as separate files. Auth is fully implemented in `src/lib/auth.ts` and `src/lib/auth.config.ts`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -89,3 +89,60 @@ This means:
|
||||
|
||||
> [!CAUTION]
|
||||
> The most common silent bug: seeder sends `{ items: [...] }` (an object), frontend plugin omits `mapWebsocketPayload`. Data arrives but WsClient drops it with a console warning. The globe stays empty. Always implement `mapWebsocketPayload` for any plugin whose seeder sends an object payload.
|
||||
|
||||
## 8. Seeder Authoring Contract — the module shape
|
||||
|
||||
§7 covers what a seeder **sends**. This covers how you **write** one. The engine
|
||||
auto-discovers a seeder by scanning `SEEDERS_DIR` for any folder with
|
||||
`dist/index.mjs` and importing its **default export**. The seeder's `id` is the
|
||||
**folder name**, not the `name` field. You never call a register function — the
|
||||
authoritative reference is `wwv-data-engine/README.md` → "Authoring a Seeder".
|
||||
|
||||
The default export is `{ name }` plus **one** of these shapes:
|
||||
|
||||
| Shape | You provide | How data is published |
|
||||
|---|---|---|
|
||||
| `interval` + `fetch(ctx)` | `fetch` **returns** the array | scheduler wraps + stores + broadcasts it for you |
|
||||
| `cron` + `fn(ctx)` | `fn` publishes itself | `import { setLiveSnapshot } from '@worldwideview/seeder-sdk'` and call it |
|
||||
| `init(ctx)` | a persistent listener | publish via the SDK as push data arrives |
|
||||
|
||||
**The trap (this caused a real, silent CI failure):** `ctx` is **only `{ redis }`**.
|
||||
There is no `ctx.setLiveSnapshot`. Reaching for it throws at runtime and the
|
||||
snapshot never lands. Publish helpers come from `@worldwideview/seeder-sdk`, not
|
||||
from `ctx`. The engine now types `ctx` as `SeederContext { redis }`, so this is a
|
||||
compile error for any typed seeder — but `.mjs` seeders without type-checking get
|
||||
no such safety net, so know the contract.
|
||||
|
||||
<bad-example>
|
||||
```ts
|
||||
// cron + fn reaching for a method that does not exist on ctx
|
||||
export default {
|
||||
name: "earthquakes",
|
||||
cron: "0 * * * *",
|
||||
fn: async (ctx) => {
|
||||
await ctx.setLiveSnapshot("earthquakes", items, 3600); // ❌ not a function — dies silently
|
||||
},
|
||||
};
|
||||
```
|
||||
</bad-example>
|
||||
|
||||
<good-example>
|
||||
```ts
|
||||
// Option A — cron + fn: publish via the SDK (dominant idiom)
|
||||
import { setLiveSnapshot } from "@worldwideview/seeder-sdk";
|
||||
export default {
|
||||
name: "earthquakes",
|
||||
cron: "0 * * * *",
|
||||
fn: async () => {
|
||||
await setLiveSnapshot("earthquakes", { source: "earthquakes", fetchedAt: new Date().toISOString(), items, totalCount: items.length }, 3600);
|
||||
},
|
||||
};
|
||||
|
||||
// Option B — interval + fetch: just return the array, scheduler does the rest
|
||||
export default {
|
||||
name: "earthquakes",
|
||||
interval: 60_000,
|
||||
fetch: async () => items, // ✅ no publishing call needed
|
||||
};
|
||||
```
|
||||
</good-example>
|
||||
@@ -206,18 +206,10 @@ Hard refresh: `Ctrl+Shift+R`
|
||||
|
||||
## Creating Static OSM Plugins
|
||||
|
||||
See full guide: `.agents/skills/osm-static-plugin-creation.md`
|
||||
Use the `plugin-new` skill (`.agents/skills/plugin-new/SKILL.md`) to scaffold new plugins, including OSM-based static data plugins. The old `scaffold-osm-plugin.mjs` script and `osm-static-plugin-creation.md` skill were removed; static OSM plugins are now built as standard `bundle` format plugins via the wwv-cli:
|
||||
|
||||
**Quick start:**
|
||||
```bash
|
||||
node scripts/scaffold-osm-plugin.mjs '{
|
||||
"name": "volcanoes",
|
||||
"displayName": "Volcanoes",
|
||||
"osmTag": "natural=volcano",
|
||||
"icon": "Mountain",
|
||||
"color": "#ef4444",
|
||||
"category": "Natural Disaster"
|
||||
}'
|
||||
node packages/wwv-cli/dist/index.js create <name> --local
|
||||
```
|
||||
|
||||
**Manual Overpass API query (PowerShell):**
|
||||
@@ -227,26 +219,29 @@ $body = "data=[out:json][timeout:300];(node[$tag];way[$tag];relation[$tag];);out
|
||||
Invoke-RestMethod -Uri 'https://overpass-api.de/api/interpreter' -Method Post -Body $body -OutFile 'tmp/raw_data.json'
|
||||
```
|
||||
|
||||
**Note:** OSM data is licensed under **ODbL** — include attribution in plugin READMEs.
|
||||
**Note:** OSM data is licensed under **ODbL** - include attribution in plugin READMEs.
|
||||
|
||||
---
|
||||
|
||||
## npm Plugin Publishing
|
||||
|
||||
See full guide: `.agents/skills/version-control/npm-plugin-publishing.md`
|
||||
The `npm-plugin-publishing.md` skill was removed. Use the wwv-cli publish command:
|
||||
|
||||
```bash
|
||||
# First-time publish
|
||||
# Publish a local plugin
|
||||
node packages/wwv-cli/dist/index.js publish <name> [--org <your-org>]
|
||||
|
||||
# Or publish directly via pnpm (for packages/ workspace members)
|
||||
pnpm publish --workspace=packages/wwv-plugin-<name> --access public
|
||||
|
||||
# Future versions — via Trusted Publishing (GitHub Actions CI/CD)
|
||||
# Future versions via Trusted Publishing (GitHub Actions CI/CD)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Git / Version Control
|
||||
|
||||
See full guide: `.agents/skills/version-control/git-version-control.md`
|
||||
The `git-version-control.md` skill was removed. See `.agents/skills/using-git-worktrees/SKILL.md` for worktree workflows and `.agents/skills/branch-cleanup/SKILL.md` for the post-merge teardown flow.
|
||||
|
||||
**Commit convention:** `feat:`, `fix:`, `chore:`, `docs:` prefixes.
|
||||
**Commit when:** A new feature is completed (per project rules).
|
||||
@@ -255,7 +250,7 @@ See full guide: `.agents/skills/version-control/git-version-control.md`
|
||||
|
||||
## Security Checks
|
||||
|
||||
See full guide: `.agents/skills/security/security-check.md`
|
||||
The `security-check.md` skill was removed. Security reviews are handled by the `security-reviewer` agent (`.agents/agents/security-reviewer.md`). Trigger it after any change touching auth routes, API routes, plugin loading, or marketplace flows.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -12,6 +12,22 @@ paths:
|
||||
## Purpose
|
||||
The standard operating procedure for instantiating, modifying, and registering a new data source plugin within the engine.
|
||||
|
||||
## Data Engine Agnosticism (Separation of Concern)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **WWV is agnostic to which data engine a plugin uses.** Each plugin MUST declare its own `streamUrl` in `getServerConfig()`. The WWV application never controls or overrides plugin stream URLs.
|
||||
|
||||
This is intentional architectural separation: a user can have 30 plugins pointing to 30 different custom backend servers, and WWV opens 30 separate WebSocket connections without caring. The WWV app does not have a "the data engine" — each plugin has its own.
|
||||
|
||||
**Practical rules:**
|
||||
- Plugins hardcode their cloud engine URL (e.g. `wss://dataenginev2.worldwideview.dev/stream`) — this is correct and by design.
|
||||
- Do not add env vars to let WWV override a plugin's `streamUrl` globally — that breaks the separation.
|
||||
- When editing a plugin's fallback fetch URL, use `https://dataenginev2.worldwideview.dev` (note the `v2`).
|
||||
- `NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL` is a local dev only var (`.env.local` only, never production) that routes locally-developed plugin seeders to a local engine instance. It is NOT injected into plugin stream URLs.
|
||||
- `WWV_DATA_ENGINE_URL` is the production server-side var (docker-compose / Coolify) for the WWV app's own REST calls (MCP tools, entity search). Never set `NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL` in production.
|
||||
|
||||
---
|
||||
|
||||
## The WorldPlugin Contract
|
||||
|
||||
All data ingest flows through `WorldPlugin` (defined entirely within `@worldwideview/wwv-plugin-sdk`).
|
||||
@@ -237,7 +253,7 @@ GET marketplace.worldwideview.dev/api/registry
|
||||
- Trust is **always stamped server-side** — no client-side trust claims accepted
|
||||
- Registry response cached for **5 minutes** (in-memory on each WWV instance)
|
||||
- If registry unreachable, last cached result used; new unknowns default to `unverified`
|
||||
- **Managing:** Edit `src/data/verifiedPlugins.ts` in marketplace repo and redeploy
|
||||
- **Managing:** Use the marketplace admin API (`/api/admin/registry`) to manage the signed plugin registry. The old `src/data/verifiedPlugins.ts` static file was replaced by database-driven registry management.
|
||||
- **Revoking:** Remove plugin ID and redeploy — WWV instances drop trust on next cache refresh
|
||||
|
||||
### Unverified Plugin Warning
|
||||
@@ -437,7 +453,7 @@ This queries Overpass API, converts to GeoJSON, scaffolds the package, and print
|
||||
| Power plants | `power=plant` | 15k |
|
||||
| Wind farms | `generator:source=wind` | 50k |
|
||||
|
||||
See skill: `.agents/skills/osm-static-plugin-creation.md`
|
||||
The `osm-static-plugin-creation.md` skill was removed. Use `node packages/wwv-cli/dist/index.js create <name> --local` to scaffold a new plugin, then populate it with OSM data fetched via the Overpass API.
|
||||
|
||||
---
|
||||
|
||||
@@ -462,7 +478,7 @@ To solve this friction and make third-party plugin hosting highly intuitive, the
|
||||
2. **Backend SDK:** They write simple `.ts` fetch scripts returning `GeoEntity[]` and drop them into a mounted `/seeders` volume.
|
||||
3. **Zero Configuration:** The Docker engine hot-reloads these seeders, handles the Redis caching, and exposes standardized REST or WebSocket endpoints automatically. The developer focuses only on fetching data, avoiding all backend infrastructure setup.
|
||||
|
||||
See skill: `.agents/skills/data-engine-seeder-creation.md`
|
||||
The `data-engine-seeder-creation.md` skill was removed. Seeder implementation rules are documented inline in `.agents/rules/data-engine-architecture.md`. Seeders live in `local-seeders/community/` or `local-seeders/private/` (separate git clones).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# /triage-issue
|
||||
|
||||
Triage a single GitHub issue in `silvertakana/worldwideview` per the project's [TRIAGE.md](../../TRIAGE.md) intake rules. Classifies the issue, recommends a disposition, and executes it after explicit user confirmation.
|
||||
|
||||
**Usage:** `/triage-issue <issue-number>`
|
||||
|
||||
`$ARGUMENTS` = the issue number to triage.
|
||||
|
||||
## Procedure
|
||||
|
||||
### 1. Fetch the issue
|
||||
|
||||
```bash
|
||||
gh issue view $ARGUMENTS --repo silvertakana/worldwideview --json number,title,body,labels,comments,author
|
||||
```
|
||||
|
||||
### 2. Classify
|
||||
|
||||
Determine the type from the title prefix and body:
|
||||
|
||||
| Signal | Type |
|
||||
|---|---|
|
||||
| `[PLUGIN]`, "data source", "show X on the globe" | **plugin-request** |
|
||||
| `[FEATURE]`, "feature request", capability not tied to a data source | **enhancement** |
|
||||
| `[BUG]`, error, stack trace, "doesn't work" | **bug** |
|
||||
| Open-ended question, no actionable ask | **question** |
|
||||
|
||||
### 3. Apply the TRIAGE.md rule
|
||||
|
||||
- **plugin-request:** vet the API first (dispatch the `plugin-researcher` agent if the source is unknown). Then apply the build/do-not-build rule (free API + renders something meaningful + fits the demo).
|
||||
- Viable -> propose: add a checklist line to #4, label `plugin-request` + `good first issue` + `help wanted`, close standalone with "Tracked in #4."
|
||||
- Not viable -> propose: close with the specific reason.
|
||||
- **enhancement:** propose: label `enhancement`, add a one-line ROADMAP backlog entry, keep open.
|
||||
- **bug:** propose: label `bug`, reproduce, then fix inline or route to the `debugger` agent.
|
||||
- **question:** draft a reply; propose answer-then-close.
|
||||
|
||||
### 4. Confirm before any state change
|
||||
|
||||
Present the classification and proposed actions as a short summary. **Do not** comment, label, pin, close, or edit anything until the user explicitly approves (per the project's "explicit user authorization before any state-changing action" rule). Comments are posted from the owner account, so they read as owner triage notes - keep them accurate and neutral.
|
||||
|
||||
### 5. Execute
|
||||
|
||||
On approval, run the `gh` commands for the approved actions only. Report each result with its URL.
|
||||
|
||||
## Notes
|
||||
|
||||
- Issue #4 (Plugin Wishlist) is the canonical pinned funnel for plugin ideas - never create a competing wishlist.
|
||||
- Never promise dates on `enhancement` issues.
|
||||
- See [TRIAGE.md](../../TRIAGE.md) for the full rationale and the build/do-not-build test.
|
||||
@@ -96,6 +96,19 @@ PROXY_HOST_ALLOWLIST=*
|
||||
# Comma-separated list of plugin IDs
|
||||
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=
|
||||
|
||||
# Local Engine URL (local dev only — set in .env.local, NEVER in production)
|
||||
# Points at your local data engine instance for per-plugin WS stream routing.
|
||||
# Each worktree should use a different port so their engines don't collide.
|
||||
# Local dev (engine on host): http://localhost:5000
|
||||
NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL=
|
||||
|
||||
# Data Engine REST URL (production / Docker Compose — server-side only)
|
||||
# Used by MCP data tools and server-side entity queries to reach the engine REST API.
|
||||
# NOT read by the browser. Set this in docker-compose or Coolify, not in .env.local.
|
||||
# Docker Compose (same network): http://wwv-data-engine:5000
|
||||
# External engine: http://<engine-host-ip>:5002
|
||||
# WWV_DATA_ENGINE_URL=
|
||||
|
||||
# Edition: "local" | "cloud" | "demo"
|
||||
NEXT_PUBLIC_WWV_EDITION=local
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ jobs:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=raw,value=ci,enable={{is_default_branch}}
|
||||
type=ref,event=branch
|
||||
type=sha,format=short
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
---
|
||||
phase: 17-instance-picker-ui-overhaul
|
||||
plan: "01"
|
||||
subsystem: marketplace-instance-data-layer
|
||||
tags: [api, tdd, validation, prisma, auth]
|
||||
dependency_graph:
|
||||
requires: []
|
||||
provides: [SavedInstance-lastUsedAt, GET-me-instances-fixed, validateInstanceUrl, POST-instances-link, DELETE-PATCH-instances-id]
|
||||
affects: [InstancePicker, InstanceHydrator, InstanceCapture, InstanceConfig]
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: [discriminated-union, idempotent-upsert, ownership-check-404, tdd-red-green]
|
||||
key_files:
|
||||
created:
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceValidation.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceValidation.spec.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/link/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/[id]/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/link/route.test.ts
|
||||
modified:
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceStore.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/me/instances/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/me/instances/route.test.ts
|
||||
decisions:
|
||||
- "GET /api/me/instances kept at current URL - not renamed to /api/instances"
|
||||
- "Anon callers still receive 200 + empty array - no 401 switch"
|
||||
- "SavedInstance gets lastUsedAt only - createdAt deliberately excluded per plan"
|
||||
- "Route test mocks updated to reflect getOrCreateMarketplaceUser addition (Rule 1 fix)"
|
||||
metrics:
|
||||
duration: "~25 minutes"
|
||||
completed: "2026-05-30"
|
||||
tasks_completed: 3
|
||||
files_changed: 8
|
||||
---
|
||||
|
||||
# Phase 17 Plan 01: Instance Data Layer Summary
|
||||
|
||||
**One-liner:** Server-side instance sync data layer with idempotent upsert, URL validation discriminated union, and ownership-checked CRUD routes.
|
||||
|
||||
## Tasks Completed
|
||||
|
||||
| Task | Name | Commit | Files |
|
||||
|------|------|--------|-------|
|
||||
| 1 | Add lastUsedAt to SavedInstance + fix GET | 421a5b8 | instanceStore.ts, me/instances/route.ts |
|
||||
| 2 (RED) | validateInstanceUrl failing tests | 269cad1 | instanceValidation.spec.ts |
|
||||
| 2 (GREEN) | validateInstanceUrl implementation | 9a3fcb7 | instanceValidation.ts |
|
||||
| 3 (RED) | link route failing tests | 20c7ea0 | instances/link/route.test.ts |
|
||||
| 3 (GREEN) | link + [id] routes implementation | e69ebca | instances/link/route.ts, instances/[id]/route.ts, route.test.ts fix |
|
||||
|
||||
## What Was Built
|
||||
|
||||
**Task 1** fixed two issues in the existing GET route:
|
||||
- `SavedInstance` interface now includes `lastUsedAt: string` (no `createdAt` per plan)
|
||||
- GET route now calls `getOrCreateMarketplaceUser` to resolve the marketplace cuid before querying `LinkedInstance.userId`. The previous bug queried with the raw Supabase user id, so rows written by `/api/install/start` (which use the marketplace cuid) were never returned.
|
||||
- `lastUsedAt` added to the SELECT
|
||||
- Anonymous callers still receive `200 + { instances: [] }` - no auth-contract regression
|
||||
|
||||
**Task 2** ported `instanceValidation.ts` with full TDD:
|
||||
- `InstanceValidationResult` discriminated union: `{ ok: true; url: string } | { ok: false; reason: string }`
|
||||
- `validateInstanceUrl(raw, marketplaceOrigin)` normalises to `parsed.origin`, rejects non-http(s), self-loops, unparseable, empty/null
|
||||
- 8 Vitest cases (split null/undefined case and empty-string into separate `it` blocks)
|
||||
- RED commit preceded GREEN commit
|
||||
|
||||
**Task 3** ported both write routes with TDD:
|
||||
- `POST /api/instances/link`: idempotent upsert via `userId_url` compound key, bumps `lastUsedAt` on repeat
|
||||
- `DELETE /api/instances/[id]`: ownership check via `findFirst { id, userId }`; returns 404 (never 403)
|
||||
- `PATCH /api/instances/[id]`: nickname trimmed to 80 chars, null clears field; 404 for non-owned
|
||||
- Link route unit tests: 401 for anon + upsert called with correct `userId_url`
|
||||
- RED commit preceded GREEN commit
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] Existing route.test.ts for GET /api/me/instances broken by Task 1**
|
||||
- **Found during:** Task 3 full test run
|
||||
- **Issue:** The existing `src/app/api/me/instances/route.test.ts` mocked `prisma` without `user.findUnique` and did not mock `getOrCreateMarketplaceUser`. After Task 1 added `getOrCreateMarketplaceUser` to the route, the test threw `TypeError: Cannot read properties of undefined (reading 'findUnique')`.
|
||||
- **Fix:** Updated the test to mock `getOrCreateMarketplaceUser`, updated prisma mock (no longer needs `user` table), and adjusted assertions to use marketplace user id (`mkt-456`) instead of raw supabase id.
|
||||
- **Files modified:** `src/app/api/me/instances/route.test.ts`
|
||||
- **Commit:** e69ebca (bundled with Task 3 GREEN)
|
||||
|
||||
### Pre-existing Failures (Out of Scope)
|
||||
|
||||
- `src/app/oauth/authorize/actions.spec.ts` has 1 failing test that existed before this plan. Verified by stash-and-test. Not caused by any change in this plan. Logged for deferred attention.
|
||||
|
||||
## TDD Gate Compliance
|
||||
|
||||
| Gate | Commit | Status |
|
||||
|------|--------|--------|
|
||||
| Task 2 RED | 269cad1 | test(17-01): add failing tests for validateInstanceUrl (RED) |
|
||||
| Task 2 GREEN | 9a3fcb7 | feat(17-01): implement validateInstanceUrl (GREEN) |
|
||||
| Task 3 RED | 20c7ea0 | test(17-01): add failing tests for POST /api/instances/link (RED) |
|
||||
| Task 3 GREEN | e69ebca | feat(17-01): create POST /api/instances/link + DELETE/PATCH /api/instances/[id] (GREEN) |
|
||||
|
||||
Both TDD cycles satisfied: RED commit preceded GREEN commit for Tasks 2 and 3.
|
||||
|
||||
## Known Stubs
|
||||
|
||||
None. All routes are fully implemented and wired to live Prisma queries.
|
||||
|
||||
## Threat Surface Scan
|
||||
|
||||
All mitigations from the plan's threat model are present:
|
||||
- T-17-01: `validateInstanceUrl` rejects non-http(s), unparseable, marketplace self-origin; only `parsed.origin` stored
|
||||
- T-17-02: DELETE/PATCH use `findFirst { id, userId }` ownership check; return 404 (not 403)
|
||||
- T-17-03: GET uses `getOrCreateMarketplaceUser` scoped to caller's marketplace cuid
|
||||
- T-17-04: PATCH trims nickname to 80 chars before persist
|
||||
|
||||
No new security surface introduced beyond what the threat model covers.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- `src/lib/instanceStore.ts` - FOUND, contains `lastUsedAt: string`
|
||||
- `src/app/api/me/instances/route.ts` - FOUND, uses `getOrCreateMarketplaceUser`
|
||||
- `src/lib/instanceValidation.ts` - FOUND, exports `validateInstanceUrl`
|
||||
- `src/lib/instanceValidation.spec.ts` - FOUND, 8 `it(` blocks
|
||||
- `src/app/api/instances/link/route.ts` - FOUND, exports `POST`
|
||||
- `src/app/api/instances/[id]/route.ts` - FOUND, exports `DELETE` and `PATCH`
|
||||
- `src/app/api/instances/link/route.test.ts` - FOUND, 2 tests pass
|
||||
- Commits 421a5b8, 269cad1, 9a3fcb7, 20c7ea0, e69ebca - all present in git log
|
||||
- `npx tsc --noEmit` - no errors
|
||||
- `pnpm test` - 75 passed, 1 pre-existing failure (oauth, out of scope)
|
||||
@@ -60,6 +60,7 @@ Agents MUST respect these at all times:
|
||||
> - **MUST** require explicit user authorization before any state-changing action that isn't simple/safe.
|
||||
> - **MUST** ask clarifying questions rather than assume when requirements are unclear.
|
||||
> - **MUST** update `.agents/rules/` files immediately whenever an architectural shift invalidates them.
|
||||
> - **MUST** close context gaps: when missing/wrong/undocumented context made you err, struggle, or go slow, fix the relevant doc/context (or add a type/guardrail) at its source — or ask the user to update it when it depends on their knowledge. In autonomous mode, log the gap to revisit later. Never fix only the symptom and leave the trap armed for the next contributor.
|
||||
|
||||
---
|
||||
|
||||
@@ -132,6 +133,7 @@ See `.agents/context/INDEX.md` for the full navigation table. Key files:
|
||||
| `/five` | Five Whys root cause analysis | `.agents/workflows/five.md` |
|
||||
| `/stitch-to-nextjs` | Generate UI with Stitch MCP, port into Next.js | `.agents/workflows/stitch-to-nextjs.md` |
|
||||
| `/branch-cleanup` | **Post-merge teardown** — commit leftovers, delete plan file, remove worktree via worktree-manager | `.agents/skills/branch-cleanup/SKILL.md` |
|
||||
| `/triage-issue` | Triage a single issue (plugin/feature/bug/question) per `TRIAGE.md`; confirm before any state change | `.agents/workflows/triage-issue.md` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Issue Triage Guide
|
||||
|
||||
How incoming **plugin requests** and **feature requests** are handled in `silvertakana/worldwideview`. The goal is a consistent, low-effort intake so nothing rots and contributors always know where their idea stands.
|
||||
|
||||
Run `/triage-issue <number>` to apply this guide to a specific issue.
|
||||
|
||||
## 1. Intake types and labels
|
||||
|
||||
Every non-bug request is one of two types:
|
||||
|
||||
| Type | What it is | Label | Examples |
|
||||
|---|---|---|---|
|
||||
| **Plugin request** | A new data source to render on the globe | `plugin-request` | BirdNET (#148), ISS tracker, AIS ships |
|
||||
| **Feature request** | A platform capability, not a data source | `enhancement` | GeoJSON editor (#84), ontology layer (#138) |
|
||||
|
||||
Community-buildable plugin requests also get `good first issue` + `help wanted`.
|
||||
|
||||
## 2. Plugin requests funnel into #4
|
||||
|
||||
[Issue #4 - Plugin Wishlist](https://github.com/silvertakana/worldwideview/issues/4) is the **single pinned funnel** for plugin ideas. When a `[PLUGIN]` issue arrives:
|
||||
|
||||
1. **Vet the data source.** Is there a free, public API? Check rate limits and CORS. The `plugin-researcher` agent does this in about a minute.
|
||||
2. **If viable:** add it as a checklist line in #4, label the standalone `plugin-request` + `good first issue` + `help wanted`, then close the standalone with a note: "Tracked in the Plugin Wishlist #4." This keeps one canonical list instead of scattered duplicates.
|
||||
3. **If not viable** (no free API, paywalled, or geofenced - e.g. aviation/OpenSky in #149): close with the reason stated, so nobody re-opens the same dead end.
|
||||
|
||||
## 3. Feature requests stay open as tracking threads
|
||||
|
||||
1. Label `enhancement`.
|
||||
2. Add a one-line entry to the `.planning` ROADMAP backlog (shared root, see `WWV_SHARED_PLANNING`).
|
||||
3. Leave the issue **open** as the canonical tracking thread. Reply with status, but **promise no dates**.
|
||||
|
||||
## 4. The build / do-not-build rule
|
||||
|
||||
Only build a plugin yourself (or kick off the `/plugin-new` pipeline) when **all three** hold:
|
||||
|
||||
1. **Free API exists** - no paywall, usable rate limits.
|
||||
2. **Renders something meaningful** - points, paths, or regions on the globe, not just a number.
|
||||
3. **Fits the demo** - relevant to the live `demo` edition, not a niche one-off.
|
||||
|
||||
If any one fails, it lives in the wishlist (#4) for community contributors. The same three-part test is why aviation was pulled from the demo (#149): the only free API was unreliable.
|
||||
|
||||
## 5. Quick reference
|
||||
|
||||
```
|
||||
[PLUGIN] issue -> vet API -> viable? yes: add to #4, label, close standalone
|
||||
no: close with reason
|
||||
[FEATURE] issue -> label enhancement -> add to ROADMAP backlog -> keep open
|
||||
bug -> reproduce -> label bug -> fix or route to debugger agent
|
||||
question -> answer -> close
|
||||
```
|
||||
@@ -0,0 +1,97 @@
|
||||
# Reusable compose for plugin smoke CI (consumed by wwv-plugins repo).
|
||||
#
|
||||
# Boots a full stack with a STUB seeder that emits known-good GeoEntity[]
|
||||
# data under the plugin-under-test's id. This isolates "is the frontend
|
||||
# wiring correct" from "is the real backend healthy" — a broken real seeder
|
||||
# cannot fail plugin CI.
|
||||
#
|
||||
# ─── Scope boundary (what THIS compose does vs what the workflow does) ───
|
||||
#
|
||||
# This compose only boots services. The consuming workflow's Playwright
|
||||
# `globalSetup` is responsible for:
|
||||
# 1. Inserting the test user into `users` (for NextAuth credentials login)
|
||||
# 2. Inserting the `InstalledPlugin` row with the plugin's manifest JSON
|
||||
# (entry URL → http://localhost:3000/plugins-local/<PLUGIN_ID>/frontend.mjs)
|
||||
# 3. UI login → save storageState.json
|
||||
# 4. Running the smoke spec
|
||||
#
|
||||
# Reuse the pattern from worldwideview/tests/global.setup.ts. DB migrations
|
||||
# are handled automatically by the wwv-app entrypoint at container start.
|
||||
#
|
||||
# ─── Stub seeder source ───
|
||||
#
|
||||
# The stub seeder is baked into the `wwv-data-engine:ci` image at
|
||||
# /app/seeders/stub (see wwv-data-engine/Dockerfile.ci). The compose only needs
|
||||
# to set STUB_PLUGIN_ID — no volume mount, so a consumer repo can download just
|
||||
# this YAML and run it without the worldwideview source tree present.
|
||||
#
|
||||
# Expected env vars from consuming workflow:
|
||||
# PLUGIN_ID — kebab-case id of the plugin under test (e.g. "aviation")
|
||||
# PLUGIN_BUNDLE_DIR — host path to the plugin's compiled dist/ (mounted into wwv-app)
|
||||
# CI_IMAGE_TAG — image tag to pull (default: ci)
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: worldwideview
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d worldwideview"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
wwv-redis:
|
||||
image: redis:7-alpine
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
wwv-data-engine:
|
||||
image: ghcr.io/silvertakana/wwv-data-engine:${CI_IMAGE_TAG:-ci}
|
||||
command: ["node", "dist/server.js"]
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
PORT: 5000
|
||||
REDIS_URL: redis://wwv-redis:6379
|
||||
SEEDERS_DIR: /app/seeders
|
||||
DB_PATH: /tmp/engine.db
|
||||
# Stub seeder reads the target plugin id from this env var
|
||||
STUB_PLUGIN_ID: ${PLUGIN_ID}
|
||||
WWV_SKIP_WS_AUTH: "true"
|
||||
NODE_ENV: ci
|
||||
# No volume mount: the stub seeder is baked into the :ci image at
|
||||
# /app/seeders/stub, so the engine discovers it as id "stub" with no host
|
||||
# path dependency.
|
||||
depends_on:
|
||||
wwv-redis:
|
||||
condition: service_healthy
|
||||
|
||||
wwv-app:
|
||||
image: ghcr.io/silvertakana/worldwideview:${CI_IMAGE_TAG:-ci}
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
AUTH_SECRET: ci-placeholder-secret-not-used-in-tests
|
||||
DATABASE_URL: postgresql://postgres:postgres@db:5432/worldwideview?schema=public
|
||||
NEXT_PUBLIC_WWV_EDITION: local
|
||||
NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL: http://localhost:5000
|
||||
volumes:
|
||||
# Mount the plugin's compiled bundle so the app can load it locally
|
||||
- ${PLUGIN_BUNDLE_DIR}:/app/public/plugins-local/${PLUGIN_ID}:ro
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
wwv-data-engine:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
@@ -0,0 +1,64 @@
|
||||
# Reusable compose for seeder smoke CI (consumed by wwv-seeders-* repos).
|
||||
#
|
||||
# Runs the REAL seeder against a MOCK upstream HTTP server. This isolates
|
||||
# "is the seeder code correct" from "is the upstream provider up" — a
|
||||
# NASA FIRMS / OpenSky / Overpass outage cannot fail seeder CI.
|
||||
#
|
||||
# Expected env vars from consuming workflow:
|
||||
# SEEDER_NAME — kebab-case name of the seeder under test
|
||||
# SEEDER_DIST_DIR — host path to the seeder's compiled dist/ + package.json
|
||||
# FIXTURE_DIR — host path to the seeder's __fixtures__ directory
|
||||
# CI_IMAGE_TAG — image tag to pull (default: ci)
|
||||
#
|
||||
# Plus any seeder-specific upstream env vars (e.g. OPENSKY_API_BASE)
|
||||
# already exported in the workflow shell, all pointing at http://mock-upstream:8080
|
||||
|
||||
services:
|
||||
wwv-redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
mock-upstream:
|
||||
build:
|
||||
context: ./mock-upstream
|
||||
volumes:
|
||||
- ${FIXTURE_DIR}:/fixtures:ro
|
||||
environment:
|
||||
FIXTURE_DIR: /fixtures
|
||||
PORT: 8080
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q -O- http://localhost:8080/__health || exit 1"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
wwv-data-engine:
|
||||
image: ghcr.io/silvertakana/wwv-data-engine:${CI_IMAGE_TAG:-ci}
|
||||
command: ["node", "dist/server.js"]
|
||||
ports:
|
||||
- "5000:5000"
|
||||
volumes:
|
||||
# Mount ONLY this seeder under /app/seeders/community/<name> — isolates
|
||||
# the test from any cross-seeder dependencies or collisions.
|
||||
- ${SEEDER_DIST_DIR}:/app/seeders/community/${SEEDER_NAME}:ro
|
||||
environment:
|
||||
PORT: 5000
|
||||
REDIS_URL: redis://wwv-redis:6379
|
||||
SEEDERS_DIR: /app/seeders
|
||||
DB_PATH: /tmp/engine.db
|
||||
# Seeder-specific upstream env vars are injected by the consuming
|
||||
# workflow via `environment:` overrides or `env_file:`.
|
||||
env_file:
|
||||
- path: ./.seeder.env
|
||||
required: false
|
||||
depends_on:
|
||||
wwv-redis:
|
||||
condition: service_healthy
|
||||
mock-upstream:
|
||||
condition: service_healthy
|
||||
@@ -0,0 +1,5 @@
|
||||
FROM node:22-alpine
|
||||
WORKDIR /mock
|
||||
COPY server.mjs ./
|
||||
EXPOSE 8080
|
||||
CMD ["node", "/mock/server.mjs"]
|
||||
@@ -0,0 +1,48 @@
|
||||
# mock-upstream
|
||||
|
||||
Tiny HTTP server used in CI to stand in for upstream data APIs (OpenSky, NASA FIRMS, Overpass, etc.) so seeder CI can run hermetically without real API keys or network flakiness.
|
||||
|
||||
## How it works
|
||||
|
||||
Mount a fixture directory at `/fixtures`. The directory must contain a `routes.json` mapping request paths → fixture filenames:
|
||||
|
||||
```json
|
||||
{
|
||||
"/api/states/all": "opensky-states.json",
|
||||
"/api/v2/flights": "flights.json"
|
||||
}
|
||||
```
|
||||
|
||||
When the server receives `GET /api/states/all`, it serves the contents of `/fixtures/opensky-states.json`.
|
||||
|
||||
## Env vars
|
||||
|
||||
| Var | Default | Purpose |
|
||||
|---|---|---|
|
||||
| `FIXTURE_DIR` | `/fixtures` | Directory mounted from the seeder repo |
|
||||
| `ROUTES_FILE` | `${FIXTURE_DIR}/routes.json` | Override the routes manifest path |
|
||||
| `PORT` | `8080` | Listen port |
|
||||
|
||||
## Per-seeder convention
|
||||
|
||||
Each seeder ships its own `__fixtures__/` folder next to `src/`:
|
||||
|
||||
```
|
||||
wwv-seeders-community/aviation/
|
||||
├── src/index.ts
|
||||
└── __fixtures__/
|
||||
├── routes.json
|
||||
└── opensky-states.json
|
||||
```
|
||||
|
||||
In CI compose, that folder is mounted into the mock-upstream container at `/fixtures` for the duration of the seeder smoke test.
|
||||
|
||||
## Architectural contract
|
||||
|
||||
Seeders MUST read upstream URLs from documented env vars with the production URL as the default, e.g.:
|
||||
|
||||
```ts
|
||||
const UPSTREAM = process.env.OPENSKY_API_BASE ?? "https://opensky-network.org";
|
||||
```
|
||||
|
||||
The CI compose then overrides `OPENSKY_API_BASE=http://mock-upstream:8080`. Without this convention, CI mocking is impossible — hardcoded URLs cannot be intercepted.
|
||||
@@ -0,0 +1,61 @@
|
||||
import { createServer } from "node:http";
|
||||
import { readFileSync, existsSync } from "node:fs";
|
||||
import { resolve, join } from "node:path";
|
||||
|
||||
const FIXTURE_DIR = process.env.FIXTURE_DIR ?? "/fixtures";
|
||||
const PORT = Number(process.env.PORT ?? 8080);
|
||||
const ROUTES_FILE = process.env.ROUTES_FILE ?? join(FIXTURE_DIR, "routes.json");
|
||||
|
||||
if (!existsSync(ROUTES_FILE)) {
|
||||
console.error(`[mock-upstream] no routes file at ${ROUTES_FILE}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let routes;
|
||||
try {
|
||||
routes = JSON.parse(readFileSync(ROUTES_FILE, "utf8"));
|
||||
} catch (err) {
|
||||
console.error(`[mock-upstream] failed to parse ${ROUTES_FILE}:`, err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`[mock-upstream] loaded ${Object.keys(routes).length} routes from ${ROUTES_FILE}`);
|
||||
|
||||
createServer((req, res) => {
|
||||
const path = req.url?.split("?")[0] ?? "/";
|
||||
if (path === "/__health") {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("content-type", "application/json");
|
||||
res.end(JSON.stringify({ status: "ok" }));
|
||||
return;
|
||||
}
|
||||
const file = routes[path];
|
||||
if (!file) {
|
||||
console.warn(`[mock-upstream] 404 ${req.method} ${path}`);
|
||||
res.statusCode = 404;
|
||||
res.setHeader("content-type", "application/json");
|
||||
res.end(JSON.stringify({ error: "no fixture", path }));
|
||||
return;
|
||||
}
|
||||
|
||||
const filePath = resolve(FIXTURE_DIR, file);
|
||||
if (!filePath.startsWith(resolve(FIXTURE_DIR))) {
|
||||
res.statusCode = 400;
|
||||
res.end("bad fixture path");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const body = readFileSync(filePath);
|
||||
res.statusCode = 200;
|
||||
res.setHeader("content-type", file.endsWith(".json") ? "application/json" : "text/plain");
|
||||
res.end(body);
|
||||
console.log(`[mock-upstream] 200 ${req.method} ${path} -> ${file}`);
|
||||
} catch (err) {
|
||||
console.error(`[mock-upstream] 500 ${req.method} ${path}:`, err);
|
||||
res.statusCode = 500;
|
||||
res.end("fixture read failed");
|
||||
}
|
||||
}).listen(PORT, () => {
|
||||
console.log(`[mock-upstream] listening on :${PORT}`);
|
||||
});
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// CI-only stub seeder. Emits a known-good GeoEntity[] payload under the
|
||||
// plugin id provided via STUB_PLUGIN_ID. Used by plugin-CI to isolate
|
||||
// frontend wiring from real backend health.
|
||||
//
|
||||
// NOTE: This bypasses ADR-0002's compile-time name rule on purpose — the
|
||||
// data engine reads `name` once at load time, so an env-driven name is
|
||||
// fine in CI. Do NOT copy this pattern into real seeders.
|
||||
|
||||
const pluginId = process.env.STUB_PLUGIN_ID;
|
||||
// When unconfigured (e.g. seeder-CI, where this stub is baked into the shared
|
||||
// :ci image but unused), export a nameless module so the seeder-loader skips
|
||||
// it instead of crashing the engine.
|
||||
//
|
||||
// Uses the interval+fetch seeder contract: fetch() RETURNS the array and the
|
||||
// scheduler auto-wraps it into a snapshot stored under the seeder id. The
|
||||
// cron+fn contract would require the engine-internal setLiveSnapshot, which is
|
||||
// NOT exposed on the seeder ctx (ctx is only { redis }).
|
||||
|
||||
function makeEntities() {
|
||||
const now = new Date().toISOString();
|
||||
return [
|
||||
{
|
||||
id: `${pluginId}-stub-1`,
|
||||
pluginId,
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
altitude: 0,
|
||||
timestamp: now,
|
||||
label: "Stub entity 1",
|
||||
properties: { source: "ci-stub" },
|
||||
},
|
||||
{
|
||||
id: `${pluginId}-stub-2`,
|
||||
pluginId,
|
||||
latitude: 10,
|
||||
longitude: 10,
|
||||
altitude: 0,
|
||||
timestamp: now,
|
||||
label: "Stub entity 2",
|
||||
properties: { source: "ci-stub" },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export default pluginId
|
||||
? {
|
||||
name: pluginId,
|
||||
interval: 10000,
|
||||
fetch: async () => {
|
||||
const entities = makeEntities();
|
||||
console.log(`[stub-seeder] emitting ${entities.length} entities for ${pluginId}`);
|
||||
return entities;
|
||||
},
|
||||
}
|
||||
: {};
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "stub-seeder",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"main": "dist/index.mjs",
|
||||
"private": true
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "worldwideview",
|
||||
"version": "2.48.13",
|
||||
"version": "2.48.24",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
@@ -82,7 +82,7 @@
|
||||
"@typescript-eslint/parser": "^8.60.1",
|
||||
"@vitejs/plugin-react": "^6.0.2",
|
||||
"@vitest/coverage-v8": "4.1.8",
|
||||
"concurrently": "^9.2.1",
|
||||
"concurrently": "^10.0.3",
|
||||
"copy-webpack-plugin": "^14.0.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# @worldwideview/wwv-ci-probe
|
||||
|
||||
CI probe — asserts plugin/seeder integration health for the WorldWideView ecosystem.
|
||||
|
||||
Used by the smoke-test workflows in [`wwv-plugins`](https://github.com/silvertakana/wwv-plugins), [`wwv-seeders-community`](https://github.com/silvertakana/wwv-seeders-community), and [`wwv-seeders-private`](https://github.com/silvertakana/wwv-seeders-private).
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
# Via npx (recommended in CI)
|
||||
npx --yes @worldwideview/wwv-ci-probe <subcommand>
|
||||
|
||||
# Or as a dev dependency
|
||||
pnpm add -D @worldwideview/wwv-ci-probe
|
||||
```
|
||||
|
||||
## Subcommands
|
||||
|
||||
### `seeder <name>`
|
||||
|
||||
Polls Redis for `data:<name>:live` and validates the payload shape. Accepts `GeoEntity[]`, `{ items: [...] }`, or `{ <key>: [...] }`. Use this in seeder CI after booting the data engine against a mock upstream.
|
||||
|
||||
```bash
|
||||
wwv-probe seeder aviation --redis redis://localhost:6379 --timeout 60000
|
||||
```
|
||||
|
||||
### `ws <name>`
|
||||
|
||||
Connects to the data engine's `/stream` WebSocket and waits for a `data` message matching the given `pluginId`. Validates the same payload shapes as `seeder`. Use this when you want to assert the engine is broadcasting (not just persisting).
|
||||
|
||||
```bash
|
||||
wwv-probe ws aviation --url ws://localhost:5000/stream --timeout 30000
|
||||
```
|
||||
|
||||
### `id-contract <seederDist>`
|
||||
|
||||
Statically validates that a compiled seeder exports a kebab-case `name` (ADR-0002). Optionally checks the name matches an expected id.
|
||||
|
||||
```bash
|
||||
wwv-probe id-contract ./dist/index.mjs --expect aviation
|
||||
```
|
||||
|
||||
## Plugin smoke testing — not in this probe
|
||||
|
||||
The probe deliberately does **not** include a `plugin` subcommand. Plugin smoke tests need to exercise the full Next.js + Cesium frontend (plugin bundle loading, `mapWebsocketPayload`, DataBus wiring), which requires a real browser via Playwright.
|
||||
|
||||
The `wwv-plugins` repo writes its own Playwright spec for that — it reuses the auth bootstrap pattern from `worldwideview/tests/global.setup.ts` (insert test user + `InstalledPlugin` row, UI login to capture `storageState.json`, then run the plugin-toggle smoke).
|
||||
|
||||
Keeping that logic inside `wwv-plugins` avoids coupling this probe to `@playwright/test` and to the specific UI structure of the Next.js frontend.
|
||||
|
||||
## Exit codes
|
||||
|
||||
- `0` — assertion passed within the timeout
|
||||
- `1` — assertion failed (timeout exceeded, invalid payload shape, or contract violation)
|
||||
- `2` — fatal probe error (unhandled exception)
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@worldwideview/wwv-ci-probe",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"description": "CI probe — asserts plugin/seeder integration health (ADR-0002, WS payload contract, Redis snapshots)",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"wwv-probe": "dist/index.js"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"clean": "rm -rf dist",
|
||||
"prepublishOnly": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^14.0.3",
|
||||
"ioredis": "^5.4.1",
|
||||
"ws": "^8.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.9.1",
|
||||
"@types/ws": "^8.5.13",
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const KEBAB_RE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
||||
|
||||
/**
|
||||
* Validates ADR-0002: a seeder's exported `name` field must be kebab-case
|
||||
* and (optionally) match an expected plugin id.
|
||||
*
|
||||
* @returns true if the contract holds; false (with stderr explanation) otherwise.
|
||||
*/
|
||||
export async function probeIdContract(opts: {
|
||||
seederDist: string;
|
||||
expectId?: string;
|
||||
}): Promise<boolean> {
|
||||
const absPath = resolve(opts.seederDist);
|
||||
let mod: any;
|
||||
try {
|
||||
mod = await import(pathToFileURL(absPath).href);
|
||||
} catch (err) {
|
||||
console.error(`[id-contract] failed to import ${absPath}:`, err);
|
||||
return false;
|
||||
}
|
||||
|
||||
const seeder = mod.default ?? mod;
|
||||
if (!seeder || typeof seeder !== "object") {
|
||||
console.error(`[id-contract] ${absPath} has no default export (or export is not an object)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const name = seeder.name;
|
||||
if (typeof name !== "string" || name.length === 0) {
|
||||
console.error(`[id-contract] seeder default export missing required string field 'name'`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!KEBAB_RE.test(name)) {
|
||||
console.error(`[id-contract] seeder name "${name}" is not valid kebab-case (must match ${KEBAB_RE})`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opts.expectId && opts.expectId !== name) {
|
||||
console.error(
|
||||
`[id-contract] seeder name "${name}" does not match expected plugin id "${opts.expectId}" (ADR-0002 violation)`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(`[id-contract] OK — seeder name "${name}"${opts.expectId ? ` matches expected id` : ""}`);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env node
|
||||
import { Command } from "commander";
|
||||
import { probeSeeder } from "./seeder.js";
|
||||
import { probeWs } from "./ws.js";
|
||||
import { probeIdContract } from "./id-contract.js";
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program
|
||||
.name("wwv-probe")
|
||||
.description("WorldWideView CI probe — asserts plugin/seeder integration health")
|
||||
.version("0.1.0");
|
||||
|
||||
program
|
||||
.command("seeder")
|
||||
.description("Wait for Redis key data:<name>:live to be populated and validate payload shape")
|
||||
.argument("<name>", "Canonical plugin id (kebab-case)")
|
||||
.option("--redis <url>", "Redis URL", "redis://localhost:6379")
|
||||
.option("--timeout <ms>", "Timeout in milliseconds", "60000")
|
||||
.action(async (name: string, opts: { redis: string; timeout: string }) => {
|
||||
const ok = await probeSeeder({
|
||||
name,
|
||||
redisUrl: opts.redis,
|
||||
timeoutMs: Number(opts.timeout),
|
||||
});
|
||||
process.exit(ok ? 0 : 1);
|
||||
});
|
||||
|
||||
program
|
||||
.command("ws")
|
||||
.description("Connect to engine /stream and wait for a data payload for the given pluginId")
|
||||
.argument("<name>", "Canonical plugin id (kebab-case)")
|
||||
.option("--url <url>", "WebSocket URL", "ws://localhost:5000/stream")
|
||||
.option("--timeout <ms>", "Timeout in milliseconds", "30000")
|
||||
.action(async (name: string, opts: { url: string; timeout: string }) => {
|
||||
const ok = await probeWs({
|
||||
name,
|
||||
wsUrl: opts.url,
|
||||
timeoutMs: Number(opts.timeout),
|
||||
});
|
||||
process.exit(ok ? 0 : 1);
|
||||
});
|
||||
|
||||
program
|
||||
.command("id-contract")
|
||||
.description("Verify seeder dist exports a kebab-case name matching the expected plugin id (ADR-0002)")
|
||||
.argument("<seederDist>", "Path to compiled seeder dist/index.mjs")
|
||||
.option("--expect <id>", "Expected plugin id (if omitted, only validates kebab-case)")
|
||||
.action(async (seederDist: string, opts: { expect?: string }) => {
|
||||
const ok = await probeIdContract({
|
||||
seederDist,
|
||||
expectId: opts.expect,
|
||||
});
|
||||
process.exit(ok ? 0 : 1);
|
||||
});
|
||||
|
||||
program.parseAsync().catch((err) => {
|
||||
console.error("[wwv-probe] fatal:", err);
|
||||
process.exit(2);
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { validatePayloadValue, validatePayloadString } from "./payloadShape.js";
|
||||
|
||||
describe("validatePayloadValue", () => {
|
||||
it("accepts a non-empty GeoEntity array", () => {
|
||||
expect(validatePayloadValue([{ id: "a" }])).toEqual({ ok: true, shape: "geo-entity-array" });
|
||||
});
|
||||
it("rejects an empty array", () => {
|
||||
expect(validatePayloadValue([])).toEqual({ ok: false, reason: "GeoEntity[] is empty" });
|
||||
});
|
||||
it("accepts a non-empty items object", () => {
|
||||
expect(validatePayloadValue({ items: [1] })).toEqual({ ok: true, shape: "items-object" });
|
||||
});
|
||||
it("rejects an empty items array", () => {
|
||||
expect(validatePayloadValue({ items: [] })).toEqual({ ok: false, reason: "items[] is empty" });
|
||||
});
|
||||
it("accepts a single named collection", () => {
|
||||
expect(validatePayloadValue({ quakes: [1, 2] })).toEqual({ ok: true, shape: "named-collection" });
|
||||
});
|
||||
it("rejects an object with no array field", () => {
|
||||
const r = validatePayloadValue({ a: 1, b: 2 });
|
||||
expect(r.ok).toBe(false);
|
||||
});
|
||||
it("rejects a non-object, non-array value", () => {
|
||||
const r = validatePayloadValue(42);
|
||||
expect(r.ok).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("validatePayloadString", () => {
|
||||
it("parses then validates", () => {
|
||||
expect(validatePayloadString('[{"id":"x"}]')).toEqual({ ok: true, shape: "geo-entity-array" });
|
||||
});
|
||||
it("rejects invalid JSON", () => {
|
||||
const r = validatePayloadString("{not json");
|
||||
expect(r.ok).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Shared payload-shape validator for the WWV data contract (data-engine-architecture.md §7).
|
||||
* A valid live payload is one of three non-empty shapes:
|
||||
* - geo-entity-array: a top-level non-empty array
|
||||
* - items-object: an object with a non-empty `items` array
|
||||
* - named-collection: an object whose single array-valued key is non-empty
|
||||
*/
|
||||
export type PayloadShape = "geo-entity-array" | "items-object" | "named-collection";
|
||||
|
||||
export type PayloadValidation =
|
||||
| { ok: true; shape: PayloadShape }
|
||||
| { ok: false; reason: string };
|
||||
|
||||
/**
|
||||
* Validate an already-parsed payload value.
|
||||
* @param p - parsed JSON value
|
||||
* @returns ok with the detected shape, or a reason for rejection
|
||||
*/
|
||||
export function validatePayloadValue(p: unknown): PayloadValidation {
|
||||
if (Array.isArray(p)) {
|
||||
return p.length > 0
|
||||
? { ok: true, shape: "geo-entity-array" }
|
||||
: { ok: false, reason: "GeoEntity[] is empty" };
|
||||
}
|
||||
if (p && typeof p === "object") {
|
||||
const obj = p as Record<string, unknown>;
|
||||
if (Array.isArray(obj.items)) {
|
||||
return obj.items.length > 0
|
||||
? { ok: true, shape: "items-object" }
|
||||
: { ok: false, reason: "items[] is empty" };
|
||||
}
|
||||
const arrayKeys = Object.keys(obj).filter((k) => Array.isArray(obj[k]));
|
||||
if (arrayKeys.length === 1) {
|
||||
const arr = obj[arrayKeys[0]] as unknown[];
|
||||
return arr.length > 0
|
||||
? { ok: true, shape: "named-collection" }
|
||||
: { ok: false, reason: `${arrayKeys[0]}[] is empty` };
|
||||
}
|
||||
return {
|
||||
ok: false,
|
||||
reason: `payload object has no recognizable array field (keys: ${Object.keys(obj).join(", ")})`,
|
||||
};
|
||||
}
|
||||
return { ok: false, reason: `payload is neither array nor object (typeof=${typeof p})` };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a raw JSON string, then validate the resulting value's shape.
|
||||
* @param raw - raw JSON string from Redis
|
||||
*/
|
||||
export function validatePayloadString(raw: string): PayloadValidation {
|
||||
let parsed: unknown;
|
||||
try {
|
||||
parsed = JSON.parse(raw);
|
||||
} catch (err) {
|
||||
return { ok: false, reason: `not valid JSON (${(err as Error).message})` };
|
||||
}
|
||||
return validatePayloadValue(parsed);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Redis } from "ioredis";
|
||||
import { validatePayloadString } from "./payloadShape.js";
|
||||
|
||||
/**
|
||||
* Polls Redis for `data:<name>:live` and validates that the seeder produced a
|
||||
* non-empty payload in one of the three accepted shapes (see
|
||||
* data-engine-architecture.md §7).
|
||||
*
|
||||
* @returns true if a valid payload arrived within the timeout; false otherwise.
|
||||
*/
|
||||
export async function probeSeeder(opts: {
|
||||
name: string;
|
||||
redisUrl: string;
|
||||
timeoutMs: number;
|
||||
}): Promise<boolean> {
|
||||
const redis = new Redis(opts.redisUrl, { lazyConnect: true, maxRetriesPerRequest: 1 });
|
||||
const key = `data:${opts.name}:live`;
|
||||
const deadline = Date.now() + opts.timeoutMs;
|
||||
const pollIntervalMs = 1000;
|
||||
|
||||
try {
|
||||
await redis.connect();
|
||||
} catch (err) {
|
||||
console.error(`[seeder] cannot connect to Redis at ${opts.redisUrl}:`, err);
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(`[seeder] waiting for ${key} (timeout ${opts.timeoutMs}ms)`);
|
||||
|
||||
while (Date.now() < deadline) {
|
||||
const raw = await redis.get(key);
|
||||
if (raw && raw.length > 0) {
|
||||
const validation = validatePayloadString(raw);
|
||||
await redis.quit();
|
||||
if (!validation.ok) {
|
||||
console.error(`[seeder] payload present but invalid: ${validation.reason}`);
|
||||
return false;
|
||||
}
|
||||
console.log(`[seeder] OK — ${key} populated (shape: ${validation.shape}, bytes: ${raw.length})`);
|
||||
return true;
|
||||
}
|
||||
await sleep(pollIntervalMs);
|
||||
}
|
||||
|
||||
await redis.quit();
|
||||
console.error(`[seeder] timed out — ${key} never populated within ${opts.timeoutMs}ms`);
|
||||
return false;
|
||||
}
|
||||
|
||||
function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { describe, it, expect, afterEach } from "vitest";
|
||||
import { WebSocketServer } from "ws";
|
||||
import { probeWs } from "./ws.js";
|
||||
|
||||
let server: WebSocketServer | undefined;
|
||||
afterEach(() => { server?.close(); server = undefined; });
|
||||
|
||||
function startEngine(opts: { pluginId: string; requireSubscribe: boolean }) {
|
||||
server = new WebSocketServer({ port: 0 });
|
||||
server.on("connection", (sock) => {
|
||||
sock.send(JSON.stringify({ type: "welcome", engine: "test", plugins: [opts.pluginId] }));
|
||||
const send = () =>
|
||||
sock.send(JSON.stringify({ type: "data", pluginId: opts.pluginId, payload: [{ id: "x" }] }));
|
||||
if (!opts.requireSubscribe) { setInterval(send, 20); return; }
|
||||
sock.on("message", (raw) => {
|
||||
const msg = JSON.parse(raw.toString());
|
||||
if (msg.action === "subscribe" && msg.pluginId === opts.pluginId) send();
|
||||
});
|
||||
});
|
||||
const addr = server.address();
|
||||
const port = typeof addr === "object" && addr ? addr.port : 0;
|
||||
return `ws://127.0.0.1:${port}/stream`;
|
||||
}
|
||||
|
||||
describe("probeWs", () => {
|
||||
it("receives data from a subscribe-required engine (sends subscribe frame)", async () => {
|
||||
const url = startEngine({ pluginId: "stub", requireSubscribe: true });
|
||||
const ok = await probeWs({ name: "stub", wsUrl: url, timeoutMs: 3000 });
|
||||
expect(ok).toBe(true);
|
||||
});
|
||||
it("times out (false) when the plugin never produces data", async () => {
|
||||
const url = startEngine({ pluginId: "other", requireSubscribe: true });
|
||||
const ok = await probeWs({ name: "stub", wsUrl: url, timeoutMs: 800 });
|
||||
expect(ok).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import WebSocket from "ws";
|
||||
import { validatePayloadValue } from "./payloadShape.js";
|
||||
|
||||
/**
|
||||
* Connects to the data-engine's /stream WebSocket and resolves when a
|
||||
* `{ type: "data", pluginId: <name>, payload: ... }` message arrives for the
|
||||
* given plugin id (see data-engine-architecture.md §7).
|
||||
*
|
||||
* Rejects with exit code 1 if no matching payload arrives within the timeout
|
||||
* — which is the signature of an ADR-0002 id mismatch or a silently-dropped
|
||||
* object payload.
|
||||
*/
|
||||
export async function probeWs(opts: {
|
||||
name: string;
|
||||
wsUrl: string;
|
||||
timeoutMs: number;
|
||||
}): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const ws = new WebSocket(opts.wsUrl);
|
||||
let settled = false;
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
console.error(
|
||||
`[ws] timed out — no data message with pluginId="${opts.name}" in ${opts.timeoutMs}ms ` +
|
||||
`(check ADR-0002 seeder.name vs plugin id, and that the seeder is producing data)`,
|
||||
);
|
||||
ws.terminate();
|
||||
resolve(false);
|
||||
}, opts.timeoutMs);
|
||||
|
||||
ws.on("open", () => {
|
||||
// The engine is subscribe-required: it only broadcasts a plugin's data to
|
||||
// connections that have subscribed to it (websocket.ts broadcastPluginData).
|
||||
// Auth is bypassed in CI via WWV_SKIP_WS_AUTH=true, so no auth frame is sent.
|
||||
ws.send(JSON.stringify({ action: "subscribe", pluginId: opts.name }));
|
||||
console.log(`[ws] connected to ${opts.wsUrl}, subscribed to pluginId="${opts.name}"`);
|
||||
});
|
||||
|
||||
ws.on("message", (raw) => {
|
||||
let msg: any;
|
||||
try {
|
||||
msg = JSON.parse(raw.toString());
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
if (msg?.type !== "data" || msg.pluginId !== opts.name) return;
|
||||
if (settled) return;
|
||||
|
||||
const payload = msg.payload;
|
||||
const valid = validatePayloadValue(payload);
|
||||
if (!valid.ok) {
|
||||
console.error(`[ws] received message for "${opts.name}" but payload invalid: ${valid.reason}`);
|
||||
// Keep waiting — a later message might be valid.
|
||||
return;
|
||||
}
|
||||
|
||||
settled = true;
|
||||
clearTimeout(timer);
|
||||
console.log(`[ws] OK — received valid payload for "${opts.name}" (shape: ${valid.shape})`);
|
||||
ws.close();
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
ws.on("error", (err) => {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
clearTimeout(timer);
|
||||
console.error(`[ws] connection error:`, err);
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": false
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
"test": "node --test \"test/**/*.test.mjs\""
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^14.0.3",
|
||||
"commander": "^15.0.0",
|
||||
"prompts": "^2.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Generated
+452
-69
@@ -180,8 +180,8 @@ importers:
|
||||
specifier: 4.1.8
|
||||
version: 4.1.8([email protected])
|
||||
concurrently:
|
||||
specifier: ^9.2.1
|
||||
version: 9.2.1
|
||||
specifier: ^10.0.3
|
||||
version: 10.0.3
|
||||
copy-webpack-plugin:
|
||||
specifier: ^14.0.0
|
||||
version: 14.0.0([email protected]([email protected]))
|
||||
@@ -234,11 +234,281 @@ importers:
|
||||
specifier: ^4.1.7
|
||||
version: 4.1.8(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
|
||||
packages/wwv-cli:
|
||||
local-plugins/wwv-plugin-air-defense:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^22.0.0
|
||||
version: 22.19.19
|
||||
'@types/react':
|
||||
specifier: ^19.0.0
|
||||
version: 19.2.16
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
version: 5.9.3
|
||||
|
||||
local-plugins/wwv-plugin-airports:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
|
||||
local-plugins/wwv-plugin-aviation:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-lib-aviation':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-lib-aviation
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: '>=0.576.0'
|
||||
version: 1.17.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-borders:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
|
||||
local-plugins/wwv-plugin-camera:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: '>=0.576.0'
|
||||
version: 1.17.0([email protected])
|
||||
react:
|
||||
specifier: '>=18'
|
||||
version: 19.2.7
|
||||
|
||||
local-plugins/wwv-plugin-civil-unrest:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
cesium:
|
||||
specifier: ^1.139.0
|
||||
version: 1.142.0
|
||||
lucide-react:
|
||||
specifier: ^0.477.0
|
||||
version: 0.477.0([email protected])
|
||||
react:
|
||||
specifier: ^19.0.0
|
||||
version: 19.2.7
|
||||
resium:
|
||||
specifier: 1.19.4
|
||||
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
|
||||
devDependencies:
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
vite:
|
||||
specifier: ^8.0.8
|
||||
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-conflict-events:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-lib-incidents':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-lib-incidents
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
cesium:
|
||||
specifier: ^1.139.0
|
||||
version: 1.142.0
|
||||
lucide-react:
|
||||
specifier: ^0.477.0
|
||||
version: 0.477.0([email protected])
|
||||
react:
|
||||
specifier: ^19.0.0
|
||||
version: 19.2.7
|
||||
resium:
|
||||
specifier: 1.19.4
|
||||
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
|
||||
devDependencies:
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
vite:
|
||||
specifier: ^8.0.8
|
||||
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-cyber-attacks:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: ^1.14.0
|
||||
version: 1.17.0([email protected])
|
||||
devDependencies:
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
vite:
|
||||
specifier: ^8.0.8
|
||||
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-earthquakes:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-lib-incidents':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-lib-incidents
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: ^1.4.10
|
||||
version: 1.5.0([email protected])
|
||||
lucide-react:
|
||||
specifier: ^1.14.0
|
||||
version: 1.17.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-fortiguard:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
devDependencies:
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
version: 5.9.3
|
||||
|
||||
local-plugins/wwv-plugin-gps-jamming:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
cesium:
|
||||
specifier: ^1.139.0
|
||||
version: 1.142.0
|
||||
h3-js:
|
||||
specifier: ^4.4.0
|
||||
version: 4.4.0
|
||||
lucide-react:
|
||||
specifier: ^0.477.0
|
||||
version: 0.477.0([email protected])
|
||||
react:
|
||||
specifier: ^19.0.0
|
||||
version: 19.2.7
|
||||
resium:
|
||||
specifier: 1.19.4
|
||||
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
|
||||
devDependencies:
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
vite:
|
||||
specifier: ^8.0.8
|
||||
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-international-sanctions:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: ^1.14.0
|
||||
version: 1.17.0([email protected])
|
||||
devDependencies:
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
vite:
|
||||
specifier: ^8.0.8
|
||||
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-iranwarlive:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-lib-incidents':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-lib-incidents
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: ^1.4.10
|
||||
version: 1.5.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-maritime:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: '>=0.576.0'
|
||||
version: 1.17.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-military-aviation:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-lib-aviation':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-lib-aviation
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: ^1.4.10
|
||||
version: 1.5.0([email protected])
|
||||
lucide-react:
|
||||
specifier: '>=0.576.0'
|
||||
version: 1.17.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-nz-traffic-cameras:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^20.0.0
|
||||
version: 20.19.41
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^4.1.8
|
||||
version: 4.1.8(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
|
||||
local-plugins/wwv-plugin-satellite:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: ^1.4.10
|
||||
version: 1.5.0([email protected])
|
||||
|
||||
local-plugins/wwv-plugin-wildfire:
|
||||
dependencies:
|
||||
'@worldwideview/wwv-plugin-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/wwv-plugin-sdk
|
||||
lucide-react:
|
||||
specifier: '>=0.576.0'
|
||||
version: 1.17.0([email protected])
|
||||
|
||||
packages/wwv-ci-probe:
|
||||
dependencies:
|
||||
commander:
|
||||
specifier: ^14.0.3
|
||||
version: 14.0.3
|
||||
ioredis:
|
||||
specifier: ^5.4.1
|
||||
version: 5.11.0
|
||||
ws:
|
||||
specifier: ^8.18.0
|
||||
version: 8.21.0
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^25.9.1
|
||||
version: 25.9.1
|
||||
'@types/ws':
|
||||
specifier: ^8.5.13
|
||||
version: 8.18.1
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
version: 5.9.3
|
||||
|
||||
packages/wwv-cli:
|
||||
dependencies:
|
||||
commander:
|
||||
specifier: ^15.0.0
|
||||
version: 15.0.0
|
||||
prompts:
|
||||
specifier: ^2.4.2
|
||||
version: 2.4.2
|
||||
@@ -2056,6 +2326,12 @@ packages:
|
||||
'@types/[email protected]':
|
||||
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution: {integrity: sha512-ECymXOukMnOoVkC2bb1Vc/w/836DXncOg5m8Xj1RH7xSHZJWNYY6Zh7EH477vcnD5egKNNfy2RpNOmuChhFPgQ==}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution: {integrity: sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution: {integrity: sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==}
|
||||
|
||||
@@ -2433,6 +2709,10 @@ packages:
|
||||
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -2441,6 +2721,10 @@ packages:
|
||||
resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
||||
|
||||
@@ -2710,9 +2994,9 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}
|
||||
|
||||
cliui@8.0.1:
|
||||
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
|
||||
engines: {node: '>=12'}
|
||||
cliui@9.0.1:
|
||||
resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-zj9gjJa6xW8MNrfc4oKuwgGS0njRLpOlQjdifbuNxvy8k4Y3pKCyKCMG2XIsjd2iQGhgjS57b1P5VWdJlxcXBw==}
|
||||
@@ -2739,6 +3023,10 @@ packages:
|
||||
resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==}
|
||||
engines: {node: '>=22.12.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
||||
|
||||
@@ -2748,9 +3036,9 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
|
||||
concurrently@9.2.1:
|
||||
resolution: {integrity: sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==}
|
||||
engines: {node: '>=18'}
|
||||
concurrently@10.0.3:
|
||||
resolution: {integrity: sha512-hc3LH4UaKWd/bbyDK/IGVa4RB6PtQ3CUYwtrkzqHn+wIG3Hr5fhpRlk0L/gCa8ZE1L/Ufj50Zho69cI5w8SQBA==}
|
||||
engines: {node: '>=22'}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
@@ -2987,9 +3275,6 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
|
||||
|
||||
@@ -3420,6 +3705,10 @@ packages:
|
||||
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
|
||||
engines: {node: 6.* || 8.* || >= 10.*}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -3495,6 +3784,10 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-5ykVn/EXM1hF0XCaWh05VbYvEiOL2lY1kBxZtaYsyvjp7cmWOU1XsAdfQBwClraEofXDT197lFbXOEVMHpvQOg==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-DvJh07MhGgY2KcC4OeZc8SSyA+ZXpdvoh6uCzGpoKvWtZxJB+g6VXXC1+eWYkaMIsLz7J/ErhOalHCpcs1KYog==}
|
||||
engines: {node: '>=4', npm: '>=3', yarn: '>=1.3.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -3705,10 +3998,6 @@ packages:
|
||||
resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -4052,6 +4341,11 @@ packages:
|
||||
resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==}
|
||||
engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-yCf7aYxerFZAbd8jHJxjwe1j7jEMPptjnaOqdYeirFnEy85cNR3/L+o0I875CYFYya+eEVzZSbNuRk8BZPDpVw==}
|
||||
peerDependencies:
|
||||
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-9FA9evdox/JQL5PT57fdA1x/yg8T7knJ98+zjTL3UfKza6pflQUUh3XtaQIHKvnsJw1lmsEyHVlt5jchYxOQ5w==}
|
||||
peerDependencies:
|
||||
@@ -4695,10 +4989,6 @@ packages:
|
||||
engines: {node: '>= 6'}
|
||||
deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -4707,6 +4997,14 @@ packages:
|
||||
resolution: {integrity: sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==}
|
||||
engines: {node: '>=9.3.0 || >=8.10.0 <9.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-RW0ffHlQUbgqbc0jDaF2Dnor/GKbiz5s5AKdamEKxMJfxiwQNgtgfaKK7UvafFpX25Y2J4DZP1MclTlEQ/5YUw==}
|
||||
engines: {node: '>=20.19.0'}
|
||||
peerDependencies:
|
||||
cesium: 1.x
|
||||
react: '>=18.2.0'
|
||||
react-dom: '>=18.2.0'
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-pR+ySBudmCstgYOBFY+qcPQt0+xPmsdhSkD3u7JBfaiHcx/pxyuigjYoL0ET7Ak2a2uZ7jEu47cdZKThZx8A5w==}
|
||||
engines: {node: '>=20.19.0'}
|
||||
@@ -4861,8 +5159,8 @@ packages:
|
||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
[email protected].3:
|
||||
resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}
|
||||
[email protected].4:
|
||||
resolution: {integrity: sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
[email protected]:
|
||||
@@ -4958,9 +5256,9 @@ packages:
|
||||
resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
string-width@4.2.3:
|
||||
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
|
||||
engines: {node: '>=8'}
|
||||
string-width@7.2.0:
|
||||
resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==}
|
||||
@@ -4988,9 +5286,9 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
|
||||
|
||||
strip-ansi@6.0.1:
|
||||
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
|
||||
engines: {node: '>=8'}
|
||||
strip-ansi@7.2.0:
|
||||
resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
|
||||
@@ -5033,6 +5331,10 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-9pP/CVNp4NF2MNlRzLwQkjiTgKKe9WYXrLh9+8QokWmMxz+zt2mf1utkWLco26IuA3AfVcTb//qtlTIjY3VHxA==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -5256,6 +5558,9 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
|
||||
|
||||
@@ -5495,9 +5800,9 @@ packages:
|
||||
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
|
||||
engines: {node: '>=10'}
|
||||
wrap-ansi@9.0.2:
|
||||
resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||
@@ -5532,13 +5837,13 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
|
||||
|
||||
yargs-parser@21.1.1:
|
||||
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
|
||||
engines: {node: '>=12'}
|
||||
yargs-parser@22.0.0:
|
||||
resolution: {integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==}
|
||||
engines: {node: ^20.19.0 || ^22.12.0 || >=23}
|
||||
|
||||
yargs@17.7.2:
|
||||
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
|
||||
engines: {node: '>=12'}
|
||||
yargs@18.0.0:
|
||||
resolution: {integrity: sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==}
|
||||
engines: {node: ^20.19.0 || ^22.12.0 || >=23}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||
@@ -7315,6 +7620,14 @@ snapshots:
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
undici-types: 7.24.6
|
||||
@@ -7539,6 +7852,14 @@ snapshots:
|
||||
chai: 6.2.2
|
||||
tinyrainbow: 3.1.0
|
||||
|
||||
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':
|
||||
dependencies:
|
||||
'@vitest/spy': 4.1.8
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.21
|
||||
optionalDependencies:
|
||||
vite: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':
|
||||
dependencies:
|
||||
'@vitest/spy': 4.1.8
|
||||
@@ -7722,12 +8043,16 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -8056,11 +8381,11 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
cliui@8.0.1:
|
||||
cliui@9.0.1:
|
||||
dependencies:
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 7.0.0
|
||||
string-width: 7.2.0
|
||||
strip-ansi: 7.2.0
|
||||
wrap-ansi: 9.0.2
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -8080,20 +8405,22 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
concurrently@9.2.1:
|
||||
concurrently@10.0.3:
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
chalk: 5.6.2
|
||||
rxjs: 7.8.2
|
||||
shell-quote: 1.8.3
|
||||
supports-color: 8.1.1
|
||||
shell-quote: 1.8.4
|
||||
supports-color: 10.2.2
|
||||
tree-kill: 1.2.2
|
||||
yargs: 17.7.2
|
||||
yargs: 18.0.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -8340,8 +8667,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
@@ -8966,6 +9291,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
call-bind-apply-helpers: 1.0.2
|
||||
@@ -9045,6 +9372,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -9274,8 +9603,6 @@ snapshots:
|
||||
dependencies:
|
||||
call-bound: 1.0.4
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
call-bound: 1.0.4
|
||||
@@ -9585,6 +9912,10 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
react: 19.2.7
|
||||
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
react: 19.2.7
|
||||
@@ -10247,8 +10578,6 @@ snapshots:
|
||||
tunnel-agent: 0.6.0
|
||||
uuid: 3.4.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -10258,6 +10587,12 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
[email protected]([email protected])([email protected]([email protected]))([email protected]):
|
||||
dependencies:
|
||||
cesium: 1.142.0
|
||||
react: 19.2.7
|
||||
react-dom: 19.2.7([email protected])
|
||||
|
||||
[email protected]([email protected])([email protected]([email protected]))([email protected]):
|
||||
dependencies:
|
||||
cesium: 1.142.0
|
||||
@@ -10507,7 +10842,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected].3: {}
|
||||
[email protected].4: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -10605,11 +10940,11 @@ snapshots:
|
||||
es-errors: 1.3.0
|
||||
internal-slot: 1.1.0
|
||||
|
||||
string-width@4.2.3:
|
||||
string-width@7.2.0:
|
||||
dependencies:
|
||||
emoji-regex: 8.0.0
|
||||
is-fullwidth-code-point: 3.0.0
|
||||
strip-ansi: 6.0.1
|
||||
emoji-regex: 10.6.0
|
||||
get-east-asian-width: 1.6.0
|
||||
strip-ansi: 7.2.0
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -10666,9 +11001,9 @@ snapshots:
|
||||
safe-buffer: 5.2.1
|
||||
optional: true
|
||||
|
||||
strip-ansi@6.0.1:
|
||||
strip-ansi@7.2.0:
|
||||
dependencies:
|
||||
ansi-regex: 5.0.1
|
||||
ansi-regex: 6.2.2
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -10692,6 +11027,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
@@ -10899,6 +11236,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
@@ -10981,6 +11320,21 @@ snapshots:
|
||||
'@vimeo/player': 2.29.0
|
||||
media-played-ranges-mixin: 0.1.0
|
||||
|
||||
[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):
|
||||
dependencies:
|
||||
lightningcss: 1.32.0
|
||||
picomatch: 4.0.4
|
||||
postcss: 8.5.15
|
||||
rolldown: 1.0.3
|
||||
tinyglobby: 0.2.17
|
||||
optionalDependencies:
|
||||
'@types/node': 20.19.41
|
||||
esbuild: 0.28.0
|
||||
fsevents: 2.3.3
|
||||
jiti: 2.7.0
|
||||
terser: 5.48.0
|
||||
tsx: 4.22.4
|
||||
|
||||
[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):
|
||||
dependencies:
|
||||
lightningcss: 1.32.0
|
||||
@@ -10996,6 +11350,36 @@ snapshots:
|
||||
terser: 5.48.0
|
||||
tsx: 4.22.4
|
||||
|
||||
[email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):
|
||||
dependencies:
|
||||
'@vitest/expect': 4.1.8
|
||||
'@vitest/mocker': 4.1.8([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
'@vitest/pretty-format': 4.1.8
|
||||
'@vitest/runner': 4.1.8
|
||||
'@vitest/snapshot': 4.1.8
|
||||
'@vitest/spy': 4.1.8
|
||||
'@vitest/utils': 4.1.8
|
||||
es-module-lexer: 2.1.0
|
||||
expect-type: 1.3.0
|
||||
magic-string: 0.30.21
|
||||
obug: 2.1.1
|
||||
pathe: 2.0.3
|
||||
picomatch: 4.0.4
|
||||
std-env: 4.1.0
|
||||
tinybench: 2.9.0
|
||||
tinyexec: 1.2.4
|
||||
tinyglobby: 0.2.17
|
||||
tinyrainbow: 3.1.0
|
||||
vite: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@types/node': 20.19.41
|
||||
'@vitest/coverage-v8': 4.1.8([email protected])
|
||||
jsdom: 28.1.0
|
||||
transitivePeerDependencies:
|
||||
- msw
|
||||
|
||||
[email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):
|
||||
dependencies:
|
||||
'@vitest/expect': 4.1.8
|
||||
@@ -11163,11 +11547,11 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
wrap-ansi@9.0.2:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
ansi-styles: 6.2.3
|
||||
string-width: 7.2.0
|
||||
strip-ansi: 7.2.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -11183,17 +11567,16 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
yargs-parser@21.1.1: {}
|
||||
yargs-parser@22.0.0: {}
|
||||
|
||||
yargs@17.7.2:
|
||||
yargs@18.0.0:
|
||||
dependencies:
|
||||
cliui: 8.0.1
|
||||
cliui: 9.0.1
|
||||
escalade: 3.2.0
|
||||
get-caller-file: 2.0.5
|
||||
require-directory: 2.1.1
|
||||
string-width: 4.2.3
|
||||
string-width: 7.2.0
|
||||
y18n: 5.0.8
|
||||
yargs-parser: 21.1.1
|
||||
yargs-parser: 22.0.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ model User {
|
||||
name String
|
||||
hashedPassword String
|
||||
role String @default("user")
|
||||
// Bumping this invalidates all of the user's existing JWT sessions.
|
||||
// The JWT embeds the value at sign-in; the auth jwt callback rejects any
|
||||
// token whose value no longer matches the DB (logout-everywhere / revoke).
|
||||
sessionVersion Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
favorites Favorite[]
|
||||
memberships WorkspaceMember[]
|
||||
|
||||
+40
-7
@@ -148,6 +148,9 @@ const ANTI_PATTERNS = [
|
||||
tier: 'A',
|
||||
globs: ['*.ts', '*.tsx'],
|
||||
pattern: '@ts-ignore',
|
||||
// Only flag the actual suppression directive form (// @ts-ignore or /* @ts-ignore),
|
||||
// not the token appearing in JSDoc prose (e.g. "No @ts-ignore used here").
|
||||
directiveOnly: true,
|
||||
desc: '@ts-ignore suppresses real type errors — remove and fix the underlying type',
|
||||
},
|
||||
{
|
||||
@@ -155,6 +158,7 @@ const ANTI_PATTERNS = [
|
||||
tier: 'A',
|
||||
globs: ['*.ts', '*.tsx'],
|
||||
pattern: '@ts-nocheck',
|
||||
directiveOnly: true,
|
||||
desc: '@ts-nocheck disables all type checking for the file — remove and fix types',
|
||||
},
|
||||
{
|
||||
@@ -175,7 +179,7 @@ const ANTI_PATTERNS = [
|
||||
];
|
||||
|
||||
function detectAntiPatterns() {
|
||||
for (const { id, tier, globs, pattern, desc, excludePrefix } of ANTI_PATTERNS) {
|
||||
for (const { id, tier, globs, pattern, desc, excludePrefix, directiveOnly } of ANTI_PATTERNS) {
|
||||
const globArgs = globs.map(g => `"${g}"`).join(' ');
|
||||
const raw = run(`git grep -En "${pattern}" -- ${globArgs}`);
|
||||
if (!raw) continue;
|
||||
@@ -189,13 +193,19 @@ function detectAntiPatterns() {
|
||||
const m = line.match(/^([^:]+):(\d+):(.*)/);
|
||||
if (!m) continue;
|
||||
if (m[1].startsWith('node_modules/') || m[1].includes('public/cesium')) continue;
|
||||
const content = m[3].trim();
|
||||
// For directive-only patterns (e.g. @ts-ignore), skip lines where the token
|
||||
// appears in prose rather than as a comment suppression directive.
|
||||
// A real directive has @ts-ignore/@ts-nocheck immediately after the // or /*
|
||||
// comment opener — not buried mid-sentence in a comment that mentions it.
|
||||
if (directiveOnly && !/^\s*\/[/*]\s*@ts-(ignore|nocheck)/.test(m[3])) continue;
|
||||
add({
|
||||
type: 'anti-pattern',
|
||||
patternId: id,
|
||||
tier,
|
||||
file: m[1],
|
||||
line: parseInt(m[2], 10),
|
||||
content: m[3].trim().slice(0, 200),
|
||||
content: content.slice(0, 200),
|
||||
description: desc,
|
||||
});
|
||||
}
|
||||
@@ -306,13 +316,36 @@ function detectOutdatedDeps() {
|
||||
if (!existsSync(join(ROOT, 'package.json'))) return;
|
||||
const raw = run('pnpm outdated --no-color 2>/dev/null || true');
|
||||
if (!raw) return;
|
||||
const dataLines = raw
|
||||
// pnpm outdated renders a Unicode box-drawing table. Data rows start with │ and
|
||||
// contain pipe-separated columns; separator/border rows contain ─ or ┼ characters.
|
||||
// We extract data rows by splitting on │ and discarding header/separator lines.
|
||||
const SEPARATOR_CHARS = /[┌┐└┘├┤─]/;
|
||||
const tableDataRows = raw
|
||||
.split('\n')
|
||||
.filter(l => l.trim() && !l.startsWith('Package') && !l.startsWith('Legend') && !l.startsWith(' '));
|
||||
.filter(l => l.startsWith('│') && !SEPARATOR_CHARS.test(l));
|
||||
// Fall back to plain whitespace-separated output (older pnpm / --no-color plain format)
|
||||
const plainDataLines = !tableDataRows.length
|
||||
? raw.split('\n').filter(l => l.trim() && !l.startsWith('Package') && !l.startsWith('Legend') && !l.startsWith(' '))
|
||||
: [];
|
||||
|
||||
const dataLines = tableDataRows.length ? tableDataRows : plainDataLines;
|
||||
|
||||
for (const line of dataLines.slice(0, 12)) {
|
||||
const cols = line.trim().split(/\s+/);
|
||||
if (cols.length < 3) continue;
|
||||
const [pkg, current, latest] = cols;
|
||||
let pkg, current, latest;
|
||||
if (tableDataRows.length) {
|
||||
// Parse │ col1 │ col2 │ col3 │ format
|
||||
const cols = line.split('│').map(c => c.trim()).filter(Boolean);
|
||||
if (cols.length < 3) continue;
|
||||
// Header row: first column is literally "Package"
|
||||
if (cols[0] === 'Package') continue;
|
||||
[pkg, current, latest] = cols;
|
||||
// current may be "1.2.3 (wanted 1.2.4)" — extract just the installed version
|
||||
current = current.split(' ')[0];
|
||||
} else {
|
||||
const cols = line.trim().split(/\s+/);
|
||||
if (cols.length < 3) continue;
|
||||
[pkg, current, latest] = cols;
|
||||
}
|
||||
if (!pkg || !current || !latest || current === latest) continue;
|
||||
const isMajor = current.replace(/^[^0-9]*/, '').split('.')[0] !== latest.replace(/^[^0-9]*/, '').split('.')[0];
|
||||
add({
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth, signOut } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { isCloud } from "@/core/edition";
|
||||
|
||||
/**
|
||||
* POST /api/auth/revoke: "sign out everywhere".
|
||||
*
|
||||
* Increments the authenticated user's `sessionVersion`, which invalidates every
|
||||
* existing JWT issued for that user: the auth `jwt` callback compares each
|
||||
* token's embedded version against the DB on its next use and rejects stale
|
||||
* ones. Also clears the caller's own session cookie.
|
||||
*
|
||||
* Requires an authenticated session. Same-origin only in practice: the session
|
||||
* cookie is `sameSite=lax`, so a cross-site POST carries no credentials.
|
||||
*/
|
||||
export async function POST() {
|
||||
const session = await auth();
|
||||
const userId = session?.user?.id;
|
||||
if (!userId) {
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
// Cloud identities are managed by Supabase; there is no local users row to bump.
|
||||
if (!isCloud) {
|
||||
await prisma.user.update({
|
||||
where: { id: userId },
|
||||
data: { sessionVersion: { increment: 1 } },
|
||||
});
|
||||
}
|
||||
|
||||
await signOut({ redirect: false });
|
||||
return NextResponse.json({ ok: true });
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
import type { PluginDataSnapshot } from "@/lib/data-query/types";
|
||||
import type { RegionOptions } from "@/lib/data-query/types";
|
||||
import type { FilterDefinition } from "@/core/plugins/PluginTypes";
|
||||
import { getAllPluginSnapshots } from "@/lib/data-query/service";
|
||||
import { getAllPluginSnapshots, getEngineUrl } from "@/lib/data-query/service";
|
||||
import { getLocalSourceIds } from "@/lib/data-query/localSources";
|
||||
import { readActiveSessions, readGlobeState } from "@/lib/globeStateStore";
|
||||
import { readSessionCatalog } from "@/lib/mcpSessionCatalog";
|
||||
@@ -112,7 +112,7 @@ export interface ListStreamingPluginsResult {
|
||||
* are not blocked waiting for a slow engine.
|
||||
*/
|
||||
async function probeEngineReachable(): Promise<boolean> {
|
||||
const engineUrl = (process.env.WWV_DATA_ENGINE_URL ?? "http://localhost:5001") + "/manifest";
|
||||
const engineUrl = getEngineUrl() + "/manifest";
|
||||
try {
|
||||
const res = await fetch(engineUrl, { signal: AbortSignal.timeout(2000) });
|
||||
return res.ok;
|
||||
|
||||
@@ -24,6 +24,7 @@ export function BottomPanelManager() {
|
||||
);
|
||||
|
||||
const isCoveredRef = useRef(false);
|
||||
const isDraggingRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeBottomPanel) {
|
||||
@@ -39,17 +40,18 @@ export function BottomPanelManager() {
|
||||
}, [activeBottomPanel]);
|
||||
|
||||
// Pointer-capture drag handlers — attached directly to the resize handle element.
|
||||
// Using setPointerCapture ensures pointermove/pointerup are delivered to the
|
||||
// element even when the pointer leaves it, which is required for webkit
|
||||
// (without capture, webkit drops synthetic pointermove events from Playwright
|
||||
// and from fast real-user drags that leave the element bounds).
|
||||
// setPointerCapture ensures pointermove/pointerup are delivered to the element even
|
||||
// when the pointer leaves its bounds (required for fast real-user drags and Playwright).
|
||||
// isDraggingRef guards the move handler instead of hasPointerCapture, which has
|
||||
// inconsistent behaviour across webkit versions in CI for repeated drag sequences.
|
||||
const handleResizePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
isDraggingRef.current = true;
|
||||
document.body.classList.add("is-dragging-bottom-panel");
|
||||
};
|
||||
|
||||
const handleResizePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
|
||||
if (!isDraggingRef.current) return;
|
||||
const newHeight = window.innerHeight - e.clientY;
|
||||
const clampedHeight = Math.max(120, Math.min(newHeight, window.innerHeight - 100));
|
||||
setBottomPanelHeight(clampedHeight);
|
||||
@@ -57,6 +59,7 @@ export function BottomPanelManager() {
|
||||
|
||||
const handleResizePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
e.currentTarget.releasePointerCapture(e.pointerId);
|
||||
isDraggingRef.current = false;
|
||||
document.body.classList.remove("is-dragging-bottom-panel");
|
||||
};
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ describe("resolveEngineUrl", () => {
|
||||
await fetchLocalEngineManifest();
|
||||
|
||||
const url = resolveEngineUrl("plugin-local");
|
||||
expect(url).toContain("localhost:5000/stream");
|
||||
expect(url).toMatch(/ws:\/\/localhost:\d+\/stream/);
|
||||
});
|
||||
|
||||
it("should fall back to plugin's custom streamUrl if not local", () => {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// src/core/data/__tests__/engineManifest.test.ts
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { fetchLocalEngineManifest, resetManifestCache } from '../engineManifest';
|
||||
|
||||
const mockFetch = vi.fn();
|
||||
|
||||
describe('fetchLocalEngineManifest', () => {
|
||||
beforeEach(() => {
|
||||
resetManifestCache();
|
||||
mockFetch.mockReset();
|
||||
vi.stubGlobal('fetch', mockFetch);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
delete process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL;
|
||||
});
|
||||
|
||||
it('probes port 5000 when NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL is not set', async () => {
|
||||
mockFetch.mockResolvedValue({ ok: false } as Response);
|
||||
await fetchLocalEngineManifest();
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
expect.stringContaining(':5000/manifest'),
|
||||
expect.any(Object)
|
||||
);
|
||||
});
|
||||
|
||||
it('probes the env-configured URL when NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL is set', async () => {
|
||||
process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL = 'http://localhost:5003';
|
||||
mockFetch.mockResolvedValue({ ok: false } as Response);
|
||||
await fetchLocalEngineManifest();
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
expect.stringContaining(':5003/manifest'),
|
||||
expect.any(Object)
|
||||
);
|
||||
});
|
||||
|
||||
it('returns plugin list when engine responds successfully', async () => {
|
||||
mockFetch.mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({ plugins: ['flight-tracker', 'ais-tracker'] }),
|
||||
} as Response);
|
||||
const result = await fetchLocalEngineManifest();
|
||||
expect(result).toEqual(['flight-tracker', 'ais-tracker']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
// src/core/data/__tests__/resolveEngineUrl.test.ts
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
|
||||
vi.mock('../engineManifest', () => ({
|
||||
localEngineHasPlugin: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/core/plugins/PluginManager', () => ({
|
||||
pluginManager: {
|
||||
getPlugin: vi.fn().mockReturnValue(null),
|
||||
getManifest: vi.fn().mockReturnValue(null),
|
||||
},
|
||||
}));
|
||||
|
||||
import { resolveEngineUrl } from '../resolveEngineUrl';
|
||||
import { localEngineHasPlugin } from '../engineManifest';
|
||||
|
||||
describe('resolveEngineUrl', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(localEngineHasPlugin).mockReset();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL;
|
||||
});
|
||||
|
||||
it('uses port 5000 by default when no env var is set', () => {
|
||||
vi.mocked(localEngineHasPlugin).mockReturnValue(true);
|
||||
expect(resolveEngineUrl('test-plugin')).toContain(':5000/stream');
|
||||
});
|
||||
|
||||
it('uses the configured URL when NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL is set', () => {
|
||||
process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL = 'http://localhost:5003';
|
||||
vi.mocked(localEngineHasPlugin).mockReturnValue(true);
|
||||
expect(resolveEngineUrl('test-plugin')).toContain(':5003/stream');
|
||||
});
|
||||
|
||||
it('falls back to cloud URL when local engine does not have the plugin', () => {
|
||||
vi.mocked(localEngineHasPlugin).mockReturnValue(false);
|
||||
expect(resolveEngineUrl('test-plugin')).toContain('worldwideview.dev');
|
||||
});
|
||||
});
|
||||
@@ -8,16 +8,13 @@ let manifestFetched = false;
|
||||
/**
|
||||
* Resolve the base URL of the local data engine.
|
||||
*
|
||||
* Always checks localhost:5000 — the port docker-compose.yml binds for
|
||||
* wwv-data-engine. NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL is intentionally
|
||||
* NOT used here: that variable belongs to each plugin's own declared engine
|
||||
* URL (production, third-party, etc.) and must not poison local detection.
|
||||
* Mixing the two caused the production engine to be reported as "local".
|
||||
* Reads NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL (default http://localhost:5000).
|
||||
* Only set this in .env.local for local development — never in production.
|
||||
* Each plugin owns its own streamUrl; this variable is only for routing
|
||||
* locally-developed plugin seeders to a local engine instance.
|
||||
*/
|
||||
function getLocalEngineBase() {
|
||||
const port = process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT || '5000';
|
||||
if (typeof window === "undefined") return `http://localhost:${port}`;
|
||||
return `${window.location.protocol}//${window.location.hostname}:${port}`;
|
||||
return process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL ?? 'http://localhost:5000';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,19 +20,19 @@ function toWsStreamUrl(url: string): string {
|
||||
const DEFAULT_ENGINE_URL = toWsStreamUrl(RAW_ENGINE_URL);
|
||||
|
||||
function getLocalWsUrl() {
|
||||
const port = process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT || '5000';
|
||||
if (typeof window === "undefined") return `ws://localhost:${port}/stream`;
|
||||
return `${window.location.protocol === "https:" ? "wss:" : "ws:"}//${window.location.hostname}:${port}/stream`;
|
||||
const base = process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL ?? 'http://localhost:5000';
|
||||
const ws = base.replace(/^https:\/\//, 'wss://').replace(/^http:\/\//, 'ws://');
|
||||
return ws.replace(/\/+$/, '') + '/stream';
|
||||
}
|
||||
/**
|
||||
* Resolves the WebSocket engine URL for a given plugin.
|
||||
*
|
||||
* Resolution order:
|
||||
* 1. Local engine (if running at localhost:5000 and has this plugin's seeder)
|
||||
* 1. Local engine (if running at NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL and has this plugin's seeder)
|
||||
* 2. Plugin's ServerPluginConfig.streamUrl (code-based plugins)
|
||||
* 3. Plugin's PluginManifest.dataSource.streamUrl (manifest-based plugins)
|
||||
* 4. NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL env var
|
||||
* 5. Fallback: wss://dataengine.worldwideview.dev/stream (cloud)
|
||||
* 5. Fallback: wss://dataenginev2.worldwideview.dev/stream (cloud)
|
||||
*/
|
||||
export function resolveEngineUrl(pluginId: string): string {
|
||||
// 1. Local engine (split-routing) - PRIORITY #1
|
||||
|
||||
@@ -48,6 +48,24 @@ export const isCloud: boolean = edition === "cloud";
|
||||
/** True when running as the public demo instance. */
|
||||
export const isDemo: boolean = edition === "demo";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Secure-context detection (https)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* True when the deployment serves over https, derived from the configured auth
|
||||
* URL or a production NODE_ENV. This is the request-independent half of the
|
||||
* secure-context check: the NextAuth cookie WRITER (auth.ts) uses it to decide
|
||||
* the secure flag / __Secure- cookie prefix, and the edge proxy READER (proxy.ts)
|
||||
* ORs it with per-request X-Forwarded-Proto / protocol when reading the token.
|
||||
* Centralised here so the writer and reader can never disagree on which cookie
|
||||
* name is in play behind a TLS-terminating reverse proxy.
|
||||
*/
|
||||
export function isHttpsDeployment(): boolean {
|
||||
const authUrl = process.env.AUTH_URL ?? process.env.NEXTAUTH_URL ?? "";
|
||||
return authUrl.startsWith("https://") || process.env.NODE_ENV === "production";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Demo admin secret (must be before feature flags so they can reference it)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -70,18 +70,18 @@ export async function injectHostGlobals(): Promise<void> {
|
||||
};
|
||||
|
||||
// REST Engine URL (Fallback)
|
||||
// Note: Local Docker-based engine interception (localhost:5000) happens dynamically inside
|
||||
// resolveEngineUrl.ts during plugin routing. These variables act as global fallbacks.
|
||||
// Note: Local engine interception (via NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL) happens dynamically
|
||||
// inside resolveEngineUrl.ts during plugin routing. These variables act as global fallbacks.
|
||||
const envDataEngine = process.env.NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL;
|
||||
if (envDataEngine) {
|
||||
(globalThis as Record<string, unknown>).__WWV_ENGINE_URL__ = envDataEngine;
|
||||
} else {
|
||||
// ALWAYS default to the cloud engine unless explicitly told otherwise via env var
|
||||
(globalThis as Record<string, unknown>).__WWV_ENGINE_URL__ = 'https://dataengine.worldwideview.dev';
|
||||
(globalThis as Record<string, unknown>).__WWV_ENGINE_URL__ = 'https://dataenginev2.worldwideview.dev';
|
||||
}
|
||||
|
||||
// WebSocket Engine URL
|
||||
const fallbackWs = envDataEngine ? `${envDataEngine.replace(/^http/, "ws")}/stream` : 'wss://dataengine.worldwideview.dev/stream';
|
||||
const fallbackWs = envDataEngine ? `${envDataEngine.replace(/^http/, "ws")}/stream` : 'wss://dataenginev2.worldwideview.dev/stream';
|
||||
(globalThis as Record<string, unknown>).__WWV_WS_ENGINE_URL__ = fallbackWs;
|
||||
|
||||
console.log("[HostGlobals] React and SDK injected for dynamic plugins");
|
||||
|
||||
@@ -123,7 +123,7 @@ describe("DeclarativePlugin", () => {
|
||||
getCurrentTime: () => new Date(),
|
||||
env: {},
|
||||
edition: "local",
|
||||
getEngineUrl: () => "http://localhost:5001",
|
||||
getEngineUrl: () => "http://test-engine/",
|
||||
});
|
||||
|
||||
const entities = await plugin.fetch({ start: new Date(), end: new Date() });
|
||||
|
||||
@@ -375,3 +375,53 @@ describe("validateManifest no execution field required (MAN-04)", () => {
|
||||
expect(hasExecutionError).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SEC-URL: entry URL allowlist must host-match the PARSED hostname.
|
||||
// Substring checks (includes / startsWith on the raw string) are bypassable
|
||||
// and would allow an attacker-controlled origin to serve the imported bundle.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("validateManifest entry URL allowlist (security)", () => {
|
||||
const ERR =
|
||||
"entry URL must be a relative path, CDN, localhost, or worldwideview.dev domain";
|
||||
|
||||
const accepts = (entry: string) => {
|
||||
const result = validateManifest(baseManifest({ entry }));
|
||||
expect(result.errors, `expected "${entry}" to be accepted`).not.toContain(ERR);
|
||||
};
|
||||
const rejects = (entry: string) => {
|
||||
const result = validateManifest(baseManifest({ entry }));
|
||||
expect(result.errors, `expected "${entry}" to be rejected`).toContain(ERR);
|
||||
};
|
||||
|
||||
it("accepts relative and exact known-host absolute entries", () => {
|
||||
accepts("/plugins/test/frontend.mjs");
|
||||
accepts("./frontend.mjs");
|
||||
accepts("https://unpkg.com/@wwv/plugin/frontend.mjs");
|
||||
accepts("https://cdn.jsdelivr.net/npm/@wwv/plugin/frontend.mjs");
|
||||
accepts("https://marketplace.worldwideview.dev/p/frontend.mjs");
|
||||
accepts("https://worldwideview.dev/p/frontend.mjs");
|
||||
accepts("http://localhost:3000/plugins/x/frontend.mjs");
|
||||
accepts("http://127.0.0.1:5000/plugins/x/frontend.mjs");
|
||||
accepts("http://[::1]:5000/plugins/x/frontend.mjs");
|
||||
});
|
||||
|
||||
it("rejects substring-bypass hostnames the old check allowed", () => {
|
||||
rejects("https://unpkg.com.evil.com/frontend.mjs");
|
||||
rejects("https://cdn.jsdelivr.net.evil.com/frontend.mjs");
|
||||
rejects("https://sub.worldwideview.dev.evil.com/frontend.mjs");
|
||||
rejects("https://evil.com/#.worldwideview.dev");
|
||||
rejects("https://evil.com/?x=.worldwideview.dev");
|
||||
rejects("http://localhost.evil.com/frontend.mjs");
|
||||
rejects("https://hacker.com/malicious.js");
|
||||
});
|
||||
|
||||
it("rejects protocol-relative, slash-backslash, userinfo and non-http(s) scheme tricks", () => {
|
||||
rejects("//evil.com/frontend.mjs");
|
||||
rejects("/\\evil.com/frontend.mjs");
|
||||
rejects("https://[email protected]/frontend.mjs");
|
||||
rejects("javascript:alert(1)");
|
||||
rejects("data:text/javascript,alert(1)");
|
||||
});
|
||||
});
|
||||
@@ -86,25 +86,41 @@ export function validateManifest(
|
||||
errors.push("Missing required field: entry");
|
||||
} else {
|
||||
const entry = manifest.entry.trim();
|
||||
const isRelative = entry.startsWith("/") || entry.startsWith("./");
|
||||
const isLocal = entry.startsWith("http://localhost") || entry.startsWith("http://127.0.0.1");
|
||||
const isWWV = entry.includes(".worldwideview.dev");
|
||||
const isCDN = entry.startsWith("https://cdn.jsdelivr.net") || entry.startsWith("https://unpkg.com");
|
||||
// A relative path starts with "/" or "./". Reject protocol-relative
|
||||
// ("//host") and slash-backslash ("/\\host") forms: they start with "/"
|
||||
// but resolve to an EXTERNAL origin when import()-ed.
|
||||
const isRelative =
|
||||
entry.startsWith("./") ||
|
||||
(entry.startsWith("/") && entry[1] !== "/" && entry[1] !== "\\");
|
||||
|
||||
// Accept bundles served from a configured marketplace/instance host
|
||||
// (e.g. marketplace.wwv.local) derived from env, so custom deployment
|
||||
// hostnames work without being hardcoded.
|
||||
let isConfiguredHost = false;
|
||||
if (ENV_ALLOWED_ENTRY_HOSTS.size > 0) {
|
||||
// Absolute entry URLs are host-matched against an allowlist using the
|
||||
// PARSED hostname. Substring checks on the raw string (includes /
|
||||
// startsWith) are bypassable, e.g. "https://unpkg.com.evil.com/x.mjs"
|
||||
// or "https://sub.worldwideview.dev.evil.com/x.mjs", which would let an
|
||||
// attacker-controlled origin serve the dynamically imported bundle (RCE).
|
||||
let isAllowedHost = false;
|
||||
if (!isRelative) {
|
||||
try {
|
||||
isConfiguredHost = ENV_ALLOWED_ENTRY_HOSTS.has(new URL(entry).hostname);
|
||||
const url = new URL(entry);
|
||||
const host = url.hostname;
|
||||
const isSecure = url.protocol === "https:";
|
||||
const isLocalhost =
|
||||
(url.protocol === "http:" || isSecure) &&
|
||||
(host === "localhost" || host === "127.0.0.1" || host === "[::1]");
|
||||
const isWWV =
|
||||
isSecure &&
|
||||
(host === "worldwideview.dev" || host.endsWith(".worldwideview.dev"));
|
||||
const isCDN = isSecure && (host === "cdn.jsdelivr.net" || host === "unpkg.com");
|
||||
// Operator-configured hosts (from NEXT_PUBLIC_*MARKETPLACE_URL) are an
|
||||
// explicit deployment opt-in, so their protocol is trusted as set.
|
||||
const isConfiguredHost = ENV_ALLOWED_ENTRY_HOSTS.has(host);
|
||||
isAllowedHost = isLocalhost || isWWV || isCDN || isConfiguredHost;
|
||||
} catch {
|
||||
// Relative paths and other non-absolute entries aren't parseable
|
||||
// as full URLs — they're already covered by `isRelative`.
|
||||
// Not a parseable absolute URL and not relative: rejected below.
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRelative && !isLocal && !isWWV && !isCDN && !isConfiguredHost) {
|
||||
if (!isRelative && !isAllowedHost) {
|
||||
errors.push("entry URL must be a relative path, CDN, localhost, or worldwideview.dev domain");
|
||||
}
|
||||
}
|
||||
|
||||
+45
-1
@@ -18,8 +18,9 @@ vi.unmock("@/lib/auth");
|
||||
// vi.hoisted() runs before all vi.mock() factories, so the variable is
|
||||
// defined before the hoisted factory closure captures it.
|
||||
// ---------------------------------------------------------------------------
|
||||
const { mockUpsert } = vi.hoisted(() => ({
|
||||
const { mockUpsert, mockFindUnique } = vi.hoisted(() => ({
|
||||
mockUpsert: vi.fn().mockResolvedValue(undefined),
|
||||
mockFindUnique: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/db", () => ({
|
||||
@@ -27,6 +28,7 @@ vi.mock("@/lib/db", () => ({
|
||||
user: {
|
||||
upsert: mockUpsert,
|
||||
findFirst: vi.fn(),
|
||||
findUnique: mockFindUnique,
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -54,6 +56,7 @@ vi.mock("@/core/edition", () => ({
|
||||
isDemo: false,
|
||||
getDemoAdminSecret: vi.fn(() => undefined),
|
||||
DEMO_ADMIN_ROLE: "demo-admin",
|
||||
isHttpsDeployment: vi.fn(() => false),
|
||||
}));
|
||||
vi.mock("bcryptjs", () => ({ compareSync: vi.fn(() => false) }));
|
||||
|
||||
@@ -61,6 +64,7 @@ vi.mock("bcryptjs", () => ({ compareSync: vi.fn(() => false) }));
|
||||
import {
|
||||
persistDemoAdminIfNeeded,
|
||||
ensureLocalUserPersisted,
|
||||
revalidateSession,
|
||||
DEMO_ADMIN_ID,
|
||||
DEMO_ADMIN_EMAIL,
|
||||
DEMO_ADMIN_NAME,
|
||||
@@ -148,3 +152,43 @@ describe("persistDemoAdminIfNeeded -- jwt callback guard", () => {
|
||||
expect(mockUpsert).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// revalidateSession -- authoritative JWT revocation check
|
||||
// ---------------------------------------------------------------------------
|
||||
describe("revalidateSession -- jwt revocation check", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("returns null when the token carries no user id", async () => {
|
||||
const result = await revalidateSession({});
|
||||
expect(result).toBeNull();
|
||||
expect(mockFindUnique).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns null when the user no longer exists in the DB (deleted / cross-database token)", async () => {
|
||||
mockFindUnique.mockResolvedValue(null);
|
||||
const result = await revalidateSession({ id: "missing-user", sessionVersion: 0 });
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when the token sessionVersion is stale (revoked / logout-everywhere)", async () => {
|
||||
mockFindUnique.mockResolvedValue({ sessionVersion: 3, role: "user" });
|
||||
const result = await revalidateSession({ id: "u1", sessionVersion: 2 });
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns the token with role refreshed when the version matches", async () => {
|
||||
mockFindUnique.mockResolvedValue({ sessionVersion: 5, role: "admin" });
|
||||
const result = await revalidateSession({ id: "u1", sessionVersion: 5, role: "user" });
|
||||
expect(result).not.toBeNull();
|
||||
expect((result as { role?: string }).role).toBe("admin");
|
||||
});
|
||||
|
||||
it("treats a missing token sessionVersion as 0", async () => {
|
||||
mockFindUnique.mockResolvedValue({ sessionVersion: 0, role: "user" });
|
||||
const result = await revalidateSession({ id: "u1" });
|
||||
expect(result).not.toBeNull();
|
||||
});
|
||||
});
|
||||
+75
-5
@@ -3,8 +3,9 @@ import Credentials from "next-auth/providers/credentials";
|
||||
import { compareSync } from "bcryptjs";
|
||||
import { timingSafeEqual } from "crypto";
|
||||
import { prisma } from "@/lib/db";
|
||||
import type { JWT } from "next-auth/jwt";
|
||||
import {
|
||||
isDemo, isCloud, getDemoAdminSecret, DEMO_ADMIN_ROLE
|
||||
isDemo, isCloud, getDemoAdminSecret, DEMO_ADMIN_ROLE, isHttpsDeployment
|
||||
} from "@/core/edition";
|
||||
import { authConfig } from "@/lib/auth.config";
|
||||
import { SupabaseAdapter } from "@auth/supabase-adapter";
|
||||
@@ -91,6 +92,7 @@ const localCredentialsProvider = Credentials({
|
||||
name: "Demo Admin",
|
||||
email: "admin",
|
||||
role: DEMO_ADMIN_ROLE,
|
||||
sessionVersion: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -120,15 +122,72 @@ const localCredentialsProvider = Credentials({
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
role: user.role,
|
||||
sessionVersion: user.sessionVersion,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// True when the deployment serves over https (session cookie gets the secure
|
||||
// flag / __Secure- prefix). Shared with the edge proxy reader via
|
||||
// isHttpsDeployment() so the cookie writer and reader never disagree on the
|
||||
// __Secure- prefix behind a TLS-terminating reverse proxy.
|
||||
const isSecureDeploy = isHttpsDeployment();
|
||||
|
||||
/**
|
||||
* Authoritative session revocation check, run from the jwt callback on every
|
||||
* non-sign-in request (local/demo editions). Returns the token unchanged when
|
||||
* still valid, or `null` to invalidate the session when:
|
||||
* - the user row no longer exists (deleted, or the token was minted against a
|
||||
* different database, e.g. another worktree/instance even with a shared
|
||||
* AUTH_SECRET), or
|
||||
* - the user's sessionVersion was bumped (logout-everywhere / credential
|
||||
* rotation), making the token's embedded version stale.
|
||||
*/
|
||||
export async function revalidateSession(token: JWT): Promise<JWT | null> {
|
||||
const userId = token.id;
|
||||
if (typeof userId !== "string" || !userId) return null;
|
||||
|
||||
const dbUser = await prisma.user.findUnique({
|
||||
where: { id: userId },
|
||||
select: { sessionVersion: true, role: true },
|
||||
});
|
||||
if (!dbUser) return null;
|
||||
|
||||
const tokenVersion = typeof token.sessionVersion === "number" ? token.sessionVersion : 0;
|
||||
if (dbUser.sessionVersion !== tokenVersion) return null;
|
||||
|
||||
// Keep role fresh in case it changed server-side since the token was issued.
|
||||
token.role = dbUser.role;
|
||||
return token;
|
||||
}
|
||||
|
||||
export const {
|
||||
handlers, auth, signIn, signOut
|
||||
} = NextAuth({
|
||||
...authConfig,
|
||||
session: { strategy: "jwt" },
|
||||
session: {
|
||||
strategy: "jwt",
|
||||
// Bound the lifetime of the signature-only token. The edge proxy gate
|
||||
// verifies the JWT signature but cannot reach the DB (no Prisma on the
|
||||
// edge runtime), so a shorter maxAge limits how long a leaked-but-
|
||||
// unexpired token can reach pages before the authoritative revocation
|
||||
// check (revalidateSession) rejects it on any auth() call.
|
||||
maxAge: 7 * 24 * 60 * 60, // 7 days
|
||||
updateAge: 24 * 60 * 60, // sliding refresh, at most once per day
|
||||
},
|
||||
// Explicit, hardened cookie options. These pin NextAuth's secure defaults so
|
||||
// they cannot silently regress: httpOnly blocks JS access (XSS token theft),
|
||||
// sameSite=lax blocks cross-site sends (CSRF), secure requires https in prod.
|
||||
cookies: {
|
||||
sessionToken: {
|
||||
options: {
|
||||
httpOnly: true,
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
secure: isSecureDeploy,
|
||||
},
|
||||
},
|
||||
},
|
||||
adapter: isCloud ? SupabaseAdapter({
|
||||
url: process.env.NEXT_PUBLIC_SUPABASE_URL || "http://dummy.supabase.co",
|
||||
secret: process.env.SUPABASE_SERVICE_ROLE_KEY || "dummy",
|
||||
@@ -137,21 +196,32 @@ export const {
|
||||
callbacks: {
|
||||
...authConfig.callbacks,
|
||||
async jwt({ token, user }) {
|
||||
// Initial sign-in: copy identity claims from the authorized user.
|
||||
if (user) {
|
||||
token.role = (user as { role?: string }).role ?? "user";
|
||||
token.role = user.role ?? "user";
|
||||
token.id = user.id;
|
||||
// Embed the user's current sessionVersion so the token can be
|
||||
// compared against the DB on later requests and revoked.
|
||||
token.sessionVersion = user.sessionVersion ?? 0;
|
||||
// Persist the demo-admin synthetic identity on first sign-in so
|
||||
// that the `users` FK target exists for API key creation. Runs
|
||||
// only when `user` is present (initial sign-in, not token refresh).
|
||||
// All values inside come from server-controlled constants.
|
||||
await persistDemoAdminIfNeeded(user.id!, isCloud);
|
||||
return token;
|
||||
}
|
||||
return token;
|
||||
|
||||
// Every subsequent request re-validates the token against the DB so
|
||||
// that deleted users, cross-database tokens, and bumped
|
||||
// sessionVersions are rejected. Cloud identities live in Supabase
|
||||
// (no local `users` row), so they skip the Prisma comparison.
|
||||
if (isCloud) return token;
|
||||
return revalidateSession(token);
|
||||
},
|
||||
async session({ session, token }) {
|
||||
if (session.user) {
|
||||
session.user.id = token.id as string;
|
||||
(session.user as { role?: string }).role = token.role as string;
|
||||
session.user.role = token.role as string | undefined;
|
||||
}
|
||||
return session;
|
||||
},
|
||||
|
||||
@@ -12,7 +12,11 @@ import type { FilterValue } from "@/core/plugins/PluginTypes";
|
||||
import { hasLocalSource, resolveLocalSnapshot, getLocalSourceIds } from "./localSources";
|
||||
|
||||
export function getEngineUrl(): string {
|
||||
return process.env.WWV_DATA_ENGINE_URL ?? "http://localhost:5001";
|
||||
// WWV_DATA_ENGINE_URL = production (docker-compose, server-side only)
|
||||
// NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL = local dev override
|
||||
return process.env.WWV_DATA_ENGINE_URL
|
||||
?? process.env.NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL
|
||||
?? "http://localhost:5000";
|
||||
}
|
||||
|
||||
function normalizeEntity(raw: unknown): GeoEntity | null {
|
||||
|
||||
+97
-25
@@ -2,11 +2,62 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { getToken } from "next-auth/jwt";
|
||||
import { isDemo } from "@/core/edition";
|
||||
import { isDemo, isHttpsDeployment } from "@/core/edition";
|
||||
|
||||
const workspaceCache = new Map<string, { status: string; expiresAt: number }>();
|
||||
const CACHE_TTL = 60_000; // 60 seconds
|
||||
|
||||
// Anchored static-asset allowlist. Only requests ending in a real asset
|
||||
// extension bypass the auth gate. This replaces the former `path.includes(".")`
|
||||
// check, which let ANY dotted path (e.g. `/secret.page`, `/globe.config`)
|
||||
// skip authentication entirely.
|
||||
const STATIC_ASSET_RE = /\.(?:js|mjs|cjs|css|map|json|txt|xml|webmanifest|ico|png|jpe?g|gif|svg|webp|avif|bmp|woff2?|ttf|otf|eot|wasm|mp4|webm|glb|gltf)$/i;
|
||||
|
||||
// API routes that must stay reachable WITHOUT a logged-in session cookie.
|
||||
// Everything else under /api is deny-by-default (requires a valid session JWT).
|
||||
// - auth/internal/health/billing-webhook: pre-login, server-to-server, infra, or external callers.
|
||||
// - mcp/globe/v1-entities: dual-auth routes that self-guard via Bearer API key
|
||||
// (programmatic clients send no session cookie, so the gate must not block them).
|
||||
// - marketplace/*: every marketplace route self-guards. validateMarketplaceAuth
|
||||
// accepts a cross-origin Bearer marketplace JWT (callers send no session cookie),
|
||||
// auth() guards the same-origin routes, and sideload is NODE_ENV-gated to dev.
|
||||
// Gating the prefix here would 401 those cross-origin Bearer/preflight requests
|
||||
// before their own auth runs, breaking install/manage from the marketplace origin.
|
||||
// - glitchtip-tunnel/build/dev: telemetry/diagnostics (dev/* is NODE_ENV-gated to 403 in prod).
|
||||
const PUBLIC_API_PREFIXES = [
|
||||
"/api/auth",
|
||||
"/api/internal/workspace",
|
||||
"/api/health",
|
||||
"/api/billing/webhook",
|
||||
"/api/mcp",
|
||||
"/api/globe",
|
||||
"/api/v1/entities",
|
||||
"/api/marketplace",
|
||||
"/api/glitchtip-tunnel",
|
||||
"/api/build",
|
||||
"/api/dev",
|
||||
];
|
||||
|
||||
function isPublicApiPath(path: string): boolean {
|
||||
return PUBLIC_API_PREFIXES.some((p) => path === p || path.startsWith(`${p}/`));
|
||||
}
|
||||
|
||||
// Resolve the Auth.js session token, handling the __Secure- cookie prefix used
|
||||
// behind a TLS-terminating reverse proxy (the public URL is https but the
|
||||
// request reaching us may be plain http). Detect via X-Forwarded-Proto / AUTH_URL.
|
||||
async function getSessionToken(req: NextRequest) {
|
||||
// Request-aware OR the deploy-wide https signal (isHttpsDeployment), so the
|
||||
// reader agrees with the cookie writer (auth.ts) on the __Secure- prefix.
|
||||
const isSecure = req.headers.get("x-forwarded-proto") === "https"
|
||||
|| isHttpsDeployment()
|
||||
|| req.nextUrl.protocol === "https:";
|
||||
return getToken({
|
||||
req,
|
||||
secret: process.env.AUTH_SECRET,
|
||||
secureCookie: isSecure,
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveWorkspace(subdomain: string) {
|
||||
const cached = workspaceCache.get(subdomain);
|
||||
if (cached && Date.now() < cached.expiresAt) return cached;
|
||||
@@ -62,16 +113,49 @@ export default async function proxy(req: NextRequest) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// Static assets, API routes, data files — always pass through.
|
||||
// Strip any client-supplied x-tenant-subdomain on /api/* before forwarding,
|
||||
// then re-inject only the server-resolved value (H2: tenant-header spoof prevention).
|
||||
// A forged header must never reach the Prisma tenant extension.
|
||||
// API routes: DENY BY DEFAULT. Evaluated BEFORE the static-asset allowlist so
|
||||
// that no `/api/...` path ending in an asset-like extension (e.g. a catch-all
|
||||
// segment such as `/api/x/y.json`) can match the static fast-path and skip the
|
||||
// gate. Public/self-guarded routes pass through; every other /api route requires
|
||||
// a valid session JWT (else 401 JSON). This closes the former blanket `/api`
|
||||
// pass-through that left unauthenticated data proxies (places/*, camera/test,
|
||||
// earthquake, iss*, weather*, ...) open and burning server-held upstream keys.
|
||||
if (path.startsWith("/api")) {
|
||||
const res = NextResponse.next();
|
||||
// Always drop a client-supplied tenant header; only the server-resolved
|
||||
// value may be forwarded (H2: tenant-header spoof prevention).
|
||||
res.headers.delete("x-tenant-subdomain");
|
||||
|
||||
// CORS preflight is credential-less by design (no cookie, no Authorization
|
||||
// header), so gating it would 401 the preflight and break every cross-origin
|
||||
// API route before its real request is ever sent. Let OPTIONS through; the
|
||||
// route's own OPTIONS/CORS handler answers it (no body, nothing to leak).
|
||||
if (req.method === "OPTIONS") return res;
|
||||
|
||||
if (isPublicApiPath(path)) {
|
||||
if (tenantSubdomain) res.headers.set("x-tenant-subdomain", tenantSubdomain);
|
||||
return res;
|
||||
}
|
||||
|
||||
const apiToken = await getSessionToken(req);
|
||||
if (apiToken) {
|
||||
if (tenantSubdomain) res.headers.set("x-tenant-subdomain", tenantSubdomain);
|
||||
return res;
|
||||
}
|
||||
return NextResponse.json(
|
||||
{ error: "Unauthorized" },
|
||||
{ status: 401, headers: { "WWW-Authenticate": "Bearer" } },
|
||||
);
|
||||
}
|
||||
|
||||
// Static assets and internal data dirs always pass through (no auth).
|
||||
// Static files match an explicit extension allowlist instead of the old,
|
||||
// bypass-prone `path.includes(".")` (which let any dotted path skip the gate).
|
||||
if (
|
||||
path.startsWith("/_next")
|
||||
|| path.startsWith("/api")
|
||||
|| path.startsWith("/data")
|
||||
|| path.startsWith("/cesium")
|
||||
|| path.includes(".")
|
||||
|| STATIC_ASSET_RE.test(path)
|
||||
) {
|
||||
const res = NextResponse.next();
|
||||
res.headers.delete("x-tenant-subdomain");
|
||||
@@ -91,7 +175,7 @@ export default async function proxy(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
// Auth pages — always accessible
|
||||
// Auth pages: always accessible
|
||||
if (path.startsWith("/setup") || path.startsWith("/login")) {
|
||||
const res = NextResponse.next();
|
||||
if (tenantSubdomain) res.headers.set("x-tenant-subdomain", tenantSubdomain);
|
||||
@@ -106,30 +190,18 @@ export default async function proxy(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check JWT session from Auth.js cookie.
|
||||
// Behind a TLS-terminating reverse proxy, the cookie was set with the
|
||||
// `__Secure-` prefix (because the public URL is https), but the request
|
||||
// reaching us is plain http, so getToken's auto-detection looks for the
|
||||
// unprefixed name and misses it. Detect via X-Forwarded-Proto / AUTH_URL.
|
||||
const xfProto = req.headers.get("x-forwarded-proto");
|
||||
const authUrl = process.env.AUTH_URL ?? process.env.NEXTAUTH_URL ?? "";
|
||||
const isSecure = xfProto === "https"
|
||||
|| authUrl.startsWith("https://")
|
||||
|| req.nextUrl.protocol === "https:";
|
||||
const token = await getToken({
|
||||
req,
|
||||
secret: process.env.AUTH_SECRET,
|
||||
secureCookie: isSecure,
|
||||
});
|
||||
// Check the Auth.js session cookie for page requests (the helper handles the
|
||||
// __Secure- cookie prefix used behind a TLS-terminating reverse proxy).
|
||||
const token = await getSessionToken(req);
|
||||
|
||||
if (token) {
|
||||
// User is logged in — allow through
|
||||
// User is logged in, allow through
|
||||
const res = NextResponse.next();
|
||||
if (tenantSubdomain) res.headers.set("x-tenant-subdomain", tenantSubdomain);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Not logged in — check if first-run (no users)
|
||||
// Not logged in: check if first-run (no users)
|
||||
try {
|
||||
const appUrl = process.env.NEXT_PUBLIC_APP_URL || process.env.APP_URL || `http://127.0.0.1:${process.env.PORT || "3000"}`;
|
||||
const url = new URL("/api/auth/setup-status", appUrl);
|
||||
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
import type { DefaultSession } from "next-auth";
|
||||
|
||||
/**
|
||||
* Module augmentation for NextAuth/Auth.js. The app carries a per-user `role`
|
||||
* and a `sessionVersion` (used for session revocation) on the authorized user,
|
||||
* the session, and the JWT. Declaring them here makes those fields first-class
|
||||
* and removes the need for `as { role?: string }` casts throughout auth.ts.
|
||||
*/
|
||||
declare module "next-auth" {
|
||||
interface User {
|
||||
role?: string;
|
||||
sessionVersion?: number;
|
||||
}
|
||||
|
||||
interface Session {
|
||||
user: {
|
||||
id: string;
|
||||
role?: string;
|
||||
} & DefaultSession["user"];
|
||||
}
|
||||
}
|
||||
|
||||
declare module "next-auth/jwt" {
|
||||
interface JWT {
|
||||
id?: string;
|
||||
role?: string;
|
||||
sessionVersion?: number;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user