@happyvertical/smrt-commerce 0.51.32 → 0.51.33

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 (55) hide show
  1. package/dist/__tests__/foreign-key-fixtures.d.ts +13 -0
  2. package/dist/__tests__/foreign-key-fixtures.d.ts.map +1 -0
  3. package/dist/__tests__/helpers/anchor-fixture.d.ts +36 -0
  4. package/dist/__tests__/helpers/anchor-fixture.d.ts.map +1 -0
  5. package/dist/__tests__/helpers/billing-fixture.d.ts +51 -0
  6. package/dist/__tests__/helpers/billing-fixture.d.ts.map +1 -0
  7. package/dist/__tests__/helpers/consumer-license-sale.d.ts +13 -0
  8. package/dist/__tests__/helpers/consumer-license-sale.d.ts.map +1 -0
  9. package/dist/__tests__/helpers/fake-stripe.d.ts +146 -0
  10. package/dist/__tests__/helpers/fake-stripe.d.ts.map +1 -0
  11. package/dist/billing/cards.d.ts +14 -4
  12. package/dist/billing/credits.d.ts +2 -2
  13. package/dist/billing/cycles.d.ts +21 -1
  14. package/dist/billing/events.d.ts +14 -4
  15. package/dist/billing/jobs.d.ts +3 -3
  16. package/dist/billing/period-close.d.ts +1 -1
  17. package/dist/billing/provider.d.ts +12 -2
  18. package/dist/billing/runtime.d.ts +17 -12
  19. package/dist/billing/stripe.d.ts +11 -2
  20. package/dist/billing/top-up.d.ts +4 -4
  21. package/dist/collections/ContractCollection.d.ts +4 -0
  22. package/dist/collections/ContractLineItemCollection.d.ts +4 -0
  23. package/dist/collections/CustomerCollection.d.ts +4 -0
  24. package/dist/collections/FulfillmentCollection.d.ts +5 -1
  25. package/dist/collections/FulfillmentLineItemCollection.d.ts +4 -0
  26. package/dist/collections/InvoiceCollection.d.ts +4 -0
  27. package/dist/collections/InvoiceLineItemCollection.d.ts +5 -1
  28. package/dist/collections/PaymentAllocationCollection.d.ts +4 -0
  29. package/dist/collections/PaymentCollection.d.ts +5 -1
  30. package/dist/collections/PaymentInstrumentCollection.d.ts +4 -0
  31. package/dist/collections/PaymentIntentCollection.d.ts +12 -1
  32. package/dist/collections/PayoutCollection.d.ts +12 -1
  33. package/dist/collections/VendorCollection.d.ts +4 -0
  34. package/dist/index.d.ts +63 -0
  35. package/dist/index.js +1 -1
  36. package/dist/manifest.json +1 -1
  37. package/dist/migrations/moneyMinorUnits.d.ts +61 -1
  38. package/dist/models/Contract.d.ts +6 -2
  39. package/dist/models/ContractLineItem.d.ts +5 -1
  40. package/dist/models/Customer.d.ts +5 -1
  41. package/dist/models/Fulfillment.d.ts +5 -1
  42. package/dist/models/FulfillmentLineItem.d.ts +5 -1
  43. package/dist/models/Invoice.d.ts +6 -2
  44. package/dist/models/InvoiceLineItem.d.ts +5 -1
  45. package/dist/models/Payment.d.ts +6 -2
  46. package/dist/models/PaymentAllocation.d.ts +5 -1
  47. package/dist/models/PaymentInstrument.d.ts +5 -1
  48. package/dist/models/PaymentIntent.d.ts +24 -1
  49. package/dist/models/Payout.d.ts +24 -1
  50. package/dist/models/Vendor.d.ts +5 -1
  51. package/dist/models/billing.d.ts +8 -1
  52. package/dist/smrt-knowledge.json +4 -4
  53. package/dist/types/index.d.ts +5 -1
  54. package/dist/ui.d.ts +14 -1
  55. package/package.json +10 -10
@@ -1,3 +1,7 @@
1
+ /**
2
+ * VendorCollection - Collection manager for Vendor objects
3
+ * @packageDocumentation
4
+ */
1
5
  import { SmrtCollection } from '@happyvertical/smrt-core';
2
6
  import { Vendor } from '../models/Vendor.js';
3
7
  import { VendorStatus } from '../types/index.js';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,66 @@
1
+ /**
2
+ * @happyvertical/smrt-commerce
3
+ *
4
+ * Commerce models for the SMRT framework - contracts, fulfillments, payments.
5
+ *
6
+ * Key concepts:
7
+ * - Customer/Vendor link to Profile (from smrt-profiles)
8
+ * - Contract uses STI for different types (Estimate, Order, Lease, etc.)
9
+ * - Payment integrates with smrt-ledgers for journal entries
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import {
14
+ * Customer,
15
+ * CustomerCollection,
16
+ * Order,
17
+ * ContractCollection,
18
+ * Payment,
19
+ * PaymentCollection,
20
+ * } from '@happyvertical/smrt-commerce';
21
+ *
22
+ * // Create collections
23
+ * const customers = await CustomerCollection.create({
24
+ * persistence: { type: 'sql', url: 'commerce.db' }
25
+ * });
26
+ *
27
+ * // Create a customer linked to a profile
28
+ * // Every money value is integer minor units — $100.00 is 10000 (#2401).
29
+ * const customer = await customers.create({
30
+ * profileId: 'profile-uuid',
31
+ * creditLimit: 1000000, // $10,000.00
32
+ * paymentTerms: 'Net 30'
33
+ * });
34
+ * await customer.save();
35
+ *
36
+ * // Create an order
37
+ * const contracts = await ContractCollection.create(customer.options);
38
+ * const order = await contracts.create({
39
+ * _meta_type: 'Order',
40
+ * customerId: customer.id,
41
+ * totalAmount: 150000 // $1,500.00
42
+ * });
43
+ * await order.save();
44
+ *
45
+ * // Record payment with ledger integration
46
+ * const payments = await PaymentCollection.create(order.options);
47
+ * const payment = await payments.create({
48
+ * contractId: order.id,
49
+ * customerId: customer.id,
50
+ * amount: 150000
51
+ * });
52
+ * await payment.save();
53
+ *
54
+ * await payment.recordPayment({
55
+ * ledgerId: ledger.id,
56
+ * receivablesAccountId: arAccount.id,
57
+ * cashAccountId: bankAccount.id
58
+ * });
59
+ * ```
60
+ *
61
+ * @packageDocumentation
62
+ */
63
+ import './__smrt-register__.js';
1
64
  export * from './billing/index.js';
2
65
  export { ContractCollection, ContractLineItemCollection, type CreatePayoutFromPaymentArgs, CustomerCollection, FulfillmentCollection, FulfillmentLineItemCollection, InvoiceCollection, InvoiceLineItemCollection, type InvoiceNumberOptions, PaymentAllocationCollection, PaymentCollection, PaymentInstrumentCollection, PaymentIntentCollection, type PaymentIntentIdempotencyArgs, type PaymentIntentSeed, PayoutCollection, UNPAID_STATUSES, VendorCollection, } from './collections/index.js';
3
66
  export { COMMERCE_MONEY_COLUMNS, COMMERCE_MONEY_MINOR_UNITS_BACKFILL, COMMERCE_NATIVE_UNIT_COLUMNS, migrateCommerceMoneyToMinorUnits, preflightCommerceMoneyMinorUnits, } from './migrations/moneyMinorUnits.js';