crovver-node 1.0.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.
@@ -0,0 +1,582 @@
1
+ /**
2
+ * Configuration options for the Crovver client
3
+ */
4
+ export interface CrovverConfig {
5
+ /** Your organization's API key (required) */
6
+ apiKey: string;
7
+ /** Override the base URL (optional, useful for local development) */
8
+ baseUrl?: string;
9
+ /** Request timeout in milliseconds (optional, defaults to 30000) */
10
+ timeout?: number;
11
+ /** Maximum number of retries for failed requests (optional, defaults to 3) */
12
+ maxRetries?: number;
13
+ /** Enable debug logging (optional, defaults to false) */
14
+ debug?: boolean;
15
+ /** Custom logger function (optional) */
16
+ logger?: (message: string, data?: unknown) => void;
17
+ }
18
+ /**
19
+ * API Response wrapper type (internal)
20
+ * Matches the backend ApiResponseHelper format
21
+ */
22
+ export interface ApiResponse<T = unknown> {
23
+ success: boolean;
24
+ data: T | null;
25
+ error: {
26
+ message: string;
27
+ code?: string;
28
+ } | null;
29
+ meta?: Record<string, unknown>;
30
+ }
31
+ /**
32
+ * Custom error class for Crovver API errors
33
+ */
34
+ export declare class CrovverError extends Error {
35
+ /** HTTP status code (if available) */
36
+ readonly statusCode?: number;
37
+ /** Error code from API (if available) */
38
+ readonly code?: string;
39
+ /** Original error object (if available) */
40
+ readonly originalError?: unknown;
41
+ /** Whether the error is retryable (5xx, network errors, rate limits) */
42
+ readonly isRetryable: boolean;
43
+ constructor(message: string, statusCode?: number, code?: string, originalError?: unknown);
44
+ /**
45
+ * Check if a status code indicates a retryable error
46
+ * - 5xx: Server errors (temporary)
47
+ * - 429: Rate limited
48
+ * - 408: Request timeout
49
+ * - undefined: Network errors
50
+ */
51
+ static isRetryableStatus(status?: number): boolean;
52
+ /**
53
+ * Convert to JSON for logging
54
+ */
55
+ toJSON(): {
56
+ name: string;
57
+ message: string;
58
+ statusCode: number | undefined;
59
+ code: string | undefined;
60
+ isRetryable: boolean;
61
+ };
62
+ }
63
+ export interface CreateTenantRequest {
64
+ /** Your SaaS app's company/workspace ID */
65
+ externalTenantId: string;
66
+ /** Company/workspace name */
67
+ name: string;
68
+ /** URL-friendly slug (optional, auto-generated from name if not provided) */
69
+ slug?: string;
70
+ /** Owner's user ID from your app */
71
+ ownerExternalUserId: string;
72
+ /** Owner's email (optional) */
73
+ ownerEmail?: string;
74
+ /** Owner's name (optional) */
75
+ ownerName?: string;
76
+ /** Custom metadata (optional) */
77
+ metadata?: Record<string, unknown>;
78
+ }
79
+ export interface TenantOwner {
80
+ id: string;
81
+ externalUserId: string;
82
+ email?: string;
83
+ name?: string;
84
+ }
85
+ export interface Tenant {
86
+ id: string;
87
+ externalTenantId: string;
88
+ name: string;
89
+ slug: string;
90
+ isActive: boolean;
91
+ metadata?: Record<string, unknown>;
92
+ createdAt: string;
93
+ }
94
+ export interface CreateTenantResponse {
95
+ tenant: Tenant;
96
+ owner: TenantOwner;
97
+ message: string;
98
+ }
99
+ export interface GetTenantResponse {
100
+ tenant: Tenant;
101
+ members: TenantOwner[];
102
+ organization: {
103
+ id: string;
104
+ name: string;
105
+ type: "b2b" | "d2c";
106
+ };
107
+ }
108
+ export interface PlanPricing {
109
+ currency: string;
110
+ interval: "monthly" | "yearly" | "one_time";
111
+ isSeatBased: boolean;
112
+ /** Flat-rate pricing amount */
113
+ amount?: number | null;
114
+ /** Base price for seat-based plans */
115
+ basePrice?: number | null;
116
+ /** Number of seats included in base price */
117
+ includedSeats?: number;
118
+ /** Price per additional seat */
119
+ perSeatPrice?: number | null;
120
+ /** Minimum number of seats */
121
+ minSeats?: number | null;
122
+ /** Maximum number of seats */
123
+ maxSeats?: number | null;
124
+ }
125
+ export interface PlanTrial {
126
+ days: number;
127
+ available: boolean;
128
+ }
129
+ export interface Product {
130
+ id: string;
131
+ name: string;
132
+ description?: string;
133
+ }
134
+ export interface PaymentProviderMapping {
135
+ provider_id: string;
136
+ provider_type: string;
137
+ /** External price ID for flat-rate plans */
138
+ external_price_id?: string;
139
+ /** External product ID for seat-based plans */
140
+ external_product_id?: string;
141
+ /** Base price ID for seat-based plans */
142
+ external_base_price_id?: string;
143
+ /** Per-seat price ID for seat-based plans */
144
+ external_per_seat_price_id?: string;
145
+ is_active: boolean;
146
+ }
147
+ export interface Plan {
148
+ id: string;
149
+ name: string;
150
+ description?: string;
151
+ pricing: PlanPricing;
152
+ trial: PlanTrial;
153
+ test_mode: boolean;
154
+ features: Record<string, boolean>;
155
+ limits: Record<string, number | null>;
156
+ product: Product;
157
+ payment_providers: PaymentProviderMapping[];
158
+ created_at: string;
159
+ updated_at: string;
160
+ }
161
+ export interface GetPlansResponse {
162
+ plans: Plan[];
163
+ organization: {
164
+ id: string;
165
+ name: string;
166
+ type: "b2b" | "d2c";
167
+ };
168
+ }
169
+ export interface SubscriptionBilling {
170
+ current_period_start: string;
171
+ current_period_end: string;
172
+ next_billing_date: string | null;
173
+ }
174
+ export interface SubscriptionTrial {
175
+ is_active: boolean;
176
+ ends_at: string | null;
177
+ days_remaining: number;
178
+ }
179
+ export interface SubscriptionCancellation {
180
+ is_canceled: boolean;
181
+ canceled_at: string | null;
182
+ will_end_at: string | null;
183
+ }
184
+ export interface SubscriptionPlan {
185
+ id: string;
186
+ name: string;
187
+ description?: string;
188
+ pricing: PlanPricing;
189
+ features: Record<string, boolean>;
190
+ limits: Record<string, number | null>;
191
+ }
192
+ export type SubscriptionStatus = "active" | "trialing" | "past_due" | "canceled" | "unpaid" | "incomplete" | "incomplete_expired" | "paused";
193
+ export interface Subscription {
194
+ id: string;
195
+ status: SubscriptionStatus;
196
+ provider_subscription_id: string;
197
+ billing: SubscriptionBilling;
198
+ trial: SubscriptionTrial;
199
+ cancellation: SubscriptionCancellation;
200
+ plan: SubscriptionPlan;
201
+ product: Product;
202
+ payment_providers: PaymentProviderMapping[];
203
+ capacity?: {
204
+ units: number;
205
+ billing_mode: string;
206
+ };
207
+ metadata: Record<string, unknown>;
208
+ created_at: string;
209
+ updated_at: string;
210
+ }
211
+ export interface GetSubscriptionsResponse {
212
+ subscriptions: Subscription[];
213
+ tenant: {
214
+ id: string;
215
+ external_tenant_id: string;
216
+ name: string;
217
+ slug: string;
218
+ metadata: Record<string, unknown>;
219
+ };
220
+ organization: {
221
+ id: string;
222
+ name: string;
223
+ type: "b2b" | "d2c";
224
+ };
225
+ }
226
+ export type PaymentProvider = "stripe" | "paddle" | "lemonsqueezy";
227
+ export interface CreateCheckoutSessionRequest {
228
+ /** User making the purchase */
229
+ requestingUserId: string;
230
+ /** Tenant ID (required for B2B, optional for D2C) */
231
+ requestingTenantId?: string;
232
+ /** Plan to subscribe to */
233
+ planId: string;
234
+ /** Payment provider to use */
235
+ provider: PaymentProvider;
236
+ /** URL to redirect to on successful payment */
237
+ successUrl?: string;
238
+ /** URL to redirect to on canceled payment */
239
+ cancelUrl?: string;
240
+ /** User email (required for D2C tenant creation) */
241
+ userEmail?: string;
242
+ /** User name (required for D2C tenant creation) */
243
+ userName?: string;
244
+ /** Custom metadata */
245
+ metadata?: Record<string, unknown>;
246
+ /** Number of seats to purchase (for seat-based plans) */
247
+ quantity?: number;
248
+ }
249
+ export interface CreateCheckoutSessionResponse {
250
+ subscriptionId: string;
251
+ checkoutUrl: string;
252
+ sessionId: string;
253
+ error: string | null;
254
+ }
255
+ export interface CanAccessRequest {
256
+ /** External tenant ID (B2B) or user ID (D2C) */
257
+ requestingEntityId: string;
258
+ /** Feature key to check access for */
259
+ featureKey: string;
260
+ }
261
+ export interface CanAccessResponse {
262
+ canAccess: boolean;
263
+ }
264
+ export interface RecordUsageRequest {
265
+ /** External tenant ID (B2B) or user ID (D2C) */
266
+ requestingEntityId: string;
267
+ /** Metric key to record usage for */
268
+ metric: string;
269
+ /** Usage value (default: 1) */
270
+ value?: number;
271
+ /** Custom metadata */
272
+ metadata?: Record<string, unknown>;
273
+ }
274
+ export interface RecordUsageResponse {
275
+ success: boolean;
276
+ }
277
+ export interface CheckUsageLimitRequest {
278
+ /** External tenant ID (B2B) or user ID (D2C) */
279
+ requestingEntityId: string;
280
+ /** Metric key to check */
281
+ metric: string;
282
+ }
283
+ export interface CheckUsageLimitResponse {
284
+ /** Whether additional usage is allowed */
285
+ allowed: boolean;
286
+ /** Current usage value */
287
+ current: number;
288
+ /** Usage limit (null = unlimited) */
289
+ limit: number | null;
290
+ /** Remaining usage (null = unlimited) */
291
+ remaining: number | null;
292
+ /** Usage percentage (null = unlimited) */
293
+ percentage: number | null;
294
+ }
295
+ export interface CreateProrationCheckoutRequest {
296
+ /** External tenant ID */
297
+ requestingEntityId: string;
298
+ /** New total seat capacity to upgrade to */
299
+ newCapacity: number;
300
+ /** Plan ID (optional if the tenant only has one active subscription) */
301
+ planId?: string;
302
+ /** URL to redirect to on success */
303
+ successUrl?: string;
304
+ /** URL to redirect to on cancel */
305
+ cancelUrl?: string;
306
+ }
307
+ export interface CreateProrationCheckoutResponse {
308
+ prorationId: string;
309
+ checkoutUrl: string | null;
310
+ requiresPayment: boolean;
311
+ prorationAmount: number;
312
+ prorationDetails: Record<string, unknown>;
313
+ message: string;
314
+ }
315
+ export interface CancelSubscriptionResponse {
316
+ subscriptionId: string;
317
+ status: string;
318
+ canceledAt: string;
319
+ willEndAt: string | null;
320
+ }
321
+ export interface Invoice {
322
+ id: string;
323
+ invoice_number: string;
324
+ invoice_type: string;
325
+ subtotal: number;
326
+ total_amount: number;
327
+ currency: string;
328
+ status: string;
329
+ due_date: string | null;
330
+ created_at: string;
331
+ }
332
+ export interface GetInvoicesResponse {
333
+ invoices: Invoice[];
334
+ }
335
+ export interface SubscriptionStatusResponse {
336
+ isActive: boolean;
337
+ status: SubscriptionStatus | null;
338
+ plan: SubscriptionPlan | null;
339
+ trialEndsAt: string | null;
340
+ currentPeriodEnd: string | null;
341
+ }
342
+ export interface SupportedPaymentProvider {
343
+ id: string;
344
+ code: string;
345
+ name: string;
346
+ description?: string;
347
+ logoUrl?: string;
348
+ isEnabled: boolean;
349
+ supportsRecurringBilling: boolean;
350
+ supportsWebhooks: boolean;
351
+ supportsTestMode: boolean;
352
+ capabilities: string[];
353
+ }
354
+ export interface GetSupportedProvidersResponse {
355
+ providers: SupportedPaymentProvider[];
356
+ }
357
+ export declare class CrovverClient {
358
+ private client;
359
+ private config;
360
+ private logger;
361
+ constructor(config: CrovverConfig);
362
+ private setupInterceptors;
363
+ /**
364
+ * Execute a request with automatic retry logic
365
+ */
366
+ private withRetry;
367
+ /**
368
+ * Create a new tenant (B2B organizations only)
369
+ *
370
+ * For D2C organizations, tenants are automatically created during checkout.
371
+ *
372
+ * @param request - Tenant creation request
373
+ * @returns Created tenant and owner information
374
+ * @throws {CrovverError} If the organization is D2C or tenant already exists
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * const result = await crovver.createTenant({
379
+ * externalTenantId: 'company-123',
380
+ * name: 'Acme Corporation',
381
+ * ownerExternalUserId: 'user-456',
382
+ * ownerEmail: 'admin@acme.com',
383
+ * });
384
+ * console.log('Tenant created:', result.tenant.id);
385
+ * ```
386
+ */
387
+ createTenant(request: CreateTenantRequest): Promise<CreateTenantResponse>;
388
+ /**
389
+ * Get tenant information by external tenant ID
390
+ *
391
+ * @param externalTenantId - The external tenant ID from your SaaS app
392
+ * @returns Tenant information with members
393
+ *
394
+ * @example
395
+ * ```typescript
396
+ * const { tenant, members } = await crovver.getTenant('company-123');
397
+ * console.log(`Tenant: ${tenant.name}`);
398
+ * console.log(`Members: ${members.length}`);
399
+ * ```
400
+ */
401
+ getTenant(externalTenantId: string): Promise<GetTenantResponse>;
402
+ /**
403
+ * Get all available plans for the organization
404
+ *
405
+ * Use this to render pricing pages or display upgrade options.
406
+ *
407
+ * @returns List of all active plans with pricing and features
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * const { plans } = await crovver.getPlans();
412
+ * plans.forEach(plan => {
413
+ * console.log(`${plan.name}: $${plan.pricing.amount}/${plan.pricing.interval}`);
414
+ * });
415
+ * ```
416
+ */
417
+ getPlans(): Promise<GetPlansResponse>;
418
+ /**
419
+ * Get active subscriptions for a tenant/user
420
+ *
421
+ * @param requestingEntityId - External tenant ID (B2B) or user ID (D2C)
422
+ * @returns Active subscriptions with plan and billing details
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const { subscriptions, tenant } = await crovver.getSubscriptions('company-123');
427
+ * console.log(`${tenant.name} has ${subscriptions.length} subscriptions`);
428
+ * ```
429
+ */
430
+ getSubscriptions(requestingEntityId: string): Promise<GetSubscriptionsResponse>;
431
+ /**
432
+ * Create a checkout session for payment
433
+ *
434
+ * For B2B: Provide requestingUserId and requestingTenantId
435
+ * For D2C: Provide requestingUserId, userEmail, and userName (tenant auto-created)
436
+ *
437
+ * @param request - Checkout session request
438
+ * @returns Checkout URL to redirect the user to
439
+ *
440
+ * @example
441
+ * ```typescript
442
+ * // B2B checkout
443
+ * const checkout = await crovver.createCheckoutSession({
444
+ * requestingUserId: 'user-456',
445
+ * requestingTenantId: 'company-123',
446
+ * planId: 'plan-uuid',
447
+ * provider: 'stripe',
448
+ * successUrl: 'https://myapp.com/success',
449
+ * cancelUrl: 'https://myapp.com/cancel',
450
+ * });
451
+ * window.location.href = checkout.checkoutUrl;
452
+ * ```
453
+ */
454
+ createCheckoutSession(request: CreateCheckoutSessionRequest): Promise<CreateCheckoutSessionResponse>;
455
+ /**
456
+ * Check if a tenant/user can access a specific feature
457
+ *
458
+ * @param requestingEntityId - External tenant ID (B2B) or user ID (D2C)
459
+ * @param featureKey - The feature key to check
460
+ * @returns Whether access is allowed
461
+ *
462
+ * @example
463
+ * ```typescript
464
+ * const canAccess = await crovver.canAccess('company-123', 'advanced-analytics');
465
+ * if (canAccess) {
466
+ * // Show the feature
467
+ * } else {
468
+ * // Show upgrade prompt
469
+ * }
470
+ * ```
471
+ */
472
+ canAccess(requestingEntityId: string, featureKey: string): Promise<boolean>;
473
+ /**
474
+ * Record usage for a metric
475
+ *
476
+ * @param requestingEntityId - External tenant ID (B2B) or user ID (D2C)
477
+ * @param metric - The metric key to record usage for
478
+ * @param value - Usage value (default: 1)
479
+ * @param metadata - Optional metadata
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * await crovver.recordUsage('company-123', 'api-calls', 1, {
484
+ * endpoint: '/api/v1/users',
485
+ * method: 'GET'
486
+ * });
487
+ * ```
488
+ */
489
+ recordUsage(requestingEntityId: string, metric: string, value?: number, metadata?: Record<string, unknown>): Promise<RecordUsageResponse>;
490
+ /**
491
+ * Check current usage and limits for a metric
492
+ *
493
+ * @param requestingEntityId - External tenant ID (B2B) or user ID (D2C)
494
+ * @param metric - The metric key to check
495
+ * @returns Usage information including current value, limit, and remaining
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * const usage = await crovver.checkUsageLimit('company-123', 'api-calls');
500
+ * console.log(`Used: ${usage.current} / ${usage.limit}`);
501
+ * console.log(`Remaining: ${usage.remaining}`);
502
+ * ```
503
+ */
504
+ checkUsageLimit(requestingEntityId: string, metric: string): Promise<CheckUsageLimitResponse>;
505
+ /**
506
+ * Create a proration checkout session for a mid-cycle seat capacity upgrade.
507
+ *
508
+ * The proration amount is calculated server-side. After successful payment
509
+ * the webhook will upgrade the subscription capacity automatically.
510
+ *
511
+ * @param params - Proration checkout details
512
+ * @returns Checkout URL, proration ID, and calculated amount
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * const checkout = await crovver.createProrationCheckout({
517
+ * requestingEntityId: 'company-123',
518
+ * newCapacity: 15,
519
+ * planId: 'plan-uuid', // optional
520
+ * successUrl: 'https://myapp.com/success',
521
+ * cancelUrl: 'https://myapp.com/cancel',
522
+ * });
523
+ *
524
+ * if (checkout.checkoutUrl) {
525
+ * window.location.href = checkout.checkoutUrl;
526
+ * }
527
+ * ```
528
+ */
529
+ createProrationCheckout(params: CreateProrationCheckoutRequest): Promise<CreateProrationCheckoutResponse>;
530
+ /**
531
+ * Cancel an active subscription.
532
+ *
533
+ * The subscription remains active until the end of the current billing
534
+ * period (cancel-at-period-end behaviour).
535
+ *
536
+ * @param subscriptionId - The Crovver subscription ID
537
+ * @param reason - Cancellation reason (required by the API)
538
+ * @param feedback - Optional free-text feedback
539
+ *
540
+ * @example
541
+ * ```typescript
542
+ * const result = await crovver.cancelSubscription(
543
+ * 'sub-uuid',
544
+ * 'too_expensive',
545
+ * 'Pricing is a bit high for our team size',
546
+ * );
547
+ * console.log(`Subscription ends at: ${result.willEndAt}`);
548
+ * ```
549
+ */
550
+ cancelSubscription(subscriptionId: string, reason: string, feedback?: string): Promise<CancelSubscriptionResponse>;
551
+ /**
552
+ * Get invoices for a tenant.
553
+ *
554
+ * @param externalTenantId - External tenant ID
555
+ * @returns List of invoices
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * const { invoices } = await crovver.getInvoices('company-123');
560
+ * invoices.forEach(inv => {
561
+ * console.log(`${inv.invoice_number}: ${inv.total_amount} ${inv.currency}`);
562
+ * });
563
+ * ```
564
+ */
565
+ getInvoices(externalTenantId: string): Promise<GetInvoicesResponse>;
566
+ /**
567
+ * Get list of supported payment providers
568
+ *
569
+ * Returns all payment providers available on the Crovver platform.
570
+ *
571
+ * @returns List of supported payment providers
572
+ *
573
+ * @example
574
+ * ```typescript
575
+ * const { providers } = await crovver.getSupportedProviders();
576
+ * providers.forEach(p => console.log(`${p.name}: ${p.code}`));
577
+ * ```
578
+ */
579
+ getSupportedProviders(): Promise<GetSupportedProvidersResponse>;
580
+ }
581
+ export default CrovverClient;
582
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IACh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OAgBG;IACG,SAAS,CACb,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC;IAanB;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CACf,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAU,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,mBAAmB,CAAC;IAe/B;;;;;;;;;;;;;OAaG;IACG,eAAe,CACnB,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,uBAAuB,CAAC;IAiBnC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,uBAAuB,CAC3B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,+BAA+B,CAAC;IAmB3C;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,0BAA0B,CAAC;IActC;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAczE;;;;;;;;;;;;OAYG;IACG,qBAAqB,IAAI,OAAO,CAAC,6BAA6B,CAAC;CAQtE;AAED,eAAe,aAAa,CAAC"}
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "crovver-node",
3
+ "version": "1.0.0",
4
+ "description": "Official Node.js/TypeScript SDK for Crovver subscription management platform",
5
+ "author": "Crovver <engineering@crovver.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/crovver/crovver-node#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/crovver/crovver-node.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/crovver/crovver-node/issues"
14
+ },
15
+ "keywords": [
16
+ "crovver",
17
+ "subscription",
18
+ "billing",
19
+ "saas",
20
+ "entitlements",
21
+ "feature-flags",
22
+ "usage-tracking",
23
+ "seat-based-billing",
24
+ "stripe",
25
+ "payment"
26
+ ],
27
+ "main": "./dist/cjs/index.js",
28
+ "module": "./dist/esm/index.js",
29
+ "types": "./dist/types/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "import": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "default": "./dist/esm/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/types/index.d.ts",
38
+ "default": "./dist/cjs/index.js"
39
+ }
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md",
45
+ "CHANGELOG.md",
46
+ "LICENSE"
47
+ ],
48
+ "sideEffects": false,
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
52
+ "scripts": {
53
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
54
+ "build:cjs": "tsc -p tsconfig.cjs.json",
55
+ "build:esm": "tsc -p tsconfig.esm.json",
56
+ "build:types": "tsc -p tsconfig.types.json",
57
+ "clean": "rm -rf dist",
58
+ "prebuild": "npm run clean",
59
+ "test": "jest",
60
+ "test:watch": "jest --watch",
61
+ "test:coverage": "jest --coverage",
62
+ "lint": "eslint src --ext .ts",
63
+ "lint:fix": "eslint src --ext .ts --fix",
64
+ "format": "prettier --write \"src/**/*.ts\"",
65
+ "format:check": "prettier --check \"src/**/*.ts\"",
66
+ "typecheck": "tsc --noEmit",
67
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build"
68
+ },
69
+ "dependencies": {
70
+ "axios": "^1.7.0"
71
+ },
72
+ "devDependencies": {
73
+ "@types/jest": "^29.5.0",
74
+ "@types/node": "^20.10.0",
75
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
76
+ "@typescript-eslint/parser": "^7.0.0",
77
+ "eslint": "^8.57.0",
78
+ "jest": "^29.7.0",
79
+ "prettier": "^3.2.0",
80
+ "ts-jest": "^29.1.0",
81
+ "typescript": "^5.4.0"
82
+ },
83
+ "publishConfig": {
84
+ "access": "public",
85
+ "registry": "https://registry.npmjs.org/"
86
+ },
87
+ "peerDependencies": {
88
+ "typescript": ">=4.7.0"
89
+ },
90
+ "peerDependenciesMeta": {
91
+ "typescript": {
92
+ "optional": true
93
+ }
94
+ }
95
+ }