Fix scope
This commit is contained in:
4
packages/core/locals.d.ts
vendored
4
packages/core/locals.d.ts
vendored
@@ -5,7 +5,7 @@
|
||||
* Referenced via triple-slash directive in the generated emdash-env.d.ts.
|
||||
*/
|
||||
|
||||
import type { User } from "@emdashcms/auth";
|
||||
import type { User } from "@emdash-cms/auth";
|
||||
|
||||
import type { EmDashHandlers, EmDashManifest } from "./dist/types.d.mts";
|
||||
|
||||
@@ -30,7 +30,7 @@ declare global {
|
||||
/**
|
||||
* Per-session Durable Object database for playground mode.
|
||||
*
|
||||
* Set by the playground middleware (@emdashcms/cloudflare). Read by
|
||||
* Set by the playground middleware (@emdash-cms/cloudflare). Read by
|
||||
* the runtime middleware and request-context middleware to set the
|
||||
* database in ALS for the current request.
|
||||
*
|
||||
|
||||
@@ -152,9 +152,9 @@
|
||||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emdashcms/admin": "workspace:*",
|
||||
"@emdashcms/auth": "workspace:*",
|
||||
"@emdashcms/gutenberg-to-portable-text": "workspace:*",
|
||||
"@emdash-cms/admin": "workspace:*",
|
||||
"@emdash-cms/auth": "workspace:*",
|
||||
"@emdash-cms/gutenberg-to-portable-text": "workspace:*",
|
||||
"@floating-ui/react": "^0.27.16",
|
||||
"@modelcontextprotocol/sdk": "^1.26.0",
|
||||
"@portabletext/toolkit": "^5.0.1",
|
||||
@@ -205,7 +205,7 @@
|
||||
"devDependencies": {
|
||||
"@apidevtools/swagger-parser": "^12.1.0",
|
||||
"@arethetypeswrong/cli": "catalog:",
|
||||
"@emdashcms/blocks": "workspace:*",
|
||||
"@emdash-cms/blocks": "workspace:*",
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/pg": "^8.16.0",
|
||||
"@types/sanitize-html": "^2.16.0",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Authorization helpers for API routes
|
||||
*
|
||||
* Thin wrappers around @emdashcms/auth RBAC that return HTTP responses.
|
||||
* Thin wrappers around @emdash-cms/auth RBAC that return HTTP responses.
|
||||
* Auth middleware handles authentication; these handle authorization.
|
||||
*/
|
||||
|
||||
import type { Permission, RoleLevel } from "@emdashcms/auth";
|
||||
import { hasPermission, canActOnOwn } from "@emdashcms/auth";
|
||||
import type { Permission, RoleLevel } from "@emdash-cms/auth";
|
||||
import { hasPermission, canActOnOwn } from "@emdash-cms/auth";
|
||||
|
||||
import { apiError } from "./error.js";
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* The user opens a browser, logs in, enters the code, and the CLI gets
|
||||
* an access + refresh token pair.
|
||||
*
|
||||
* Uses arctic for code generation and @emdashcms/auth for token utilities.
|
||||
* Uses arctic for code generation and @emdash-cms/auth for token utilities.
|
||||
*/
|
||||
|
||||
import { clampScopes } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { clampScopes } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* Implements the server side of the authorization code grant for MCP clients
|
||||
* (Claude Desktop, VS Code, etc.) per the MCP authorization spec (draft).
|
||||
*
|
||||
* Uses arctic for PKCE challenge generation and @emdashcms/auth for token
|
||||
* Uses arctic for PKCE challenge generation and @emdash-cms/auth for token
|
||||
* utilities. Token infrastructure is shared with the device flow.
|
||||
*/
|
||||
|
||||
import { clampScopes, computeS256Challenge } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { clampScopes, computeS256Challenge } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* role and reject disabled users.
|
||||
*/
|
||||
|
||||
import { toRoleLevel, type RoleLevel } from "@emdashcms/auth";
|
||||
import { toRoleLevel, type RoleLevel } from "@emdash-cms/auth";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
import type { Database } from "../../database/types.js";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { z } from "zod";
|
||||
import { roleLevel } from "./common.js";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// WebAuthn credential schemas (matching @emdashcms/auth/passkey types)
|
||||
// WebAuthn credential schemas (matching @emdash-cms/auth/passkey types)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const authenticatorTransport = z.enum(["usb", "nfc", "ble", "internal", "hybrid"]);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Astro integration for EmDash CMS (build-time only)
|
||||
*
|
||||
* For runtime APIs (loader, query functions, dialects), import from "emdash" directly.
|
||||
* For Cloudflare-specific adapters (d1, r2, access), import from "@emdashcms/cloudflare".
|
||||
* For Cloudflare-specific adapters (d1, r2, access), import from "@emdash-cms/cloudflare".
|
||||
*/
|
||||
|
||||
// Locals types (for typing Astro.locals in API routes)
|
||||
@@ -17,7 +17,7 @@ export type {
|
||||
} from "./types.js";
|
||||
|
||||
// Storage adapters (for integration config)
|
||||
// Note: For R2 bindings, use `r2()` from `@emdashcms/cloudflare`
|
||||
// Note: For R2 bindings, use `r2()` from `@emdash-cms/cloudflare`
|
||||
export { local, s3 } from "./storage/index.js";
|
||||
export type { StorageDescriptor, LocalStorageConfig, S3StorageConfig } from "./storage/index.js";
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface PluginDescriptor<TOptions = Record<string, unknown>> {
|
||||
id: string;
|
||||
/** Plugin version (semver) */
|
||||
version: string;
|
||||
/** Module specifier to import (e.g., "@emdashcms/plugin-api-test") */
|
||||
/** Module specifier to import (e.g., "@emdash-cms/plugin-api-test") */
|
||||
entrypoint: string;
|
||||
/**
|
||||
* Options to pass to createPlugin(). Native format only.
|
||||
@@ -87,7 +87,7 @@ export interface PluginDescriptor<TOptions = Record<string, unknown>> {
|
||||
*
|
||||
*/
|
||||
format?: "standard" | "native";
|
||||
/** Admin UI module specifier (e.g., "@emdashcms/plugin-audit-log/admin") */
|
||||
/** Admin UI module specifier (e.g., "@emdash-cms/plugin-audit-log/admin") */
|
||||
adminEntry?: string;
|
||||
/** Module specifier for site-side Astro rendering components (must export `blockComponents`) */
|
||||
componentsEntry?: string;
|
||||
@@ -153,8 +153,8 @@ export interface EmDashConfig {
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { auditLogPlugin } from "@emdashcms/plugin-audit-log";
|
||||
* import { webhookNotifierPlugin } from "@emdashcms/plugin-webhook-notifier";
|
||||
* import { auditLogPlugin } from "@emdash-cms/plugin-audit-log";
|
||||
* import { webhookNotifierPlugin } from "@emdash-cms/plugin-webhook-notifier";
|
||||
*
|
||||
* emdash({
|
||||
* plugins: [
|
||||
@@ -178,7 +178,7 @@ export interface EmDashConfig {
|
||||
* emdash({
|
||||
* plugins: [trustedPlugin()], // runs in host
|
||||
* sandboxed: [untrustedPlugin()], // runs in isolate
|
||||
* sandboxRunner: "@emdashcms/sandbox-cloudflare",
|
||||
* sandboxRunner: "@emdash-cms/sandbox-cloudflare",
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@@ -190,7 +190,7 @@ export interface EmDashConfig {
|
||||
* @example
|
||||
* ```ts
|
||||
* emdash({
|
||||
* sandboxRunner: "@emdashcms/sandbox-cloudflare",
|
||||
* sandboxRunner: "@emdash-cms/sandbox-cloudflare",
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@@ -200,13 +200,13 @@ export interface EmDashConfig {
|
||||
* Authentication configuration
|
||||
*
|
||||
* Use an auth adapter function from a platform package:
|
||||
* - `access({ teamDomain: "..." })` from `@emdashcms/cloudflare`
|
||||
* - `access({ teamDomain: "..." })` from `@emdash-cms/cloudflare`
|
||||
*
|
||||
* When an external auth provider is configured, passkey auth is disabled.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { access } from "@emdashcms/cloudflare";
|
||||
* import { access } from "@emdash-cms/cloudflare";
|
||||
*
|
||||
* emdash({
|
||||
* auth: access({
|
||||
@@ -256,7 +256,7 @@ export interface EmDashConfig {
|
||||
* ```ts
|
||||
* emdash({
|
||||
* marketplace: "https://marketplace.emdashcms.com",
|
||||
* sandboxRunner: "@emdashcms/sandbox-cloudflare",
|
||||
* sandboxRunner: "@emdash-cms/sandbox-cloudflare",
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
@@ -273,7 +273,7 @@ export interface EmDashConfig {
|
||||
*
|
||||
* Setup and auth middleware are skipped (the playground handles both).
|
||||
*
|
||||
* Requires `@emdashcms/cloudflare` as a dependency and a DO binding
|
||||
* Requires `@emdash-cms/cloudflare` as a dependency and a DO binding
|
||||
* in wrangler.jsonc.
|
||||
*
|
||||
* @example
|
||||
@@ -281,7 +281,7 @@ export interface EmDashConfig {
|
||||
* emdash({
|
||||
* database: playgroundDatabase({ binding: "PLAYGROUND_DB" }),
|
||||
* playground: {
|
||||
* middlewareEntrypoint: "@emdashcms/cloudflare/db/playground-middleware",
|
||||
* middlewareEntrypoint: "@emdash-cms/cloudflare/db/playground-middleware",
|
||||
* },
|
||||
* })
|
||||
* ```
|
||||
@@ -300,8 +300,8 @@ export interface EmDashConfig {
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { cloudflareImages, cloudflareStream } from "@emdashcms/cloudflare";
|
||||
* import { unsplash } from "@emdashcms/provider-unsplash";
|
||||
* import { cloudflareImages, cloudflareStream } from "@emdash-cms/cloudflare";
|
||||
* import { unsplash } from "@emdash-cms/provider-unsplash";
|
||||
*
|
||||
* emdash({
|
||||
* mediaProviders: [
|
||||
|
||||
@@ -55,19 +55,19 @@ import {
|
||||
*/
|
||||
function resolveAdminDist(): string {
|
||||
const require = createRequire(import.meta.url);
|
||||
const adminPath = require.resolve("@emdashcms/admin");
|
||||
const adminPath = require.resolve("@emdash-cms/admin");
|
||||
// Return the directory containing the built package (dist/)
|
||||
return dirname(adminPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve path to the admin package source directory.
|
||||
* In dev mode, we alias @emdashcms/admin to the source so Vite processes it
|
||||
* In dev mode, we alias @emdash-cms/admin to the source so Vite processes it
|
||||
* directly — giving instant HMR instead of requiring a rebuild + restart.
|
||||
*/
|
||||
function resolveAdminSource(): string | undefined {
|
||||
const require = createRequire(import.meta.url);
|
||||
const adminPath = require.resolve("@emdashcms/admin");
|
||||
const adminPath = require.resolve("@emdash-cms/admin");
|
||||
// dist/index.js -> go up to package root, then into src/
|
||||
const packageRoot = resolve(dirname(adminPath), "..");
|
||||
const srcEntry = resolve(packageRoot, "src", "index.ts");
|
||||
@@ -244,16 +244,16 @@ export function createViteConfig(
|
||||
|
||||
return {
|
||||
resolve: {
|
||||
dedupe: ["@emdashcms/admin", "react", "react-dom"],
|
||||
dedupe: ["@emdash-cms/admin", "react", "react-dom"],
|
||||
// Array form so more-specific entries are checked first.
|
||||
// The styles.css alias must come before the package alias, otherwise
|
||||
// Vite's prefix matching on "@emdashcms/admin" would resolve
|
||||
// "@emdashcms/admin/styles.css" through the source directory.
|
||||
// Vite's prefix matching on "@emdash-cms/admin" would resolve
|
||||
// "@emdash-cms/admin/styles.css" through the source directory.
|
||||
alias: [
|
||||
// CSS: always dist (pre-compiled by @tailwindcss/cli)
|
||||
{ find: "@emdashcms/admin/styles.css", replacement: resolve(adminDistPath, "styles.css") },
|
||||
{ find: "@emdash-cms/admin/styles.css", replacement: resolve(adminDistPath, "styles.css") },
|
||||
// JS: source in dev (HMR), dist in build
|
||||
{ find: "@emdashcms/admin", replacement: useSource ? adminSourcePath : adminDistPath },
|
||||
{ find: "@emdash-cms/admin", replacement: useSource ? adminSourcePath : adminDistPath },
|
||||
],
|
||||
},
|
||||
// eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Monorepo has both vite 6 (docs) and vite 7 (core). tsgo resolves correctly.
|
||||
@@ -264,7 +264,7 @@ export function createViteConfig(
|
||||
// ssr.external conflicts with @cloudflare/vite-plugin's resolve.external validation.
|
||||
ssr: cloudflare
|
||||
? {
|
||||
noExternal: ["emdash", "@emdashcms/admin"],
|
||||
noExternal: ["emdash", "@emdash-cms/admin"],
|
||||
// Pre-bundle EmDash's runtime deps for workerd. Without this,
|
||||
// Vite discovers them one-by-one on first request, causing workerd
|
||||
// to enter "worker cancelled" state on cold cache.
|
||||
@@ -288,10 +288,10 @@ export function createViteConfig(
|
||||
"emdash > sax",
|
||||
// Deeper transitive deps
|
||||
"emdash > sanitize-html > parse5",
|
||||
"emdash > @emdashcms/gutenberg-to-portable-text > @wordpress/block-serialization-default-parser",
|
||||
"emdash > @emdashcms/auth > @oslojs/crypto/ecdsa",
|
||||
"emdash > @emdashcms/auth > @oslojs/crypto/sha2",
|
||||
"emdash > @emdashcms/auth > @oslojs/webauthn",
|
||||
"emdash > @emdash-cms/gutenberg-to-portable-text > @wordpress/block-serialization-default-parser",
|
||||
"emdash > @emdash-cms/auth > @oslojs/crypto/ecdsa",
|
||||
"emdash > @emdash-cms/auth > @oslojs/crypto/sha2",
|
||||
"emdash > @emdash-cms/auth > @oslojs/webauthn",
|
||||
// React (commonly used, may be hoisted)
|
||||
"react",
|
||||
"react/jsx-dev-runtime",
|
||||
@@ -301,7 +301,7 @@ export function createViteConfig(
|
||||
// Top-level deps (use astro > path for pnpm compat)
|
||||
"astro > zod/v4",
|
||||
"astro > zod/v4/core",
|
||||
"@emdashcms/cloudflare > kysely-d1",
|
||||
"@emdash-cms/cloudflare > kysely-d1",
|
||||
// Astro internal deps not covered by @astrojs/cloudflare adapter
|
||||
"astro/virtual-modules/middleware.js",
|
||||
"astro/virtual-modules/live-config",
|
||||
@@ -314,14 +314,14 @@ export function createViteConfig(
|
||||
}
|
||||
: {
|
||||
external: NODE_NATIVE_EXTERNALS,
|
||||
noExternal: ["emdash", "@emdashcms/admin"],
|
||||
noExternal: ["emdash", "@emdash-cms/admin"],
|
||||
},
|
||||
optimizeDeps: {
|
||||
// When using source, don't pre-bundle JS — let Vite transform on the fly for HMR.
|
||||
// When using dist, pre-bundle to avoid re-optimization on first hydration.
|
||||
include: useSource
|
||||
? ["@astrojs/react/client.js"]
|
||||
: ["@emdashcms/admin", "@astrojs/react/client.js"],
|
||||
: ["@emdash-cms/admin", "@astrojs/react/client.js"],
|
||||
exclude: cloudflare ? [] : NODE_NATIVE_EXTERNALS,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
* we know setup is complete and users exist.
|
||||
*/
|
||||
|
||||
import type { User, RoleLevel } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import type { User, RoleLevel } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { defineMiddleware } from "astro:middleware";
|
||||
import { ulid } from "ulidx";
|
||||
// Import auth provider via virtual module (statically bundled)
|
||||
@@ -47,7 +47,7 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
// Role level constants (matching @emdashcms/auth)
|
||||
// Role level constants (matching @emdash-cms/auth)
|
||||
const ROLE_ADMIN = 50;
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
||||
const { user } = context.locals;
|
||||
const isEditor = !!user && user.role >= 30;
|
||||
|
||||
// Playground mode: the playground middleware (from @emdashcms/cloudflare) stashes
|
||||
// Playground mode: the playground middleware (from @emdash-cms/cloudflare) stashes
|
||||
// the per-session DO database on locals.__playgroundDb. We set it via ALS here
|
||||
// (same module instance as the loader) so getDb() picks it up correctly.
|
||||
const playgroundDb = context.locals.__playgroundDb;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* together with the admin app and available via React context.
|
||||
*/
|
||||
|
||||
import { AdminApp } from "@emdashcms/admin";
|
||||
import { AdminApp } from "@emdash-cms/admin";
|
||||
// @ts-ignore - virtual module generated by integration
|
||||
import { pluginAdmins } from "virtual:emdash/admin-registry";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This page serves the EmDash admin React SPA.
|
||||
* AdminWrapper imports plugin admin modules and passes them to AdminApp.
|
||||
*/
|
||||
import "@emdashcms/admin/styles.css";
|
||||
import "@emdash-cms/admin/styles.css";
|
||||
// Use package-qualified import so Astro generates a proper module URL
|
||||
// (relative imports resolve to absolute paths which break client hydration)
|
||||
import AdminWrapper from "emdash/routes/PluginRegistry";
|
||||
|
||||
@@ -10,8 +10,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { Role, roleFromLevel } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role, roleFromLevel } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -10,8 +10,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { Role, roleFromLevel } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role, roleFromLevel } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* DELETE /_emdash/api/admin/api-tokens/:id — Revoke a token
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, handleError, unwrapResult } from "#api/error.js";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* POST /_emdash/api/admin/api-tokens — Create a new token
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { requirePerm } from "#api/authorize.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { requirePerm } from "#api/authorize.js";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* DELETE /_emdash/api/admin/oauth-clients/:id — Delete a client
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* POST /_emdash/api/admin/oauth-clients — Register a new OAuth client
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* POST /_emdash/api/admin/users/:id/disable - Soft-disable a user
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* POST /_emdash/api/admin/users/:id/enable - Re-enable a disabled user
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* PUT /_emdash/api/admin/users/:id - Update user
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* Admin-initiated account recovery — sends a recovery magic link to the user's email.
|
||||
*/
|
||||
|
||||
import { Role, sendMagicLink, type MagicLinkConfig } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role, sendMagicLink, type MagicLinkConfig } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* GET /_emdash/api/admin/users - List users with search, filter, pagination
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
@@ -29,7 +29,7 @@ import { runMigrations } from "#db/migrations/runner.js";
|
||||
const DEV_USER_EMAIL = "dev@emdash.local";
|
||||
const DEV_USER_NAME = "Dev Admin";
|
||||
|
||||
// RBAC role levels (matching @emdashcms/auth)
|
||||
// RBAC role levels (matching @emdash-cms/auth)
|
||||
const ROLE_ADMIN = 50;
|
||||
|
||||
async function handleDevBypass(context: Parameters<APIRoute>[0]): Promise<Response> {
|
||||
@@ -49,7 +49,7 @@ async function handleDevBypass(context: Parameters<APIRoute>[0]): Promise<Respon
|
||||
// Ensure migrations are run
|
||||
await runMigrations(emdash.db);
|
||||
|
||||
// Find or create dev user (direct DB access to avoid @emdashcms/auth import issues in dev)
|
||||
// Find or create dev user (direct DB access to avoid @emdash-cms/auth import issues in dev)
|
||||
const existingUser = await emdash.db
|
||||
.selectFrom("users")
|
||||
.selectAll()
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { validateInvite, InviteError, roleFromLevel } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { validateInvite, InviteError, roleFromLevel } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { completeInvite, InviteError } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdashcms/auth/passkey";
|
||||
import { completeInvite, InviteError } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -13,8 +13,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createInvite, InviteError, Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { createInvite, InviteError, Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -11,8 +11,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { sendMagicLink, type MagicLinkConfig } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { sendMagicLink, type MagicLinkConfig } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { verifyMagicLink, MagicLinkError } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { verifyMagicLink, MagicLinkError } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError } from "#api/error.js";
|
||||
import { isSafeRedirect } from "#api/redirect.js";
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createAuthorizationUrl, type OAuthConsumerConfig } from "@emdashcms/auth";
|
||||
import { createAuthorizationUrl, type OAuthConsumerConfig } from "@emdash-cms/auth";
|
||||
|
||||
import { createOAuthStateStore } from "#auth/oauth-state-store.js";
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
Role,
|
||||
type OAuthConsumerConfig,
|
||||
type RoleLevel,
|
||||
} from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
} from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { createOAuthStateStore } from "#auth/oauth-state-store.js";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { generateAuthenticationOptions } from "@emdashcms/auth/passkey";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { generateAuthenticationOptions } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseOptionalBody } from "#api/parse.js";
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { generateRegistrationOptions } from "@emdashcms/auth/passkey";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { generateRegistrationOptions } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseOptionalBody } from "#api/parse.js";
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdashcms/auth/passkey";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { authenticateWithPasskey } from "@emdashcms/auth/passkey";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { authenticateWithPasskey } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -9,9 +9,9 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { completeSignup, SignupError } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdashcms/auth/passkey";
|
||||
import { completeSignup, SignupError } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { requestSignup } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { requestSignup } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { validateSignupToken, SignupError, roleFromLevel } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { validateSignupToken, SignupError, roleFromLevel } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* DELETE /_emdash/api/content/{collection}/{id} - Delete content
|
||||
*/
|
||||
|
||||
import { hasPermission, type Permission } from "@emdashcms/auth";
|
||||
import { hasPermission, type Permission } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
import { requirePerm, requireOwnerPerm } from "#api/authorize.js";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Accepts WXR file and import configuration, imports content into the database.
|
||||
*/
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import type { APIRoute } from "astro";
|
||||
import {
|
||||
parseWxrString,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* POST /_emdash/api/settings/email/test — send a test email through the full pipeline
|
||||
*/
|
||||
|
||||
import { escapeHtml } from "@emdashcms/auth";
|
||||
import { escapeHtml } from "@emdash-cms/auth";
|
||||
import type { APIRoute } from "astro";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdashcms/auth/passkey";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { verifyRegistrationResponse, registerPasskey } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { APIRoute } from "astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import { generateRegistrationOptions } from "@emdashcms/auth/passkey";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { generateRegistrationOptions } from "@emdash-cms/auth/passkey";
|
||||
|
||||
import { apiError, apiSuccess, handleError } from "#api/error.js";
|
||||
import { isParseError, parseBody } from "#api/parse.js";
|
||||
|
||||
@@ -31,7 +31,7 @@ import { applySeed } from "#seed/apply.js";
|
||||
import { loadSeed } from "#seed/load.js";
|
||||
import { validateSeed } from "#seed/validate.js";
|
||||
|
||||
// RBAC role levels (matching @emdashcms/auth)
|
||||
// RBAC role levels (matching @emdash-cms/auth)
|
||||
const ROLE_ADMIN = 50;
|
||||
|
||||
const DEV_USER_EMAIL = "dev@emdash.local";
|
||||
@@ -72,7 +72,7 @@ async function handleDevBypass(context: Parameters<APIRoute>[0]): Promise<Respon
|
||||
|
||||
const options = new OptionsRepository(emdash.db);
|
||||
|
||||
// Find or create dev user (direct DB access to avoid @emdashcms/auth import issues in dev)
|
||||
// Find or create dev user (direct DB access to avoid @emdash-cms/auth import issues in dev)
|
||||
const existingUser = await emdash.db
|
||||
.selectFrom("users")
|
||||
.selectAll()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* For Cloudflare R2 bindings, use `r2()` from `@emdashcms/cloudflare`.
|
||||
* For Cloudflare R2 bindings, use `r2()` from `@emdash-cms/cloudflare`.
|
||||
*/
|
||||
|
||||
import type { StorageDescriptor, S3StorageConfig, LocalStorageConfig } from "./types.js";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Re-exports config-time adapter functions and types.
|
||||
* Runtime entrypoints are in the emdash core package.
|
||||
*
|
||||
* For Cloudflare R2 bindings, use `r2()` from `@emdashcms/cloudflare`.
|
||||
* For Cloudflare R2 bindings, use `r2()` from `@emdash-cms/cloudflare`.
|
||||
*/
|
||||
|
||||
// Config-time adapter functions
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* - Runtime loads entrypoint and calls createStorage(config)
|
||||
*
|
||||
* Each adapter is responsible for accessing its own bindings.
|
||||
* For Cloudflare (R2), use `@emdashcms/cloudflare` package.
|
||||
* For Cloudflare (R2), use `@emdash-cms/cloudflare` package.
|
||||
*/
|
||||
|
||||
import type { Storage } from "../../index.js";
|
||||
@@ -27,7 +27,7 @@ export interface StorageDescriptor {
|
||||
* Each adapter accesses its own bindings directly:
|
||||
* - S3: uses credentials from config
|
||||
* - Local: uses filesystem path from config
|
||||
* - R2: use @emdashcms/cloudflare package
|
||||
* - R2: use @emdash-cms/cloudflare package
|
||||
*/
|
||||
export type CreateStorageFn = (config: Record<string, unknown>) => Storage;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* the locals interface that the middleware provides.
|
||||
*/
|
||||
|
||||
import type { Element } from "@emdashcms/blocks";
|
||||
import type { Element } from "@emdash-cms/blocks";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
// Re-export core types
|
||||
@@ -45,7 +45,7 @@ export interface ManifestCollection {
|
||||
*/
|
||||
export interface ManifestPlugin {
|
||||
version?: string;
|
||||
/** Package name for dynamic import (e.g., "@emdashcms/plugin-audit-log") */
|
||||
/** Package name for dynamic import (e.g., "@emdash-cms/plugin-audit-log") */
|
||||
package?: string;
|
||||
/** Whether the plugin is currently enabled */
|
||||
enabled?: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* API token generation and hashing utilities.
|
||||
*
|
||||
* Re-exports from @emdashcms/auth which owns the implementations.
|
||||
* Re-exports from @emdash-cms/auth which owns the implementations.
|
||||
* Uses Oslo.js (@oslojs/crypto, @oslojs/encoding) for all crypto.
|
||||
*
|
||||
* Token format: `ec_pat_<base64url>` (Personal Access Tokens)
|
||||
@@ -22,4 +22,4 @@ export {
|
||||
hasScope,
|
||||
computeS256Challenge,
|
||||
type ApiTokenScope,
|
||||
} from "@emdashcms/auth";
|
||||
} from "@emdash-cms/auth";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Stores WebAuthn challenges in a dedicated table with automatic expiration.
|
||||
*/
|
||||
|
||||
import type { ChallengeStore, ChallengeData } from "@emdashcms/auth/passkey";
|
||||
import type { ChallengeStore, ChallengeData } from "@emdash-cms/auth/passkey";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
import type { Database } from "../database/types.js";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Uses the existing table but with type="oauth" to distinguish from WebAuthn challenges.
|
||||
*/
|
||||
|
||||
import type { StateStore, OAuthState } from "@emdashcms/auth";
|
||||
import type { StateStore, OAuthState } from "@emdash-cms/auth";
|
||||
import type { Kysely } from "kysely";
|
||||
|
||||
import type { Database } from "../database/types.js";
|
||||
|
||||
@@ -37,7 +37,7 @@ export interface AuthDescriptor {
|
||||
/**
|
||||
* Module specifier to import at runtime
|
||||
* The module must export an `authenticate` function.
|
||||
* @example "@emdashcms/cloudflare/auth"
|
||||
* @example "@emdash-cms/cloudflare/auth"
|
||||
*/
|
||||
entrypoint: string;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* rest still run. Failures are logged but never surface to callers.
|
||||
*/
|
||||
|
||||
import { createKyselyAdapter, type AuthTables } from "@emdashcms/auth/adapters/kysely";
|
||||
import { createKyselyAdapter, type AuthTables } from "@emdash-cms/auth/adapters/kysely";
|
||||
import { sql, type Kysely } from "kysely";
|
||||
|
||||
import { cleanupExpiredChallenges } from "./auth/challenge-store.js";
|
||||
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
const TS_EXT_RE = /\.tsx?$/;
|
||||
const SLASH_RE = /\//g;
|
||||
const LEADING_AT_RE = /^@/;
|
||||
const emdash_SCOPE_RE = /^@emdashcms\//;
|
||||
const emdash_SCOPE_RE = /^@emdash-cms\//;
|
||||
|
||||
export const bundleCommand = defineCommand({
|
||||
meta: {
|
||||
@@ -179,7 +179,7 @@ export const bundleCommand = defineCommand({
|
||||
});
|
||||
|
||||
// Symlink plugin's node_modules so the built module can resolve
|
||||
// external dependencies (emdash, @emdashcms/*, etc.)
|
||||
// external dependencies (emdash, @emdash-cms/*, etc.)
|
||||
const pluginNodeModules = join(pluginDir, "node_modules");
|
||||
const tmpNodeModules = join(mainOutDir, "node_modules");
|
||||
if (await fileExists(pluginNodeModules)) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { createReadStream } from "node:fs";
|
||||
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import pc from "picocolors";
|
||||
|
||||
import { slugify } from "#utils/slugify.js";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Created once per worker lifetime, cached and reused across requests.
|
||||
*/
|
||||
|
||||
import type { Element } from "@emdashcms/blocks";
|
||||
import type { Element } from "@emdash-cms/blocks";
|
||||
import { Kysely, sql, type Dialect } from "kysely";
|
||||
|
||||
import { validateRev } from "./api/rev.js";
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Import reusable blocks from WordPress WXR exports as EmDash sections.
|
||||
*/
|
||||
|
||||
import type { PortableTextBlock } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import type { PortableTextBlock } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import type { Kysely } from "kysely";
|
||||
import { ulid } from "ulidx";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Provides full access to all content including drafts, custom post types, and ACF fields.
|
||||
*/
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
|
||||
import { encodeBase64 } from "../../utils/base64.js";
|
||||
import { ssrfSafeFetch, validateExternalUrl } from "../ssrf.js";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This wraps the existing WXR parsing and analysis logic.
|
||||
*/
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
|
||||
import { parseWxrString, type WxrData, type WxrPost } from "../../cli/wxr/parser.js";
|
||||
import type {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* to all produce the same normalized format for the import flow.
|
||||
*/
|
||||
|
||||
import type { PortableTextBlock } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import type { PortableTextBlock } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
|
||||
// =============================================================================
|
||||
// Author Types
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
||||
import type { Permission, RoleLevel } from "@emdashcms/auth";
|
||||
import { canActOnOwn, Role } from "@emdashcms/auth";
|
||||
import type { Permission, RoleLevel } from "@emdash-cms/auth";
|
||||
import { canActOnOwn, Role } from "@emdash-cms/auth";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { EmDashHandlers } from "../astro/types.js";
|
||||
|
||||
@@ -160,11 +160,11 @@ export interface SandboxRunner {
|
||||
|
||||
/**
|
||||
* Factory function type for creating sandbox runners.
|
||||
* Exported by platform adapters (e.g., @emdashcms/adapter-cloudflare/sandbox).
|
||||
* Exported by platform adapters (e.g., @emdash-cms/adapter-cloudflare/sandbox).
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // In @emdashcms/adapter-cloudflare/sandbox.ts
|
||||
* // In @emdash-cms/adapter-cloudflare/sandbox.ts
|
||||
* export const createSandboxRunner: SandboxRunnerFactory = (options) => {
|
||||
* return new CloudflareSandboxRunner(options);
|
||||
* };
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import type { Element } from "@emdashcms/blocks";
|
||||
import type { Element } from "@emdash-cms/blocks";
|
||||
import type { JSX } from "astro/jsx-runtime";
|
||||
import type { z } from "astro/zod";
|
||||
|
||||
@@ -1046,8 +1046,8 @@ export type SettingField =
|
||||
|
||||
/**
|
||||
* Block Kit element for block editing fields.
|
||||
* This is the `Element` discriminated union from `@emdashcms/blocks`.
|
||||
* Plugin authors should use `@emdashcms/blocks` builder functions to create these.
|
||||
* This is the `Element` discriminated union from `@emdash-cms/blocks`.
|
||||
* Plugin authors should use `@emdash-cms/blocks` builder functions to create these.
|
||||
*/
|
||||
export type PortableTextBlockField = Element;
|
||||
|
||||
@@ -1089,7 +1089,7 @@ export interface FieldWidgetConfig {
|
||||
* Admin configuration
|
||||
*/
|
||||
export interface PluginAdminConfig {
|
||||
/** Module specifier for admin UI exports (e.g., "@emdashcms/plugin-audit-log/admin") */
|
||||
/** Module specifier for admin UI exports (e.g., "@emdash-cms/plugin-audit-log/admin") */
|
||||
entry?: string;
|
||||
/** Settings schema for auto-generated UI */
|
||||
settingsSchema?: Record<string, SettingField>;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* in-memory SQLite database.
|
||||
*/
|
||||
|
||||
import { computeS256Challenge, Role } from "@emdashcms/auth";
|
||||
import { computeS256Challenge, Role } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Tests the full device flow lifecycle against a real in-memory SQLite database.
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* redirect URIs not in the client's registered set.
|
||||
*/
|
||||
|
||||
import { computeS256Challenge, Role } from "@emdashcms/auth";
|
||||
import { computeS256Challenge, Role } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import node from "@astrojs/node";
|
||||
import react from "@astrojs/react";
|
||||
import { colorPlugin } from "@emdashcms/plugin-color";
|
||||
import { colorPlugin } from "@emdash-cms/plugin-color";
|
||||
import { defineConfig } from "astro/config";
|
||||
import emdash from "emdash/astro";
|
||||
import { sqlite } from "emdash/db";
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"dependencies": {
|
||||
"@astrojs/node": "catalog:",
|
||||
"@astrojs/react": "catalog:",
|
||||
"@emdashcms/auth": "workspace:*",
|
||||
"@emdashcms/plugin-color": "workspace:*",
|
||||
"@emdash-cms/auth": "workspace:*",
|
||||
"@emdash-cms/plugin-color": "workspace:*",
|
||||
"astro": "catalog:",
|
||||
"better-sqlite3": "^11.10.0",
|
||||
"emdash": "workspace:*",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Tests the complete chain that would have caught bug #3:
|
||||
* signPreviewUrl → middleware builds header → snapshot endpoint parses and verifies
|
||||
*
|
||||
* The signing side (signPreviewUrl) lives in @emdashcms/cloudflare, but we
|
||||
* The signing side (signPreviewUrl) lives in @emdash-cms/cloudflare, but we
|
||||
* inline the same HMAC logic here to test the format contract without
|
||||
* cross-package imports.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ const SECRET = "test-preview-secret";
|
||||
|
||||
/**
|
||||
* Sign a preview URL using the same HMAC-SHA256 logic as
|
||||
* @emdashcms/cloudflare signPreviewUrl(). Inlined here so we test
|
||||
* @emdash-cms/cloudflare signPreviewUrl(). Inlined here so we test
|
||||
* the format contract without cross-package deps.
|
||||
*/
|
||||
async function signPreview(
|
||||
@@ -75,7 +75,7 @@ describe("preview snapshot auth flow", () => {
|
||||
VALUES ('p1', 'test-post', 'published', 'Test', 'Body', datetime('now'), datetime('now'), 1)
|
||||
`.execute(db);
|
||||
|
||||
// 2. Sign a preview URL (same logic as @emdashcms/cloudflare signPreviewUrl)
|
||||
// 2. Sign a preview URL (same logic as @emdash-cms/cloudflare signPreviewUrl)
|
||||
const signed = await signPreview("https://mysite.com");
|
||||
|
||||
// 3. Build the header the way the preview middleware does
|
||||
|
||||
@@ -12,7 +12,7 @@ import { createReadStream, existsSync } from "node:fs";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import { describe, it, expect, beforeAll } from "vitest";
|
||||
|
||||
import { parseWxr } from "../../../src/cli/wxr/parser.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthAdapter } from "@emdashcms/auth";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import type { AuthAdapter } from "@emdash-cms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unit tests for API token generation, hashing, and scope utilities.
|
||||
*/
|
||||
|
||||
import { Role, scopesForRole, clampScopes } from "@emdashcms/auth";
|
||||
import { Role, scopesForRole, clampScopes } from "@emdash-cms/auth";
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdashcms/auth";
|
||||
import type { EmailMessage } from "@emdashcms/auth";
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdash-cms/auth";
|
||||
import type { EmailMessage } from "@emdash-cms/auth";
|
||||
import {
|
||||
Role,
|
||||
createInvite,
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
InviteError,
|
||||
escapeHtml,
|
||||
generateToken,
|
||||
} from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
} from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthAdapter, Credential, User } from "@emdashcms/auth";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import type { AuthAdapter, Credential, User } from "@emdash-cms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdashcms/auth";
|
||||
import type { EmailMessage } from "@emdashcms/auth";
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdash-cms/auth";
|
||||
import type { EmailMessage } from "@emdash-cms/auth";
|
||||
import {
|
||||
Role,
|
||||
canSignup,
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
validateSignupToken,
|
||||
completeSignup,
|
||||
SignupError,
|
||||
} from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
} from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Tests for the cleanup subsystems.
|
||||
*
|
||||
* Note: runSystemCleanup() is not tested directly here because it imports
|
||||
* from @emdashcms/auth/adapters/kysely, which requires the auth package to
|
||||
* from @emdash-cms/auth/adapters/kysely, which requires the auth package to
|
||||
* be built. Instead, we test each subsystem independently:
|
||||
* - cleanupExpiredChallenges: tested in auth/challenge-store.test.ts
|
||||
* - deleteExpiredTokens: tested below using direct DB operations
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { EmDashHandlers } from "../../../src/astro/types.js";
|
||||
|
||||
@@ -40,11 +40,11 @@ describe("definePlugin", () => {
|
||||
|
||||
it("accepts valid scoped ID", () => {
|
||||
const plugin = definePlugin({
|
||||
id: "@emdashcms/seo-plugin",
|
||||
id: "@emdash-cms/seo-plugin",
|
||||
version: "1.0.0",
|
||||
});
|
||||
|
||||
expect(plugin.id).toBe("@emdashcms/seo-plugin");
|
||||
expect(plugin.id).toBe("@emdash-cms/seo-plugin");
|
||||
});
|
||||
|
||||
it("accepts scoped ID with numbers", () => {
|
||||
|
||||
Reference in New Issue
Block a user