@strav/stripe 0.1.0 → 0.1.5

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 CHANGED
@@ -1,20 +1,20 @@
1
- # @stravigor/stripe
1
+ # @strav/stripe
2
2
 
3
- Stripe billing for the [Strav](https://www.npmjs.com/package/@stravigor/core) framework. Subscriptions, one-time charges, checkout sessions, invoices, payment methods, and webhooks.
3
+ Stripe billing for the [Strav](https://www.npmjs.com/package/@strav/core) framework. Subscriptions, one-time charges, checkout sessions, invoices, payment methods, and webhooks.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- bun add @stravigor/stripe
8
+ bun add @strav/stripe
9
9
  bun strav install stripe
10
10
  ```
11
11
 
12
- Requires `@stravigor/core` as a peer dependency.
12
+ Requires `@strav/core` as a peer dependency.
13
13
 
14
14
  ## Setup
15
15
 
16
16
  ```ts
17
- import { StripeProvider } from '@stravigor/stripe'
17
+ import { StripeProvider } from '@strav/stripe'
18
18
 
19
19
  app.use(new StripeProvider())
20
20
  ```
@@ -22,7 +22,7 @@ app.use(new StripeProvider())
22
22
  ## Usage
23
23
 
24
24
  ```ts
25
- import { stripe } from '@stravigor/stripe'
25
+ import { stripe } from '@strav/stripe'
26
26
 
27
27
  // Create a customer
28
28
  const customer = await stripe.createOrGetCustomer(user)
@@ -44,7 +44,7 @@ const checkout = await stripe
44
44
  ## Billable Mixin
45
45
 
46
46
  ```ts
47
- import { billable } from '@stravigor/stripe'
47
+ import { billable } from '@strav/stripe'
48
48
 
49
49
  class User extends billable(BaseModel) {
50
50
  // adds subscription, invoice, and payment helpers
@@ -54,7 +54,7 @@ class User extends billable(BaseModel) {
54
54
  ## Webhooks
55
55
 
56
56
  ```ts
57
- import { stripeWebhook, onWebhookEvent } from '@stravigor/stripe'
57
+ import { stripeWebhook, onWebhookEvent } from '@strav/stripe'
58
58
 
59
59
  onWebhookEvent('customer.subscription.updated', async (event) => {
60
60
  // handle subscription changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strav/stripe",
3
- "version": "0.1.0",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "Stripe billing for the Strav framework",
6
6
  "license": "MIT",
@@ -15,9 +15,9 @@
15
15
  "tsconfig.json"
16
16
  ],
17
17
  "peerDependencies": {
18
- "@strav/kernel": "0.1.0",
19
- "@strav/database": "0.1.0",
20
- "@strav/http": "0.1.0"
18
+ "@strav/kernel": "0.1.4",
19
+ "@strav/database": "0.1.4",
20
+ "@strav/http": "0.1.4"
21
21
  },
22
22
  "dependencies": {
23
23
  "stripe": "^17.4.0"
package/src/billable.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type Stripe from 'stripe'
2
- import type { BaseModel } from '@stravigor/database'
3
- import type { NormalizeConstructor } from '@stravigor/kernel'
4
- import { extractUserId } from '@stravigor/database'
2
+ import type { BaseModel } from '@strav/database'
3
+ import type { NormalizeConstructor } from '@strav/kernel'
4
+ import { extractUserId } from '@strav/database'
5
5
  import Customer from './customer.ts'
6
6
  import Subscription from './subscription.ts'
7
7
  import SubscriptionBuilder from './subscription_builder.ts'
@@ -49,8 +49,8 @@ class BoundCheckoutBuilder extends CheckoutBuilder {
49
49
  * Mixin that adds billing methods to a BaseModel subclass.
50
50
  *
51
51
  * @example
52
- * import { BaseModel } from '@stravigor/database'
53
- * import { billable } from '@stravigor/stripe'
52
+ * import { BaseModel } from '@strav/database'
53
+ * import { billable } from '@strav/stripe'
54
54
  *
55
55
  * class User extends billable(BaseModel) {
56
56
  * declare id: number
@@ -58,7 +58,7 @@ class BoundCheckoutBuilder extends CheckoutBuilder {
58
58
  * }
59
59
  *
60
60
  * // Composable with other mixins:
61
- * import { compose } from '@stravigor/kernel'
61
+ * import { compose } from '@strav/kernel'
62
62
  * class User extends compose(BaseModel, softDeletes, billable) { }
63
63
  *
64
64
  * const user = await User.find(1)
@@ -1,5 +1,5 @@
1
1
  import type Stripe from 'stripe'
2
- import { extractUserId } from '@stravigor/database'
2
+ import { extractUserId } from '@strav/database'
3
3
  import StripeManager from './stripe_manager.ts'
4
4
  import Customer from './customer.ts'
5
5
 
package/src/customer.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type Stripe from 'stripe'
2
- import { extractUserId } from '@stravigor/database'
2
+ import { extractUserId } from '@strav/database'
3
3
  import StripeManager from './stripe_manager.ts'
4
4
  import type { CustomerData } from './types.ts'
5
5
 
package/src/errors.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StravError } from '@stravigor/kernel'
1
+ import { StravError } from '@strav/kernel'
2
2
 
3
3
  /** Base error class for all Stripe billing errors. */
4
4
  export class StripeError extends StravError {}
package/src/helpers.ts CHANGED
@@ -13,7 +13,7 @@ import type { CustomerData, SubscriptionData, ReceiptData } from './types.ts'
13
13
  * Stripe helper object — the primary convenience API.
14
14
  *
15
15
  * @example
16
- * import { stripe } from '@stravigor/stripe'
16
+ * import { stripe } from '@strav/stripe'
17
17
  *
18
18
  * // Direct Stripe instance access
19
19
  * stripe.stripe.customers.list()
package/src/receipt.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { extractUserId } from '@stravigor/database'
1
+ import { extractUserId } from '@strav/database'
2
2
  import StripeManager from './stripe_manager.ts'
3
3
  import type { ReceiptData } from './types.ts'
4
4
 
@@ -1,6 +1,6 @@
1
1
  import Stripe from 'stripe'
2
- import { inject, Configuration, ConfigurationError } from '@stravigor/kernel'
3
- import { Database, toSnakeCase } from '@stravigor/database'
2
+ import { inject, Configuration, ConfigurationError } from '@strav/kernel'
3
+ import { Database, toSnakeCase } from '@strav/database'
4
4
  import type { StripeConfig } from './types.ts'
5
5
 
6
6
  @inject
@@ -1,5 +1,5 @@
1
- import { ServiceProvider } from '@stravigor/kernel'
2
- import type { Application } from '@stravigor/kernel'
1
+ import { ServiceProvider } from '@strav/kernel'
2
+ import type { Application } from '@strav/kernel'
3
3
  import StripeManager from './stripe_manager.ts'
4
4
 
5
5
  export default class StripeProvider extends ServiceProvider {
@@ -1,4 +1,4 @@
1
- import { extractUserId } from '@stravigor/database'
1
+ import { extractUserId } from '@strav/database'
2
2
  import StripeManager from './stripe_manager.ts'
3
3
  import type { SubscriptionData } from './types.ts'
4
4
  import { SubscriptionStatus } from './types.ts'
@@ -1,5 +1,5 @@
1
1
  import type Stripe from 'stripe'
2
- import { extractUserId } from '@stravigor/database'
2
+ import { extractUserId } from '@strav/database'
3
3
  import StripeManager from './stripe_manager.ts'
4
4
  import Customer from './customer.ts'
5
5
  import Subscription from './subscription.ts'
package/src/webhook.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type Stripe from 'stripe'
2
- import type { Context, Handler } from '@stravigor/http'
2
+ import type { Context, Handler } from '@strav/http'
3
3
  import StripeManager from './stripe_manager.ts'
4
4
  import Customer from './customer.ts'
5
5
  import Subscription from './subscription.ts'
@@ -14,7 +14,7 @@ const customHandlers = new Map<string, WebhookEventHandler[]>()
14
14
  * Register a custom handler for a Stripe webhook event type.
15
15
  *
16
16
  * @example
17
- * import { onWebhookEvent } from '@stravigor/stripe/webhook'
17
+ * import { onWebhookEvent } from '@strav/stripe/webhook'
18
18
  *
19
19
  * onWebhookEvent('invoice.payment_failed', async (event) => {
20
20
  * const invoice = event.data.object as Stripe.Invoice
@@ -35,7 +35,7 @@ export function onWebhookEvent(eventType: string, handler: WebhookEventHandler):
35
35
  * `onWebhookEvent()`.
36
36
  *
37
37
  * @example
38
- * import { stripeWebhook } from '@stravigor/stripe/webhook'
38
+ * import { stripeWebhook } from '@strav/stripe/webhook'
39
39
  * router.post('/stripe/webhook', stripeWebhook())
40
40
  */
41
41
  export function stripeWebhook(): Handler {
@@ -1,4 +1,4 @@
1
- import { env } from '@stravigor/kernel/helpers'
1
+ import { env } from '@strav/kernel/helpers'
2
2
 
3
3
  export default {
4
4
  /** Stripe secret key. */
@@ -1,4 +1,4 @@
1
- import { defineSchema, t, Archetype } from '@stravigor/database/schema'
1
+ import { defineSchema, t, Archetype } from '@strav/database/schema'
2
2
 
3
3
  export default defineSchema('customer', {
4
4
  archetype: Archetype.Component,
@@ -1,4 +1,4 @@
1
- import { defineSchema, t, Archetype } from '@stravigor/database/schema'
1
+ import { defineSchema, t, Archetype } from '@strav/database/schema'
2
2
 
3
3
  export default defineSchema('receipt', {
4
4
  archetype: Archetype.Component,
@@ -1,4 +1,4 @@
1
- import { defineSchema, t, Archetype } from '@stravigor/database/schema'
1
+ import { defineSchema, t, Archetype } from '@strav/database/schema'
2
2
 
3
3
  export default defineSchema('subscription', {
4
4
  archetype: Archetype.Component,
@@ -1,4 +1,4 @@
1
- import { defineSchema, t, Archetype } from '@stravigor/database/schema'
1
+ import { defineSchema, t, Archetype } from '@strav/database/schema'
2
2
 
3
3
  export default defineSchema('subscription_item', {
4
4
  archetype: Archetype.Component,