@stacksjs/orm 0.75.79 → 0.75.81

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.
@@ -1,6 +1,68 @@
1
- import type { SubscriptionSummary } from '@stacksjs/payments';
1
+ import type { ChargeOptions, CheckoutRequest, CheckoutSession, ClientConfirmation, CreatePaymentOptions, Customer, ManageTransaction, Money, PaymentResult, StoredPaymentMethod, StoreTransactionOptions, SubscriptionSummary } from '@stacksjs/payments';
2
+ import type { StripeCustomerOptions } from '@stacksjs/types';
2
3
  import type Stripe from 'stripe';
3
- export declare function createBillableMethods(_tableName: string): void;
4
+ export declare function createBillableMethods(_tableName: string): {
5
+ paymentCustomer: (model: any) => Promise<Customer>;
6
+ charge: (model: any, amount: Money, paymentMethod: string, options?: ChargeOptions) => Promise<PaymentResult>;
7
+ createPayment: (model: any, amount: Money, options?: CreatePaymentOptions) => Promise<PaymentResult>;
8
+ checkout: (model: any, request: CheckoutRequest) => Promise<CheckoutSession>;
9
+ paymentMethods: (model: any) => Promise<StoredPaymentMethod[]>;
10
+ removePaymentMethod: (model: any, paymentMethodId: string) => Promise<void>;
11
+ newSubscription: (model: any, type: string, price: string) => Promise<SubscriptionSummary>;
12
+ cancelSubscription: (model: any, providerId: string, options?: { atPeriodEnd?: boolean }) => Promise<SubscriptionSummary>;
13
+ activeSubscription: (model: any) => Promise<ActiveSubscriptionResult | undefined>;
14
+ syncStripeCustomerDetails: (model: any, options: StripeCustomerOptions) => Promise<Stripe.Response<Stripe.Customer>>;
15
+ createStripeUser: (model: any, options: Stripe.CustomerCreateParams) => Promise<Stripe.Response<Stripe.Customer>>;
16
+ updateStripeUser: (model: any, options: Stripe.CustomerUpdateParams) => Promise<Stripe.Response<Stripe.Customer>>;
17
+ deleteStripeUser: (model: any) => Promise<Stripe.Response<Stripe.DeletedCustomer>>;
18
+ createOrGetStripeUser: (model: any, options: Stripe.CustomerCreateParams) => Promise<Stripe.Response<Stripe.Customer>>;
19
+ retrieveStripeUser: (model: any) => Promise<Stripe.Response<Stripe.Customer> | undefined>;
20
+ defaultPaymentMethod: (model: any) => Promise<ReturnType<unknown.retrieveDefaultPaymentMethod>>;
21
+ setDefaultPaymentMethod: (model: any, paymentMethod: number | string) => Promise<void>;
22
+ addPaymentMethod: (model: any, paymentMethodId: string) => Promise<StoredPaymentMethod>;
23
+ updateSubscription: (model: any, type: string, price: string) => Promise<SubscriptionSummary>;
24
+ createSetupIntent: (model: any, options?: Stripe.SetupIntentCreateParams) => Promise<{ id: string, clientConfirmation: ClientConfirmation }>;
25
+ storeTransaction: (model: any, productId: number, options: StoreTransactionOptions) => Promise<ReturnType<ManageTransaction['store']>>;
26
+ subscriptionHistory: (model: any) => Promise<Stripe.ApiList<Stripe.Invoice>>;
27
+ transactionHistory: (model: any) => Promise<ReturnType<unknown.list>>;
28
+ connectAccount: (model: any, options?: { accountColumn?: string }) => Promise<Stripe.Account | null>;
29
+ createConnectAccount: (model: any,
30
+ options?: {
31
+ type?: 'express' | 'standard' | 'custom'
32
+ email?: string
33
+ country?: string
34
+ capabilities?: Record<string, { requested: boolean }>
35
+ accountColumn?: string
36
+ modelTable?: string
37
+ },) => Promise<Stripe.Account>;
38
+ connectOnboardLink: (
39
+ model: any,
40
+ options: {
41
+ refreshUrl: string
42
+ returnUrl: string
43
+ type?: 'account_onboarding' | 'account_update'
44
+ accountColumn?: string
45
+ },
46
+ ) => Promise<{ url: string, accountId: string }>;
47
+ syncConnectStatus: (model: any,
48
+ options?: {
49
+ accountColumn?: string
50
+ chargesColumn?: string
51
+ payoutsColumn?: string
52
+ modelTable?: string
53
+ },) => Promise<{ chargesEnabled: boolean, payoutsEnabled: boolean }>;
54
+ chargeWithSplit: (
55
+ model: any,
56
+ options: {
57
+ amountCents: number
58
+ currency?: string
59
+ metadata?: Record<string, string>
60
+ platformFeeCents?: number
61
+ connectAccountId?: string
62
+ accountColumn?: string
63
+ },
64
+ ) => Promise<Stripe.Response<Stripe.PaymentIntent>>
65
+ };
4
66
  /**
5
67
  * Whether `model` carries the billable instance methods - which is to say,
6
68
  * whether it is a hydrated instance of a model that declares
@@ -2,4 +2,11 @@
2
2
  // resolution to the concrete invocation here can leave methods marked
3
3
  // `T | undefined` under strict null checks. Cast through `any` so the trait
4
4
  // helpers can call the runtime-defined methods without a guard at every site.
5
- export declare function createCategorizableMethods(tableName: string): void;
5
+ export declare function createCategorizableMethods(tableName: string): {
6
+ categories: (id: number) => Promise<any[]>;
7
+ categoryCount: (id: number) => Promise<number>;
8
+ addCategory: (id: number, category: { name: string, description?: string }) => Promise<any>;
9
+ activeCategories: (id: number) => Promise<any[]>;
10
+ inactiveCategories: (id: number) => Promise<any[]>;
11
+ removeCategory: (id: number, categoryId: number) => Promise<void>
12
+ };
@@ -1,4 +1,4 @@
1
- export declare function createCommentableMethods(tableName: string): void;
1
+ export declare function createCommentableMethods(tableName: string): boolean;
2
2
  /** The fields a caller may set on a new comment. */
