alepha
Version:
Easy-to-use modern TypeScript framework for building many kind of applications.
1,076 lines • 62.1 kB
TypeScript
import { Alepha, AlephaError, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
import { ServerReply } from "alepha/server";
import { DateTimeProvider } from "alepha/datetime";
import { CryptoProvider } from "alepha/crypto";
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
import "drizzle-orm/pg-core/foreign-keys";
import "drizzle-orm/pg-core/session";
import "drizzle-kit/api";
import "drizzle-orm/d1";
import "drizzle-orm/sqlite-core";
//#region ../../src/orm/core/schemas/insertSchema.d.ts
/**
* Transforms a TObject schema for insert operations.
* All default properties at the root level are made optional.
* Generated columns are excluded entirely.
*
* @example
* Before: { name: string; age: number(default=0); fullName: generated }
* After: { name: string; age?: number; }
*/
type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["shape"] as T["shape"][K] extends {
[PG_GENERATED]: any;
} ? never : K]: T["shape"][K] extends {
[PG_DEFAULT]: any;
} | {
[PG_ORGANIZATION]: any;
} ? TOptional<Extract<T["shape"][K], TSchema>> : T["shape"][K]; }>;
//#endregion
//#region ../../src/orm/core/schemas/updateSchema.d.ts
/**
* Transforms a TObject schema for update operations.
* All optional properties at the root level are made nullable (i.e., `T | null`).
* Generated columns are excluded entirely.
*
* @example
* Before: { name?: string; age: number; fullName: generated }
* After: { name?: string | null; age: number; }
*/
type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["shape"] as T["shape"][K] extends {
[PG_GENERATED]: any;
} ? never : K]: T["shape"][K] extends TOptional<infer U extends TSchema> ? TOptional<TUnion<[U, TNull]>> : T["shape"][K]; }>;
//#endregion
//#region ../../src/orm/core/primitives/$entity.d.ts
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
/**
* The database table name that will be created for this entity.
* If not provided, name will be inferred from the $repository variable name.
*/
name: string;
/**
* TypeBox schema defining the table structure and column types.
*/
schema: T;
/**
* Database indexes to create for query optimization.
*/
indexes?: (Keys | {
/**
* Single column to index.
*/
column: Keys;
/**
* Whether this should be a unique index (enforces uniqueness constraint).
*/
unique?: boolean;
/**
* Custom name for the index. If not provided, generates name automatically.
*/
name?: string;
/**
* Partial index condition. Only rows matching this SQL expression are indexed.
*/
where?: SQL;
} | {
/**
* Multiple columns for composite index (order matters for query optimization).
*/
columns: Keys[];
/**
* Whether this should be a unique index (enforces uniqueness constraint).
*/
unique?: boolean;
/**
* Custom name for the index. If not provided, generates name automatically.
*/
name?: string;
/**
* Partial index condition. Only rows matching this SQL expression are indexed.
*/
where?: SQL;
} | {
/**
* SQL expressions for expression-based indexes.
*
* Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
* Columns and expressions can be mixed together.
*
* @example
* ```ts
* // Case-insensitive unique username per realm
* indexes: [{
* expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
* unique: true,
* name: "users_realm_username_lower_idx",
* }]
* ```
*/
expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
/**
* Whether this should be a unique index (enforces uniqueness constraint).
*/
unique?: boolean;
/**
* Custom name for the index. If not provided, generates name automatically.
*/
name: string;
/**
* Partial index condition. Only rows matching this SQL expression are indexed.
*/
where?: SQL;
})[];
/**
* Foreign key constraints to maintain referential integrity.
*/
foreignKeys?: Array<{
/**
* Optional name for the foreign key constraint.
*/
name?: string;
/**
* Local columns that reference the foreign table.
*/
columns: Array<keyof Static<T>>;
/**
* Referenced columns in the foreign table.
* Must be EntityColumn references from other entities.
*/
foreignColumns: Array<() => EntityColumn<any>>;
}>;
/**
* Additional table constraints for data validation.
*
* Constraints enforce business rules at the database level, providing
* an additional layer of data integrity beyond application validation.
*
* **Constraint Types**:
* - **Unique constraints**: Prevent duplicate values across columns
* - **Check constraints**: Enforce custom validation rules with SQL expressions
*
* @example
* ```ts
* constraints: [
* {
* name: "unique_user_email",
* columns: ["email"],
* unique: true
* },
* {
* name: "valid_age_range",
* columns: ["age"],
* check: sql`age >= 0 AND age <= 150`
* },
* {
* name: "unique_user_username_per_tenant",
* columns: ["tenantId", "username"],
* unique: true
* }
* ]
* ```
*/
constraints?: Array<{
/**
* Columns involved in this constraint.
*/
columns: Array<keyof Static<T>>;
/**
* Optional name for the constraint.
*/
name?: string;
/**
* Whether this is a unique constraint.
*/
unique?: boolean | {};
/**
* SQL expression for check constraint validation.
*/
check?: SQL;
}>;
/**
* Advanced Drizzle ORM configuration for complex table setups.
*/
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
}
declare class EntityPrimitive<T extends TObject = TObject> {
readonly options: EntityPrimitiveOptions<T>;
constructor(options: EntityPrimitiveOptions<T>);
alias(alias: string): this;
get cols(): EntityColumns<T>;
get name(): string;
get schema(): T;
protected _insertSchema?: TObjectInsert<T>;
get insertSchema(): TObjectInsert<T>;
protected _updateSchema?: TObjectUpdate<T>;
get updateSchema(): TObjectUpdate<T>;
}
/**
* Convert a schema to columns.
*/
type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase; };
type EntityColumn<T extends TObject> = {
name: string;
entity: EntityPrimitive<T>;
};
type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T>; };
//#endregion
//#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
declare const PG_DEFAULT: unique symbol;
declare const PG_PRIMARY_KEY: unique symbol;
declare const PG_CREATED_AT: unique symbol;
declare const PG_UPDATED_AT: unique symbol;
declare const PG_DELETED_AT: unique symbol;
declare const PG_VERSION: unique symbol;
declare const PG_IDENTITY: unique symbol;
declare const PG_ENUM: unique symbol;
declare const PG_REF: unique symbol;
declare const PG_GENERATED: unique symbol;
declare const PG_ORGANIZATION: unique symbol;
/**
* @deprecated Use `PG_IDENTITY` instead.
*/
declare const PG_SERIAL: unique symbol;
type PgSymbols = {
[PG_DEFAULT]: {};
[PG_PRIMARY_KEY]: {};
[PG_CREATED_AT]: {};
[PG_UPDATED_AT]: {};
[PG_DELETED_AT]: {};
[PG_VERSION]: {};
[PG_IDENTITY]: PgIdentityOptions;
[PG_REF]: PgRefOptions;
[PG_ENUM]: PgEnumOptions;
[PG_GENERATED]: PgGeneratedOptions;
[PG_ORGANIZATION]: PgOrganizationOptions;
/**
* @deprecated Use `PG_IDENTITY` instead.
*/
[PG_SERIAL]: {};
};
type PgSymbolKeys = keyof PgSymbols;
interface PgOrganizationOptions {
/**
* Fail-closed tenant scoping. When `true`, the repository (a) refuses any
* read/write with no resolved tenant instead of falling through to an
* unfiltered "see/write everything" query, and (b) drops the
* `OR organizationId IS NULL` "global row" escape — a scoped tenant never
* sees NULL/global rows. Use for security-sensitive tables. Defaults to
* `false` (the historic fail-open semantics).
*/
strict?: boolean;
}
type PgIdentityOptions = {
mode: "always" | "byDefault";
} & PgSequenceOptions & {
name?: string;
};
interface PgEnumOptions {
name?: string;
description?: string;
}
interface PgGeneratedOptions {
/**
* SQL expression for the generated column.
*/
expression: SQL;
/**
* Storage mode for the generated column.
* - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
* - `"virtual"` — value is computed on read (default for SQLite).
*/
mode?: "stored" | "virtual";
}
interface PgRefOptions {
ref: () => {
name: string;
entity: EntityPrimitive;
};
actions?: {
onUpdate?: UpdateDeleteAction;
onDelete?: UpdateDeleteAction;
};
}
//#endregion
//#region ../../src/orm/core/helpers/pgAttr.d.ts
/**
* Type representation.
*/
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K]; };
//#endregion
//#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
/**
* Base database environment schema.
*
* Defines the `DATABASE_URL` connection string used by all ORM providers
* to determine the database driver and connection target.
*
* Supported URL formats:
* - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
* - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
* - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
* - `d1://BINDING_NAME` — Cloudflare D1
* - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
*/
declare const databaseEnvSchema: import("zod").ZodObject<{
DATABASE_URL: import("zod").ZodOptional<import("zod").ZodString>;
DATABASE_SYNC: import("zod").ZodOptional<import("zod").ZodBoolean>;
}, import("zod/v4/core").$strip>;
declare module "alepha" {
interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
}
//#endregion
//#region ../../src/api/payments/entities/paymentIntents.d.ts
declare const paymentIntents: import("alepha/orm").EntityPrimitive<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
type PaymentIntentEntity = Static<typeof paymentIntents.schema>;
//#endregion
//#region ../../src/api/payments/entities/refunds.d.ts
declare const refunds: import("alepha/orm").EntityPrimitive<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
intentId: import("zod").ZodString;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
completed: "completed";
failed: "failed";
pending: "pending";
processing: "processing";
}>;
reason: import("zod").ZodOptional<import("zod").ZodString>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
type RefundEntity = Static<typeof refunds.schema>;
//#endregion
//#region ../../src/api/payments/providers/PaymentProvider.d.ts
interface CreateSessionResult {
url: string;
providerRef: string;
}
interface RefundResult {
providerRef: string;
}
interface WebhookEvent {
providerRef: string;
/**
* Secondary reference to try when `providerRef` matches no stored intent.
* Checkout-session events carry BOTH a session id and a PaymentIntent id,
* while the stored intent ref is whichever existed at session-creation
* time (the PI when eager, the session id when the PSP creates the PI
* lazily — e.g. Stripe Checkout on connected accounts).
*/
providerRefAlt?: string;
status: string;
/**
* PSP account that emitted the event, when delivered by a
* connected-accounts endpoint (Stripe: `acct_…` on `connect: true`
* endpoints). Lets multi-tenant consumers route the event to the right
* tenant before resolving the intent.
*/
account?: string;
raw: unknown;
}
interface CreatePaymentMethodResult {
providerRef: string;
type: string;
brand?: string;
last4?: string;
expMonth?: number;
expYear?: number;
}
declare abstract class PaymentProvider {
/**
* Create a checkout session with the PSP.
* Returns a URL to redirect the user to, and the PSP's reference ID.
*/
abstract createSession(intent: PaymentIntentEntity, options: {
returnUrl: string;
authorize?: boolean;
stripeAccount?: string;
applicationFeeAmount?: number;
/** Pre-fill the payer's email on the hosted checkout page. */
customerEmail?: string;
}): Promise<CreateSessionResult>;
/**
* Capture a previously authorized payment.
* Amount can differ from the original authorization (partial capture).
*/
abstract capturePayment(providerRef: string, amount: number): Promise<void>;
/**
* Void/cancel a previously authorized payment before capture.
*/
abstract voidPayment(providerRef: string): Promise<void>;
/**
* Refund a captured payment (partial or full).
*/
abstract refundPayment(providerRef: string, amount: number, options?: {
stripeAccount?: string;
}): Promise<RefundResult>;
/**
* Parse and verify the authenticity of an incoming PSP webhook request.
*
* Implementations MUST establish authenticity before returning. Two
* common strategies, both acceptable:
*
* - Signature verification (Stripe, Adyen): verify an HMAC header
* against the raw body using a shared secret. Throw if invalid.
* - Re-fetch (Mollie, legacy webhooks): the body only carries an id;
* call back into the PSP API with your authenticated client to
* fetch the real resource state. The fetch itself is the auth —
* an attacker can POST a fake id but cannot influence the result.
*
* Throw an error if authenticity cannot be established. This endpoint
* has no $secure middleware; provider verification is its only auth.
*/
abstract parseWebhook(request: Request): Promise<WebhookEvent>;
/**
* Store a payment method token with the PSP and return the saved
* instrument's reference. Implementations that don't support
* tokenize-then-attach (e.g. Mollie, where mandates are created by
* making a "first" payment) MAY throw to signal the host app to use
* the checkout flow with `setup_future_usage`-style options instead.
*/
abstract createPaymentMethod(userId: string, token: string): Promise<CreatePaymentMethodResult>;
/**
* Delete a stored payment method from the PSP. Implementations that
* don't manage payment methods directly MAY no-op.
*/
abstract deletePaymentMethod(providerRef: string): Promise<void>;
/**
* Expire/cancel a checkout session on the PSP side.
* Called during stale session cleanup.
*/
abstract expireSession(providerRef: string): Promise<void>;
}
//#endregion
//#region ../../src/api/payments/services/PaymentService.d.ts
declare class PaymentService {
protected readonly alepha: Alepha;
protected readonly log: import("alepha/logger").Logger;
protected readonly dateTime: DateTimeProvider;
protected readonly provider: PaymentProvider;
protected readonly intentRepo: import("alepha/orm").Repository<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
protected readonly refundRepo: import("alepha/orm").Repository<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
intentId: import("zod").ZodString;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
completed: "completed";
failed: "failed";
pending: "pending";
processing: "processing";
}>;
reason: import("zod").ZodOptional<import("zod").ZodString>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
/**
* Expires stale payment intents that have been in "processing" status
* for more than 30 minutes. Runs every 5 minutes — shares the CF wrangler
* trigger with the jobs sweep so no extra binding is consumed.
*/
protected readonly expireStaleIntents: import("alepha/api/jobs").JobPrimitive<import("alepha").ZType>;
/**
* Create a new payment intent in "created" status.
*/
createIntent(amount: number, currency: string, metadata?: unknown, options?: {
paymentMethodId?: string;
userId?: string;
}): Promise<PaymentIntentEntity>;
/**
* Create a checkout session with the payment provider and
* transition the intent to "processing".
*/
createSession(intentId: string, returnUrl: string, authorize?: boolean, userId?: string, options?: {
stripeAccount?: string;
applicationFeeAmount?: number;
/**
* Pre-fills the payer's email on the PSP checkout page. Useful when
* the session runs on a sub-account (Stripe connected account) where
* no customer object exists — without it the hosted checkout makes
* the payer retype an address the platform already knows.
*/
customerEmail?: string;
}): Promise<{
url: string;
intentId: string;
}>;
/**
* Handle an incoming webhook from the payment provider.
*/
handleWebhook(request: Request): Promise<void>;
/**
* Resolve an already-parsed webhook event to its stored intent and apply
* it. Split from `handleWebhook` so callers that parse with a DIFFERENT
* verification path (e.g. a connected-accounts endpoint that must first
* route the event to a tenant) can reuse the matching + transition logic.
*/
handleParsedWebhook(event: WebhookEvent): Promise<void>;
/**
* Process a webhook event by updating the intent status and emitting
* the corresponding payment event.
*/
/**
* Valid status transitions from webhook events.
* Only these transitions are allowed — all others are silently ignored.
*/
protected static readonly VALID_WEBHOOK_TRANSITIONS: Record<string, string[]>;
handleWebhookEvent(intentId: string, status: string, raw?: unknown): Promise<void>;
/**
* Capture a previously authorized payment. Optionally specify a different
* amount for partial capture.
*/
capture(intentId: string, finalAmount?: number): Promise<PaymentIntentEntity>;
/**
* Void a previously authorized payment before capture.
*/
void(intentId: string): Promise<PaymentIntentEntity>;
/**
* Refund a captured payment (partial or full).
*/
refund(intentId: string, amount: number, reason?: string, options?: {
/**
* PSP sub-account holding the charge (Stripe connected account) —
* required to refund payments that were created with the same option,
* e.g. direct charges on a club's connected account.
*/
stripeAccount?: string;
}): Promise<RefundEntity>;
/**
* Record a cash or offline payment directly as captured,
* bypassing the checkout flow.
*/
recordCashPayment(amount: number, currency: string, metadata?: unknown): Promise<PaymentIntentEntity>;
/**
* Cancel a payment intent that has not yet entered processing.
*/
cancel(intentId: string): Promise<PaymentIntentEntity>;
/**
* Get a payment intent by ID. Throws NotFoundError if not found.
*/
getIntent(intentId: string): Promise<PaymentIntentEntity>;
/**
* Find payment intents with optional filters and pagination.
*/
findIntents(query: {
status?: string;
userId?: string;
sort?: string;
size?: number;
page?: number;
}): Promise<import("alepha").Page<import("alepha/orm").PgStatic<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>, import("alepha/orm").PgRelationMap<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>>>>;
protected assertStatus(intent: PaymentIntentEntity, expected: PaymentIntentEntity["status"], operation: string): void;
}
//#endregion
//#region ../../src/api/payments/controllers/AdminPaymentController.d.ts
declare class AdminPaymentController {
protected readonly url = "/admin/payments";
protected readonly group = "admin:payments";
protected readonly payments: PaymentService;
/**
* List payment intents with pagination and filtering.
*/
readonly listIntents: import("alepha/server").ActionPrimitiveFn<{
query: import("zod").ZodObject<{
page: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodInt>>;
size: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodInt>>;
sort: import("zod").ZodOptional<import("zod").ZodString>;
status: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
content: import("zod").ZodArray<import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>>;
page: import("zod").ZodObject<{
number: import("zod").ZodInt;
size: import("zod").ZodInt;
offset: import("zod").ZodInt;
numberOfElements: import("zod").ZodInt;
totalElements: import("zod").ZodOptional<import("zod").ZodInt>;
totalPages: import("zod").ZodOptional<import("zod").ZodInt>;
isEmpty: import("zod").ZodBoolean;
isFirst: import("zod").ZodBoolean;
isLast: import("zod").ZodBoolean;
}, import("zod/v4/core").$strip>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Get a payment intent by ID.
*/
readonly getIntent: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Capture an authorized intent.
*/
readonly captureIntent: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
body: import("zod").ZodObject<{
amount: import("zod").ZodOptional<import("zod").ZodInt>;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Void an authorized intent.
*/
readonly voidIntent: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Refund a captured intent.
*/
readonly refundIntent: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
body: import("zod").ZodObject<{
amount: import("zod").ZodInt;
reason: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
intentId: import("zod").ZodString;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
completed: "completed";
failed: "failed";
pending: "pending";
processing: "processing";
}>;
reason: import("zod").ZodOptional<import("zod").ZodString>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Cancel a created intent.
*/
readonly cancelIntent: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* Record a cash payment.
*/
readonly recordCash: import("alepha/server").ActionPrimitiveFn<{
body: import("zod").ZodObject<{
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
amount: import("zod").ZodInt;
currency: import("zod").ZodString;
status: import("zod").ZodEnum<{
authorized: "authorized";
cancelled: "cancelled";
captured: "captured";
created: "created";
expired: "expired";
failed: "failed";
partially_refunded: "partially_refunded";
processing: "processing";
refunded: "refunded";
voided: "voided";
}>;
providerRef: import("zod").ZodOptional<import("zod").ZodString>;
providerRaw: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
paymentMethodId: import("zod").ZodOptional<import("zod").ZodString>;
userId: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
/**
* PSP webhook endpoint (not under /admin, no auth — verified by provider).
*/
readonly webhook: import("alepha/server").ActionPrimitiveFn<{
response: import("zod").ZodObject<{
ok: import("zod").ZodBoolean;
id: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
count: import("zod").ZodOptional<import("zod").ZodNumber>;
}, import("zod/v4/core").$strip>;
}>;
}
//#endregion
//#region ../../src/api/payments/controllers/MockCheckoutController.d.ts
declare class MockCheckoutController {
protected readonly url = "/payments/mock-checkout";
protected readonly payments: PaymentService;
protected readonly provider: PaymentProvider;
protected isMemoryProvider(): boolean;
protected forbidden(reply: ServerReply): string;
readonly mockCheckoutPage: import("alepha/server").RoutePrimitive<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
query: import("zod").ZodObject<{
returnUrl: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
readonly mockCheckoutConfirm: import("alepha/server").RoutePrimitive<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
body: import("zod").ZodObject<{
returnUrl: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
readonly mockCheckoutCancel: import("alepha/server").RoutePrimitive<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
body: import("zod").ZodObject<{
returnUrl: import("zod").ZodOptional<import("zod").ZodString>;
}, import("zod/v4/core").$strip>;
}>;
}
//#endregion
//#region ../../src/api/payments/entities/paymentMethods.d.ts
declare const paymentMethods: import("alepha/orm").EntityPrimitive<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
userId: import("zod").ZodString;
type: import("zod").ZodString;
brand: import("zod").ZodOptional<import("zod").ZodString>;
last4: import("zod").ZodOptional<import("zod").ZodString>;
expMonth: import("zod").ZodOptional<import("zod").ZodInt>;
expYear: import("zod").ZodOptional<import("zod").ZodInt>;
isDefault: import("zod").ZodBoolean;
providerRef: import("zod").ZodString;
}, import("zod/v4/core").$strip>>;
type PaymentMethodEntity = Static<typeof paymentMethods.schema>;
//#endregion
//#region ../../src/api/payments/services/PaymentMethodService.d.ts
declare class PaymentMethodService {
protected readonly log: import("alepha/logger").Logger;
protected readonly provider: PaymentProvider;
protected readonly methodRepo: import("alepha/orm").Repository<import("zod").ZodObject<{
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodInt, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("zod").ZodString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
organizationId: import("alepha/orm").PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof import("alepha/orm").PG_ORGANIZATION>;
userId: import("zod").ZodString;
type: import("zod").ZodString;
brand: import("zod").ZodOptional<import("zod").ZodString>;
last4: import("zod").ZodOptional<import("zod").ZodString>;
expMonth: import("zod").ZodOptional<import("zod").ZodInt>;
expYear: import("zod").ZodOptional<import("zod").ZodInt>;
isDefault: import("zod").ZodBoolean;
providerRef: import("zod").ZodString;
}, import("zod/v4/core").$strip>>;
addPaymentMethod(userId: string, organizationId: string, token: string): Promise<PaymentMethodEntity>;
listPaymentMethods(userId: string): Promise<PaymentMethodEntity[]>;
removePaymentMethod(methodId: string, userId: string): Promise<void>;
setDefault(methodId: string, userId: string): Promise<PaymentMethodEntity>;
}
//#endregion
//#region ../../src/api/payments/controllers/PaymentController.d.ts
declare class PaymentController {
protected readonly url = "/payments";
protected readonly group = "payments";
protected readonly payments: PaymentService;
protected readonly paymentMethods: PaymentMethodService;
/**
* List the current user's saved payment methods.
*/
readonly listPaymentMethods: import("alepha/server").ActionPrimitiveFn<{
response: import("zod").ZodArray<import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
userId: import("zod").ZodString;
type: import("zod").ZodString;
brand: import("zod").ZodOptional<import("zod").ZodString>;
last4: import("zod").ZodOptional<import("zod").ZodString>;
expMonth: import("zod").ZodOptional<import("zod").ZodInt>;
expYear: import("zod").ZodOptional<import("zod").ZodInt>;
isDefault: import("zod").ZodBoolean;
providerRef: import("zod").ZodString;
}, import("zod/v4/core").$strip>>;
}>;
/**
* Add a new payment method.
*/
readonly addPaymentMethod: import("alepha/server").ActionPrimitiveFn<{
body: import("zod").ZodObject<{
token: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodObject<{
id: PgAttr<PgAttr<import("zod").ZodString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
version: PgAttr<PgAttr<import("zod").ZodInt, typeof PG_VERSION>, typeof PG_DEFAULT>;
createdAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
updatedAt: PgAttr<PgAttr<import("zod").ZodString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
organizationId: PgAttr<import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodString, typeof PG_ORGANIZATION>;
userId: import("zod").ZodString;
type: import("zod").ZodString;
brand: import("zod").ZodOptional<import("zod").ZodString>;
last4: import("zod").ZodOptional<import("zod").ZodString>;
expMonth: import("zod").ZodOptional<import("zod").ZodInt>;
expYear: import("zod").ZodOptional<import("zod").ZodInt>;
isDefault: import("zod").ZodBoolean;
providerRef: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
}>;
/**
* Remove a payment method.
*/
readonly removePaymentMethod: import("alepha/server").ActionPrimitiveFn<{
params: import("zod").ZodObject<{
id: import("zod").ZodString;
}, import("zod/v4/core").$strip>;
response: import("zod").ZodOb