openadminjs 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -18
- package/dist/create-project.js +27 -4
- package/dist/create-project.test.js +57 -41
- package/dist/index.js +16 -5
- package/package.json +4 -2
- package/template/.env.example +2 -2
- package/template/README.md +24 -5
- package/template/apps/admin/app/api/auth/login/route.ts +51 -0
- package/template/apps/admin/app/api/auth/logout/route.ts +11 -0
- package/template/apps/admin/app/api/auth/refresh/route.ts +46 -0
- package/template/apps/admin/app/api-tokens/page.tsx +253 -0
- package/template/apps/admin/app/audit-logs/page.tsx +5 -0
- package/template/apps/admin/app/dashboard/page.tsx +392 -0
- package/template/apps/admin/app/files/page.tsx +5 -0
- package/template/apps/admin/app/globals.css +206 -0
- package/template/apps/admin/app/jobs/page.tsx +19 -0
- package/template/apps/admin/app/layout.tsx +57 -0
- package/template/apps/admin/app/login/page.test.tsx +18 -0
- package/template/apps/admin/app/login/page.tsx +161 -0
- package/template/apps/admin/app/login/safe-next-param.ts +4 -0
- package/template/apps/admin/app/notifications/page.tsx +146 -0
- package/template/apps/admin/app/page.tsx +5 -0
- package/template/apps/admin/app/plugins/page.tsx +407 -0
- package/template/apps/admin/app/profile/page.tsx +116 -0
- package/template/apps/admin/app/resources/[resource]/[id]/edit/page.tsx +45 -0
- package/template/apps/admin/app/resources/[resource]/[id]/page.tsx +449 -0
- package/template/apps/admin/app/resources/[resource]/create/page.tsx +34 -0
- package/template/apps/admin/app/resources/[resource]/page.tsx +100 -0
- package/template/apps/admin/app/settings/page.tsx +233 -0
- package/template/apps/admin/components/ai-assistant-widget.tsx +684 -0
- package/template/apps/admin/components/app-shell.tsx +305 -0
- package/template/apps/admin/components/auth-guard.test.tsx +55 -0
- package/template/apps/admin/components/auth-guard.tsx +39 -0
- package/template/apps/admin/components/jobs-panel.tsx +103 -0
- package/template/apps/admin/components/logo.tsx +30 -0
- package/template/apps/admin/components/resource-form.tsx +349 -0
- package/template/apps/admin/components/resource-table.tsx +277 -0
- package/template/apps/admin/lib/ai-events.ts +23 -0
- package/template/apps/admin/lib/api.test.ts +118 -0
- package/template/apps/admin/lib/api.ts +135 -0
- package/template/apps/admin/lib/auth-flow.e2e.test.ts +79 -0
- package/template/apps/admin/lib/brand.ts +14 -0
- package/template/apps/admin/lib/locale.ts +49 -0
- package/template/apps/admin/lib/tokens.ts +93 -0
- package/template/apps/admin/middleware.ts +58 -0
- package/template/apps/admin/next-env.d.ts +6 -0
- package/template/apps/admin/next.config.mjs +7 -0
- package/template/apps/admin/package.json +44 -0
- package/template/apps/admin/postcss.config.mjs +6 -0
- package/template/apps/admin/public/brand/apple-touch-icon.png +0 -0
- package/template/apps/admin/public/brand/favicon.svg +1 -0
- package/template/apps/admin/public/brand/og-image.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
- package/template/apps/admin/tailwind.config.ts +37 -0
- package/template/apps/admin/tsconfig.json +23 -0
- package/template/apps/admin/vitest.config.ts +7 -0
- package/template/apps/api/package.json +56 -0
- package/template/apps/api/plugins.manifest.example.json +34 -0
- package/template/apps/api/plugins.manifest.json +4 -0
- package/template/apps/api/src/access/catalog.ts +112 -0
- package/template/apps/api/src/access/derive-permissions.test.ts +26 -0
- package/template/apps/api/src/access/derive-permissions.ts +36 -0
- package/template/apps/api/src/access/public-catalog.ts +28 -0
- package/template/apps/api/src/admin/admin-ai.controller.ts +125 -0
- package/template/apps/api/src/admin/admin-ai.events.ts +23 -0
- package/template/apps/api/src/admin/admin-ai.service.ts +1271 -0
- package/template/apps/api/src/admin/admin-analytics.service.ts +164 -0
- package/template/apps/api/src/admin/admin-plugins.controller.ts +32 -0
- package/template/apps/api/src/admin/admin-plugins.service.ts +267 -0
- package/template/apps/api/src/admin/admin-resource.service.test.ts +118 -0
- package/template/apps/api/src/admin/admin-resource.service.ts +375 -0
- package/template/apps/api/src/admin/admin.controller.ts +72 -0
- package/template/apps/api/src/admin/admin.module.ts +30 -0
- package/template/apps/api/src/admin/dto/plugins.dto.ts +55 -0
- package/template/apps/api/src/admin/validate-resource-payload.test.ts +44 -0
- package/template/apps/api/src/admin/validate-resource-payload.ts +103 -0
- package/template/apps/api/src/app.module.ts +45 -0
- package/template/apps/api/src/auth/auth.controller.ts +70 -0
- package/template/apps/api/src/auth/auth.dto.ts +49 -0
- package/template/apps/api/src/auth/auth.module.ts +30 -0
- package/template/apps/api/src/auth/auth.service.test.ts +75 -0
- package/template/apps/api/src/auth/auth.service.ts +231 -0
- package/template/apps/api/src/common/auth-realm.decorator.ts +6 -0
- package/template/apps/api/src/common/auth.guard.test.ts +61 -0
- package/template/apps/api/src/common/auth.guard.ts +78 -0
- package/template/apps/api/src/common/casl-ability.factory.test.ts +33 -0
- package/template/apps/api/src/common/casl-ability.factory.ts +41 -0
- package/template/apps/api/src/common/current-user.decorator.ts +6 -0
- package/template/apps/api/src/common/permission.decorator.ts +7 -0
- package/template/apps/api/src/common/permissions.guard.ts +31 -0
- package/template/apps/api/src/common/prisma.service.ts +13 -0
- package/template/apps/api/src/health/health.controller.ts +25 -0
- package/template/apps/api/src/mail/mail.module.ts +9 -0
- package/template/apps/api/src/mail/mail.service.ts +115 -0
- package/template/apps/api/src/main.ts +37 -0
- package/template/apps/api/src/plugins/bootstrap.ts +4 -0
- package/template/apps/api/src/plugins/bundled/admin-widget.plugin.ts +25 -0
- package/template/apps/api/src/plugins/bundled/hello.plugin.ts +19 -0
- package/template/apps/api/src/plugins/bundled/image-optimizer.plugin.ts +22 -0
- package/template/apps/api/src/plugins/bundled/registry.ts +13 -0
- package/template/apps/api/src/plugins/bundled/seo.plugin.ts +25 -0
- package/template/apps/api/src/plugins/manifest-path.ts +35 -0
- package/template/apps/api/src/plugins/manifest.schema.test.ts +36 -0
- package/template/apps/api/src/plugins/manifest.schema.ts +58 -0
- package/template/apps/api/src/plugins/plugin-api.interceptor.ts +47 -0
- package/template/apps/api/src/plugins/plugin-loader.ts +134 -0
- package/template/apps/api/src/plugins/plugin-runtime.test.ts +24 -0
- package/template/apps/api/src/plugins/plugin-runtime.ts +85 -0
- package/template/apps/api/src/queue/queue.controller.ts +28 -0
- package/template/apps/api/src/queue/queue.module.ts +23 -0
- package/template/apps/api/src/queue/queue.processor.ts +47 -0
- package/template/apps/api/src/queue/queue.service.ts +50 -0
- package/template/apps/api/src/resources/categories.resource.ts +21 -0
- package/template/apps/api/src/resources/commerce.resource.ts +157 -0
- package/template/apps/api/src/resources/operations.resource.ts +111 -0
- package/template/apps/api/src/resources/posts.resource.ts +88 -0
- package/template/apps/api/src/resources/registry.ts +27 -0
- package/template/apps/api/src/resources/resource-hooks.install.ts +18 -0
- package/template/apps/api/src/resources/resource-hooks.registry.test.ts +72 -0
- package/template/apps/api/src/resources/resource-hooks.registry.ts +66 -0
- package/template/apps/api/src/resources/resource-hooks.runner.ts +93 -0
- package/template/apps/api/src/resources/system.resource.ts +51 -0
- package/template/apps/api/src/resources/users.resource.ts +19 -0
- package/template/apps/api/src/store/payment/payment.controller.ts +98 -0
- package/template/apps/api/src/store/payment/payment.module.ts +14 -0
- package/template/apps/api/src/store/payment/payment.provider.ts +38 -0
- package/template/apps/api/src/store/payment/payment.service.ts +235 -0
- package/template/apps/api/src/store/store.controller.ts +26 -0
- package/template/apps/api/src/store/store.module.ts +12 -0
- package/template/apps/api/src/test-setup.ts +1 -0
- package/template/apps/api/tsconfig.json +11 -0
- package/template/apps/api/vitest.config.ts +21 -0
- package/template/apps/web/lib/openadmin-client.ts +11 -0
- package/template/apps/web/lib/seo.test.ts +41 -0
- package/template/apps/web/lib/seo.ts +24 -13
- package/template/apps/web/next-env.d.ts +4 -0
- package/template/apps/web/package.json +2 -1
- package/template/apps/web/test/next-stub.ts +7 -0
- package/template/apps/web/vitest.config.ts +19 -0
- package/template/package.json +18 -11
- package/template/packages/auth/package.json +17 -0
- package/template/packages/auth/src/index.test.ts +10 -0
- package/template/packages/auth/src/index.ts +17 -0
- package/template/packages/auth/tsconfig.json +8 -0
- package/template/packages/brand/apps/admin/public/brand/apple-touch-icon.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/favicon.svg +1 -0
- package/template/packages/brand/apps/admin/public/brand/og-image.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
- package/template/packages/brand/apps/web/public/brand/apple-touch-icon.png +0 -0
- package/template/packages/brand/apps/web/public/brand/favicon.svg +1 -0
- package/template/packages/brand/apps/web/public/brand/og-image.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-icon-new.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-logo-new.png +0 -0
- package/template/packages/brand/package.json +19 -0
- package/template/packages/brand/site/assets/brand/favicon.svg +1 -0
- package/template/packages/brand/site/assets/brand/og-image.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-icon.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-dark.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-horizontal.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-monochrome.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo.svg +1 -0
- package/template/packages/brand/src/generate-assets.mjs +182 -0
- package/template/packages/brand/src/index.test.ts +9 -0
- package/template/packages/brand/src/index.ts +7 -0
- package/template/packages/brand/tsconfig.json +7 -0
- package/template/packages/core/package.json +20 -0
- package/template/packages/core/src/index.js +1 -0
- package/template/packages/core/src/index.test.ts +27 -0
- package/template/packages/core/src/index.ts +61 -0
- package/template/packages/core/tsconfig.json +8 -0
- package/template/packages/mail/package.json +18 -0
- package/template/packages/mail/src/index.test.ts +23 -0
- package/template/packages/mail/src/index.ts +246 -0
- package/template/packages/mail/tsconfig.json +5 -0
- package/template/packages/notifications/package.json +16 -0
- package/template/packages/notifications/src/index.test.ts +9 -0
- package/template/packages/notifications/src/index.ts +5 -0
- package/template/packages/notifications/tsconfig.json +5 -0
- package/template/packages/payments/package.json +15 -0
- package/template/packages/payments/src/index.ts +256 -0
- package/template/packages/payments/tsconfig.json +9 -0
- package/template/packages/permissions/package.json +17 -0
- package/template/packages/permissions/src/blueprints.js +57 -0
- package/template/packages/permissions/src/blueprints.test.ts +62 -0
- package/template/packages/permissions/src/blueprints.ts +89 -0
- package/template/packages/permissions/src/index.js +11 -0
- package/template/packages/permissions/src/index.test.ts +34 -0
- package/template/packages/permissions/src/index.ts +22 -0
- package/template/packages/permissions/tsconfig.json +8 -0
- package/template/packages/plugin-sdk/package.json +26 -0
- package/template/packages/plugin-sdk/src/hooks.ts +135 -0
- package/template/packages/plugin-sdk/src/index.ts +42 -0
- package/template/packages/plugin-sdk/src/sdk.test.ts +13 -0
- package/template/packages/plugin-sdk/tsconfig.json +8 -0
- package/template/packages/plugin-sdk/vitest.config.ts +5 -0
- package/template/packages/queue/package.json +16 -0
- package/template/packages/queue/src/index.test.ts +12 -0
- package/template/packages/queue/src/index.ts +6 -0
- package/template/packages/queue/tsconfig.json +5 -0
- package/template/packages/resource/package.json +17 -0
- package/template/packages/resource/src/index.js +177 -0
- package/template/packages/resource/src/index.test.ts +151 -0
- package/template/packages/resource/src/index.ts +344 -0
- package/template/packages/resource/tsconfig.json +8 -0
- package/template/packages/storage/package.json +16 -0
- package/template/packages/storage/src/index.test.ts +10 -0
- package/template/packages/storage/src/index.ts +23 -0
- package/template/packages/storage/tsconfig.json +5 -0
- package/template/prisma/migrations/20260505151751_baseline_init_all_tables/migration.sql +371 -0
- package/template/prisma/migrations/migration_lock.toml +3 -0
- package/template/prisma/schema.prisma +291 -0
- package/template/prisma/seed.ts +217 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openadminjs/notifications",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.json",
|
|
8
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
9
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
10
|
+
"test": "vitest run"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"typescript": "^5.7.2",
|
|
14
|
+
"vitest": "^2.1.8"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import type { NotificationMessage } from "./index";
|
|
3
|
+
|
|
4
|
+
describe("NotificationMessage", () => {
|
|
5
|
+
it("accepts optional body", () => {
|
|
6
|
+
const msg: NotificationMessage = { userId: "u1", title: "Hello" };
|
|
7
|
+
expect(msg.body).toBeUndefined();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openadminjs/payments",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
|
+
"description": "Payment provider abstractions for OpenAdminJS (Stripe, Mock, extensible)",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc -p tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"typescript": "^5.7.2",
|
|
13
|
+
"stripe": "^17.0.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// @openadminjs/payments — payment provider abstraction layer
|
|
3
|
+
//
|
|
4
|
+
// Usage:
|
|
5
|
+
// import { MockPaymentProvider, type PaymentProvider } from "@openadminjs/payments";
|
|
6
|
+
// const provider = process.env.STRIPE_SECRET_KEY
|
|
7
|
+
// ? new StripePaymentProvider(process.env.STRIPE_SECRET_KEY)
|
|
8
|
+
// : new MockPaymentProvider();
|
|
9
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export type Currency = string; // ISO 4217, e.g. "USD", "EUR"
|
|
12
|
+
|
|
13
|
+
export type OrderLineItem = {
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
/** Unit price in smallest currency unit (cents for USD) */
|
|
17
|
+
unitAmount: number;
|
|
18
|
+
quantity: number;
|
|
19
|
+
productId?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CheckoutInput = {
|
|
23
|
+
/** Your internal order ID */
|
|
24
|
+
orderId: string;
|
|
25
|
+
lineItems: OrderLineItem[];
|
|
26
|
+
currency: Currency;
|
|
27
|
+
/** Where to redirect after successful payment */
|
|
28
|
+
successUrl: string;
|
|
29
|
+
/** Where to redirect on cancel */
|
|
30
|
+
cancelUrl: string;
|
|
31
|
+
/** Customer email (optional, pre-fills checkout form) */
|
|
32
|
+
customerEmail?: string;
|
|
33
|
+
metadata?: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type CheckoutResult = {
|
|
37
|
+
/** URL to redirect the user to for payment */
|
|
38
|
+
checkoutUrl: string;
|
|
39
|
+
/** Provider-side session / intent ID */
|
|
40
|
+
providerSessionId: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type WebhookEventType =
|
|
44
|
+
| "payment.succeeded"
|
|
45
|
+
| "payment.failed"
|
|
46
|
+
| "payment.refunded"
|
|
47
|
+
| "checkout.expired"
|
|
48
|
+
| "unknown";
|
|
49
|
+
|
|
50
|
+
export type WebhookEvent = {
|
|
51
|
+
type: WebhookEventType;
|
|
52
|
+
orderId: string | null;
|
|
53
|
+
providerEventId: string;
|
|
54
|
+
amount?: number;
|
|
55
|
+
currency?: Currency;
|
|
56
|
+
raw: unknown;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type RefundInput = {
|
|
60
|
+
providerTransactionId: string;
|
|
61
|
+
/** Amount in cents. If omitted → full refund. */
|
|
62
|
+
amount?: number;
|
|
63
|
+
reason?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type RefundResult = {
|
|
67
|
+
providerRefundId: string;
|
|
68
|
+
amount: number;
|
|
69
|
+
status: "succeeded" | "pending" | "failed";
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// ──────────────────────────────────────────────
|
|
73
|
+
// Provider interface
|
|
74
|
+
// ──────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
export interface PaymentProvider {
|
|
77
|
+
readonly name: string;
|
|
78
|
+
|
|
79
|
+
/** Create a hosted checkout session and return a redirect URL. */
|
|
80
|
+
createCheckout(input: CheckoutInput): Promise<CheckoutResult>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Verify and parse an inbound webhook payload.
|
|
84
|
+
* @param rawBody - raw Buffer/string as received by the HTTP server
|
|
85
|
+
* @param signature - value of the provider-specific signature header
|
|
86
|
+
*/
|
|
87
|
+
verifyWebhook(rawBody: Buffer | string, signature: string): Promise<WebhookEvent>;
|
|
88
|
+
|
|
89
|
+
/** Issue a full or partial refund. */
|
|
90
|
+
refund(input: RefundInput): Promise<RefundResult>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ──────────────────────────────────────────────
|
|
94
|
+
// Mock provider (dev / testing)
|
|
95
|
+
// ──────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
export class MockPaymentProvider implements PaymentProvider {
|
|
98
|
+
readonly name = "mock";
|
|
99
|
+
|
|
100
|
+
async createCheckout(input: CheckoutInput): Promise<CheckoutResult> {
|
|
101
|
+
const sessionId = `mock_sess_${Date.now()}`;
|
|
102
|
+
const params = new URLSearchParams({ session: sessionId, orderId: input.orderId });
|
|
103
|
+
return {
|
|
104
|
+
checkoutUrl: `${input.successUrl}?${params.toString()}`,
|
|
105
|
+
providerSessionId: sessionId
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async verifyWebhook(rawBody: Buffer | string, _signature: string): Promise<WebhookEvent> {
|
|
110
|
+
try {
|
|
111
|
+
const body = JSON.parse(typeof rawBody === "string" ? rawBody : rawBody.toString("utf-8")) as {
|
|
112
|
+
type?: string;
|
|
113
|
+
orderId?: string;
|
|
114
|
+
id?: string;
|
|
115
|
+
amount?: number;
|
|
116
|
+
currency?: string;
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
type: (body.type as WebhookEventType) ?? "payment.succeeded",
|
|
120
|
+
orderId: body.orderId ?? null,
|
|
121
|
+
providerEventId: body.id ?? `mock_evt_${Date.now()}`,
|
|
122
|
+
amount: body.amount,
|
|
123
|
+
currency: body.currency,
|
|
124
|
+
raw: body
|
|
125
|
+
};
|
|
126
|
+
} catch {
|
|
127
|
+
return {
|
|
128
|
+
type: "unknown",
|
|
129
|
+
orderId: null,
|
|
130
|
+
providerEventId: `mock_evt_${Date.now()}`,
|
|
131
|
+
raw: rawBody
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async refund(input: RefundInput): Promise<RefundResult> {
|
|
137
|
+
return {
|
|
138
|
+
providerRefundId: `mock_re_${Date.now()}`,
|
|
139
|
+
amount: input.amount ?? 0,
|
|
140
|
+
status: "succeeded"
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ──────────────────────────────────────────────
|
|
146
|
+
// Stripe provider
|
|
147
|
+
// ──────────────────────────────────────────────
|
|
148
|
+
|
|
149
|
+
export class StripePaymentProvider implements PaymentProvider {
|
|
150
|
+
readonly name = "stripe";
|
|
151
|
+
|
|
152
|
+
// We import Stripe lazily so the package doesn't crash when stripe is not installed
|
|
153
|
+
private stripeInstance: unknown = null;
|
|
154
|
+
|
|
155
|
+
constructor(private readonly secretKey: string, private readonly webhookSecret?: string) {}
|
|
156
|
+
|
|
157
|
+
private async getStripe(): Promise<import("stripe").default> {
|
|
158
|
+
if (!this.stripeInstance) {
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
160
|
+
const { default: Stripe } = (await import("stripe")) as { default: typeof import("stripe").default };
|
|
161
|
+
this.stripeInstance = new Stripe(this.secretKey, { apiVersion: "2025-02-24.acacia" });
|
|
162
|
+
}
|
|
163
|
+
return this.stripeInstance as import("stripe").default;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async createCheckout(input: CheckoutInput): Promise<CheckoutResult> {
|
|
167
|
+
const stripe = await this.getStripe();
|
|
168
|
+
const session = await stripe.checkout.sessions.create({
|
|
169
|
+
payment_method_types: ["card"],
|
|
170
|
+
mode: "payment",
|
|
171
|
+
line_items: input.lineItems.map((item) => ({
|
|
172
|
+
quantity: item.quantity,
|
|
173
|
+
price_data: {
|
|
174
|
+
currency: input.currency.toLowerCase(),
|
|
175
|
+
unit_amount: item.unitAmount,
|
|
176
|
+
product_data: {
|
|
177
|
+
name: item.name,
|
|
178
|
+
description: item.description
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
})),
|
|
182
|
+
customer_email: input.customerEmail,
|
|
183
|
+
success_url: input.successUrl,
|
|
184
|
+
cancel_url: input.cancelUrl,
|
|
185
|
+
metadata: { orderId: input.orderId, ...input.metadata }
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
checkoutUrl: session.url ?? input.cancelUrl,
|
|
190
|
+
providerSessionId: session.id
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async verifyWebhook(rawBody: Buffer | string, signature: string): Promise<WebhookEvent> {
|
|
195
|
+
if (!this.webhookSecret) throw new Error("STRIPE_WEBHOOK_SECRET is not set");
|
|
196
|
+
const stripe = await this.getStripe();
|
|
197
|
+
const event = stripe.webhooks.constructEvent(rawBody, signature, this.webhookSecret);
|
|
198
|
+
|
|
199
|
+
const typeMap: Record<string, WebhookEventType> = {
|
|
200
|
+
"checkout.session.completed": "payment.succeeded",
|
|
201
|
+
"checkout.session.expired": "checkout.expired",
|
|
202
|
+
"payment_intent.payment_failed": "payment.failed",
|
|
203
|
+
"charge.refunded": "payment.refunded"
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const session = event.data.object as unknown as Record<string, unknown>;
|
|
207
|
+
const orderId = (session.metadata as Record<string, string> | null)?.orderId ?? null;
|
|
208
|
+
const amount = typeof session.amount_total === "number" ? session.amount_total : undefined;
|
|
209
|
+
const currency = typeof session.currency === "string" ? session.currency.toUpperCase() : undefined;
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
type: typeMap[event.type] ?? "unknown",
|
|
213
|
+
orderId,
|
|
214
|
+
providerEventId: event.id,
|
|
215
|
+
amount,
|
|
216
|
+
currency,
|
|
217
|
+
raw: event
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async refund(input: RefundInput): Promise<RefundResult> {
|
|
222
|
+
const stripe = await this.getStripe();
|
|
223
|
+
const params: {
|
|
224
|
+
payment_intent: string;
|
|
225
|
+
reason: "duplicate" | "fraudulent" | "requested_by_customer";
|
|
226
|
+
amount?: number;
|
|
227
|
+
} = {
|
|
228
|
+
payment_intent: input.providerTransactionId,
|
|
229
|
+
reason: (input.reason as "duplicate" | "fraudulent" | "requested_by_customer") ?? "requested_by_customer"
|
|
230
|
+
};
|
|
231
|
+
if (input.amount) params.amount = input.amount;
|
|
232
|
+
const refund = await stripe.refunds.create(params as never);
|
|
233
|
+
return {
|
|
234
|
+
providerRefundId: refund.id,
|
|
235
|
+
amount: refund.amount,
|
|
236
|
+
status: refund.status === "succeeded" ? "succeeded" : refund.status === "pending" ? "pending" : "failed"
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ──────────────────────────────────────────────
|
|
242
|
+
// Factory helper
|
|
243
|
+
// ──────────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
export type ProviderName = "stripe" | "mock";
|
|
246
|
+
|
|
247
|
+
export function createPaymentProvider(
|
|
248
|
+
provider: ProviderName = "mock",
|
|
249
|
+
config: { stripeSecretKey?: string; stripeWebhookSecret?: string } = {}
|
|
250
|
+
): PaymentProvider {
|
|
251
|
+
if (provider === "stripe") {
|
|
252
|
+
if (!config.stripeSecretKey) throw new Error("STRIPE_SECRET_KEY is required for Stripe provider");
|
|
253
|
+
return new StripePaymentProvider(config.stripeSecretKey, config.stripeWebhookSecret);
|
|
254
|
+
}
|
|
255
|
+
return new MockPaymentProvider();
|
|
256
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openadminjs/permissions",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.json",
|
|
9
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
10
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
11
|
+
"test": "vitest run"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^5.7.2",
|
|
15
|
+
"vitest": "^2.1.8"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const DEFAULT_AUTH_REALM = "admin";
|
|
2
|
+
export function realmOf(blueprint) {
|
|
3
|
+
return blueprint.realm ?? DEFAULT_AUTH_REALM;
|
|
4
|
+
}
|
|
5
|
+
export function roleMatrixKey(realm, roleName) {
|
|
6
|
+
return `${realm}:${roleName}`;
|
|
7
|
+
}
|
|
8
|
+
function collectRolePermissions(blueprints, realm, roleName, wildcardSlugs, stack, memo) {
|
|
9
|
+
const memoKey = roleMatrixKey(realm, roleName);
|
|
10
|
+
if (memo.has(memoKey))
|
|
11
|
+
return new Set(memo.get(memoKey));
|
|
12
|
+
if (stack.has(memoKey)) {
|
|
13
|
+
throw new Error(`Circular role inheritance involving "${realm}:${roleName}"`);
|
|
14
|
+
}
|
|
15
|
+
const bp = blueprints.find((b) => b.name === roleName && realmOf(b) === realm);
|
|
16
|
+
if (!bp) {
|
|
17
|
+
throw new Error(`Unknown role blueprint: "${roleName}" in realm "${realm}"`);
|
|
18
|
+
}
|
|
19
|
+
stack.add(memoKey);
|
|
20
|
+
const out = new Set();
|
|
21
|
+
for (const parent of bp.inherits ?? []) {
|
|
22
|
+
for (const p of collectRolePermissions(blueprints, realm, parent, wildcardSlugs, stack, memo)) {
|
|
23
|
+
out.add(p);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
for (const p of bp.permissions ?? []) {
|
|
27
|
+
if (p === "*") {
|
|
28
|
+
out.add("*");
|
|
29
|
+
for (const s of wildcardSlugs)
|
|
30
|
+
out.add(s);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
out.add(p);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
stack.delete(memoKey);
|
|
37
|
+
memo.set(memoKey, out);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves inherits + wildcard expansion within one realm.
|
|
42
|
+
* When `slugsByRealm` is set, `"*"` expands only that realm's slug list (so admin superusers do not silently gain storefront-only slugs unless you assign them).
|
|
43
|
+
*/
|
|
44
|
+
export function expandRolePermissions(blueprints, realm, roleName, allPermissionSlugs, slugsByRealm) {
|
|
45
|
+
const wildcardSlugs = slugsByRealm?.[realm] ?? allPermissionSlugs;
|
|
46
|
+
return collectRolePermissions(blueprints, realm, roleName, wildcardSlugs, new Set(), new Map());
|
|
47
|
+
}
|
|
48
|
+
/** Every blueprint gets a frozen permission array keyed as `realm:roleName`. */
|
|
49
|
+
export function materializeAllRoles(blueprints, allPermissionSlugs, slugsByRealm) {
|
|
50
|
+
const map = new Map();
|
|
51
|
+
for (const bp of blueprints) {
|
|
52
|
+
const r = realmOf(bp);
|
|
53
|
+
const set = expandRolePermissions(blueprints, r, bp.name, allPermissionSlugs, slugsByRealm);
|
|
54
|
+
map.set(roleMatrixKey(r, bp.name), [...set].sort());
|
|
55
|
+
}
|
|
56
|
+
return map;
|
|
57
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { DEFAULT_AUTH_REALM, expandRolePermissions, materializeAllRoles, roleMatrixKey } from "./blueprints";
|
|
3
|
+
|
|
4
|
+
const slugs = ["a.read", "a.write", "b.read"] as const;
|
|
5
|
+
|
|
6
|
+
describe("expandRolePermissions", () => {
|
|
7
|
+
it("merges inherits before local permissions", () => {
|
|
8
|
+
const blueprints = [
|
|
9
|
+
{ name: "base", permissions: ["a.read"] },
|
|
10
|
+
{ name: "child", inherits: ["base"], permissions: ["a.write"] }
|
|
11
|
+
] as const;
|
|
12
|
+
const perms = expandRolePermissions(blueprints, DEFAULT_AUTH_REALM, "child", slugs);
|
|
13
|
+
expect(perms.has("a.read")).toBe(true);
|
|
14
|
+
expect(perms.has("a.write")).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("expands wildcard against catalog slugs", () => {
|
|
18
|
+
const blueprints = [{ name: "root", permissions: ["*"] }] as const;
|
|
19
|
+
const perms = expandRolePermissions(blueprints, DEFAULT_AUTH_REALM, "root", slugs);
|
|
20
|
+
expect(perms.has("*")).toBe(true);
|
|
21
|
+
expect(perms.has("a.read")).toBe(true);
|
|
22
|
+
expect(perms.has("b.read")).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("throws on circular inheritance", () => {
|
|
26
|
+
const blueprints = [
|
|
27
|
+
{ name: "a", inherits: ["b"], permissions: [] },
|
|
28
|
+
{ name: "b", inherits: ["a"], permissions: [] }
|
|
29
|
+
] as const;
|
|
30
|
+
expect(() => expandRolePermissions(blueprints, DEFAULT_AUTH_REALM, "a", slugs)).toThrow(/Circular/);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("does not inherit across realms", () => {
|
|
34
|
+
const blueprints = [
|
|
35
|
+
{ name: "base", realm: "admin", permissions: ["a.read"] },
|
|
36
|
+
{ name: "x", realm: "public", inherits: ["base"], permissions: ["a.write"] }
|
|
37
|
+
] as const;
|
|
38
|
+
expect(() => expandRolePermissions(blueprints, "public", "x", slugs)).toThrow(/Unknown role blueprint/);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("materializeAllRoles", () => {
|
|
43
|
+
it("materializes every blueprint", () => {
|
|
44
|
+
const blueprints = [
|
|
45
|
+
{ name: "v", permissions: ["a.read"] },
|
|
46
|
+
{ name: "e", inherits: ["v"], permissions: ["a.write"] }
|
|
47
|
+
] as const;
|
|
48
|
+
const map = materializeAllRoles(blueprints, slugs);
|
|
49
|
+
expect(map.get(roleMatrixKey(DEFAULT_AUTH_REALM, "v"))).toEqual(["a.read"]);
|
|
50
|
+
expect([...(map.get(roleMatrixKey(DEFAULT_AUTH_REALM, "e")) ?? [])].sort()).toEqual(["a.read", "a.write"].sort());
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("keys public and admin roles separately", () => {
|
|
54
|
+
const blueprints = [
|
|
55
|
+
{ name: "customer", realm: "public", permissions: ["x.read"] },
|
|
56
|
+
{ name: "customer", realm: "admin", permissions: ["y.read"] }
|
|
57
|
+
] as const;
|
|
58
|
+
const map = materializeAllRoles(blueprints, ["x.read", "y.read"]);
|
|
59
|
+
expect(map.get("public:customer")).toEqual(["x.read"]);
|
|
60
|
+
expect(map.get("admin:customer")).toEqual(["y.read"]);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export type LocalizedRoleLabel = string | Record<string, string>;
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_AUTH_REALM = "admin";
|
|
4
|
+
|
|
5
|
+
export type RoleBlueprint = {
|
|
6
|
+
name: string;
|
|
7
|
+
/** RBAC partition (admin UI vs storefront API, etc.). Inherits only resolve within the same realm. */
|
|
8
|
+
realm?: string;
|
|
9
|
+
label?: LocalizedRoleLabel;
|
|
10
|
+
/** Other blueprint names to merge first (DAG; cycles throw) */
|
|
11
|
+
inherits?: readonly string[];
|
|
12
|
+
/** Permission slugs; "*" expands to every slug in `allSlugs` plus keeps literal "*" for super-admin checks */
|
|
13
|
+
permissions?: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function realmOf(blueprint: Pick<RoleBlueprint, "realm">): string {
|
|
17
|
+
return blueprint.realm ?? DEFAULT_AUTH_REALM;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function roleMatrixKey(realm: string, roleName: string): string {
|
|
21
|
+
return `${realm}:${roleName}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function collectRolePermissions(
|
|
25
|
+
blueprints: readonly RoleBlueprint[],
|
|
26
|
+
realm: string,
|
|
27
|
+
roleName: string,
|
|
28
|
+
wildcardSlugs: readonly string[],
|
|
29
|
+
stack: Set<string>,
|
|
30
|
+
memo: Map<string, Set<string>>
|
|
31
|
+
): Set<string> {
|
|
32
|
+
const memoKey = roleMatrixKey(realm, roleName);
|
|
33
|
+
if (memo.has(memoKey)) return new Set(memo.get(memoKey)!);
|
|
34
|
+
if (stack.has(memoKey)) {
|
|
35
|
+
throw new Error(`Circular role inheritance involving "${realm}:${roleName}"`);
|
|
36
|
+
}
|
|
37
|
+
const bp = blueprints.find((b) => b.name === roleName && realmOf(b) === realm);
|
|
38
|
+
if (!bp) {
|
|
39
|
+
throw new Error(`Unknown role blueprint: "${roleName}" in realm "${realm}"`);
|
|
40
|
+
}
|
|
41
|
+
stack.add(memoKey);
|
|
42
|
+
const out = new Set<string>();
|
|
43
|
+
for (const parent of bp.inherits ?? []) {
|
|
44
|
+
for (const p of collectRolePermissions(blueprints, realm, parent, wildcardSlugs, stack, memo)) {
|
|
45
|
+
out.add(p);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const p of bp.permissions ?? []) {
|
|
49
|
+
if (p === "*") {
|
|
50
|
+
out.add("*");
|
|
51
|
+
for (const s of wildcardSlugs) out.add(s);
|
|
52
|
+
} else {
|
|
53
|
+
out.add(p);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
stack.delete(memoKey);
|
|
57
|
+
memo.set(memoKey, out);
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Resolves inherits + wildcard expansion within one realm.
|
|
63
|
+
* When `slugsByRealm` is set, `"*"` expands only that realm's slug list (so admin superusers do not silently gain storefront-only slugs unless you assign them).
|
|
64
|
+
*/
|
|
65
|
+
export function expandRolePermissions(
|
|
66
|
+
blueprints: readonly RoleBlueprint[],
|
|
67
|
+
realm: string,
|
|
68
|
+
roleName: string,
|
|
69
|
+
allPermissionSlugs: readonly string[],
|
|
70
|
+
slugsByRealm?: Record<string, readonly string[]>
|
|
71
|
+
): Set<string> {
|
|
72
|
+
const wildcardSlugs = slugsByRealm?.[realm] ?? allPermissionSlugs;
|
|
73
|
+
return collectRolePermissions(blueprints, realm, roleName, wildcardSlugs, new Set(), new Map());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Every blueprint gets a frozen permission array keyed as `realm:roleName`. */
|
|
77
|
+
export function materializeAllRoles(
|
|
78
|
+
blueprints: readonly RoleBlueprint[],
|
|
79
|
+
allPermissionSlugs: readonly string[],
|
|
80
|
+
slugsByRealm?: Record<string, readonly string[]>
|
|
81
|
+
): Map<string, readonly string[]> {
|
|
82
|
+
const map = new Map<string, readonly string[]>();
|
|
83
|
+
for (const bp of blueprints) {
|
|
84
|
+
const r = realmOf(bp);
|
|
85
|
+
const set = expandRolePermissions(blueprints, r, bp.name, allPermissionSlugs, slugsByRealm);
|
|
86
|
+
map.set(roleMatrixKey(r, bp.name), [...set].sort());
|
|
87
|
+
}
|
|
88
|
+
return map;
|
|
89
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { DEFAULT_AUTH_REALM, expandRolePermissions, materializeAllRoles, realmOf, roleMatrixKey } from "./blueprints";
|
|
2
|
+
export function can(permissions, permission) {
|
|
3
|
+
return permissions.includes(permission) || permissions.includes("*");
|
|
4
|
+
}
|
|
5
|
+
export function requirePermission(permissions, permission) {
|
|
6
|
+
if (!can(permissions, permission)) {
|
|
7
|
+
const error = new Error(`Missing permission: ${permission}`);
|
|
8
|
+
error.name = "ForbiddenError";
|
|
9
|
+
throw error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { can, requirePermission } from "./index";
|
|
3
|
+
|
|
4
|
+
describe("can", () => {
|
|
5
|
+
it("allows explicit permission and wildcard", () => {
|
|
6
|
+
expect(can(["posts.read"], "posts.read")).toBe(true);
|
|
7
|
+
expect(can(["*"], "settings.update")).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("denies missing permission", () => {
|
|
11
|
+
expect(can(["posts.read"], "posts.update")).toBe(false);
|
|
12
|
+
expect(can([], "posts.read")).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe("requirePermission", () => {
|
|
17
|
+
it("throws when denied", () => {
|
|
18
|
+
expect(() => requirePermission(["posts.read"], "posts.update")).toThrow("Missing permission");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("throws ForbiddenError named errors", () => {
|
|
22
|
+
try {
|
|
23
|
+
requirePermission([], "any");
|
|
24
|
+
expect.fail("should throw");
|
|
25
|
+
} catch (e) {
|
|
26
|
+
expect(e).toBeInstanceOf(Error);
|
|
27
|
+
expect((e as Error).name).toBe("ForbiddenError");
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("no-ops when allowed", () => {
|
|
32
|
+
expect(() => requirePermission(["a.b"], "a.b")).not.toThrow();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Permission = `${string}.${string}`;
|
|
2
|
+
|
|
3
|
+
export type { LocalizedRoleLabel, RoleBlueprint } from "./blueprints";
|
|
4
|
+
export {
|
|
5
|
+
DEFAULT_AUTH_REALM,
|
|
6
|
+
expandRolePermissions,
|
|
7
|
+
materializeAllRoles,
|
|
8
|
+
realmOf,
|
|
9
|
+
roleMatrixKey
|
|
10
|
+
} from "./blueprints";
|
|
11
|
+
|
|
12
|
+
export function can(permissions: readonly string[], permission: string): boolean {
|
|
13
|
+
return permissions.includes(permission) || permissions.includes("*");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function requirePermission(permissions: readonly string[], permission: string): void {
|
|
17
|
+
if (!can(permissions, permission)) {
|
|
18
|
+
const error = new Error(`Missing permission: ${permission}`);
|
|
19
|
+
error.name = "ForbiddenError";
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openadminjs/plugin-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Contracts for OpenAdminJS server plugins (hooks, manifest metadata).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./src/index.ts",
|
|
9
|
+
"types": "./src/index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@openadminjs/core": "workspace:*"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "echo \"@openadminjs/plugin-sdk ships TypeScript sources; emit dist when publishing to npm\"",
|
|
18
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
19
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
20
|
+
"test": "vitest run"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.7.2",
|
|
24
|
+
"vitest": "^2.1.8"
|
|
25
|
+
}
|
|
26
|
+
}
|