@skillsmith/core 0.6.3 → 0.7.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +16 -0
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/src/api/client.d.ts.map +1 -1
  5. package/dist/src/api/client.events.d.ts.map +1 -1
  6. package/dist/src/api/client.events.js +10 -1
  7. package/dist/src/api/client.events.js.map +1 -1
  8. package/dist/src/api/client.health.d.ts.map +1 -1
  9. package/dist/src/api/client.health.js +7 -1
  10. package/dist/src/api/client.health.js.map +1 -1
  11. package/dist/src/api/client.js +11 -1
  12. package/dist/src/api/client.js.map +1 -1
  13. package/dist/src/api/utils.d.ts +14 -3
  14. package/dist/src/api/utils.d.ts.map +1 -1
  15. package/dist/src/api/utils.js +14 -4
  16. package/dist/src/api/utils.js.map +1 -1
  17. package/dist/src/exports/services.d.ts +0 -1
  18. package/dist/src/exports/services.d.ts.map +1 -1
  19. package/dist/src/exports/services.js +14 -3
  20. package/dist/src/exports/services.js.map +1 -1
  21. package/dist/src/index.d.ts +2 -1
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +4 -1
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/types.d.ts +12 -0
  26. package/dist/src/types.d.ts.map +1 -1
  27. package/dist/tests/api/client.auth.test.js +50 -0
  28. package/dist/tests/api/client.auth.test.js.map +1 -1
  29. package/dist/tests/api/utils.test.js +7 -3
  30. package/dist/tests/api/utils.test.js.map +1 -1
  31. package/dist/tests/{billing/stripe-validators.test.d.ts → security/sanitization-stripe-ids.test.d.ts} +1 -1
  32. package/dist/tests/security/sanitization-stripe-ids.test.d.ts.map +1 -0
  33. package/dist/tests/{billing/stripe-validators.test.js → security/sanitization-stripe-ids.test.js} +1 -1
  34. package/dist/tests/security/sanitization-stripe-ids.test.js.map +1 -0
  35. package/dist/tests/shared.test.js.map +1 -1
  36. package/package.json +1 -6
  37. package/dist/src/billing/BillingService.d.ts +0 -101
  38. package/dist/src/billing/BillingService.d.ts.map +0 -1
  39. package/dist/src/billing/BillingService.helpers.d.ts +0 -15
  40. package/dist/src/billing/BillingService.helpers.d.ts.map +0 -1
  41. package/dist/src/billing/BillingService.helpers.js +0 -45
  42. package/dist/src/billing/BillingService.helpers.js.map +0 -1
  43. package/dist/src/billing/BillingService.js +0 -263
  44. package/dist/src/billing/BillingService.js.map +0 -1
  45. package/dist/src/billing/BillingService.types.d.ts +0 -52
  46. package/dist/src/billing/BillingService.types.d.ts.map +0 -1
  47. package/dist/src/billing/BillingService.types.js +0 -6
  48. package/dist/src/billing/BillingService.types.js.map +0 -1
  49. package/dist/src/billing/GDPRComplianceService.d.ts +0 -81
  50. package/dist/src/billing/GDPRComplianceService.d.ts.map +0 -1
  51. package/dist/src/billing/GDPRComplianceService.js +0 -361
  52. package/dist/src/billing/GDPRComplianceService.js.map +0 -1
  53. package/dist/src/billing/StripeClient.d.ts +0 -119
  54. package/dist/src/billing/StripeClient.d.ts.map +0 -1
  55. package/dist/src/billing/StripeClient.js +0 -405
  56. package/dist/src/billing/StripeClient.js.map +0 -1
  57. package/dist/src/billing/StripeReconciliationJob.d.ts +0 -50
  58. package/dist/src/billing/StripeReconciliationJob.d.ts.map +0 -1
  59. package/dist/src/billing/StripeReconciliationJob.js +0 -365
  60. package/dist/src/billing/StripeReconciliationJob.js.map +0 -1
  61. package/dist/src/billing/StripeWebhookHandler.d.ts +0 -49
  62. package/dist/src/billing/StripeWebhookHandler.d.ts.map +0 -1
  63. package/dist/src/billing/StripeWebhookHandler.js +0 -162
  64. package/dist/src/billing/StripeWebhookHandler.js.map +0 -1
  65. package/dist/src/billing/gdpr-types.d.ts +0 -103
  66. package/dist/src/billing/gdpr-types.d.ts.map +0 -1
  67. package/dist/src/billing/gdpr-types.js +0 -7
  68. package/dist/src/billing/gdpr-types.js.map +0 -1
  69. package/dist/src/billing/index.d.ts +0 -18
  70. package/dist/src/billing/index.d.ts.map +0 -1
  71. package/dist/src/billing/index.js +0 -19
  72. package/dist/src/billing/index.js.map +0 -1
  73. package/dist/src/billing/reconciliation-helpers.d.ts +0 -16
  74. package/dist/src/billing/reconciliation-helpers.d.ts.map +0 -1
  75. package/dist/src/billing/reconciliation-helpers.js +0 -53
  76. package/dist/src/billing/reconciliation-helpers.js.map +0 -1
  77. package/dist/src/billing/reconciliation-types.d.ts +0 -71
  78. package/dist/src/billing/reconciliation-types.d.ts.map +0 -1
  79. package/dist/src/billing/reconciliation-types.js +0 -7
  80. package/dist/src/billing/reconciliation-types.js.map +0 -1
  81. package/dist/src/billing/stripe-client-types.d.ts +0 -45
  82. package/dist/src/billing/stripe-client-types.d.ts.map +0 -1
  83. package/dist/src/billing/stripe-client-types.js +0 -7
  84. package/dist/src/billing/stripe-client-types.js.map +0 -1
  85. package/dist/src/billing/stripe-helpers.d.ts +0 -17
  86. package/dist/src/billing/stripe-helpers.d.ts.map +0 -1
  87. package/dist/src/billing/stripe-helpers.js +0 -50
  88. package/dist/src/billing/stripe-helpers.js.map +0 -1
  89. package/dist/src/billing/types.d.ts +0 -266
  90. package/dist/src/billing/types.d.ts.map +0 -1
  91. package/dist/src/billing/types.js +0 -23
  92. package/dist/src/billing/types.js.map +0 -1
  93. package/dist/src/billing/webhook-handlers.d.ts +0 -56
  94. package/dist/src/billing/webhook-handlers.d.ts.map +0 -1
  95. package/dist/src/billing/webhook-handlers.js +0 -303
  96. package/dist/src/billing/webhook-handlers.js.map +0 -1
  97. package/dist/src/billing/webhook-types.d.ts +0 -42
  98. package/dist/src/billing/webhook-types.d.ts.map +0 -1
  99. package/dist/src/billing/webhook-types.js +0 -7
  100. package/dist/src/billing/webhook-types.js.map +0 -1
  101. package/dist/tests/billing/BillingService.test.d.ts +0 -7
  102. package/dist/tests/billing/BillingService.test.d.ts.map +0 -1
  103. package/dist/tests/billing/BillingService.test.js +0 -168
  104. package/dist/tests/billing/BillingService.test.js.map +0 -1
  105. package/dist/tests/billing/GDPRCompliance.test.d.ts +0 -7
  106. package/dist/tests/billing/GDPRCompliance.test.d.ts.map +0 -1
  107. package/dist/tests/billing/GDPRCompliance.test.js +0 -380
  108. package/dist/tests/billing/GDPRCompliance.test.js.map +0 -1
  109. package/dist/tests/billing/StripeClient.test.d.ts +0 -18
  110. package/dist/tests/billing/StripeClient.test.d.ts.map +0 -1
  111. package/dist/tests/billing/StripeClient.test.js +0 -566
  112. package/dist/tests/billing/StripeClient.test.js.map +0 -1
  113. package/dist/tests/billing/StripeReconciliation.test.d.ts +0 -7
  114. package/dist/tests/billing/StripeReconciliation.test.d.ts.map +0 -1
  115. package/dist/tests/billing/StripeReconciliation.test.js +0 -266
  116. package/dist/tests/billing/StripeReconciliation.test.js.map +0 -1
  117. package/dist/tests/billing/StripeWebhookHandler.test.d.ts +0 -16
  118. package/dist/tests/billing/StripeWebhookHandler.test.d.ts.map +0 -1
  119. package/dist/tests/billing/StripeWebhookHandler.test.js +0 -240
  120. package/dist/tests/billing/StripeWebhookHandler.test.js.map +0 -1
  121. package/dist/tests/billing/stripe-helpers.test.d.ts +0 -7
  122. package/dist/tests/billing/stripe-helpers.test.d.ts.map +0 -1
  123. package/dist/tests/billing/stripe-helpers.test.js +0 -91
  124. package/dist/tests/billing/stripe-helpers.test.js.map +0 -1
  125. package/dist/tests/billing/stripe-validators.test.d.ts.map +0 -1
  126. package/dist/tests/billing/stripe-validators.test.js.map +0 -1
  127. package/dist/tests/billing/webhook-handlers.test.d.ts +0 -16
  128. package/dist/tests/billing/webhook-handlers.test.d.ts.map +0 -1
  129. package/dist/tests/billing/webhook-handlers.test.js +0 -519
  130. package/dist/tests/billing/webhook-handlers.test.js.map +0 -1