3
3
  export declare interface NewComment {
4
4
  body: string
@@ -1 +1,8 @@
1
- export declare function createLikeableMethods(tableName: string, options?: { table?: string, foreignKey?: string }): void;
1
+ export declare function createLikeableMethods(tableName: string, options?: { table?: string, foreignKey?: string }): {
2
+ likes: (id: number) => Promise<any[]>;
3
+ likeCount: (id: number) => Promise<number>;
4
+ like: (id: number, userId: number) => Promise<any>;
5
+ unlike: (id: number, userId: number) => Promise<void>;
6
+ isLiked: (id: number, userId: number) => Promise<boolean>;
7
+ likedBy: (userId: number) => Promise<number[]>
8
+ };
@@ -1 +1,8 @@
1
- export declare function createTaggableMethods(tableName: string): void;
1
+ export declare function createTaggableMethods(tableName: string): {
2
+ tags: (id: number) => Promise<any[]>;
3
+ tagCount: (id: number) => Promise<number>;
4
+ addTag: (id: number, tag: { name: string, description?: string }) => Promise<any>;
5
+ activeTags: (id: number) => Promise<any[]>;
6
+ inactiveTags: (id: number) => Promise<any[]>;
7
+ removeTag: (id: number, tagId: number) => Promise<void>
8
+ };
@@ -1 +1,4 @@
1
- export declare function createTwoFactorMethods(): void;
1
+ export declare function createTwoFactorMethods(): {
2
+ generateTwoFactorForModel: (model: any) => Promise<void>;
3
+ verifyTwoFactorCode: (model: any, code: string) => Promise<boolean>
4
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/orm",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.79",
5
+ "version": "0.75.81",
6
6
  "description": "The Stacks ORM integration",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -63,31 +63,31 @@
63
63
  "prepublishOnly": "bun run build"
64
64
  },
65
65
  "dependencies": {
66
- "@stacksjs/cache": "0.75.79",
67
- "@stacksjs/cli": "0.75.79",
68
- "@stacksjs/config": "0.75.79",
69
- "@stacksjs/database": "0.75.79",
70
- "@stacksjs/env": "0.75.79",
71
- "@stacksjs/error-handling": "0.75.79",
72
- "@stacksjs/events": "0.75.79",
73
- "@stacksjs/logging": "0.75.79",
74
- "@stacksjs/model-meta": "0.75.79",
75
- "@stacksjs/pagination": "0.75.79",
76
- "@stacksjs/path": "0.75.79",
77
- "@stacksjs/query-builder": "0.75.79",
78
- "@stacksjs/realtime": "0.75.79",
79
- "@stacksjs/router": "0.75.79",
80
- "@stacksjs/storage": "0.75.79",
81
- "@stacksjs/strings": "0.75.79",
66
+ "@stacksjs/cache": "0.75.81",
67
+ "@stacksjs/cli": "0.75.81",
68
+ "@stacksjs/config": "0.75.81",
69
+ "@stacksjs/database": "0.75.81",
70
+ "@stacksjs/env": "0.75.81",
71
+ "@stacksjs/error-handling": "0.75.81",
72
+ "@stacksjs/events": "0.75.81",
73
+ "@stacksjs/logging": "0.75.81",
74
+ "@stacksjs/model-meta": "0.75.81",
75
+ "@stacksjs/pagination": "0.75.81",
76
+ "@stacksjs/path": "0.75.81",
77
+ "@stacksjs/query-builder": "0.75.81",
78
+ "@stacksjs/realtime": "0.75.81",
79
+ "@stacksjs/router": "0.75.81",
80
+ "@stacksjs/storage": "0.75.81",
81
+ "@stacksjs/strings": "0.75.81",
82
82
  "@stacksjs/ts-validation": "^0.5.6",
83
- "@stacksjs/validation": "0.75.79",
83
+ "@stacksjs/validation": "0.75.81",
84
84
  "bun-query-builder": "^0.3.5"
85
85
  },
86
86
  "peerDependencies": {
87
- "@stacksjs/auth": "0.75.79",
88
- "@stacksjs/payments": "0.75.79",
89
- "@stacksjs/queue": "0.75.79",
90
- "@stacksjs/search-engine": "0.75.79",
87
+ "@stacksjs/auth": "0.75.81",
88
+ "@stacksjs/payments": "0.75.81",
89
+ "@stacksjs/queue": "0.75.81",
90
+ "@stacksjs/search-engine": "0.75.81",
91
91
  "stripe": "23.0.0"
92
92
  },
93
93
  "peerDependenciesMeta": {
@@ -108,7 +108,7 @@
108
108
  }
109
109
  },
110
110
  "devDependencies": {
111
- "@stacksjs/types": "0.75.79",
111
+ "@stacksjs/types": "0.75.81",
112
112
  "better-dx": "^0.2.24",
113
113
  "stripe": "23.0.0"
114
114
  }