@oneaccount/express 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @oneaccount/express
2
+
3
+ Express.js SDK for OneAccount - Authentication, entitlements, and Stripe Connect integration.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @oneaccount/express
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```javascript
14
+ import express from 'express';
15
+ import { oneAccount } from '@oneaccount/express';
16
+
17
+ const app = express();
18
+ app.use(express.json());
19
+
20
+ // Initialize SDK
21
+ const oa = oneAccount({
22
+ apiKey: process.env.ONEACCOUNT_API_KEY,
23
+ accountProUrl: 'https://myaccount.one', // optional
24
+ debug: true, // optional - logs auth errors
25
+ });
26
+
27
+ // Add auth middleware to all routes
28
+ app.use(oa.middleware);
29
+
30
+ // Mount Stripe Connect routes
31
+ oa.mountRoutes(app, '/api/connect');
32
+
33
+ // Protected route - requires authentication
34
+ app.get('/api/profile', oa.requireAuth, (req, res) => {
35
+ res.json({ user: req.oneAccount.user });
36
+ });
37
+
38
+ // Protected route - requires specific entitlement
39
+ app.get('/api/classes', oa.requireEntitlement('classy'), (req, res) => {
40
+ res.json({ message: 'Welcome to Classy!' });
41
+ });
42
+
43
+ // Admin-only route
44
+ app.get('/api/admin', oa.requireSuperAdmin, (req, res) => {
45
+ res.json({ message: 'Admin access granted' });
46
+ });
47
+
48
+ app.listen(3000);
49
+ ```
50
+
51
+ ## Configuration
52
+
53
+ | Option | Type | Default | Description |
54
+ |--------|------|---------|-------------|
55
+ | `apiKey` | string | required | Your OneAccount API key |
56
+ | `accountProUrl` | string | `https://myaccount.one` | OneAccount server URL |
57
+ | `jwksUrl` | string | auto | JWKS endpoint URL (auto-derived from accountProUrl) |
58
+ | `debug` | boolean | `false` | Log authentication errors |
59
+
60
+ ## Middleware
61
+
62
+ ### `oa.middleware`
63
+
64
+ Parses JWT from `Authorization: Bearer <token>` header and populates `req.oneAccount.user`.
65
+
66
+ ### `oa.requireAuth`
67
+
68
+ Returns 401 if no authenticated user.
69
+
70
+ ### `oa.requireEntitlement(entitlement)`
71
+
72
+ Returns 403 if user doesn't have the specified entitlement (`sweetcart` or `classy`).
73
+
74
+ ### `oa.requireSuperAdmin`
75
+
76
+ Returns 403 if user is not a super admin.
77
+
78
+ ## Stripe Connect Routes
79
+
80
+ When you call `oa.mountRoutes(app, '/api/connect')`, the following routes are available:
81
+
82
+ | Method | Path | Description |
83
+ |--------|------|-------------|
84
+ | GET | `/api/connect/account` | Get Stripe Connect status |
85
+ | POST | `/api/connect/account` | Create Stripe Express account |
86
+ | POST | `/api/connect/onboarding-link` | Get Stripe onboarding URL |
87
+ | POST | `/api/connect/dashboard-link` | Get Stripe Express dashboard URL |
88
+ | GET | `/api/connect/transactions` | List transactions |
89
+ | GET | `/api/connect/balance` | Get account balance |
90
+ | POST | `/api/connect/payment` | Create marketplace payment |
91
+ | POST | `/api/connect/refund` | Refund a payment |
92
+
93
+ ## TypeScript
94
+
95
+ The SDK is fully typed. Import types as needed:
96
+
97
+ ```typescript
98
+ import type {
99
+ OneAccountRequest,
100
+ OneAccountUser,
101
+ Entitlements
102
+ } from '@oneaccount/express';
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT
@@ -0,0 +1,43 @@
1
+ import type { OneAccountConfig, StripeConnectStatus, StripeTransaction, StripeBalance } from "../types";
2
+ export declare class AccountProClient {
3
+ private baseUrl;
4
+ private apiKey;
5
+ private debug;
6
+ constructor(config: OneAccountConfig);
7
+ private log;
8
+ private request;
9
+ getConnectStatus(token: string): Promise<StripeConnectStatus>;
10
+ createConnectAccount(token: string): Promise<StripeConnectStatus>;
11
+ getOnboardingLink(token: string, returnUrl: string, refreshUrl: string): Promise<{
12
+ url: string;
13
+ expiresAt: number;
14
+ }>;
15
+ getDashboardLink(token: string): Promise<{
16
+ url: string;
17
+ }>;
18
+ getTransactions(token: string, options?: {
19
+ limit?: number;
20
+ starting_after?: string;
21
+ }): Promise<{
22
+ transactions: StripeTransaction[];
23
+ has_more: boolean;
24
+ }>;
25
+ getBalance(token: string): Promise<StripeBalance>;
26
+ createPayment(token: string, data: {
27
+ amount: number;
28
+ currency?: string;
29
+ description?: string;
30
+ customer?: string;
31
+ }): Promise<{
32
+ paymentIntentId: string;
33
+ clientSecret: string;
34
+ }>;
35
+ refundPayment(token: string, data: {
36
+ paymentIntentId: string;
37
+ amount?: number;
38
+ reason?: string;
39
+ }): Promise<{
40
+ refundId: string;
41
+ status: string;
42
+ }>;
43
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountProClient = void 0;
4
+ class AccountProClient {
5
+ constructor(config) {
6
+ this.baseUrl = config.accountProUrl || "https://myaccount.one";
7
+ this.apiKey = config.apiKey;
8
+ this.debug = config.debug || false;
9
+ }
10
+ log(message, data) {
11
+ if (this.debug) {
12
+ console.log(`[OneAccount] ${message}`, data || "");
13
+ }
14
+ }
15
+ async request(path, options = {}) {
16
+ const { token, ...fetchOptions } = options;
17
+ const headers = {
18
+ "Content-Type": "application/json",
19
+ "X-API-Key": this.apiKey,
20
+ ...options.headers,
21
+ };
22
+ if (token) {
23
+ headers["Authorization"] = `Bearer ${token}`;
24
+ }
25
+ const url = `${this.baseUrl}${path}`;
26
+ this.log(`${options.method || "GET"} ${path}`);
27
+ const response = await fetch(url, {
28
+ ...fetchOptions,
29
+ headers,
30
+ });
31
+ if (!response.ok) {
32
+ const errorData = await response.json().catch(() => ({}));
33
+ throw new Error(errorData.error || `Request failed: ${response.status}`);
34
+ }
35
+ return response.json();
36
+ }
37
+ async getConnectStatus(token) {
38
+ return this.request("/api/connect/account", { token });
39
+ }
40
+ async createConnectAccount(token) {
41
+ return this.request("/api/connect/account", {
42
+ method: "POST",
43
+ token,
44
+ });
45
+ }
46
+ async getOnboardingLink(token, returnUrl, refreshUrl) {
47
+ return this.request("/api/connect/onboarding-link", {
48
+ method: "POST",
49
+ token,
50
+ body: JSON.stringify({ return_url: returnUrl, refresh_url: refreshUrl }),
51
+ });
52
+ }
53
+ async getDashboardLink(token) {
54
+ return this.request("/api/connect/dashboard-link", {
55
+ method: "POST",
56
+ token,
57
+ });
58
+ }
59
+ async getTransactions(token, options) {
60
+ const params = new URLSearchParams();
61
+ if (options?.limit)
62
+ params.set("limit", String(options.limit));
63
+ if (options?.starting_after)
64
+ params.set("starting_after", options.starting_after);
65
+ const query = params.toString() ? `?${params.toString()}` : "";
66
+ return this.request(`/api/connect/transactions${query}`, { token });
67
+ }
68
+ async getBalance(token) {
69
+ return this.request("/api/connect/balance", { token });
70
+ }
71
+ async createPayment(token, data) {
72
+ return this.request("/api/connect/payment", {
73
+ method: "POST",
74
+ token,
75
+ body: JSON.stringify(data),
76
+ });
77
+ }
78
+ async refundPayment(token, data) {
79
+ return this.request("/api/connect/refund", {
80
+ method: "POST",
81
+ token,
82
+ body: JSON.stringify(data),
83
+ });
84
+ }
85
+ }
86
+ exports.AccountProClient = AccountProClient;
@@ -0,0 +1,17 @@
1
+ import type { Express } from "express";
2
+ import { createAuthMiddleware, requireAuth, requireEntitlement, requireSuperAdmin } from "./middleware/auth";
3
+ import { AccountProClient } from "./client/accountPro";
4
+ import type { OneAccountConfig } from "./types";
5
+ export interface OneAccountSDK {
6
+ middleware: ReturnType<typeof createAuthMiddleware>;
7
+ requireAuth: typeof requireAuth;
8
+ requireEntitlement: typeof requireEntitlement;
9
+ requireSuperAdmin: typeof requireSuperAdmin;
10
+ client: AccountProClient;
11
+ mountRoutes: (app: Express, basePath?: string) => void;
12
+ }
13
+ export declare function oneAccount(config: OneAccountConfig): OneAccountSDK;
14
+ export { createAuthMiddleware, requireAuth, requireEntitlement, requireSuperAdmin, } from "./middleware/auth";
15
+ export { createStripeConnectRoutes } from "./routes/stripeConnect";
16
+ export { AccountProClient } from "./client/accountPro";
17
+ export type { OneAccountConfig, OneAccountRequest, OneAccountUser, Entitlements, } from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountProClient = exports.createStripeConnectRoutes = exports.requireSuperAdmin = exports.requireEntitlement = exports.requireAuth = exports.createAuthMiddleware = void 0;
4
+ exports.oneAccount = oneAccount;
5
+ const auth_1 = require("./middleware/auth");
6
+ const stripeConnect_1 = require("./routes/stripeConnect");
7
+ const accountPro_1 = require("./client/accountPro");
8
+ function oneAccount(config) {
9
+ if (!config.apiKey) {
10
+ throw new Error("OneAccount SDK requires an API key");
11
+ }
12
+ const resolvedConfig = {
13
+ accountProUrl: config.accountProUrl || "https://myaccount.one",
14
+ ...config,
15
+ };
16
+ const authMiddleware = (0, auth_1.createAuthMiddleware)(resolvedConfig);
17
+ const client = new accountPro_1.AccountProClient(resolvedConfig);
18
+ return {
19
+ middleware: authMiddleware,
20
+ requireAuth: auth_1.requireAuth,
21
+ requireEntitlement: auth_1.requireEntitlement,
22
+ requireSuperAdmin: auth_1.requireSuperAdmin,
23
+ client,
24
+ mountRoutes: (app, basePath = "/api/connect") => {
25
+ app.use(basePath, (0, stripeConnect_1.createStripeConnectRoutes)(resolvedConfig));
26
+ },
27
+ };
28
+ }
29
+ var auth_2 = require("./middleware/auth");
30
+ Object.defineProperty(exports, "createAuthMiddleware", { enumerable: true, get: function () { return auth_2.createAuthMiddleware; } });
31
+ Object.defineProperty(exports, "requireAuth", { enumerable: true, get: function () { return auth_2.requireAuth; } });
32
+ Object.defineProperty(exports, "requireEntitlement", { enumerable: true, get: function () { return auth_2.requireEntitlement; } });
33
+ Object.defineProperty(exports, "requireSuperAdmin", { enumerable: true, get: function () { return auth_2.requireSuperAdmin; } });
34
+ var stripeConnect_2 = require("./routes/stripeConnect");
35
+ Object.defineProperty(exports, "createStripeConnectRoutes", { enumerable: true, get: function () { return stripeConnect_2.createStripeConnectRoutes; } });
36
+ var accountPro_2 = require("./client/accountPro");
37
+ Object.defineProperty(exports, "AccountProClient", { enumerable: true, get: function () { return accountPro_2.AccountProClient; } });
@@ -0,0 +1,6 @@
1
+ import type { Response, NextFunction } from "express";
2
+ import type { OneAccountConfig, OneAccountRequest } from "../types";
3
+ export declare function createAuthMiddleware(config: OneAccountConfig): (req: OneAccountRequest, res: Response, next: NextFunction) => Promise<void>;
4
+ export declare function requireAuth(req: OneAccountRequest, res: Response, next: NextFunction): Response<any, Record<string, any>> | undefined;
5
+ export declare function requireEntitlement(entitlement: "sweetcart" | "classy"): (req: OneAccountRequest, res: Response, next: NextFunction) => Response<any, Record<string, any>> | undefined;
6
+ export declare function requireSuperAdmin(req: OneAccountRequest, res: Response, next: NextFunction): Response<any, Record<string, any>> | undefined;
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createAuthMiddleware = createAuthMiddleware;
7
+ exports.requireAuth = requireAuth;
8
+ exports.requireEntitlement = requireEntitlement;
9
+ exports.requireSuperAdmin = requireSuperAdmin;
10
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
11
+ let cachedJWKS = null;
12
+ let jwksCacheExpiry = 0;
13
+ async function fetchJWKS(jwksUrl) {
14
+ const now = Date.now();
15
+ if (cachedJWKS && now < jwksCacheExpiry) {
16
+ return cachedJWKS;
17
+ }
18
+ const response = await fetch(jwksUrl);
19
+ if (!response.ok) {
20
+ throw new Error(`Failed to fetch JWKS: ${response.status}`);
21
+ }
22
+ cachedJWKS = await response.json();
23
+ jwksCacheExpiry = now + 3600000;
24
+ return cachedJWKS;
25
+ }
26
+ function rsaPublicKeyFromJWK(jwk) {
27
+ const n = Buffer.from(jwk.n, "base64url");
28
+ const e = Buffer.from(jwk.e, "base64url");
29
+ const nLen = n.length;
30
+ const eLen = e.length;
31
+ const nLenBytes = nLen < 128
32
+ ? [nLen]
33
+ : nLen < 256
34
+ ? [0x81, nLen]
35
+ : [0x82, (nLen >> 8) & 0xff, nLen & 0xff];
36
+ const eLenBytes = eLen < 128
37
+ ? [eLen]
38
+ : eLen < 256
39
+ ? [0x81, eLen]
40
+ : [0x82, (eLen >> 8) & 0xff, eLen & 0xff];
41
+ const nSequence = [0x02, ...nLenBytes, ...n];
42
+ const eSequence = [0x02, ...eLenBytes, ...e];
43
+ const innerSequence = [...nSequence, ...eSequence];
44
+ const innerLen = innerSequence.length;
45
+ const innerLenBytes = innerLen < 128
46
+ ? [innerLen]
47
+ : innerLen < 256
48
+ ? [0x81, innerLen]
49
+ : [0x82, (innerLen >> 8) & 0xff, innerLen & 0xff];
50
+ const bitString = [0x30, ...innerLenBytes, ...innerSequence];
51
+ const bitStringWithHeader = [
52
+ 0x03,
53
+ bitString.length + 1,
54
+ 0x00,
55
+ ...bitString,
56
+ ];
57
+ const rsaOID = [
58
+ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
59
+ 0x01, 0x05, 0x00,
60
+ ];
61
+ const fullSequence = [...rsaOID, ...bitStringWithHeader];
62
+ const fullLen = fullSequence.length;
63
+ const fullLenBytes = fullLen < 128
64
+ ? [fullLen]
65
+ : fullLen < 256
66
+ ? [0x81, fullLen]
67
+ : [0x82, (fullLen >> 8) & 0xff, fullLen & 0xff];
68
+ const der = Buffer.from([0x30, ...fullLenBytes, ...fullSequence]);
69
+ const pem = `-----BEGIN PUBLIC KEY-----\n${der.toString("base64").match(/.{1,64}/g)?.join("\n")}\n-----END PUBLIC KEY-----`;
70
+ return pem;
71
+ }
72
+ function createAuthMiddleware(config) {
73
+ const jwksUrl = config.jwksUrl ||
74
+ `${config.accountProUrl || "https://myaccount.one"}/.well-known/jwks.json`;
75
+ return async function authMiddleware(req, res, next) {
76
+ req.oneAccount = { user: null };
77
+ const authHeader = req.headers.authorization;
78
+ if (!authHeader?.startsWith("Bearer ")) {
79
+ return next();
80
+ }
81
+ const token = authHeader.substring(7);
82
+ try {
83
+ const decoded = jsonwebtoken_1.default.decode(token, { complete: true });
84
+ if (!decoded) {
85
+ return next();
86
+ }
87
+ const jwks = await fetchJWKS(jwksUrl);
88
+ const key = decoded.header.kid
89
+ ? jwks.keys.find((k) => k.kid === decoded.header.kid)
90
+ : jwks.keys[0];
91
+ if (!key) {
92
+ if (config.debug) {
93
+ console.error("[OneAccount] No matching key found in JWKS");
94
+ }
95
+ return next();
96
+ }
97
+ const publicKey = rsaPublicKeyFromJWK(key);
98
+ const payload = jsonwebtoken_1.default.verify(token, publicKey, {
99
+ algorithms: ["RS256"],
100
+ });
101
+ req.oneAccount = {
102
+ user: {
103
+ personId: payload.personId || payload.sub || "",
104
+ email: payload.email,
105
+ role: payload.role,
106
+ entitlements: payload.entitlements,
107
+ },
108
+ };
109
+ }
110
+ catch (err) {
111
+ if (config.debug) {
112
+ console.error("[OneAccount] JWT verification failed:", err);
113
+ }
114
+ }
115
+ next();
116
+ };
117
+ }
118
+ function requireAuth(req, res, next) {
119
+ if (!req.oneAccount?.user) {
120
+ return res.status(401).json({ error: "Authentication required" });
121
+ }
122
+ next();
123
+ }
124
+ function requireEntitlement(entitlement) {
125
+ return function (req, res, next) {
126
+ if (!req.oneAccount?.user) {
127
+ return res.status(401).json({ error: "Authentication required" });
128
+ }
129
+ if (!req.oneAccount.user.entitlements?.[entitlement]) {
130
+ return res.status(403).json({ error: `${entitlement} subscription required` });
131
+ }
132
+ next();
133
+ };
134
+ }
135
+ function requireSuperAdmin(req, res, next) {
136
+ if (!req.oneAccount?.user) {
137
+ return res.status(401).json({ error: "Authentication required" });
138
+ }
139
+ if (req.oneAccount.user.role !== "super_admin") {
140
+ return res.status(403).json({ error: "Admin access required" });
141
+ }
142
+ next();
143
+ }
@@ -0,0 +1,3 @@
1
+ import type { Router } from "express";
2
+ import type { OneAccountConfig } from "../types";
3
+ export declare function createStripeConnectRoutes(config: OneAccountConfig): Router;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStripeConnectRoutes = createStripeConnectRoutes;
4
+ const express_1 = require("express");
5
+ const accountPro_1 = require("../client/accountPro");
6
+ const auth_1 = require("../middleware/auth");
7
+ function createStripeConnectRoutes(config) {
8
+ const router = (0, express_1.Router)();
9
+ const client = new accountPro_1.AccountProClient(config);
10
+ function getToken(req) {
11
+ const authHeader = req.headers.authorization;
12
+ return authHeader?.startsWith("Bearer ") ? authHeader.substring(7) : "";
13
+ }
14
+ router.get("/account", auth_1.requireAuth, async (req, res) => {
15
+ try {
16
+ const status = await client.getConnectStatus(getToken(req));
17
+ res.json(status);
18
+ }
19
+ catch (error) {
20
+ const message = error instanceof Error ? error.message : "Failed to get account status";
21
+ res.status(400).json({ error: message });
22
+ }
23
+ });
24
+ router.post("/account", auth_1.requireAuth, async (req, res) => {
25
+ try {
26
+ const status = await client.createConnectAccount(getToken(req));
27
+ res.json(status);
28
+ }
29
+ catch (error) {
30
+ const message = error instanceof Error ? error.message : "Failed to create account";
31
+ res.status(400).json({ error: message });
32
+ }
33
+ });
34
+ router.post("/onboarding-link", auth_1.requireAuth, async (req, res) => {
35
+ try {
36
+ const { return_url, refresh_url } = req.body;
37
+ if (!return_url || !refresh_url) {
38
+ return res.status(400).json({ error: "return_url and refresh_url are required" });
39
+ }
40
+ const result = await client.getOnboardingLink(getToken(req), return_url, refresh_url);
41
+ res.json(result);
42
+ }
43
+ catch (error) {
44
+ const message = error instanceof Error ? error.message : "Failed to get onboarding link";
45
+ res.status(400).json({ error: message });
46
+ }
47
+ });
48
+ router.post("/dashboard-link", auth_1.requireAuth, async (req, res) => {
49
+ try {
50
+ const result = await client.getDashboardLink(getToken(req));
51
+ res.json(result);
52
+ }
53
+ catch (error) {
54
+ const message = error instanceof Error ? error.message : "Failed to get dashboard link";
55
+ res.status(400).json({ error: message });
56
+ }
57
+ });
58
+ router.get("/transactions", auth_1.requireAuth, async (req, res) => {
59
+ try {
60
+ const limit = parseInt(req.query.limit) || undefined;
61
+ const starting_after = req.query.starting_after;
62
+ const result = await client.getTransactions(getToken(req), { limit, starting_after });
63
+ res.json(result);
64
+ }
65
+ catch (error) {
66
+ const message = error instanceof Error ? error.message : "Failed to get transactions";
67
+ res.status(400).json({ error: message });
68
+ }
69
+ });
70
+ router.get("/balance", auth_1.requireAuth, async (req, res) => {
71
+ try {
72
+ const result = await client.getBalance(getToken(req));
73
+ res.json(result);
74
+ }
75
+ catch (error) {
76
+ const message = error instanceof Error ? error.message : "Failed to get balance";
77
+ res.status(400).json({ error: message });
78
+ }
79
+ });
80
+ router.post("/payment", auth_1.requireAuth, async (req, res) => {
81
+ try {
82
+ const result = await client.createPayment(getToken(req), req.body);
83
+ res.json(result);
84
+ }
85
+ catch (error) {
86
+ const message = error instanceof Error ? error.message : "Failed to create payment";
87
+ res.status(400).json({ error: message });
88
+ }
89
+ });
90
+ router.post("/refund", auth_1.requireAuth, async (req, res) => {
91
+ try {
92
+ const result = await client.refundPayment(getToken(req), req.body);
93
+ res.json(result);
94
+ }
95
+ catch (error) {
96
+ const message = error instanceof Error ? error.message : "Failed to process refund";
97
+ res.status(400).json({ error: message });
98
+ }
99
+ });
100
+ return router;
101
+ }
@@ -0,0 +1,53 @@
1
+ import type { Request } from "express";
2
+ export interface Entitlements {
3
+ sweetcart: boolean;
4
+ classy: boolean;
5
+ }
6
+ export interface OneAccountUser {
7
+ personId: string;
8
+ email: string;
9
+ role: "super_admin" | "owner";
10
+ entitlements: Entitlements;
11
+ }
12
+ export interface OneAccountRequest extends Request {
13
+ oneAccount?: {
14
+ user: OneAccountUser | null;
15
+ apiKey?: {
16
+ appName: string;
17
+ permissions: string[];
18
+ };
19
+ };
20
+ }
21
+ export interface OneAccountConfig {
22
+ apiKey: string;
23
+ accountProUrl?: string;
24
+ jwksUrl?: string;
25
+ cacheMaxAge?: number;
26
+ debug?: boolean;
27
+ }
28
+ export interface StripeConnectStatus {
29
+ hasAccount: boolean;
30
+ accountId?: string;
31
+ chargesEnabled?: boolean;
32
+ payoutsEnabled?: boolean;
33
+ detailsSubmitted?: boolean;
34
+ requiresOnboarding?: boolean;
35
+ }
36
+ export interface StripeTransaction {
37
+ id: string;
38
+ amount: number;
39
+ currency: string;
40
+ status: string;
41
+ created: number;
42
+ description?: string;
43
+ }
44
+ export interface StripeBalance {
45
+ available: {
46
+ amount: number;
47
+ currency: string;
48
+ }[];
49
+ pending: {
50
+ amount: number;
51
+ currency: string;
52
+ }[];
53
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@oneaccount/express",
3
+ "version": "0.1.0",
4
+ "description": "OneAccount SDK for Express.js - Authentication, entitlements, and Stripe Connect",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "keywords": [
15
+ "oneaccount",
16
+ "express",
17
+ "authentication",
18
+ "jwt",
19
+ "stripe",
20
+ "connect"
21
+ ],
22
+ "author": "OneAccount",
23
+ "license": "MIT",
24
+ "peerDependencies": {
25
+ "express": "^4.0.0 || ^5.0.0"
26
+ },
27
+ "dependencies": {
28
+ "jsonwebtoken": "^9.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/express": "^4.17.0",
32
+ "@types/jsonwebtoken": "^9.0.0",
33
+ "@types/node": "^20.0.0",
34
+ "typescript": "^5.0.0"
35
+ }
36
+ }