@@ -1,103 +0,0 @@
1
- /**
2
- * SMI-1068: GDPR Compliance Types
3
- *
4
- * Type definitions for GDPR data export and deletion operations.
5
- */
6
- import type { Database as DatabaseType } from '../db/database-interface.js';
7
- import type { StripeClient } from './StripeClient.js';
8
- export interface GDPRComplianceServiceConfig {
9
- /**
10
- * Database connection (better-sqlite3)
11
- */
12
- db: DatabaseType;
13
- /**
14
- * Optional StripeClient for Stripe data operations
15
- */
16
- stripeClient?: StripeClient;
17
- }
18
- /**
19
- * Exported customer data format
20
- */
21
- export interface CustomerDataExport {
22
- /**
23
- * Export metadata
24
- */
25
- metadata: {
26
- exportedAt: string;
27
- customerId: string;
28
- format: 'json';
29
- version: '1.0';
30
- };
31
- /**
32
- * Subscription data
33
- */
34
- subscriptions: SubscriptionExportData[];
35
- /**
36
- * Invoice data
37
- */
38
- invoices: InvoiceExportData[];
39
- /**
40
- * License key data (without the actual JWT for security)
41
- */
42
- licenseKeys: LicenseKeyExportData[];
43
- /**
44
- * Webhook events related to this customer
45
- */
46
- webhookEvents: WebhookEventExportData[];
47
- }
48
- export interface SubscriptionExportData {
49
- id: string;
50
- stripeSubscriptionId: string | null;
51
- tier: string;
52
- status: string;
53
- seatCount: number;
54
- currentPeriodStart: string | null;
55
- currentPeriodEnd: string | null;
56
- canceledAt: string | null;
57
- createdAt: string;
58
- updatedAt: string;
59
- }
60
- export interface InvoiceExportData {
61
- id: string;
62
- stripeInvoiceId: string;
63
- amountCents: number;
64
- currency: string;
65
- status: string;
66
- invoiceNumber: string | null;
67
- paidAt: string | null;
68
- periodStart: string | null;
69
- periodEnd: string | null;
70
- createdAt: string;
71
- }
72
- export interface LicenseKeyExportData {
73
- id: string;
74
- keyExpiry: string;
75
- isActive: boolean;
76
- generatedAt: string;
77
- revokedAt: string | null;
78
- revocationReason: string | null;
79
- }
80
- export interface WebhookEventExportData {
81
- id: string;
82
- stripeEventId: string;
83
- eventType: string;
84
- processedAt: string;
85
- success: boolean;
86
- }
87
- /**
88
- * Result of a data deletion operation
89
- */
90
- export interface DeletionResult {
91
- success: boolean;
92
- customerId: string;
93
- deletedAt: string;
94
- counts: {
95
- subscriptions: number;
96
- invoices: number;
97
- licenseKeys: number;
98
- webhookEvents: number;
99
- };
100
- stripeDeleted: boolean;
101
- errors: string[];
102
- }
103
- //# sourceMappingURL=gdpr-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gdpr-types.d.ts","sourceRoot":"","sources":["../../../src/billing/gdpr-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,EAAE,EAAE,YAAY,CAAA;IAEhB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAMD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,KAAK,CAAA;KACf,CAAA;IAED;;OAEG;IACH,aAAa,EAAE,sBAAsB,EAAE,CAAA;IAEvC;;OAEG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAA;IAE7B;;OAEG;IACH,WAAW,EAAE,oBAAoB,EAAE,CAAA;IAEnC;;OAEG;IACH,aAAa,EAAE,sBAAsB,EAAE,CAAA;CACxC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,WAAW,EAAE,MAAM,CAAA;QACnB,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,aAAa,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB"}
@@ -1,7 +0,0 @@
1
- /**
2
- * SMI-1068: GDPR Compliance Types
3
- *
4
- * Type definitions for GDPR data export and deletion operations.
5
- */
6
- export {};
7
- //# sourceMappingURL=gdpr-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gdpr-types.js","sourceRoot":"","sources":["../../../src/billing/gdpr-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,18 +0,0 @@
1
- /**
2
- * SMI-1062: Billing Module
3
- *
4
- * Stripe billing integration for Skillsmith subscriptions.
5
- * Provides subscription management, checkout, and invoice handling.
6
- */
7
- export * from './types.js';
8
- export { StripeClient } from './StripeClient.js';
9
- export type { StripeClientConfig, TierPriceConfigs } from './StripeClient.js';
10
- export { BillingService } from './BillingService.js';
11
- export type { BillingServiceConfig } from './BillingService.js';
12
- export { StripeWebhookHandler } from './StripeWebhookHandler.js';
13
- export type { StripeWebhookHandlerConfig } from './StripeWebhookHandler.js';
14
- export { GDPRComplianceService } from './GDPRComplianceService.js';
15
- export type { GDPRComplianceServiceConfig, CustomerDataExport, SubscriptionExportData, InvoiceExportData, LicenseKeyExportData, WebhookEventExportData, DeletionResult, } from './GDPRComplianceService.js';
16
- export { StripeReconciliationJob } from './StripeReconciliationJob.js';
17
- export type { StripeReconciliationJobConfig, DiscrepancyType, Discrepancy, ReconciliationResult, } from './StripeReconciliationJob.js';
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAA;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG7E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAG3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,YAAY,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,GACf,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,YAAY,EACV,6BAA6B,EAC7B,eAAe,EACf,WAAW,EACX,oBAAoB,GACrB,MAAM,8BAA8B,CAAA"}
@@ -1,19 +0,0 @@
1
- /**
2
- * SMI-1062: Billing Module
3
- *
4
- * Stripe billing integration for Skillsmith subscriptions.
5
- * Provides subscription management, checkout, and invoice handling.
6
- */
7
- // Types
8
- export * from './types.js';
9
- // Stripe Client
10
- export { StripeClient } from './StripeClient.js';
11
- // Billing Service
12
- export { BillingService } from './BillingService.js';
13
- // Webhook Handler
14
- export { StripeWebhookHandler } from './StripeWebhookHandler.js';
15
- // GDPR Compliance (SMI-1068)
16
- export { GDPRComplianceService } from './GDPRComplianceService.js';
17
- // Reconciliation Job (SMI-1069)
18
- export { StripeReconciliationJob } from './StripeReconciliationJob.js';
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/billing/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,QAAQ;AACR,cAAc,YAAY,CAAA;AAE1B,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,kBAAkB;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGhE,6BAA6B;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAWlE,gCAAgC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA"}
@@ -1,16 +0,0 @@
1
- /**
2
- * SMI-1069: Stripe Reconciliation Helpers
3
- *
4
- * Helper functions for mapping Stripe statuses to local statuses.
5
- */
6
- import type Stripe from 'stripe';
7
- import type { SubscriptionStatus } from './types.js';
8
- /**
9
- * Map Stripe subscription status to local subscription status
10
- */
11
- export declare function mapStripeStatus(stripeStatus: Stripe.Subscription.Status): SubscriptionStatus;
12
- /**
13
- * Map Stripe invoice status to local invoice status
14
- */
15
- export declare function mapInvoiceStatus(stripeStatus: Stripe.Invoice.Status | null): string;
16
- //# sourceMappingURL=reconciliation-helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reconciliation-helpers.d.ts","sourceRoot":"","sources":["../../../src/billing/reconciliation-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,kBAAkB,CAqB5F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAenF"}
@@ -1,53 +0,0 @@
1
- /**
2
- * SMI-1069: Stripe Reconciliation Helpers
3
- *
4
- * Helper functions for mapping Stripe statuses to local statuses.
5
- */
6
- // ============================================================================
7
- // Status Mapping Functions
8
- // ============================================================================
9
- /**
10
- * Map Stripe subscription status to local subscription status
11
- */
12
- export function mapStripeStatus(stripeStatus) {
13
- switch (stripeStatus) {
14
- case 'active':
15
- return 'active';
16
- case 'past_due':
17
- return 'past_due';
18
- case 'canceled':
19
- return 'canceled';
20
- case 'trialing':
21
- return 'trialing';
22
- case 'paused':
23
- return 'paused';
24
- case 'incomplete':
25
- return 'incomplete';
26
- case 'incomplete_expired':
27
- return 'incomplete_expired';
28
- case 'unpaid':
29
- return 'unpaid';
30
- default:
31
- return 'active';
32
- }
33
- }
34
- /**
35
- * Map Stripe invoice status to local invoice status
36
- */
37
- export function mapInvoiceStatus(stripeStatus) {
38
- switch (stripeStatus) {
39
- case 'paid':
40
- return 'paid';
41
- case 'open':
42
- return 'open';
43
- case 'draft':
44
- return 'draft';
45
- case 'void':
46
- return 'void';
47
- case 'uncollectible':
48
- return 'uncollectible';
49
- default:
50
- return 'open';
51
- }
52
- }
53
- //# sourceMappingURL=reconciliation-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reconciliation-helpers.js","sourceRoot":"","sources":["../../../src/billing/reconciliation-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,YAAwC;IACtE,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB,KAAK,YAAY;YACf,OAAO,YAAY,CAAA;QACrB,KAAK,oBAAoB;YACvB,OAAO,oBAAoB,CAAA;QAC7B,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB;YACE,OAAO,QAAQ,CAAA;IACnB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAA0C;IACzE,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,MAAM,CAAA;QACf,KAAK,MAAM;YACT,OAAO,MAAM,CAAA;QACf,KAAK,OAAO;YACV,OAAO,OAAO,CAAA;QAChB,KAAK,MAAM;YACT,OAAO,MAAM,CAAA;QACf,KAAK,eAAe;YAClB,OAAO,eAAe,CAAA;QACxB;YACE,OAAO,MAAM,CAAA;IACjB,CAAC;AACH,CAAC"}
@@ -1,71 +0,0 @@
1
- /**
2
- * SMI-1069: Stripe Reconciliation Types
3
- *
4
- * Type definitions for the reconciliation job.
5
- */
6
- import type { Database as DatabaseType } from '../db/database-interface.js';
7
- import type { StripeClient } from './StripeClient.js';
8
- export interface StripeReconciliationJobConfig {
9
- /**
10
- * StripeClient for API calls
11
- */
12
- stripeClient: StripeClient;
13
- /**
14
- * Database connection
15
- */
16
- db: DatabaseType;
17
- /**
18
- * Whether to automatically fix discrepancies
19
- * @default false
20
- */
21
- autoFix?: boolean;
22
- /**
23
- * Maximum subscriptions to process per run
24
- * @default 100
25
- */
26
- batchSize?: number;
27
- }
28
- export type DiscrepancyType = 'status_mismatch' | 'missing_local' | 'missing_stripe' | 'tier_mismatch' | 'seat_count_mismatch' | 'period_mismatch' | 'invoice_status_mismatch' | 'invoice_amount_mismatch';
29
- export interface Discrepancy {
30
- type: DiscrepancyType;
31
- entityType: 'subscription' | 'invoice';
32
- entityId: string;
33
- stripeId: string;
34
- localValue: string | number | null;
35
- stripeValue: string | number | null;
36
- description: string;
37
- fixed: boolean;
38
- }
39
- export interface ReconciliationResult {
40
- success: boolean;
41
- startedAt: string;
42
- completedAt: string;
43
- durationMs: number;
44
- stats: {
45
- subscriptionsChecked: number;
46
- invoicesChecked: number;
47
- discrepanciesFound: number;
48
- discrepanciesFixed: number;
49
- };
50
- discrepancies: Discrepancy[];
51
- errors: string[];
52
- }
53
- export interface LocalSubscription {
54
- id: string;
55
- customerId: string;
56
- stripeSubscriptionId: string;
57
- stripeCustomerId: string;
58
- tier: string;
59
- status: string;
60
- seatCount: number;
61
- currentPeriodStart: string | null;
62
- currentPeriodEnd: string | null;
63
- }
64
- export interface LocalInvoice {
65
- id: string;
66
- customerId: string;
67
- stripeInvoiceId: string;
68
- amountCents: number;
69
- status: string;
70
- }
71
- //# sourceMappingURL=reconciliation-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reconciliation-types.d.ts","sourceRoot":"","sources":["../../../src/billing/reconciliation-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,YAAY,EAAE,YAAY,CAAA;IAE1B;;OAEG;IACH,EAAE,EAAE,YAAY,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAMD,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,GACzB,yBAAyB,CAAA;AAE7B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE,cAAc,GAAG,SAAS,CAAA;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AAMD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE;QACL,oBAAoB,EAAE,MAAM,CAAA;QAC5B,eAAe,EAAE,MAAM,CAAA;QACvB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,kBAAkB,EAAE,MAAM,CAAA;KAC3B,CAAA;IACD,aAAa,EAAE,WAAW,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAMD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACf"}
@@ -1,7 +0,0 @@
1
- /**
2
- * SMI-1069: Stripe Reconciliation Types
3
- *
4
- * Type definitions for the reconciliation job.
5
- */
6
- export {};
7
- //# sourceMappingURL=reconciliation-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reconciliation-types.js","sourceRoot":"","sources":["../../../src/billing/reconciliation-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,45 +0,0 @@
1
- /**
2
- * SMI-1062: Stripe Client Types
3
- *
4
- * Configuration and type definitions for the Stripe client wrapper.
5
- */
6
- import type { StripePriceId } from './types.js';
7
- /**
8
- * Stripe client configuration
9
- */
10
- export interface StripeClientConfig {
11
- /**
12
- * Stripe secret key (sk_test_xxx or sk_live_xxx)
13
- */
14
- secretKey: string;
15
- /**
16
- * Stripe webhook signing secret (whsec_xxx)
17
- */
18
- webhookSecret: string;
19
- /**
20
- * Price ID mappings for each tier
21
- */
22
- prices: TierPriceConfigs;
23
- /**
24
- * Base URL for success/cancel redirects
25
- */
26
- appUrl?: string;
27
- }
28
- /**
29
- * Price configurations for all tiers
30
- */
31
- export interface TierPriceConfigs {
32
- individual: {
33
- monthly: StripePriceId;
34
- annual: StripePriceId;
35
- };
36
- team: {
37
- monthly: StripePriceId;
38
- annual: StripePriceId;
39
- };
40
- enterprise: {
41
- monthly: StripePriceId;
42
- annual: StripePriceId;
43
- };
44
- }
45
- //# sourceMappingURL=stripe-client-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripe-client-types.d.ts","sourceRoot":"","sources":["../../../src/billing/stripe-client-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAM/C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAA;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,OAAO,EAAE,aAAa,CAAA;QACtB,MAAM,EAAE,aAAa,CAAA;KACtB,CAAA;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,aAAa,CAAA;QACtB,MAAM,EAAE,aAAa,CAAA;KACtB,CAAA;IACD,UAAU,EAAE;QACV,OAAO,EAAE,aAAa,CAAA;QACtB,MAAM,EAAE,aAAa,CAAA;KACtB,CAAA;CACF"}
@@ -1,7 +0,0 @@
1
- /**
2
- * SMI-1062: Stripe Client Types
3
- *
4
- * Configuration and type definitions for the Stripe client wrapper.
5
- */
6
- export {};
7
- //# sourceMappingURL=stripe-client-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripe-client-types.js","sourceRoot":"","sources":["../../../src/billing/stripe-client-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,17 +0,0 @@
1
- /**
2
- * SMI-1062: Stripe Helper Functions
3
- *
4
- * Utility functions for Stripe operations.
5
- */
6
- import type Stripe from 'stripe';
7
- import type { SubscriptionStatus, LicenseTier, BillingPeriod, StripePriceId } from './types.js';
8
- import type { TierPriceConfigs } from './stripe-client-types.js';
9
- /**
10
- * Map Stripe subscription status to our internal status
11
- */
12
- export declare function mapSubscriptionStatus(stripeStatus: Stripe.Subscription.Status): SubscriptionStatus;
13
- /**
14
- * Get the price ID for a tier and billing period
15
- */
16
- export declare function getPriceIdForTier(prices: TierPriceConfigs, tier: LicenseTier, billingPeriod: BillingPeriod): StripePriceId | null;
17
- //# sourceMappingURL=stripe-helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripe-helpers.d.ts","sourceRoot":"","sources":["../../../src/billing/stripe-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAMhE;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,GACvC,kBAAkB,CAqBpB;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,aAAa,GAC3B,aAAa,GAAG,IAAI,CAWtB"}
@@ -1,50 +0,0 @@
1
- /**
2
- * SMI-1062: Stripe Helper Functions
3
- *
4
- * Utility functions for Stripe operations.
5
- */
6
- // ============================================================================
7
- // Status Mapping
8
- // ============================================================================
9
- /**
10
- * Map Stripe subscription status to our internal status
11
- */
12
- export function mapSubscriptionStatus(stripeStatus) {
13
- switch (stripeStatus) {
14
- case 'active':
15
- return 'active';
16
- case 'past_due':
17
- return 'past_due';
18
- case 'canceled':
19
- return 'canceled';
20
- case 'trialing':
21
- return 'trialing';
22
- case 'paused':
23
- return 'paused';
24
- case 'incomplete':
25
- return 'incomplete';
26
- case 'incomplete_expired':
27
- return 'incomplete_expired';
28
- case 'unpaid':
29
- return 'unpaid';
30
- default:
31
- return 'active';
32
- }
33
- }
34
- // ============================================================================
35
- // Price Helpers
36
- // ============================================================================
37
- /**
38
- * Get the price ID for a tier and billing period
39
- */
40
- export function getPriceIdForTier(prices, tier, billingPeriod) {
41
- if (tier === 'community') {
42
- return null; // Community tier is free, no Stripe price
43
- }
44
- const tierPrices = prices[tier];
45
- if (!tierPrices) {
46
- return null;
47
- }
48
- return tierPrices[billingPeriod];
49
- }
50
- //# sourceMappingURL=stripe-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripe-helpers.js","sourceRoot":"","sources":["../../../src/billing/stripe-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAwC;IAExC,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,UAAU;YACb,OAAO,UAAU,CAAA;QACnB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB,KAAK,YAAY;YACf,OAAO,YAAY,CAAA;QACrB,KAAK,oBAAoB;YACvB,OAAO,oBAAoB,CAAA;QAC7B,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAA;QACjB;YACE,OAAO,QAAQ,CAAA;IACnB,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAwB,EACxB,IAAiB,EACjB,aAA4B;IAE5B,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA,CAAC,0CAA0C;IACxD,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,IAA8B,CAAC,CAAA;IACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,UAAU,CAAC,aAAa,CAAC,CAAA;AAClC,CAAC"}