diff --git a/.github/workflows/ross-docs.yml b/.github/workflows/ross-docs.yml new file mode 100644 index 00000000..6bfe88df --- /dev/null +++ b/.github/workflows/ross-docs.yml @@ -0,0 +1,45 @@ +name: ROSS Docs + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + lint: + name: Markdown Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + cache-dependency-path: ross/docs/package-lock.json + - name: Install dependencies + working-directory: ross/docs + run: npm ci + - name: Markdown Lint + working-directory: ross/docs + run: npm run lint:md + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + cache-dependency-path: ross/docs/package-lock.json + - name: Install dependencies + working-directory: ross/docs + run: npm ci + - name: Build docs + working-directory: ross/docs + run: npm run build + diff --git a/ross/docs/.markdownlint.json b/ross/docs/.markdownlint.json new file mode 100644 index 00000000..ed82d00d --- /dev/null +++ b/ross/docs/.markdownlint.json @@ -0,0 +1,8 @@ +{ + "default": true, + "line-length": false, + "no-trailing-spaces": true, + "MD024": false, + "MD029": false +} + diff --git a/ross/docs/AGENTS.md b/ross/docs/AGENTS.md new file mode 100644 index 00000000..22c779bd --- /dev/null +++ b/ross/docs/AGENTS.md @@ -0,0 +1,37 @@ +# AGENTS.md — ROSS Documentation + +Rules and conventions for authoring and maintaining the ROSS documentation site. + +## Documentation Rules + +1. **No Horizontal Rules (`---`) in Content:** + - The only allowed `---` is the file's opening and closing frontmatter at the top of the file: + + ```markdown + --- + sidebar_position: 4 + --- + ``` + + - Horizontal rule dividers (`---`) anywhere else in the document are strictly disallowed. Use standard markdown section headings (`##`, `###`) or whitespace instead. + +2. **Verify Code Before Writing Documentation:** + - Always verify the actual implementation in the codebase before writing, updating, or explaining any feature. + - **Only check ROSS code** (`ross/src/`). Do not look at or infer behavior from external projects or other monorepo directories. + +3. **No Bug Descriptions:** + - Never document bugs, known flaws, or temporary buggy behaviors in user-facing documentation. + - If a bug has already been raised as an issue, assume it is already fixed and document the intended, correct specification and behavior. + +## Commands + +Run commands from the `ross/docs` directory: + +| Command | Action | +| --- | --- | +| `npm run lint:md` | Run markdownlint across all docs (`docs/**/*.md`) | +| `npm run build` | Build Docusaurus production bundle | +| `npm run start` | Start local dev server for documentation | +| `npm run typecheck` | Run TypeScript type checking | + +Always run `npm run lint:md` and `npm run build` to verify your changes before submitting. diff --git a/ross/docs/docs/api-variants.md b/ross/docs/docs/api-variants.md new file mode 100644 index 00000000..b11e7f57 --- /dev/null +++ b/ross/docs/docs/api-variants.md @@ -0,0 +1,281 @@ +--- +sidebar_position: 15 +--- + +# API Variants (`apiVariants`) + +The `apiVariants` configuration section enables you to generate multiple parallel, versioned, or specialized copies of endpoints from a single underlying data model without duplicating schemas, database migrations, or business logic. + +This feature allows you to maintain versioned routes (`v1` vs. `v2`), isolate internal or administrative endpoints (`internal` or `admin`), or expose specialized API surfaces for third-party partners or mobile clients. + +## Overview & Use Cases + +When ROSS generates REST endpoints for your models, it assigns them to the default API version prefix (defaults to `v1`). With `apiVariants`, you can instruct ROSS to spawn additional route variations for any generated endpoint: + +```text + ┌──> /v1/posts (Public, strict rate limits, standard fields) + │ +data.models.posts ───────┼──> /v2/posts (Updated pagination, new query filters) + │ + └──> /admin/posts (Requires admin role, bypasses secret fields) +``` + +### Common Use Cases + +- **API Versioning**: Serve legacy clients on `/v1/` while introducing updated query behaviors, tags, or validation on `/v2/`. +- **Administrative Portals**: Expose `/admin/` variants of standard CRUD routes that bypass secret fields (`bypassSecret: true`) and require strict administrative roles. +- **Audience Segmentation**: Create dedicated `/partner/` or `/internal/` routes with specialized outbound webhooks or server-side parameter injection. + +## Declaring Variants (`apiVariants`) + +Variants are defined in the `apiVariants` section of your configuration. + +The configuration is a dictionary where: + +- **Key**: The **base default-variant API Identifier** of the route you want to replicate (e.g. `model.v1.posts.unknown.getAll`). +- **Value**: An object with a `variants` array containing the variant names you want to generate. + +```json +{ + "apiVariants": { + "model.v1.posts.unknown.getAll": { + "variants": ["v2", "admin", "partner"] + }, + "model.v1.posts.title.search": { + "variants": ["internal"] + } + } +} +``` + +### Declaration Rules + +1. **Variant Names**: Variant names must be non-empty strings between 1 and 25 characters containing only alphanumeric characters, underscores, and hyphens (`^[a-zA-Z0-9_-]+$`). +2. **Key Format**: Keys in `apiVariants` must match the base default-variant identifier format (`....`). +3. **Automatic Deduplication**: If the default variant (e.g. `v1`) is included in `variants`, ROSS deduplicates it automatically so only one base route is generated. + +## URL Routing & Path Resolution + +Every variant declared in `apiVariants` is mounted on an HTTP path matching its variant name: + +| Target Endpoint | Variant | Generated API Identifier | HTTP Path | +| --- | --- | --- | --- | +| `model.v1.posts.unknown.getAll` | `v1` (default) | `model.v1.posts.unknown.getAll` | `GET /v1/posts/` | +| `model.v1.posts.unknown.getAll` | `v2` | `model.v2.posts.unknown.getAll` | `GET /v2/posts/` | +| `model.v1.posts.unknown.getAll` | `admin` | `model.admin.posts.unknown.getAll` | `GET /admin/posts/` | +| `model.v1.posts.title.search` | `internal` | `model.internal.posts.title.search` | `POST /internal/posts/search/title` | + +All route operations support variants, including model CRUD, field indexes, substring search, field aggregations, and custom endpoints. + +## Configuring Policies per Variant (`apis`) + +Every generated variant receives a distinct API Identifier where the `` segment corresponds to the variant name: + +```text +model.... +``` + +You can target each variant independently in the `apis` configuration section to assign custom security, tags, or operational behaviors: + +```json +{ + "apiVariants": { + "model.v1.posts.unknown.getAll": { + "variants": ["v2", "admin"] + } + }, + "apis": { + "model.v1.posts.unknown.getAll": { + "authorization": false, + "tags": ["Public Content"] + }, + "model.v2.posts.unknown.getAll": { + "authorization": true, + "tags": ["V2 Content API"], + "supportedQueries": ["eq", "in", "sort"] + }, + "model.admin.posts.unknown.getAll": { + "authorization": true, + "roles": ["admin"], + "bypassSecret": true, + "tags": ["Admin Content Management"] + } + } +} +``` + +## Policy Inheritance Rules + +When resolving policies for a variant route, ROSS applies hierarchical inheritance from the base default-variant policy: + +### 1. Scalar Properties Inherit from Base + +If a variant entry in `apis` does not define a scalar property, it automatically inherits the value declared on the default base variant: + +- **`enabled`**: If `v1` disables a route (`"enabled": false`), variants inherit `false` unless explicitly overridden. +- **`authorization`**: Inherits the authentication requirement from the base variant. +- **`roles`**: Inherits RBAC role restrictions from the base variant. +- **`tags`**: Inherits OpenAPI tags from the base variant. +- **`bypassSecret`**: Inherits secret field exposure settings from the base variant. + +```json +{ + "apis": { + "model.v1.posts.id.delete": { + "authorization": true, + "roles": ["admin"] + }, + "model.v2.posts.id.delete": { + "tags": ["V2 Posts"] + } + } +} +``` + +In this example, `model.v2.posts.id.delete` automatically inherits `"authorization": true` and `"roles": ["admin"]` from `v1`. + +### 2. List Properties Never Inherit + +List properties represent explicit sets of route-specific operational rules. They **never inherit** across variants. Each variant must explicitly declare its own lists if needed: + +- **`serverSideParams`**: Injected query/body parameters do not copy over. +- **`webhooks`**: Outbound event notifications do not copy over. +- **`supportedQueries`**: Allowed query filters do not copy over. +- **`supportedAggregations`**: Allowed statistical aggregations do not copy over. + +### 3. Deactivating Specific Variants + +You can turn off a specific variant route without affecting the base endpoint or other variants by setting `"enabled": false`: + +```json +{ + "apis": { + "model.v2.posts.id.delete": { + "enabled": false + } + } +} +``` + +Calls to `DELETE /v2/posts/delete/id/:id` will return `404 Not Found`, while `DELETE /v1/posts/delete/id/:id` remains available. + +:::warning[Auth User Model Protection on Variants] + +When authentication is enabled with an identity provider (`up-auth` or `sso`), all auto-generated CRUD routes for the auth user model (e.g. `model.v1.users.*`) are disabled by default (`enabled: false`). + +This protection extends to all variants. For instance, `model.admin.users.unknown.getAll` is disabled by default and must explicitly specify `"enabled": true` to be registered. + +::: + +## Complete Walkthrough Example + +The following configuration demonstrates a complete setup featuring multi-version public endpoints and a privileged administrative variant: + +```json +{ + "application": { + "name": "E-Commerce API" + }, + "data": { + "models": { + "orders": { + "fields": { + "id": { + "type": "integer", + "primaryKey": true, + "autoIncrement": true, + "apis": ["index"] + }, + "customer_id": { + "type": "integer", + "apis": ["search"], + "query": ["eq"] + }, + "total_amount": { + "type": "decimal", + "query": ["gte", "lte"] + }, + "internal_notes": { + "type": "text", + "secret": true + } + } + } + } + }, + "authentication": { + "enabled": true, + "jwtSecret": "env:JWT_SECRET", + "userModel": { + "modelName": "users", + "idField": "id", + "providerField": "provider" + }, + "providers": [ + { + "type": "up-auth", + "config": { + "fields": { + "usernameField": "email", + "passwordField": "password" + } + } + } + ] + }, + "rbac": { + "enabled": true, + "modelName": "users", + "roleField": "role", + "defaultRole": "customer", + "roles": { + "admin": { + "includes": ["*"] + }, + "customer": {} + } + }, + "apiVariants": { + "model.v1.orders.unknown.getAll": { + "variants": ["v2", "admin"] + } + }, + "apis": { + "model.v1.orders.unknown.getAll": { + "authorization": true, + "tags": ["Customer Orders V1"], + "serverSideParams": [ + { + "type": "query", + "name": "customer_id", + "value": "[[userId]]" + } + ] + }, + "model.v2.orders.unknown.getAll": { + "authorization": true, + "tags": ["Customer Orders V2"], + "supportedQueries": ["eq", "gte", "lte"], + "serverSideParams": [ + { + "type": "query", + "name": "customer_id", + "value": "[[userId]]" + } + ] + }, + "model.admin.orders.unknown.getAll": { + "authorization": true, + "roles": ["admin"], + "bypassSecret": true, + "tags": ["Backoffice Order Management"] + } + } +} +``` + +In this architecture: + +1. `GET /v1/orders/` serves standard customer queries scoped automatically to the authenticated user via SSP. +2. `GET /v2/orders/` introduces whitelisted query operators (`eq`, `gte`, `lte`) alongside user scoping. +3. `GET /admin/orders/` gives administrators full visibility over all orders, removes customer scoping, exposes the `internal_notes` secret field, and restricts access strictly to the `admin` role. diff --git a/ross/docs/docs/apis.md b/ross/docs/docs/apis.md new file mode 100644 index 00000000..98fba139 --- /dev/null +++ b/ross/docs/docs/apis.md @@ -0,0 +1,394 @@ +--- +sidebar_position: 11 +--- + +# Route Policies (`apis`) + +The `apis` configuration section is the central policy engine for every HTTP route generated or registered by ROSS. + +By default, ROSS inspects your data models, custom endpoints, and authentication providers to automatically generate secure RESTful routes with standard OpenAPI schemas, validation, and documentation tags. The `apis` block provides granular, declarative control to customize, protect, or disable individual endpoints without modifying your underlying database schema or application code. + +## Quick Example + +```json +{ + "apis": { + "model.v1.posts.id.delete": { + "enabled": false + }, + "model.v1.posts.unknown.getAll": { + "authorization": false, + "tags": ["Public Content"] + }, + "model.v1.posts.title.search": { + "authorization": true, + "roles": ["admin", "editor"], + "supportedQueries": ["eq", "in", "sort"] + } + } +} +``` + +## API Identifiers + +Every route in ROSS has a deterministic, five-segment **API Identifier** formatted as: + +```text +.... +``` + +| Segment | Description | Allowed Values | +| --- | --- | --- | +| `` | The subsystem or route generator | `model`, `aggregate`, `auth`, `custom` | +| `` | The API version or route prefix | `v1` (default) | +| `` | Target model name or scope | Model name from `data.models`, or `all` for custom endpoints | +| `` | Target field name or placeholder | Target field name for field-scoped routes, or `unknown` | +| `` | The specific operation name | Operation identifier (see reference below) | + +### 1. Model Routes (`model`) + +Generated from models declared under `data.models`: + +| API Identifier Pattern | HTTP Method & Path | Description | +| --- | --- | --- | +| `model...unknown.insert` | `POST /{variant}/{model}` | Insert a new record into the model. | +| `model...unknown.getAll` | `GET /{variant}/{model}` | Paginated query returning all records. | +| `model....index` | `GET /{variant}/{model}/index/{field}/:{field}` | Lookup a record by primary key, unique key, or indexed field. | +| `model....search` | `POST /{variant}/{model}/search/{field}` | Search records matching criteria against the specified field. | +| `model....edit` | `PATCH /{variant}/{model}/edit/{field}/:{field}` | Update records identified by the specified field. | +| `model....delete` | `DELETE /{variant}/{model}/delete/{field}/:{field}` | Delete records identified by the specified field. | + +### 2. Aggregation Routes (`aggregate`) + +Generated for fields with statistical aggregations configured under `data.models..fields..aggregations`: + +| API Identifier Pattern | HTTP Method & Path | Description | +| --- | --- | --- | +| `aggregate....getAggregation` | `POST /{variant}/aggregate/{model}/{field}` | Execute statistical aggregations (`count`, `avg`, `sum`, `min`, `max`, `frequency`) on the field. | + +### 3. Authentication Routes (`auth`) + +Generated when `authentication.enabled: true`: + +| API Identifier | HTTP Method & Path | Description | +| --- | --- | --- | +| `auth...unknown.providers` | `GET /{variant}/auth/providers` | List available authentication providers. | +| `auth...unknown.me` | `GET /{variant}/auth/me` | Fetch authenticated user profile. | +| `auth...unknown.editMe` | `PATCH /{variant}/auth/me` | Update authenticated user profile. | +| `auth...unknown.deleteMe` | `DELETE /{variant}/auth/me` | Delete authenticated user account. | +| `auth...unknown.registration` | `POST /{variant}/auth/registration` | Register a new username/password account. | +| `auth...unknown.login` | `POST /{variant}/auth/login` | Authenticate with username and password. | +| `auth...unknown.changePassword` | `POST /{variant}/auth/change-password` | Update account password. | +| `auth...unknown.forgotPassword` | `POST /{variant}/auth/forgot-password` | Request password reset OTP (requires email integration). | +| `auth...unknown.otpVerifyForgotPassword` | `POST /{variant}/auth/otp-verify-forgot-password` | Verify password reset OTP. | +| `auth...unknown.resendOtpForgotPassword` | `POST /{variant}/auth/resend-otp-forgot-password` | Resend password reset OTP. | +| `auth...unknown.otpVerifyLogin` | `POST /{variant}/auth/otp-verify-login` | Verify MFA login OTP (when `mfaRequired: true`). | +| `auth...unknown.resendOtpLogin` | `POST /{variant}/auth/resend-otp-login` | Resend MFA login OTP. | +| `auth...unknown.otpVerifyRegister` | `POST /{variant}/auth/otp-verify-register` | Verify registration email OTP. | +| `auth...unknown.resendOtpRegister` | `POST /{variant}/auth/resend-otp-register` | Resend registration email OTP. | +| `auth...unknown.emailChange` | `POST /{variant}/auth/email-change` | Request email address change verification. | +| `auth...unknown.ssoLogin` | `POST /{variant}/auth/sso/login` | Initiate SSO login flow. | +| `auth...unknown.ssoCallback` | `POST /{variant}/auth/sso/callback` | Handle identity provider SSO callback. | +| `auth...unknown.ssoMetadata` | `GET /{variant}/auth/sso/metadata` | Export SAML SP metadata (when SAML provider configured). | +| `auth...unknown.ssoToken` | `POST /{variant}/auth/sso/token` | Exchange SSO authorization code for token. | + +### 4. Custom Endpoints (`custom`) + +Generated for user-defined SQL or JavaScript/TypeScript function endpoints in `customEndpoints`: + +| API Identifier Pattern | Description | +| --- | --- | +| `custom..all.unknown.` | Custom SQL or function endpoint registered under `customEndpoints.`. | + +## Route Policy Properties + +Each entry in `apis` is keyed by its API Identifier and accepts the following policy options: + +```typescript +interface RoutePolicyConfig { + enabled?: boolean; + authorization?: boolean; + roles?: string[]; + tags?: string[]; + supportedQueries?: ('eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not_in' | 'sort')[]; + supportedAggregations?: ('count' | 'avg' | 'sum' | 'min' | 'max' | 'frequency')[]; + bypassSecret?: boolean; + serverSideParams?: ServerSideParamConfig[]; + webhooks?: WebhookConfig[]; +} +``` + +### `enabled` + +- **Type**: `boolean` +- **Default**: `true` (see auth user model exception below) + +Controls whether ROSS registers the route in the HTTP router. Setting `enabled: false` completely deactivates the route without removing the underlying model or custom endpoint definition. Calls to a disabled route return `404 Not Found`. + +```json +{ + "apis": { + "model.v1.users.id.delete": { + "enabled": false + } + } +} +``` + +:::warning[Default Protection for Auth User Models] + +When authentication is enabled with an identity provider (`up-auth` or `sso`), all auto-generated CRUD routes for the auth user model (e.g. `model.v1.users.*`) are **disabled by default** (`enabled: false`). This safeguard prevents accidental exposure of user credentials and password hashes through generic CRUD endpoints. + +If your application needs administrative user management routes, you must explicitly enable each route: + +```json +{ + "apis": { + "model.v1.users.unknown.getAll": { + "enabled": true, + "roles": ["admin"] + } + } +} +``` + +::: + +### `authorization` + +- **Type**: `boolean` +- **Default**: Inherits global `authentication.enabled` value + +Enforces JWT Bearer token authentication on the route via Fastify's authentication preValidation hook. + +- Setting `authorization: true` requires callers to supply a valid JWT in the `Authorization: Bearer ` header. +- Setting `authorization: false` marks a specific route as public, even when global authentication is enabled. + +:::note + +Setting `"authorization": true` is only permitted when `authentication.enabled` is `true` in your root configuration. + +::: + +```json +{ + "apis": { + "model.v1.posts.unknown.getAll": { + "authorization": false + } + } +} +``` + +### `roles` + +- **Type**: `string[]` +- **Default**: `undefined` + +Enforces Role-Based Access Control (RBAC) on the endpoint. Callers must present a valid JWT whose claims contain at least one of the specified roles. + +- Requires `rbac.enabled: true` and `authentication.enabled: true`. +- An endpoint configuring `roles` must explicitly declare `"authorization": true`. +- Requires concrete declared role names (e.g. `["admin", "editor"]`). Wildcards (`*` and `prefix:*`) are reserved for defining role hierarchies in `rbac.roles..includes`. + +```json +{ + "apis": { + "model.v1.articles.id.edit": { + "authorization": true, + "roles": ["admin", "editor"] + } + } +} +``` + +### `tags` + +- **Type**: `string[]` +- **Default**: Derived automatically from the route identifier + +Overrides the OpenAPI / Swagger documentation tags and sidebar grouping for the endpoint. + +By default, ROSS derives tags automatically using the following conventions: + +- **`model` routes**: `[ModelName, "Read" | "Insert" | "Update" | "Delete"]` +- **`aggregate` routes**: `[ModelName, "Read"]` +- **`auth` routes**: `[ModelName, "Auth", "Login" | "Register" | "Password" | "Profile" | "OTP"]` +- **`custom` routes**: `["Custom Endpoints"]` + +You can customize tags to group related endpoints under domain-specific categories: + +```json +{ + "apis": { + "model.v1.orders.unknown.insert": { + "tags": ["Checkout & Billing", "Customer API"] + } + } +} +``` + +### `supportedQueries` + +- **Type**: `Array<'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not_in' | 'sort'>` +- **Default**: All query operations enabled on the model's fields + +Whitelists the filter and sorting operations clients are permitted to execute on `model.*` endpoints. + +- Only valid on `model.*` routes. +- Every operation listed in `supportedQueries` must be supported by at least one field in the target model. +- Restricts the query parameters accepted by the route and visible in the OpenAPI documentation. Any query filters outside `supportedQueries` are rejected with validation errors. + +```json +{ + "apis": { + "model.v1.transactions.unknown.getAll": { + "supportedQueries": ["eq", "gte", "lte", "sort"] + } + } +} +``` + +### `supportedAggregations` + +- **Type**: `Array<'count' | 'avg' | 'sum' | 'min' | 'max' | 'frequency'>` +- **Default**: All aggregations configured on the field + +Whitelists the aggregation operations clients can execute on `aggregate.*` endpoints. + +- Only valid on `aggregate.*` routes. +- Every operation in `supportedAggregations` must be declared in `data.models..fields..aggregations`. +- Prevents expensive operations (such as `frequency` or `sum` on large datasets) from being requested on specific endpoints. + +```json +{ + "apis": { + "aggregate.v1.orders.total_amount.getAggregation": { + "supportedAggregations": ["count", "sum"] + } + } +} +``` + +### `bypassSecret` + +- **Type**: `boolean` +- **Default**: `false` + +Controls whether fields configured with `secret: true` in `data.models` are exposed by the endpoint. + +By default, ROSS automatically excludes secret fields from API responses, OpenAPI query parameters, and search filters. Setting `bypassSecret: true` permits the endpoint to include secret fields. This is commonly used for internal administrative routes or secure background tasks: + +```json +{ + "apis": { + "model.v1.api_keys.unknown.getAll": { + "bypassSecret": true, + "authorization": true, + "roles": ["admin"] + } + } +} +``` + +### `serverSideParams` + +- **Type**: `ServerSideParamConfig[]` +- **Default**: `[]` + +Configures Server-Side Parameters (SSP) to inject server-enforced values (such as tenant IDs or authenticated user IDs) into `query` or `body` parameters. When configured, parameters are hidden from OpenAPI documentation and cannot be passed or overridden by end users. + +For complete documentation on configuration, magic variables (`[[userId]]`, `[[userEmail]]`, custom variables), execution timing, and examples, see the dedicated [Server-Side Parameters (SSP)](./ssp.md) guide. + +```json +{ + "apis": { + "model.v1.posts.unknown.insert": { + "serverSideParams": [ + { + "type": "body", + "name": "author_id", + "value": "[[userId]]" + } + ] + } + } +} +``` + +### `webhooks` + +- **Type**: `WebhookConfig[]` +- **Default**: `[]` + +Configures outbound HTTP `POST` notifications dispatched to external URLs when the route executes. Supports triggering on request, on response, and custom header signing. + +For detailed configuration options, payload shapes, and retry mechanisms, see the [Webhooks](./webhooks.md) guide. + +```json +{ + "apis": { + "model.v1.orders.unknown.insert": { + "webhooks": [ + { + "url": "https://hooks.slack.com/services/EXAMPLE", + "data": ["body", "response"], + "triggerOnRequest": false, + "triggerOnResponse": true + } + ] + } + } +} +``` + +## Comprehensive Configuration Example + +The following example illustrates a production policy configuration combining route deactivation, public endpoints, RBAC, query whitelisting, and secret bypass: + +```json +{ + "apis": { + "model.v1.posts.id.delete": { + "enabled": false + }, + "model.v1.posts.unknown.getAll": { + "authorization": false, + "tags": ["Public Content"] + }, + "model.v1.posts.title.search": { + "authorization": true, + "roles": ["admin", "editor"], + "supportedQueries": ["eq", "in", "sort"], + "tags": ["Content Management"] + }, + "model.v1.users.unknown.getAll": { + "enabled": true, + "authorization": true, + "roles": ["admin"], + "tags": ["User Administration"] + }, + "model.v1.users.id.index": { + "enabled": true, + "authorization": true, + "roles": ["admin"], + "bypassSecret": true, + "tags": ["User Administration"] + }, + "aggregate.v1.posts.views.getAggregation": { + "supportedAggregations": ["count", "avg", "sum"] + } + } +} +``` + +## Validation & Common Errors + +ROSS validates all `apis` entries during initialization. Common validation errors include: + +- **`apis/: invalid key format`**: The identifier does not contain exactly 5 dot-separated segments. +- **`apis/: does not match any generated API route`**: The identifier refers to a non-existent model, invalid field, or an operation that ROSS does not generate. +- **`apis//authorization: authorization is only allowed when auth is enabled`**: Set `authentication.enabled: true` in your root config before setting `authorization: true`. +- **`apis//roles: endpoint with roles must have authorization enabled`**: Whenever `roles` are defined on a route policy, `"authorization": true` must be explicitly declared on that same entry. +- **`apis//supportedQueries: supportedQueries is only allowed on model APIs`**: `supportedQueries` cannot be set on `auth`, `aggregate`, or `custom` endpoints. +- **`apis//supportedAggregations: supportedAggregations is only allowed on aggregate APIs`**: `supportedAggregations` cannot be set on non-aggregate routes. diff --git a/ross/docs/docs/application.md b/ross/docs/docs/application.md index 0797eeeb..f777fb97 100644 --- a/ross/docs/docs/application.md +++ b/ross/docs/docs/application.md @@ -2,7 +2,7 @@ sidebar_position: 4 --- -# Application Configuration +# Application The `application` block is the core configuration section in `ross.json` (or `config.json`). It controls server runtime behavior, application identity, logging verbosity, security policies (CORS and rate limiting), API versioning, health checks, and server-side variable injection. diff --git a/ross/docs/docs/authentication/_category_.json b/ross/docs/docs/authentication/_category_.json index e4991e02..04fb3f50 100644 --- a/ross/docs/docs/authentication/_category_.json +++ b/ross/docs/docs/authentication/_category_.json @@ -1,6 +1,6 @@ { "label": "Authentication", - "position": 7, + "position": 10, "link": { "type": "generated-index", "description": "Configure password login, SSO identity providers (OAuth2, OIDC, SAML), and static API keys for ROSS APIs." diff --git a/ross/docs/docs/cache/_category_.json b/ross/docs/docs/cache/_category_.json index b7f0a772..85b13d90 100644 --- a/ross/docs/docs/cache/_category_.json +++ b/ross/docs/docs/cache/_category_.json @@ -1,6 +1,6 @@ { "label": "Cache", - "position": 6, + "position": 7, "link": { "type": "generated-index", "description": "Configure the cache backend used by ROSS for OTPs, rate limiting, health checks, and custom endpoint data." diff --git a/ross/docs/docs/cli.md b/ross/docs/docs/cli.md index dd0336e9..a5a05bb3 100644 --- a/ross/docs/docs/cli.md +++ b/ross/docs/docs/cli.md @@ -18,8 +18,6 @@ ROSS provides a subcommand-driven command line interface (`ross`) for developmen | `ross config show` | | Resolve, redact secrets, and print full configuration | | `ross routes` | | List all registered API routes and methods | ---- - ## Configuration Path Resolution All commands accept an optional `-c, --config ` flag. When omitted, ROSS automatically locates your configuration file using the following resolution hierarchy: @@ -56,8 +54,6 @@ If none of these candidate files exist, ROSS exits with an error: No configuration file found. Provide one via -c, --config or create a ross.json in the current directory. ``` ---- - ## Commands ### `ross dev` @@ -98,8 +94,6 @@ ross dev -m --dangerously-allow-ddl ross dev -c ./my-config.json ``` ---- - ### `ross start` **Alias:** `ross serve` @@ -130,8 +124,6 @@ ross start ross serve -p 8080 ``` ---- - ### `ross build` Builds all custom TypeScript function endpoints declared in your configuration file into standalone, single-file bundles under `.ross/functions/`. @@ -161,8 +153,6 @@ ross build ross build -c ./configs/production.json -v ``` ---- - ### `ross migrate` **Alias:** `ross db:push` @@ -203,8 +193,6 @@ ross migrate --dangerously-allow-ddl ross db:push -m prod -c ./production.json ``` ---- - ### `ross config validate` **Top-Level Alias:** `ross check` @@ -238,8 +226,6 @@ ross check ross check -m prod ``` ---- - ### `ross config show` Resolves the configuration by evaluating environment variables (`env:VAR_NAME`) and applying framework defaults. Redacts sensitive credentials (passwords, JWT secrets, webhook tokens) by default. @@ -267,8 +253,6 @@ ross config show -m prod ross config show --raw ``` ---- - ### `ross routes` Prints a formatted list of all HTTP endpoints registered by the framework, including: diff --git a/ross/docs/docs/database/_category_.json b/ross/docs/docs/database/_category_.json index d9d35ae7..8523bc4c 100644 --- a/ross/docs/docs/database/_category_.json +++ b/ross/docs/docs/database/_category_.json @@ -1,6 +1,6 @@ { "label": "Database & Models", - "position": 5, + "position": 6, "link": { "type": "generated-index", "description": "Configure database connections and run migrations in ROSS." diff --git a/ross/docs/docs/database/configuration.md b/ross/docs/docs/database/configuration.md index 45d421b9..953227a6 100644 --- a/ross/docs/docs/database/configuration.md +++ b/ross/docs/docs/database/configuration.md @@ -7,6 +7,7 @@ sidebar_position: 1 The `infrastructure.database` section of your configuration defines your application's primary database connection. ROSS connects directly to your database, pools connections, and exposes model data through automatically generated REST APIs. ROSS supports three relational database engines: + - **PostgreSQL** (`"postgres"`) - **MySQL / MariaDB** (`"mysql"`) - **SQLite** (`"sqlite"`) @@ -115,6 +116,7 @@ Contains connection parameters. #### Properties #### `connection.url` + - **Type**: `string` - **Required**: **Yes** @@ -143,10 +145,13 @@ The maximum query execution timeout in milliseconds. If a query exceeds this dur - **Engine Identifier**: `"postgres"` - **Connection URL Format**: + ```text postgresql://[user[:password]@][host][:port][/dbname][?param1=value1] ``` + - **Example**: + ```json { "engine": "postgres", @@ -155,6 +160,7 @@ The maximum query execution timeout in milliseconds. If a query exceeds this dur } } ``` + - **Features**: - Native connection pooling with automatic pool sizing. - Full support for PostgreSQL data types, including UUIDs, native JSON/JSONB, timestamps with time zone, and enums. @@ -167,10 +173,13 @@ ROSS supports MySQL (v8.0+) and MariaDB. - **Engine Identifier**: `"mysql"` - **Connection URL Format**: + ```text mysql://[user[:password]@][host][:port][/dbname][?param1=value1] ``` + - **Example**: + ```json { "engine": "mysql", @@ -179,6 +188,7 @@ ROSS supports MySQL (v8.0+) and MariaDB. } } ``` + - **Features**: - Connection pooling with automatic reconnection handling. - Support for auto-incrementing integer primary keys and full-text indexes. @@ -192,6 +202,7 @@ SQLite requires zero installation or external database processes. - **Connection URL Format**: Relative file path (e.g. `./data/app.db`) or absolute file path (e.g. `/var/data/app.db`). - **Validation**: The path must end with `.db` or `.sqlite`. In-memory databases (`":memory:"`) are not supported; a persistent file path is required. - **Example**: + ```json { "engine": "sqlite", @@ -200,6 +211,7 @@ SQLite requires zero installation or external database processes. } } ``` + - **Features**: - **Automatic Directory Creation**: If the folder containing your SQLite database (such as `./data/`) does not exist, ROSS creates it automatically when the server starts. - High-performance, synchronous file operations wrapped in async Promise APIs for Fastify. @@ -291,6 +303,7 @@ If you need a complex SQL query (joins, aggregations, reporting) but don't want ``` ### Key Features + - **Dynamic Parameter Tokens**: Inject inputs safely using `[[source.param:type]]` tokens (e.g. `[[path.id:integer]]`, `[[query.status:string]]`, `[[body.title:string]]`). - **Automatic SQL Injection Protection**: ROSS compiles placeholder tokens into native parameterized queries (`$1` in PostgreSQL, `?` in SQLite/MySQL). Values are never concatenated into the SQL string directly. - **DML Safety**: Custom SQL endpoints only permit data retrieval and mutation queries (`SELECT`, `INSERT`, `UPDATE`, `DELETE`, `WITH`). DDL statements (`CREATE`, `ALTER`, `DROP`) are blocked by default. diff --git a/ross/docs/docs/openapi.md b/ross/docs/docs/openapi.md new file mode 100644 index 00000000..f9851519 --- /dev/null +++ b/ross/docs/docs/openapi.md @@ -0,0 +1,191 @@ +--- +sidebar_position: 5 +--- + +# OpenAPI & Swagger + +ROSS automatically inspects your data models, custom endpoints, authentication schemes, and route policies to generate an OpenAPI 3.0 compliant specification and serve an interactive Swagger UI. + +This provides instant, live API documentation with zero manual maintenance, allowing you and your team to explore routes, inspect request/response schemas, and execute test requests directly in your browser. + +## Overview & Architecture + +When your ROSS server initializes: + +1. **Schema Introspection**: ROSS translates data model field definitions, validations, and database constraints into standard JSON Schemas. +2. **OpenAPI Assembly**: Fastify registers `@fastify/swagger`, compiling route parameters, query filters, request bodies, and authentication headers into an OpenAPI 3.0 document. +3. **Swagger UI Mount**: Fastify registers `@fastify/swagger-ui`, rendering the interactive documentation dashboard at the configured path (defaults to `/docs`). +4. **Security Scheme Discovery**: If authentication is enabled, ROSS automatically configures the appropriate OpenAPI security scheme (`bearerAuth` for JWT or `apiKeyAuth` for API keys) and activates the Swagger UI **Authorize** button. + +## Configuration (`docs.openapi`) + +OpenAPI metadata and Swagger UI behavior are customized in the `docs.openapi` block of your application configuration: + +```json +{ + "docs": { + "openapi": { + "enabled": true, + "path": "/docs", + "info": { + "title": "E-Commerce API", + "description": "RESTful services for orders, inventory, and customer accounts", + "version": "1.0.0", + "termsOfService": "https://example.com/terms", + "contact": { + "name": "Acme Support Team", + "url": "https://example.com/support", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + } + } + } +} +``` + +### Configuration Options + +| Option | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| `enabled` | `boolean` | No | `true` in dev, `false` in prod | Controls whether Swagger UI and the OpenAPI endpoints are registered. | +| `path` | `string` | No | `"/docs"` | The URL path where Swagger UI is mounted at root level. | +| `info` | `object` | No | `{}` | OpenAPI metadata describing the API. | +| `info.title` | `string` | No | `application.name` | The title displayed in Swagger UI and OpenAPI exports. | +| `info.description` | `string` | No | `undefined` | A detailed description or summary of your API. | +| `info.version` | `string` | No | `"1.0.0"` | The semantic version of your API specification. | +| `info.termsOfService` | `string` | No | `undefined` | URL pointing to your API terms of service. Must be a valid URI. | +| `info.contact` | `object` | No | `undefined` | Contact information for the API maintainers. | +| `info.license` | `object` | No | `undefined` | License information for the API. | + +:::warning[Environment Defaults for `enabled`] + +By default, ROSS enables documentation in development mode (`mode: "dev"`) and deactivates it in production mode (`mode: "prod"`) to prevent exposing internal API specifications publicly: + +- **Development (`NODE_ENV !== "production"`)**: `enabled: true` +- **Production (`NODE_ENV === "production"`)**: `enabled: false` + +If you want live documentation in production (e.g. for a public developer platform), explicitly set `"enabled": true`. + +::: + +### Contact & License Specifications + +When declaring `contact` or `license`, ensure fields satisfy validation requirements: + +- **`contact`**: + - `name`: Must be at least 5 characters. + - `url`: Must be a valid URI (e.g. `https://example.com/contact`). + - `email`: Must be a valid email address. +- **`license`**: + - `name`: License identifier (e.g. `"MIT"` or `"Apache 2.0"`). Required if `license` is provided. + - `url`: URL pointing to the full license text. Must be a valid URI. + +## Interactive Swagger UI + +When enabled, Swagger UI is served directly at your configured path: + +```text +http://localhost:3000/docs +``` + +:::note + +Swagger UI is mounted at the root URL (e.g. `http://localhost:3000/docs`), outside of the `/api` prefix used for auto-generated endpoints. + +::: + +### Features + +- **Route Grouping**: Endpoints are organized into distinct collapsible tags (e.g. `Posts`, `Users`, `Custom Endpoints`) derived automatically or customized via `apis..tags`. +- **Live Requests ("Try it out")**: Test endpoints directly from the browser, with query filters, URL parameters, and JSON bodies validated in real time. +- **Deep Schema Explorer**: Expand request body schemas and HTTP response definitions to review data types, nullability, enums, and nested relations. + +## Authentication & Security Schemes + +ROSS automatically synchronizes your OpenAPI security configuration with your active authentication setup in `authentication`: + +### 1. JWT Bearer Authentication + +When using username/password (`up-auth`) or Single Sign-On (`sso`), ROSS registers an HTTP Bearer security scheme in OpenAPI: + +```json +{ + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + } +} +``` + +In Swagger UI, click the green **Authorize** button at the top right, enter your JWT access token, and all subsequent "Try it out" requests will include the `Authorization: Bearer ` header automatically. + +### 2. Static API Key Authentication + +When using static API key authentication (`authentication.providers: [{ "type": "api-key" }]`), ROSS registers an API Key header scheme: + +```json +{ + "components": { + "securitySchemes": { + "apiKeyAuth": { + "type": "apiKey", + "name": "x-api-key", + "in": "header" + } + } + } +} +``` + +The **Authorize** modal in Swagger UI prompts you for the `x-api-key` header value. + +## Schema Integration & Privacy Guardrails + +ROSS automatically reflects your database modeling and route policies in the generated OpenAPI schema while safeguarding sensitive data: + +### 1. Secret Field Exclusion + +Fields configured with `secret: true` in `data.models` (such as passwords, credit card tokens, or internal flags) are **automatically omitted** from: + +- Response schemas (success status codes 200/201). +- Request query parameters. +- Search filter bodies. + +If an endpoint explicitly enables `bypassSecret: true` in its `apis` policy (e.g. an administrative variant), the secret fields are restored to that endpoint's schema. + +### 2. Server-Side Parameters (SSP) Invisibility + +When a query or body parameter is configured under `serverSideParams` in `apis`, ROSS strips that parameter entirely from Swagger UI and OpenAPI documentation. Because the server enforces the value internally, consumers do not see it in the API contract. + +### 3. Query Whitelisting + +When a model route configures `supportedQueries` under `apis`, only the whitelisted query operators (e.g. `eq`, `gte`, `sort`) are rendered as query parameters in Swagger UI. All disabled query parameters are excluded. + +### 4. Custom Tags & Operations + +You can override the default tag grouping in Swagger UI for any route using the `tags` property in `apis`: + +```json +{ + "apis": { + "model.v1.orders.unknown.insert": { + "tags": ["Checkout & Billing"] + } + } +} +``` + +## Production Recommendations + +1. **Keep Disabled in Production by Default**: Leave `enabled: false` (the default in production) unless you are publishing a public developer API. +2. **Custom URL Mount**: If you publish documentation publicly, consider changing `path` from the default `/docs` to a branded endpoint such as `/developer/reference` or `/api-reference`. +3. **Accurate Metadata**: Provide `termsOfService`, `contact`, and `license` to ensure third-party API clients and SDK generators produce valid documentation. diff --git a/ross/docs/docs/rbac.md b/ross/docs/docs/rbac.md new file mode 100644 index 00000000..bc4baa81 --- /dev/null +++ b/ross/docs/docs/rbac.md @@ -0,0 +1,344 @@ +--- +sidebar_position: 14 +--- + +# Role-Based Access Control (RBAC) + +ROSS provides a built-in, declarative Role-Based Access Control (RBAC) engine that integrates seamlessly with your database models, JWT authentication, and endpoint policy configurations. + +With RBAC enabled, user roles stored in your database are automatically extracted during authentication, embedded directly into signed JWT claims, and verified against route policies in Fastify's `preValidation` hook before any business handlers or database queries run. + +## Architecture & How It Works + +```text +1. Authentication (Login / SSO) + Database User Record [roleField: "editor:senior"] + │ + ▼ + Generate JWT with Claims { "sub": 1, "role": "editor:senior" } + │ + ▼ +2. Client Request (Authorization: Bearer ) + │ + ▼ +3. PreValidation Hook + Extract user role: "editor:senior" + Lookup Route Policy: apis["model.v1.articles.id.edit"].roles -> ["editor:junior"] + Check Role Hierarchy: Is "editor:senior" authorized for "editor:junior"? -> Yes (200 OK) + Otherwise: Return 403 Forbidden +``` + +### Key Capabilities + +- **Hierarchical Inheritance**: Define parent/child role relationships (e.g. `admin` includes `manager`, which includes `editor`, which includes `viewer`). +- **Universal & Namespaced Wildcards in Hierarchies**: Use `"*"` to inherit all declared roles, or `"prefix:*"` (such as `"editor:*"`) to inherit all roles within a namespace inside `rbac.roles..includes`. +- **O(1) Verification**: ROSS precomputes transitive role inclusion maps at server startup, ensuring zero runtime overhead for permission checks. +- **Support for Scalar or Multi-Role Users**: Store roles as simple strings (e.g. `"admin"`), database enums, or arrays/JSON lists (e.g. `["editor", "billing"]`). + +## Configuration (`rbac`) + +Configure the `rbac` section in your root application configuration: + +```json +{ + "rbac": { + "enabled": true, + "modelName": "users", + "roleField": "role", + "defaultRole": "viewer", + "roles": { + "admin": { + "description": "Full administrative access", + "includes": ["*"] + }, + "manager": { + "description": "Operations and content management", + "includes": ["editor:*"] + }, + "editor:senior": { + "description": "Senior editor with publication privileges", + "includes": ["editor:junior", "viewer"] + }, + "editor:junior": { + "description": "Junior editor with drafting privileges", + "includes": ["viewer"] + }, + "viewer": { + "description": "Read-only access" + } + } + } +} +``` + +### Configuration Options + +| Option | Type | Required | Description | +| --- | --- | --- | --- | +| `enabled` | `boolean` | Yes | Toggles RBAC enforcement on or off. | +| `modelName` | `string` | Yes | The model in `data.models` that stores user accounts and role assignments. | +| `roleField` | `string` | Yes | The field name on `modelName` containing the user's role. Must be of type `string` or `enum`. | +| `defaultRole` | `string` | Yes | Fallback role applied when a user record has `null`, `undefined`, or an empty role value. Must exist in `roles`. | +| `roles` | `Record` | Yes | Dictionary defining all valid application roles and their inheritance hierarchies. | + +:::warning[Authentication Requirement] + +RBAC requires `authentication.enabled: true` with an identity provider (`up-auth` or `sso`). Static `api-key` authentication cannot be used with RBAC because API keys do not represent individual user identities. + +::: + +:::note[Enum Fields Validation] + +If `roleField` is configured as an `enum` type in `data.models..fields`, its `values` array must match the declared role keys in `rbac.roles` exactly. + +::: + +## Role Inheritance & Hierarchies + +Roles are configured in the `rbac.roles` dictionary. Role keys can contain alphanumeric characters, underscores, colons, and hyphens (`^[a-zA-Z0-9_:-]+$`). + +Each role accepts an optional `description` and an `includes` array specifying other roles it inherits: + +```typescript +interface RoleConfig { + description?: string; + includes?: string[]; +} +``` + +### 1. Reflexive Inclusion + +Every role implicitly includes itself. A route requiring `"viewer"` is automatically satisfied by any user holding the `"viewer"` role. + +### 2. Concrete Inheritance + +A role can explicitly include other declared roles: + +```json +{ + "editor:senior": { + "includes": ["editor:junior", "viewer"] + } +} +``` + +Any user assigned `"editor:senior"` satisfies routes requiring `"editor:senior"`, `"editor:junior"`, or `"viewer"`. + +### 3. Namespaced Wildcards (`prefix:*`) + +Use the `prefix:*` syntax to inherit all declared roles sharing a common namespace: + +```json +{ + "manager": { + "includes": ["editor:*"] + } +} +``` + +If your roles define `editor:senior` and `editor:junior`, `manager` automatically inherits both. + +:::note + +A wildcard pattern like `"editor:*"` must match at least one declared role in `rbac.roles`, or configuration validation will fail on startup. + +::: + +### 4. Universal Wildcard (`*`) + +Use `"*"` to inherit every role declared in `rbac.roles`: + +```json +{ + "admin": { + "includes": ["*"] + } +} +``` + +Users with the `"admin"` role automatically satisfy requirements for any endpoint across the application. + +### 5. Transitive Resolution + +Inheritance is resolved transitively using breadth-first traversal with cycle detection. If Role A includes Role B, and Role B includes Role C, Role A automatically inherits Role C: + +```text +admin ──(includes: ["*"])──> [manager, editor:senior, editor:junior, viewer] + │ +manager ──(includes: ["editor:*"])─┘ + │ +editor:senior ──(includes: ["editor:junior", "viewer"]) + │ +editor:junior ──(includes: ["viewer"]) + │ +viewer (base level) +``` + +## JWT Role Extraction + +When a user logs in via username/password (`POST /auth/login`) or completes an SSO callback (`POST /auth/sso/callback`), ROSS extracts the user's role from the field specified in `rbac.roleField` and injects it into the JWT payload: + +- **Single Role**: If `roleField` contains a string (e.g. `"admin"`), the token receives `{ "role": "admin" }`. +- **Multiple Roles**: If `roleField` contains an array or JSON array string (e.g. `["editor", "moderator"]`), the token receives `{ "roles": ["editor", "moderator"] }`. +- **Fallback to Default**: If the user record's role value is `null`, `undefined`, or empty, ROSS assigns `rbac.defaultRole`. + +During subsequent API requests, Fastify's authentication plugin decodes the token and populates `request.user.role` or `request.user.roles`. + +## Enforcing RBAC on Routes (`apis`) + +Route-level permissions are declared under the `apis` configuration section using the target route's API Identifier: + +```json +{ + "apis": { + "model.v1.articles.id.delete": { + "authorization": true, + "roles": ["admin"] + }, + "model.v1.articles.id.edit": { + "authorization": true, + "roles": ["editor:senior", "admin"] + }, + "model.v1.articles.unknown.insert": { + "authorization": true, + "roles": ["editor:junior"] + }, + "model.v1.articles.unknown.getAll": { + "authorization": false + } + } +} +``` + +### Rules & Behaviors + +1. **Explicit Authorization Required**: Any route entry specifying `roles` must explicitly declare `"authorization": true`. +2. **Concrete Roles on Routes**: Route policies accept concrete declared role names (e.g. `["admin"]` or `["editor:junior"]`). Wildcards (`*` and `prefix:*`) are strictly reserved for defining inheritance within `rbac.roles..includes`. +3. **Inherited Role Satisfaction**: A user's role satisfies a route policy if the user's role equals the required role or includes it through the hierarchy (e.g., a user with `admin` or `manager` satisfies routes requiring `editor:junior` because `admin` includes `*` and `manager` includes `editor:*`). +4. **No Roles Configured**: If a route specifies `"authorization": true` but omits `roles`, any authenticated user is permitted, and ROSS logs an informational warning. +5. **Access Denied Response**: When an authenticated user's role does not satisfy the route requirement, ROSS immediately halts execution and returns HTTP `403 Forbidden`: + +```json +{ + "statusCode": 403, + "message": "Forbidden: Insufficient permissions", + "data": null +} +``` + +## Practical Example + +Here is an end-to-end example configuring models, authentication, role hierarchies, and route protection: + +```json +{ + "application": { + "name": "Publishing Platform" + }, + "data": { + "models": { + "users": { + "fields": { + "id": { + "type": "integer", + "primaryKey": true, + "autoIncrement": true + }, + "email": { + "type": "string", + "unique": true + }, + "password": { + "type": "string", + "secret": true + }, + "role": { + "type": "string", + "nullable": false + } + } + }, + "articles": { + "fields": { + "id": { + "type": "integer", + "primaryKey": true, + "autoIncrement": true, + "apis": ["delete", "edit", "index"] + }, + "title": { + "type": "string", + "apis": ["edit", "search"] + }, + "content": { + "type": "text" + } + } + } + } + }, + "authentication": { + "enabled": true, + "jwtSecret": "env:JWT_SECRET", + "userModel": { + "modelName": "users", + "idField": "id", + "providerField": "provider" + }, + "providers": [ + { + "type": "up-auth", + "config": { + "fields": { + "usernameField": "email", + "passwordField": "password" + } + } + } + ] + }, + "rbac": { + "enabled": true, + "modelName": "users", + "roleField": "role", + "defaultRole": "subscriber", + "roles": { + "admin": { + "description": "Full access to all platform resources", + "includes": ["*"] + }, + "editor": { + "description": "Article authoring and publishing", + "includes": ["subscriber"] + }, + "subscriber": { + "description": "Read-only access to published content" + } + } + }, + "apis": { + "model.v1.articles.id.delete": { + "authorization": true, + "roles": ["admin"] + }, + "model.v1.articles.unknown.insert": { + "authorization": true, + "roles": ["editor"] + }, + "model.v1.articles.id.edit": { + "authorization": true, + "roles": ["editor"] + }, + "model.v1.articles.unknown.getAll": { + "authorization": false + } + } +} +``` + +In this setup: + +- Anyone can read articles (`model.v1.articles.unknown.getAll` is public). +- Users with `editor` or `admin` roles can create and edit articles. +- Only users with the `admin` role can delete articles. +- New users without a specified role automatically receive the `subscriber` role. diff --git a/ross/docs/docs/ssp.md b/ross/docs/docs/ssp.md new file mode 100644 index 00000000..e2323f0b --- /dev/null +++ b/ross/docs/docs/ssp.md @@ -0,0 +1,220 @@ +--- +sidebar_position: 12 +--- + +# Server-Side Parameters (SSP) + +Server-Side Parameters (SSP) allow you to inject, enforce, and override request parameters (`query` and `body`) on the server before route handlers execute. + +When a parameter is configured as a Server-Side Parameter, it is treated as strictly server-managed and is no longer available to end users: + +- **Invisible from Swagger / OpenAPI**: ROSS automatically strips the parameter from the public API schema and documentation (including query filters and schema required lists). +- **Clients Do Not Pass It**: Callers and API consumers do not need to supply the parameter in their requests. +- **Tamper-Proof Enforcement**: Even if a client sends the parameter in the request body or URL query string, ROSS overrides it with the server-configured value during request processing. + +This provides a declarative mechanism to enforce data ownership, tenant isolation, and administrative constraints without exposing internal parameters to end users. + +## Quick Example + +Server-Side Parameters are configured per endpoint under the `apis` configuration block using the route's API identifier: + +```json +{ + "apis": { + "model.v1.posts.unknown.post": { + "serverSideParams": [ + { + "type": "body", + "name": "author_id", + "value": "[[userId]]" + } + ] + }, + "model.v1.posts.unknown.getAll": { + "serverSideParams": [ + { + "type": "query", + "name": "tenant_id", + "value": 1 + } + ] + } + } +} +``` + +In this example: + +- Any `POST /api/v1/posts` request automatically has `request.body.author_id` set to the authenticated user's ID (`request.user.id`), preventing users from spoofing the author. +- Any `GET /api/v1/posts` request automatically filters by the literal server-defined `tenant_id` (`1`), preventing cross-tenant data leaks. + +## Configuration Reference + +Each entry in the `serverSideParams` array accepts the following properties: + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `type` | `"query" \| "body"` | **Yes** | Target location in the incoming request where the parameter is injected. | +| `name` | `string` | **Yes** | The parameter name to set. Must be a valid entity identifier. | +| `value` | `string \| number \| boolean` | **Yes** | The static value to assign, or a magic variable placeholder (`"[[varName]]"`). | + +### Parameter Types + +ROSS supports injecting values into two distinct parts of an HTTP request: + +- **`"body"`**: Injected into `request.body[name]`. Applies to mutation operations such as `POST`, `PUT`, and `PATCH`. +- **`"query"`**: Injected into `request.query[name]`. Applies to retrieval and filter operations such as `GET`, `search`, and `aggregate`. + +Path parameters (`type: "path"`) cannot have Server-Side Parameters. Because HTTP routing relies on URL path segments to resolve endpoints (such as `/:id`), path parameters cannot be omitted from request URLs without causing routing failures (`404 Not Found`). + +## Magic Variables + +Instead of hardcoding static values, you can use **magic variables** to dynamically resolve parameter values from the authenticated user or application runtime configuration. + +Magic variables use the double-bracket syntax: `[[variableName]]`. + +### Built-in Magic Variables + +ROSS provides built-in magic variables resolved from the authenticated user token: + +| Variable | Source | Description | +| :--- | :--- | :--- | +| `[[userId]]` | `request.user.id` | The unique ID of the currently authenticated user. | +| `[[userEmail]]` | `request.user.email` | The email address of the currently authenticated user. | + +If `request.user` is not populated (for example, on an unauthenticated public route), built-in magic variables resolve to `undefined`. + +### Custom Magic Variables + +You can define custom magic variables globally in `application.magicVariables`. Custom magic variables can hold strings, numbers, or booleans: + +```json +{ + "application": { + "name": "my-app", + "magicVariables": { + "defaultOrg": "org_production_01", + "defaultTenant": 1001, + "enforceActiveOnly": true + } + }, + "apis": { + "model.v1.documents.unknown.getAll": { + "serverSideParams": [ + { + "type": "query", + "name": "org_id", + "value": "[[defaultOrg]]" + }, + { + "type": "query", + "name": "is_active", + "value": "[[enforceActiveOnly]]" + } + ] + } + } +} +``` + +### Resolution Order and Fallback + +When ROSS encounters a value formatted as `[[varName]]`: + +1. **`application.magicVariables`**: ROSS first checks if `varName` is defined in custom magic variables. If present, that value is used. Custom magic variables take precedence and can override built-ins. +2. **`[[userId]]`**: Resolves to `request.user.id`. +3. **`[[userEmail]]`**: Resolves to `request.user.email`. +4. **Fallback**: If `varName` is not recognized, ROSS leaves the literal string `[[varName]]` as the value. + +Values without double brackets (including single brackets like `[userId]`) are treated as literal strings and assigned as-is. + +## OpenAPI / Swagger Integration + +ROSS automatically sanitizes generated OpenAPI and Swagger schemas so that server-side parameters are hidden from public API consumers: + +- **Query Parameters**: Any property in `querystring` matching an SSP query name is removed. In addition, all generated query filter variants (such as `field_eq`, `field_ne`, `field_lt`, `field_lte`, `field_gt`, `field_gte`, `field_in`) are stripped from the schema. +- **Body Parameters**: Any property in `body` matching an SSP body name is removed from the schema and removed from the `required` fields array. + +Because query and body parameters are removed from public schemas, API consumers are not prompted to provide internal or server-managed parameters in Swagger UI. Path parameters are not eligible for SSP because OpenAPI requires all path parameters in URL templates to remain defined, and HTTP routers require callers to supply them in the URL. + +## Execution Lifecycle + +Server-Side Parameters are enforced during Fastify's `preHandler` lifecycle hook: + +1. **Route Pre-Validation & Authentication**: The route's authentication hook validates bearer tokens or API keys and populates `request.user`. +2. **Schema Validation**: Fastify validates incoming request payloads against the route's AJV validation schema. +3. **SSP Enforcement (`preHandler`)**: ROSS executes `enforceSSP`, injecting configured static values and resolving magic variables against `request.user` and `application.magicVariables`. +4. **Route Handler**: The database operation or custom endpoint runs using the sanitized, server-enforced parameters. + +Because SSP runs in `preHandler`: + +- Authenticated user context (`request.user`) is guaranteed to be available for `[[userId]]` and `[[userEmail]]`. +- Injected server parameters cannot be spoofed by incoming client payloads. If a client attempts to pass a forbidden field, ROSS overwrites it. + +## Common Use Cases + +### 1. Enforcing Resource Ownership on Creation + +When creating records in a multi-user application, ensure that the created record always belongs to the authenticated caller: + +```json +{ + "apis": { + "model.v1.comments.unknown.post": { + "authorization": true, + "serverSideParams": [ + { + "type": "body", + "name": "user_id", + "value": "[[userId]]" + } + ] + } + } +} +``` + +Even if a malicious client sends `{"user_id": 9999, "content": "Hello"}` in the request body, ROSS replaces `user_id` with the authenticated caller's user ID before inserting the row into the database. + +### 2. Multi-Tenant Query Scoping + +In multi-tenant systems, prevent clients from querying data outside their organization by locking query filters: + +```json +{ + "apis": { + "model.v1.invoices.unknown.getAll": { + "authorization": true, + "serverSideParams": [ + { + "type": "query", + "name": "org_id", + "value": "[[defaultOrg]]" + } + ] + } + } +} +``` + +All index, filter, and pagination queries on `/api/v1/invoices` are automatically scoped to the configured organization ID. + +### 3. Soft-Delete and Status Defaults + +Enforce that public listings only return active or non-archived items: + +```json +{ + "apis": { + "model.v1.products.unknown.getAll": { + "serverSideParams": [ + { + "type": "query", + "name": "is_active", + "value": true + } + ] + } + } +} +``` diff --git a/ross/docs/docs/webhooks.md b/ross/docs/docs/webhooks.md new file mode 100644 index 00000000..71472bd1 --- /dev/null +++ b/ross/docs/docs/webhooks.md @@ -0,0 +1,178 @@ +--- +sidebar_position: 13 +--- + +# Webhooks + +ROSS provides an event-driven outbound webhook engine that automatically dispatches HTTP `POST` notifications to external endpoints when your API routes execute. + +Webhooks allow you to integrate ROSS with third-party systems such as triggering Slack or Discord notifications, syncing data to external CRMs, or streaming events to downstream microservices without writing custom dispatch logic. + +## Example Configuration + +Webhooks are configured under the `apis` configuration section using the target route's **API Identifier**: + +```json +{ + "apis": { + "model.v1.orders.unknown.post": { + "webhooks": [ + { + "url": "https://api.example.com/webhooks/order-events", + "data": ["body", "response"], + "triggerOnRequest": false, + "triggerOnResponse": true + } + ] + } + } +} +``` + +## Fields Reference + +Each entry in the `webhooks` array accepts the following properties: + +| Field | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `url` | `string` | **Yes** | The destination HTTP or HTTPS endpoint URL. Supports environment variables (e.g., `"env:ORDER_WEBHOOK_URL"`). | +| `data` | `string[]` | **Yes** | Array of request/response segments to include in the payload. Allowed values: `"body"`, `"query"`, `"params"`, `"response"`. | +| `triggerOnRequest` | `boolean` | **Yes** | If `true`, the webhook fires **before** the route handler executes. | +| `triggerOnResponse` | `boolean` | **Yes** | If `true`, the webhook fires **after** the route handler completes and passes the response data. | + +## Payload Structure + +ROSS constructs a unified JSON payload containing only the segments specified in the `data` array: + +```json +{ + "body": { ... }, + "query": { ... }, + "params": { ... }, + "response": { ... } +} +``` + +- **`body`**: Injected if `"body"` is present in `data`. Contains the incoming request body (`request.body`). +- **`query`**: Injected if `"query"` is present in `data`. Contains the URL search parameters (`request.query`). +- **`params`**: Injected if `"params"` is present in `data`. Contains dynamic route parameters (`request.params`, such as `:id`). +- **`response`**: Injected if `"response"` is present in `data` and the webhook was fired on a response trigger (`triggerOnResponse: true`). Contains the structured response payload returned by the handler. + +### HTTP Headers Sent by ROSS + +Every outbound webhook request includes the following standard headers: + +```http +POST /webhooks/order-events HTTP/1.1 +Host: api.example.com +Content-Type: application/json +X-Rocket-Webhook: true +``` + +The `X-Rocket-Webhook: true` header allows receiving servers to quickly identify and verify that the request originated from ROSS. + +## Trigger Lifecycle + +ROSS routes support two execution trigger points for webhooks: + +```text +Incoming Request + │ + ▼ +[Trigger: request] ──────► Fires webhooks with triggerOnRequest: true + │ (Payload contains body, query, params) + ▼ +Route Handler Executes +(Database operations, validation, business logic) + │ + ▼ +[Trigger: response] ──────► Fires webhooks with triggerOnResponse: true + │ (Payload contains body, query, params, response) + ▼ +Client Receives Response +``` + +### 1. `triggerOnRequest: true` + +Fires immediately before the route handler runs. Useful for: + +- Auditing incoming requests before mutation. +- Ingestion notifications. + +### 2. `triggerOnResponse: true` + +Fires immediately after the route handler successfully finishes and generates its response. Useful for: + +- Post-creation notifications (e.g. sending created database IDs or timestamps). +- Sending responses to downstream queues. + +## Error Handling & Reliability + +- **Non-blocking Execution:** Webhook delivery is performed using native `fetch`. +- **Fault Tolerance:** If a webhook endpoint is unreachable, times out, or responds with an HTTP error code (such as `500 Internal Server Error`), ROSS logs the failure at `warn` or `error` level. +- **Client Safety:** A webhook failure **never fails or crashes the primary client request**. Your API consumers will always receive their intended response regardless of whether the external webhook receiver is online. + +## Practical Examples + +### 1. Order Creation Event (Post-Response) + +Send the order body and the newly created database record to an analytics service after an order is inserted: + +```json +{ + "apis": { + "model.v1.orders.unknown.post": { + "webhooks": [ + { + "url": "https://analytics.internal/events/orders", + "data": ["body", "response"], + "triggerOnRequest": false, + "triggerOnResponse": true + } + ] + } + } +} +``` + +### 2. Audit Logging on User Updates + +Audit when user records are edited, sending the route parameters (user ID), update body, and query parameters: + +```json +{ + "apis": { + "model.v1.users.unknown.edit": { + "webhooks": [ + { + "url": "https://audit.internal/log", + "data": ["params", "body"], + "triggerOnRequest": true, + "triggerOnResponse": false + } + ] + } + } +} +``` + +### 3. Custom Endpoints Integration + +Webhooks work seamlessly with custom function and SQL endpoints using their custom API identifier: + +```json +{ + "apis": { + "custom.v1.all.unknown.processPayment": { + "webhooks": [ + { + "url": "https://notifications.service.com/payment-alert", + "data": ["body", "response"], + "triggerOnRequest": false, + "triggerOnResponse": true + } + ] + } + } +} +``` diff --git a/ross/docs/package-lock.json b/ross/docs/package-lock.json index 7051d259..11145236 100644 --- a/ross/docs/package-lock.json +++ b/ross/docs/package-lock.json @@ -23,6 +23,7 @@ "@docusaurus/tsconfig": "^3.10.2", "@docusaurus/types": "^3.10.2", "@types/react": "^19.0.0", + "markdownlint-cli": "^0.45.0", "typescript": "~6.0.2" }, "engines": { @@ -4294,6 +4295,39 @@ "import-meta-resolve": "^4.2.0" } }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz", + "integrity": "sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-9.0.0.tgz", + "integrity": "sha512-AokJm4tuBHillT+FpMtxQ60n8ObyXBatq7jD2/JA9dxbDDokKQm8KMht5ibGzLVU9IJDIKK4TPKgMHEYMn3lMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, "node_modules/@jest/schemas": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", @@ -6573,6 +6607,13 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "license": "MIT" }, + "node_modules/@types/katex": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.8.tgz", + "integrity": "sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/mdast": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", @@ -10612,6 +10653,36 @@ } } }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data-encoder": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", @@ -10767,6 +10838,31 @@ "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", "license": "ISC" }, + "node_modules/glob": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -10801,6 +10897,45 @@ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "license": "BSD-2-Clause" }, + "node_modules/glob/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz", + "integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/global-dirs": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", @@ -11990,6 +12125,22 @@ "node": ">=0.10.0" } }, + "node_modules/jackspeak": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.2.3.tgz", + "integrity": "sha512-ykkVRwrYvFm1nb2AJfKKYPr0emF6IiXDYUaFx4Zn9ZuIH7MrzEZ3sD5RlqGXNRpHtvUHJyOnCEFxOlNDtGo7wg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^9.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-util": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", @@ -12129,6 +12280,13 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "dev": true, + "license": "MIT" + }, "node_modules/jsonfile": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", @@ -12141,6 +12299,16 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonpointer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", + "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/katex": { "version": "0.18.10", "resolved": "https://registry.npmjs.org/katex/-/katex-0.18.10.tgz", @@ -12505,6 +12673,26 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "license": "MIT" }, + "node_modules/linkify-it": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", + "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/loader-runner": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", @@ -12641,6 +12829,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/markdown-it": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz", + "integrity": "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, "node_modules/markdown-table": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.1.0.tgz", @@ -12651,6 +12857,289 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/markdownlint": { + "version": "0.38.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.38.0.tgz", + "integrity": "sha512-xaSxkaU7wY/0852zGApM8LdlIfGCW8ETZ0Rr62IQtAnUMlMuifsg09vWJcNYeL4f0anvr8Vo4ZQar8jGpV0btQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromark": "4.0.2", + "micromark-core-commonmark": "2.0.3", + "micromark-extension-directive": "4.0.0", + "micromark-extension-gfm-autolink-literal": "2.1.0", + "micromark-extension-gfm-footnote": "2.1.0", + "micromark-extension-gfm-table": "2.1.1", + "micromark-extension-math": "3.1.0", + "micromark-util-types": "2.0.2" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/DavidAnson" + } + }, + "node_modules/markdownlint-cli": { + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.45.0.tgz", + "integrity": "sha512-GiWr7GfJLVfcopL3t3pLumXCYs8sgWppjIA1F/Cc3zIMgD3tmkpyZ1xkm1Tej8mw53B93JsDjgA3KOftuYcfOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "~13.1.0", + "glob": "~11.0.2", + "ignore": "~7.0.4", + "js-yaml": "~4.1.0", + "jsonc-parser": "~3.3.1", + "jsonpointer": "~5.0.1", + "markdown-it": "~14.1.0", + "markdownlint": "~0.38.0", + "minimatch": "~10.0.1", + "run-con": "~1.3.2", + "smol-toml": "~1.3.4" + }, + "bin": { + "markdownlint": "markdownlint.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/markdownlint-cli/node_modules/commander": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", + "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/markdownlint-cli/node_modules/ignore": { + "version": "7.0.16", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz", + "integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/markdownlint-cli/node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/markdownlint-cli/node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/markdownlint/node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/markdownlint/node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/markdownlint/node_modules/micromark-extension-directive": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-4.0.0.tgz", + "integrity": "sha512-/C2nqVmXXmiseSSuCdItCMho7ybwwop6RrrRPk0KbOHW21JKoCldC+8rFOaundDoRBUWBnJJcxeA/Kvi34WQXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "parse-entities": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/markdownlint/node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/markdownlint/node_modules/micromark-factory-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.1.0.tgz", + "integrity": "sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/markdownlint/node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/markdownlint/node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/markdownlint/node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, "node_modules/marked": { "version": "16.4.2", "resolved": "https://registry.npmjs.org/marked/-/marked-16.4.2.tgz", @@ -13156,6 +13645,13 @@ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "license": "CC0-1.0" }, + "node_modules/mdurl": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.1.0.tgz", + "integrity": "sha512-1+HBaOx0zi/dQWht8rNv9MYf9qqpqL/kxI0hXImU6Y547zM6Sni8BQibt7ifgMcYtQg41ao3Ivd6cnSM86inpg==", + "dev": true, + "license": "MIT" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -13855,6 +14351,112 @@ ], "license": "MIT" }, + "node_modules/micromark-extension-math": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-math/-/micromark-extension-math-3.1.0.tgz", + "integrity": "sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/katex": "^0.16.0", + "devlop": "^1.0.0", + "katex": "^0.16.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-math/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/micromark-extension-math/node_modules/katex": { + "version": "0.16.47", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.47.tgz", + "integrity": "sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg==", + "dev": true, + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "license": "MIT", + "dependencies": { + "commander": "^8.3.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-factory-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.1.0.tgz", + "integrity": "sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-math/node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, "node_modules/micromark-extension-mdx-expression": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", @@ -15179,6 +15781,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mrmime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", @@ -15638,6 +16250,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/package-manager-detector": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.9.0.tgz", @@ -15807,6 +16426,33 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "license": "MIT" }, + "node_modules/path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/path-to-regexp": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", @@ -17465,6 +18111,16 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pupa": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/pupa/-/pupa-3.3.0.tgz", @@ -18353,6 +19009,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/run-con": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.3.3.tgz", + "integrity": "sha512-Lb7OKM9aaykzyoNiHGhSVCjZsvbyy6qDMp2vDXL+MoCfz3GfNJtHYH7uYsU3QNMyInBk++xx+EZ8xZ8Sxs5fNQ==", + "dev": true, + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~7.0.0", + "minimist": "^1.2.8", + "strip-json-comments": "~3.1.1" + }, + "bin": { + "run-con": "cli.js" + } + }, + "node_modules/run-con/node_modules/ini": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-7.0.0.tgz", + "integrity": "sha512-ifK0CgjALofS5bkrcTy4RaQ9Vx2Knf/eLeIO+NaswQEpH1UblrtTSCIvN71qQDMq0PeQ/SSPojvEJp9vvvfr+w==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -18917,6 +19599,19 @@ "node": ">=8" } }, + "node_modules/smol-toml": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.4.tgz", + "integrity": "sha512-UOPtVuYkzYGee0Bd2Szz8d2G3RfMfJ2t3qVdZUAozZyAk+a0Sxa+QKix0YCwjL/A1RR0ar44nCxaoN9FxdJGwA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 18" + }, + "funding": { + "url": "https://github.com/sponsors/cyyynthia" + } + }, "node_modules/snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", @@ -19628,6 +20323,13 @@ "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, "node_modules/undici-types": { "version": "7.19.2", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", diff --git a/ross/docs/package.json b/ross/docs/package.json index 5631b831..8b4ed5ff 100644 --- a/ross/docs/package.json +++ b/ross/docs/package.json @@ -12,7 +12,8 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" + "typecheck": "tsc", + "lint:md": "markdownlint --rules rules/no-hr.cjs 'docs/**/*.md'" }, "dependencies": { "@docusaurus/core": "^3.10.2", @@ -30,6 +31,7 @@ "@docusaurus/tsconfig": "^3.10.2", "@docusaurus/types": "^3.10.2", "@types/react": "^19.0.0", + "markdownlint-cli": "^0.45.0", "typescript": "~6.0.2" }, "browserslist": { diff --git a/ross/docs/rules/no-hr.cjs b/ross/docs/rules/no-hr.cjs new file mode 100644 index 00000000..ebdcfea6 --- /dev/null +++ b/ross/docs/rules/no-hr.cjs @@ -0,0 +1,18 @@ +module.exports = { + names: ['no-hr', 'no-horizontal-rules'], + description: + 'Horizontal rules (---) are not allowed in documentation content', + tags: ['hr'], + function: function noHr(params, onError) { + for (const token of params.tokens) { + if (token.type === 'hr') { + onError({ + lineNumber: token.lineNumber, + detail: + "Horizontal rules ('---') are not allowed. Use markdown headings or whitespace instead.", + }); + } + } + }, +}; + diff --git a/ross/docs/src/components/Navbar/index.tsx b/ross/docs/src/components/Navbar/index.tsx index 72470b72..1ec7ef4e 100644 --- a/ross/docs/src/components/Navbar/index.tsx +++ b/ross/docs/src/components/Navbar/index.tsx @@ -50,7 +50,7 @@ export default function Navbar(): React.JSX.Element { {/* Desktop Navigation */}