@makeco/stripe-kit 0.1.4 → 0.2.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 (260) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +47 -35
  3. package/dist/cli-prompts.d.ts +19 -0
  4. package/dist/cli-prompts.d.ts.map +1 -0
  5. package/dist/cli-prompts.js +154 -0
  6. package/dist/cli-prompts.js.map +1 -0
  7. package/dist/cli.js +13 -14
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/archive.d.ts +3 -0
  10. package/dist/commands/archive.d.ts.map +1 -0
  11. package/dist/commands/archive.js +119 -0
  12. package/dist/commands/archive.js.map +1 -0
  13. package/dist/commands/config.d.ts +3 -0
  14. package/dist/commands/config.d.ts.map +1 -0
  15. package/dist/commands/config.js +33 -0
  16. package/dist/commands/config.js.map +1 -0
  17. package/dist/commands/create.d.ts +3 -0
  18. package/dist/commands/create.d.ts.map +1 -0
  19. package/dist/commands/create.js +113 -0
  20. package/dist/commands/create.js.map +1 -0
  21. package/dist/commands/db.d.ts +3 -0
  22. package/dist/commands/db.d.ts.map +1 -0
  23. package/dist/commands/db.js +143 -0
  24. package/dist/commands/db.js.map +1 -0
  25. package/dist/commands/index.d.ts +7 -7
  26. package/dist/commands/index.js +7 -7
  27. package/dist/commands/list.d.ts +3 -0
  28. package/dist/commands/list.d.ts.map +1 -0
  29. package/dist/commands/list.js +147 -0
  30. package/dist/commands/list.js.map +1 -0
  31. package/dist/commands/update.d.ts +3 -0
  32. package/dist/commands/update.d.ts.map +1 -0
  33. package/dist/commands/update.js +141 -0
  34. package/dist/commands/update.js.map +1 -0
  35. package/dist/commands/urls.d.ts +3 -0
  36. package/dist/commands/urls.d.ts.map +1 -0
  37. package/dist/commands/urls.js +79 -0
  38. package/dist/commands/urls.js.map +1 -0
  39. package/dist/definitions/action.constants.js +16 -16
  40. package/dist/definitions/config.schemas.d.ts +19 -256
  41. package/dist/definitions/config.schemas.d.ts.map +1 -1
  42. package/dist/definitions/config.schemas.js +11 -17
  43. package/dist/definitions/config.schemas.js.map +1 -1
  44. package/dist/definitions/context.types.d.ts +3 -4
  45. package/dist/definitions/context.types.d.ts.map +1 -1
  46. package/dist/definitions/database-adapter.schemas.d.ts +2 -2
  47. package/dist/definitions/database-adapter.schemas.js +1 -1
  48. package/dist/definitions/env.constants.js +4 -4
  49. package/dist/definitions/index.d.ts +6 -8
  50. package/dist/definitions/index.d.ts.map +1 -1
  51. package/dist/definitions/index.js +6 -8
  52. package/dist/definitions/index.js.map +1 -1
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.js +2 -2
  55. package/dist/utils/create-context.d.ts +1 -1
  56. package/dist/utils/create-context.d.ts.map +1 -1
  57. package/dist/utils/create-context.js +2 -5
  58. package/dist/utils/create-context.js.map +1 -1
  59. package/dist/utils/create-logger.d.ts +1 -1
  60. package/dist/utils/create-logger.js +13 -13
  61. package/dist/utils/define-config.d.ts +1 -1
  62. package/dist/utils/define-config.js +1 -1
  63. package/dist/utils/find-env-directories.js +14 -14
  64. package/dist/utils/index.d.ts +10 -11
  65. package/dist/utils/index.d.ts.map +1 -1
  66. package/dist/utils/index.js +10 -11
  67. package/dist/utils/index.js.map +1 -1
  68. package/dist/utils/load-config.d.ts +1 -1
  69. package/dist/utils/load-config.d.ts.map +1 -1
  70. package/dist/utils/load-config.js +68 -48
  71. package/dist/utils/load-config.js.map +1 -1
  72. package/dist/utils/load-env.d.ts +1 -1
  73. package/dist/utils/load-env.js +18 -18
  74. package/dist/utils/stripe-client.d.ts +1 -1
  75. package/dist/utils/stripe-client.js +3 -3
  76. package/dist/utils/stripe-repository.d.ts +2 -2
  77. package/dist/utils/stripe-repository.js +2 -2
  78. package/dist/utils/user-preferences.d.ts +1 -1
  79. package/dist/utils/user-preferences.js +7 -7
  80. package/package.json +9 -4
  81. package/dist/cli-prompts/action.d.ts +0 -5
  82. package/dist/cli-prompts/action.d.ts.map +0 -1
  83. package/dist/cli-prompts/action.js +0 -36
  84. package/dist/cli-prompts/action.js.map +0 -1
  85. package/dist/cli-prompts/adapter.d.ts +0 -9
  86. package/dist/cli-prompts/adapter.d.ts.map +0 -1
  87. package/dist/cli-prompts/adapter.js +0 -53
  88. package/dist/cli-prompts/adapter.js.map +0 -1
  89. package/dist/cli-prompts/confirmation.d.ts +0 -6
  90. package/dist/cli-prompts/confirmation.d.ts.map +0 -1
  91. package/dist/cli-prompts/confirmation.js +0 -27
  92. package/dist/cli-prompts/confirmation.js.map +0 -1
  93. package/dist/cli-prompts/environment.d.ts +0 -5
  94. package/dist/cli-prompts/environment.d.ts.map +0 -1
  95. package/dist/cli-prompts/environment.js +0 -43
  96. package/dist/cli-prompts/environment.js.map +0 -1
  97. package/dist/cli-prompts/index.d.ts +0 -5
  98. package/dist/cli-prompts/index.d.ts.map +0 -1
  99. package/dist/cli-prompts/index.js +0 -5
  100. package/dist/cli-prompts/index.js.map +0 -1
  101. package/dist/commands/archive/archive.action.d.ts +0 -5
  102. package/dist/commands/archive/archive.action.d.ts.map +0 -1
  103. package/dist/commands/archive/archive.action.js +0 -73
  104. package/dist/commands/archive/archive.action.js.map +0 -1
  105. package/dist/commands/archive/archive.command.d.ts +0 -3
  106. package/dist/commands/archive/archive.command.d.ts.map +0 -1
  107. package/dist/commands/archive/archive.command.js +0 -24
  108. package/dist/commands/archive/archive.command.js.map +0 -1
  109. package/dist/commands/archive/archive.preflight.d.ts +0 -13
  110. package/dist/commands/archive/archive.preflight.d.ts.map +0 -1
  111. package/dist/commands/archive/archive.preflight.js +0 -27
  112. package/dist/commands/archive/archive.preflight.js.map +0 -1
  113. package/dist/commands/archive/index.d.ts +0 -2
  114. package/dist/commands/archive/index.d.ts.map +0 -1
  115. package/dist/commands/archive/index.js +0 -2
  116. package/dist/commands/archive/index.js.map +0 -1
  117. package/dist/commands/config/config.command.d.ts +0 -3
  118. package/dist/commands/config/config.command.d.ts.map +0 -1
  119. package/dist/commands/config/config.command.js +0 -33
  120. package/dist/commands/config/config.command.js.map +0 -1
  121. package/dist/commands/config/index.d.ts +0 -2
  122. package/dist/commands/config/index.d.ts.map +0 -1
  123. package/dist/commands/config/index.js +0 -2
  124. package/dist/commands/config/index.js.map +0 -1
  125. package/dist/commands/create/create.action.d.ts +0 -5
  126. package/dist/commands/create/create.action.d.ts.map +0 -1
  127. package/dist/commands/create/create.action.js +0 -53
  128. package/dist/commands/create/create.action.js.map +0 -1
  129. package/dist/commands/create/create.command.d.ts +0 -3
  130. package/dist/commands/create/create.command.d.ts.map +0 -1
  131. package/dist/commands/create/create.command.js +0 -22
  132. package/dist/commands/create/create.command.js.map +0 -1
  133. package/dist/commands/create/create.preflight.d.ts +0 -13
  134. package/dist/commands/create/create.preflight.d.ts.map +0 -1
  135. package/dist/commands/create/create.preflight.js +0 -24
  136. package/dist/commands/create/create.preflight.js.map +0 -1
  137. package/dist/commands/create/index.d.ts +0 -2
  138. package/dist/commands/create/index.d.ts.map +0 -1
  139. package/dist/commands/create/index.js +0 -2
  140. package/dist/commands/create/index.js.map +0 -1
  141. package/dist/commands/db/db.command.d.ts +0 -3
  142. package/dist/commands/db/db.command.d.ts.map +0 -1
  143. package/dist/commands/db/db.command.js +0 -13
  144. package/dist/commands/db/db.command.js.map +0 -1
  145. package/dist/commands/db/index.d.ts +0 -4
  146. package/dist/commands/db/index.d.ts.map +0 -1
  147. package/dist/commands/db/index.js +0 -4
  148. package/dist/commands/db/index.js.map +0 -1
  149. package/dist/commands/db/purge/index.d.ts +0 -2
  150. package/dist/commands/db/purge/index.d.ts.map +0 -1
  151. package/dist/commands/db/purge/index.js +0 -2
  152. package/dist/commands/db/purge/index.js.map +0 -1
  153. package/dist/commands/db/purge/purge.action.d.ts +0 -3
  154. package/dist/commands/db/purge/purge.action.d.ts.map +0 -1
  155. package/dist/commands/db/purge/purge.action.js +0 -17
  156. package/dist/commands/db/purge/purge.action.js.map +0 -1
  157. package/dist/commands/db/purge/purge.command.d.ts +0 -3
  158. package/dist/commands/db/purge/purge.command.d.ts.map +0 -1
  159. package/dist/commands/db/purge/purge.command.js +0 -23
  160. package/dist/commands/db/purge/purge.command.js.map +0 -1
  161. package/dist/commands/db/purge/purge.preflight.d.ts +0 -12
  162. package/dist/commands/db/purge/purge.preflight.d.ts.map +0 -1
  163. package/dist/commands/db/purge/purge.preflight.js +0 -27
  164. package/dist/commands/db/purge/purge.preflight.js.map +0 -1
  165. package/dist/commands/db/sync/index.d.ts +0 -2
  166. package/dist/commands/db/sync/index.d.ts.map +0 -1
  167. package/dist/commands/db/sync/index.js +0 -2
  168. package/dist/commands/db/sync/index.js.map +0 -1
  169. package/dist/commands/db/sync/sync.action.d.ts +0 -3
  170. package/dist/commands/db/sync/sync.action.d.ts.map +0 -1
  171. package/dist/commands/db/sync/sync.action.js +0 -24
  172. package/dist/commands/db/sync/sync.action.js.map +0 -1
  173. package/dist/commands/db/sync/sync.command.d.ts +0 -3
  174. package/dist/commands/db/sync/sync.command.d.ts.map +0 -1
  175. package/dist/commands/db/sync/sync.command.js +0 -23
  176. package/dist/commands/db/sync/sync.command.js.map +0 -1
  177. package/dist/commands/db/sync/sync.preflight.d.ts +0 -12
  178. package/dist/commands/db/sync/sync.preflight.d.ts.map +0 -1
  179. package/dist/commands/db/sync/sync.preflight.js +0 -33
  180. package/dist/commands/db/sync/sync.preflight.js.map +0 -1
  181. package/dist/commands/list/index.d.ts +0 -4
  182. package/dist/commands/list/index.d.ts.map +0 -1
  183. package/dist/commands/list/index.js +0 -4
  184. package/dist/commands/list/index.js.map +0 -1
  185. package/dist/commands/list/list.command.d.ts +0 -3
  186. package/dist/commands/list/list.command.d.ts.map +0 -1
  187. package/dist/commands/list/list.command.js +0 -13
  188. package/dist/commands/list/list.command.js.map +0 -1
  189. package/dist/commands/list/prices/index.d.ts +0 -2
  190. package/dist/commands/list/prices/index.d.ts.map +0 -1
  191. package/dist/commands/list/prices/index.js +0 -2
  192. package/dist/commands/list/prices/index.js.map +0 -1
  193. package/dist/commands/list/prices/prices.action.d.ts +0 -5
  194. package/dist/commands/list/prices/prices.action.d.ts.map +0 -1
  195. package/dist/commands/list/prices/prices.action.js +0 -40
  196. package/dist/commands/list/prices/prices.action.js.map +0 -1
  197. package/dist/commands/list/prices/prices.command.d.ts +0 -3
  198. package/dist/commands/list/prices/prices.command.d.ts.map +0 -1
  199. package/dist/commands/list/prices/prices.command.js +0 -22
  200. package/dist/commands/list/prices/prices.command.js.map +0 -1
  201. package/dist/commands/list/prices/prices.preflight.d.ts +0 -13
  202. package/dist/commands/list/prices/prices.preflight.d.ts.map +0 -1
  203. package/dist/commands/list/prices/prices.preflight.js +0 -19
  204. package/dist/commands/list/prices/prices.preflight.js.map +0 -1
  205. package/dist/commands/list/products/index.d.ts +0 -2
  206. package/dist/commands/list/products/index.d.ts.map +0 -1
  207. package/dist/commands/list/products/index.js +0 -2
  208. package/dist/commands/list/products/index.js.map +0 -1
  209. package/dist/commands/list/products/products.action.d.ts +0 -5
  210. package/dist/commands/list/products/products.action.d.ts.map +0 -1
  211. package/dist/commands/list/products/products.action.js +0 -32
  212. package/dist/commands/list/products/products.action.js.map +0 -1
  213. package/dist/commands/list/products/products.command.d.ts +0 -3
  214. package/dist/commands/list/products/products.command.d.ts.map +0 -1
  215. package/dist/commands/list/products/products.command.js +0 -22
  216. package/dist/commands/list/products/products.command.js.map +0 -1
  217. package/dist/commands/list/products/products.preflight.d.ts +0 -13
  218. package/dist/commands/list/products/products.preflight.d.ts.map +0 -1
  219. package/dist/commands/list/products/products.preflight.js +0 -19
  220. package/dist/commands/list/products/products.preflight.js.map +0 -1
  221. package/dist/commands/update/index.d.ts +0 -2
  222. package/dist/commands/update/index.d.ts.map +0 -1
  223. package/dist/commands/update/index.js +0 -2
  224. package/dist/commands/update/index.js.map +0 -1
  225. package/dist/commands/update/update.action.d.ts +0 -3
  226. package/dist/commands/update/update.action.d.ts.map +0 -1
  227. package/dist/commands/update/update.action.js +0 -84
  228. package/dist/commands/update/update.action.js.map +0 -1
  229. package/dist/commands/update/update.command.d.ts +0 -3
  230. package/dist/commands/update/update.command.d.ts.map +0 -1
  231. package/dist/commands/update/update.command.js +0 -22
  232. package/dist/commands/update/update.command.js.map +0 -1
  233. package/dist/commands/update/update.preflight.d.ts +0 -12
  234. package/dist/commands/update/update.preflight.d.ts.map +0 -1
  235. package/dist/commands/update/update.preflight.js +0 -36
  236. package/dist/commands/update/update.preflight.js.map +0 -1
  237. package/dist/commands/urls/index.d.ts +0 -2
  238. package/dist/commands/urls/index.d.ts.map +0 -1
  239. package/dist/commands/urls/index.js +0 -2
  240. package/dist/commands/urls/index.js.map +0 -1
  241. package/dist/commands/urls/urls.action.d.ts +0 -4
  242. package/dist/commands/urls/urls.action.d.ts.map +0 -1
  243. package/dist/commands/urls/urls.action.js +0 -65
  244. package/dist/commands/urls/urls.action.js.map +0 -1
  245. package/dist/commands/urls/urls.command.d.ts +0 -6
  246. package/dist/commands/urls/urls.command.d.ts.map +0 -1
  247. package/dist/commands/urls/urls.command.js +0 -19
  248. package/dist/commands/urls/urls.command.js.map +0 -1
  249. package/dist/definitions/stripe-price.schemas.d.ts +0 -132
  250. package/dist/definitions/stripe-price.schemas.d.ts.map +0 -1
  251. package/dist/definitions/stripe-price.schemas.js +0 -50
  252. package/dist/definitions/stripe-price.schemas.js.map +0 -1
  253. package/dist/definitions/stripe-product.schemas.d.ts +0 -87
  254. package/dist/definitions/stripe-product.schemas.d.ts.map +0 -1
  255. package/dist/definitions/stripe-product.schemas.js +0 -42
  256. package/dist/definitions/stripe-product.schemas.js.map +0 -1
  257. package/dist/utils/create-mappers.d.ts +0 -3
  258. package/dist/utils/create-mappers.d.ts.map +0 -1
  259. package/dist/utils/create-mappers.js +0 -98
  260. package/dist/utils/create-mappers.js.map +0 -1
@@ -1,22 +1,22 @@
1
1
  export const ACTIONS = {
2
- CREATE: 'create',
3
- ARCHIVE: 'archive',
4
- SYNC: 'sync',
5
- UPDATE: 'update',
6
- CLEAR_DB_PLANS: 'clear-db-plans',
7
- URL: 'url',
8
- LIST_PRODUCTS: 'list-products',
9
- LIST_PRICES: 'list-prices',
2
+ CREATE: "create",
3
+ ARCHIVE: "archive",
4
+ SYNC: "sync",
5
+ UPDATE: "update",
6
+ CLEAR_DB_PLANS: "clear-db-plans",
7
+ URL: "url",
8
+ LIST_PRODUCTS: "list-products",
9
+ LIST_PRICES: "list-prices",
10
10
  };
11
11
  export const VALID_ACTIONS = Object.values(ACTIONS);
12
12
  export const ACTION_DESCRIPTIONS = {
13
- [ACTIONS.CREATE]: '[create]: Create Stripe subscription plans (Idempotent)',
14
- [ACTIONS.ARCHIVE]: '[archive]: Archive Stripe subscription plans',
15
- [ACTIONS.SYNC]: '[sync]: Sync Stripe subscription plans to database',
16
- [ACTIONS.UPDATE]: '[update]: Update Stripe subscription plans',
17
- [ACTIONS.CLEAR_DB_PLANS]: '[clear-db-plans]: Delete subscription plans from database',
18
- [ACTIONS.URL]: '[url]: Show Stripe dashboard URL',
19
- [ACTIONS.LIST_PRODUCTS]: '[list-products]: List Stripe products',
20
- [ACTIONS.LIST_PRICES]: '[list-prices]: List Stripe prices',
13
+ [ACTIONS.CREATE]: "[create]: Create Stripe subscription plans (Idempotent)",
14
+ [ACTIONS.ARCHIVE]: "[archive]: Archive Stripe subscription plans",
15
+ [ACTIONS.SYNC]: "[sync]: Sync Stripe subscription plans to database",
16
+ [ACTIONS.UPDATE]: "[update]: Update Stripe subscription plans",
17
+ [ACTIONS.CLEAR_DB_PLANS]: "[clear-db-plans]: Delete subscription plans from database",
18
+ [ACTIONS.URL]: "[url]: Show Stripe dashboard URL",
19
+ [ACTIONS.LIST_PRODUCTS]: "[list-products]: List Stripe products",
20
+ [ACTIONS.LIST_PRICES]: "[list-prices]: List Stripe prices",
21
21
  };
22
22
  //# sourceMappingURL=action.constants.js.map
@@ -1,264 +1,22 @@
1
- import { z } from 'zod';
2
- import type { DatabaseAdapter } from './database-adapter.schemas.js';
3
- import type { Prettify } from './utility.types.js';
4
- export declare const subscriptionPlanSchema: z.ZodObject<{
5
- product: z.ZodObject<{
6
- id: z.ZodString;
7
- name: z.ZodString;
8
- active: z.ZodDefault<z.ZodBoolean>;
9
- description: z.ZodOptional<z.ZodString>;
10
- defaultPriceData: z.ZodOptional<z.ZodObject<{
11
- currency: z.ZodString;
12
- unitAmount: z.ZodOptional<z.ZodNumber>;
13
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
14
- recurring: z.ZodOptional<z.ZodObject<{
15
- interval: z.ZodEnum<{
16
- day: "day";
17
- month: "month";
18
- week: "week";
19
- year: "year";
20
- }>;
21
- intervalCount: z.ZodOptional<z.ZodNumber>;
22
- }, z.core.$strip>>;
23
- taxBehavior: z.ZodOptional<z.ZodEnum<{
24
- inclusive: "inclusive";
25
- exclusive: "exclusive";
26
- unspecified: "unspecified";
27
- }>>;
28
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
29
- }, z.core.$strip>>;
30
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
- marketingFeatures: z.ZodOptional<z.ZodArray<z.ZodObject<{
32
- name: z.ZodString;
33
- }, z.core.$strip>>>;
34
- url: z.ZodOptional<z.ZodString>;
35
- type: z.ZodDefault<z.ZodEnum<{
36
- good: "good";
37
- service: "service";
38
- }>>;
39
- shippable: z.ZodOptional<z.ZodBoolean>;
40
- packageDimensions: z.ZodOptional<z.ZodObject<{
41
- height: z.ZodNumber;
42
- length: z.ZodNumber;
43
- weight: z.ZodNumber;
44
- width: z.ZodNumber;
45
- }, z.core.$strip>>;
46
- statementDescriptor: z.ZodOptional<z.ZodString>;
47
- taxCode: z.ZodOptional<z.ZodString>;
48
- unitLabel: z.ZodOptional<z.ZodString>;
49
- features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
50
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
51
- }, z.core.$strip>;
52
- prices: z.ZodArray<z.ZodObject<{
53
- id: z.ZodString;
54
- currency: z.ZodString;
55
- unitAmount: z.ZodOptional<z.ZodNumber>;
56
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
57
- type: z.ZodDefault<z.ZodEnum<{
58
- one_time: "one_time";
59
- recurring: "recurring";
60
- }>>;
61
- billingScheme: z.ZodDefault<z.ZodEnum<{
62
- per_unit: "per_unit";
63
- tiered: "tiered";
64
- }>>;
65
- recurring: z.ZodOptional<z.ZodObject<{
66
- interval: z.ZodEnum<{
67
- day: "day";
68
- month: "month";
69
- week: "week";
70
- year: "year";
71
- }>;
72
- intervalCount: z.ZodDefault<z.ZodNumber>;
73
- trialPeriodDays: z.ZodOptional<z.ZodNumber>;
74
- usageType: z.ZodDefault<z.ZodEnum<{
75
- licensed: "licensed";
76
- metered: "metered";
77
- }>>;
78
- meter: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strip>>;
80
- tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
81
- flatAmount: z.ZodOptional<z.ZodNumber>;
82
- flatAmountDecimal: z.ZodOptional<z.ZodString>;
83
- unitAmount: z.ZodOptional<z.ZodNumber>;
84
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
85
- upTo: z.ZodUnion<readonly [z.ZodLiteral<"inf">, z.ZodNumber]>;
86
- }, z.core.$strip>>>;
87
- tiersMode: z.ZodOptional<z.ZodEnum<{
88
- graduated: "graduated";
89
- volume: "volume";
90
- }>>;
91
- transformQuantity: z.ZodOptional<z.ZodObject<{
92
- divideBy: z.ZodNumber;
93
- round: z.ZodEnum<{
94
- down: "down";
95
- up: "up";
96
- }>;
97
- }, z.core.$strip>>;
98
- currencyOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
99
- unitAmount: z.ZodOptional<z.ZodNumber>;
100
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
101
- taxBehavior: z.ZodOptional<z.ZodEnum<{
102
- inclusive: "inclusive";
103
- exclusive: "exclusive";
104
- unspecified: "unspecified";
105
- }>>;
106
- }, z.core.$strip>>>;
107
- customUnitAmount: z.ZodOptional<z.ZodObject<{
108
- enabled: z.ZodBoolean;
109
- maximum: z.ZodOptional<z.ZodNumber>;
110
- minimum: z.ZodOptional<z.ZodNumber>;
111
- preset: z.ZodOptional<z.ZodNumber>;
112
- }, z.core.$strip>>;
113
- taxBehavior: z.ZodOptional<z.ZodEnum<{
114
- inclusive: "inclusive";
115
- exclusive: "exclusive";
116
- unspecified: "unspecified";
117
- }>>;
118
- nickname: z.ZodOptional<z.ZodString>;
119
- lookupKey: z.ZodOptional<z.ZodString>;
120
- active: z.ZodDefault<z.ZodBoolean>;
121
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
122
- }, z.core.$strip>>;
123
- }, z.core.$strip>;
124
- export type SubscriptionPlan = z.infer<typeof subscriptionPlanSchema>;
125
- export interface StripePriceContext {
126
- stripeProductId: string;
127
- internalProductId: string;
128
- planName: string;
129
- tier: string;
130
- }
131
- export interface StripeMappers {
132
- mapSubscriptionPlanToStripeProduct: (plan: SubscriptionPlan) => import('stripe').Stripe.ProductCreateParams;
133
- mapSubscriptionPlanToStripePrice: (price: import('./stripe-price.schemas.js').StripePrice, context: StripePriceContext) => import('stripe').Stripe.PriceCreateParams;
1
+ import type Stripe from "stripe";
2
+ import { z } from "zod";
3
+ import type { DatabaseAdapter } from "./database-adapter.schemas.js";
4
+ import type { Prettify } from "./utility.types.js";
5
+ export interface SubscriptionPlan {
6
+ id: string;
7
+ product: Stripe.ProductCreateParams;
8
+ prices: Array<{
9
+ id: string;
10
+ } & Omit<Stripe.PriceCreateParams, "product">>;
134
11
  }
135
12
  export declare const configSchema: z.ZodObject<{
136
- plans: z.ZodArray<z.ZodObject<{
137
- product: z.ZodObject<{
138
- id: z.ZodString;
139
- name: z.ZodString;
140
- active: z.ZodDefault<z.ZodBoolean>;
141
- description: z.ZodOptional<z.ZodString>;
142
- defaultPriceData: z.ZodOptional<z.ZodObject<{
143
- currency: z.ZodString;
144
- unitAmount: z.ZodOptional<z.ZodNumber>;
145
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
146
- recurring: z.ZodOptional<z.ZodObject<{
147
- interval: z.ZodEnum<{
148
- day: "day";
149
- month: "month";
150
- week: "week";
151
- year: "year";
152
- }>;
153
- intervalCount: z.ZodOptional<z.ZodNumber>;
154
- }, z.core.$strip>>;
155
- taxBehavior: z.ZodOptional<z.ZodEnum<{
156
- inclusive: "inclusive";
157
- exclusive: "exclusive";
158
- unspecified: "unspecified";
159
- }>>;
160
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
161
- }, z.core.$strip>>;
162
- images: z.ZodOptional<z.ZodArray<z.ZodString>>;
163
- marketingFeatures: z.ZodOptional<z.ZodArray<z.ZodObject<{
164
- name: z.ZodString;
165
- }, z.core.$strip>>>;
166
- url: z.ZodOptional<z.ZodString>;
167
- type: z.ZodDefault<z.ZodEnum<{
168
- good: "good";
169
- service: "service";
170
- }>>;
171
- shippable: z.ZodOptional<z.ZodBoolean>;
172
- packageDimensions: z.ZodOptional<z.ZodObject<{
173
- height: z.ZodNumber;
174
- length: z.ZodNumber;
175
- weight: z.ZodNumber;
176
- width: z.ZodNumber;
177
- }, z.core.$strip>>;
178
- statementDescriptor: z.ZodOptional<z.ZodString>;
179
- taxCode: z.ZodOptional<z.ZodString>;
180
- unitLabel: z.ZodOptional<z.ZodString>;
181
- features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
182
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
183
- }, z.core.$strip>;
184
- prices: z.ZodArray<z.ZodObject<{
185
- id: z.ZodString;
186
- currency: z.ZodString;
187
- unitAmount: z.ZodOptional<z.ZodNumber>;
188
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
189
- type: z.ZodDefault<z.ZodEnum<{
190
- one_time: "one_time";
191
- recurring: "recurring";
192
- }>>;
193
- billingScheme: z.ZodDefault<z.ZodEnum<{
194
- per_unit: "per_unit";
195
- tiered: "tiered";
196
- }>>;
197
- recurring: z.ZodOptional<z.ZodObject<{
198
- interval: z.ZodEnum<{
199
- day: "day";
200
- month: "month";
201
- week: "week";
202
- year: "year";
203
- }>;
204
- intervalCount: z.ZodDefault<z.ZodNumber>;
205
- trialPeriodDays: z.ZodOptional<z.ZodNumber>;
206
- usageType: z.ZodDefault<z.ZodEnum<{
207
- licensed: "licensed";
208
- metered: "metered";
209
- }>>;
210
- meter: z.ZodOptional<z.ZodString>;
211
- }, z.core.$strip>>;
212
- tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
213
- flatAmount: z.ZodOptional<z.ZodNumber>;
214
- flatAmountDecimal: z.ZodOptional<z.ZodString>;
215
- unitAmount: z.ZodOptional<z.ZodNumber>;
216
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
217
- upTo: z.ZodUnion<readonly [z.ZodLiteral<"inf">, z.ZodNumber]>;
218
- }, z.core.$strip>>>;
219
- tiersMode: z.ZodOptional<z.ZodEnum<{
220
- graduated: "graduated";
221
- volume: "volume";
222
- }>>;
223
- transformQuantity: z.ZodOptional<z.ZodObject<{
224
- divideBy: z.ZodNumber;
225
- round: z.ZodEnum<{
226
- down: "down";
227
- up: "up";
228
- }>;
229
- }, z.core.$strip>>;
230
- currencyOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
231
- unitAmount: z.ZodOptional<z.ZodNumber>;
232
- unitAmountDecimal: z.ZodOptional<z.ZodString>;
233
- taxBehavior: z.ZodOptional<z.ZodEnum<{
234
- inclusive: "inclusive";
235
- exclusive: "exclusive";
236
- unspecified: "unspecified";
237
- }>>;
238
- }, z.core.$strip>>>;
239
- customUnitAmount: z.ZodOptional<z.ZodObject<{
240
- enabled: z.ZodBoolean;
241
- maximum: z.ZodOptional<z.ZodNumber>;
242
- minimum: z.ZodOptional<z.ZodNumber>;
243
- preset: z.ZodOptional<z.ZodNumber>;
244
- }, z.core.$strip>>;
245
- taxBehavior: z.ZodOptional<z.ZodEnum<{
246
- inclusive: "inclusive";
247
- exclusive: "exclusive";
248
- unspecified: "unspecified";
249
- }>>;
250
- nickname: z.ZodOptional<z.ZodString>;
251
- lookupKey: z.ZodOptional<z.ZodString>;
252
- active: z.ZodDefault<z.ZodBoolean>;
253
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
254
- }, z.core.$strip>>;
255
- }, z.core.$strip>>;
13
+ plans: z.ZodArray<z.ZodAny>;
256
14
  env: z.ZodObject<{
257
15
  stripeSecretKey: z.ZodString;
258
16
  }, z.core.$strip>;
259
17
  adapters: z.ZodRecord<z.ZodString, z.ZodObject<{
260
- syncProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<(products: import("stripe").Stripe.Product[]) => Promise<void>, any>>;
261
- syncPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<(prices: import("stripe").Stripe.Price[]) => Promise<void>, any>>;
18
+ syncProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<(products: Stripe.Product[]) => Promise<void>, any>>;
19
+ syncPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<(prices: Stripe.Price[]) => Promise<void>, any>>;
262
20
  clearProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
263
21
  clearPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
264
22
  getProducts: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<(() => Promise<unknown[]>) | undefined, any>>>;
@@ -272,7 +30,12 @@ export declare const configSchema: z.ZodObject<{
272
30
  managedByValue: z.ZodDefault<z.ZodString>;
273
31
  }, z.core.$strip>>;
274
32
  }, z.core.$strip>;
275
- export type Config = Prettify<Omit<z.infer<typeof configSchema>, 'adapters'> & {
33
+ export type Config = Prettify<Omit<z.infer<typeof configSchema>, "adapters" | "plans"> & {
34
+ adapters: Record<string, DatabaseAdapter>;
35
+ plans: SubscriptionPlan[];
36
+ }>;
37
+ export type ConfigInput = Prettify<Omit<z.input<typeof configSchema>, "adapters" | "plans"> & {
276
38
  adapters: Record<string, DatabaseAdapter>;
39
+ plans: SubscriptionPlan[];
277
40
  }>;
278
41
  //# sourceMappingURL=config.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.schemas.d.ts","sourceRoot":"","sources":["../../src/definitions/config.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAMtE,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,kCAAkC,EAAE,CAClC,IAAI,EAAE,gBAAgB,KACnB,OAAO,QAAQ,EAAE,MAAM,CAAC,mBAAmB,CAAC;IACjD,gCAAgC,EAAE,CAChC,KAAK,EAAE,OAAO,wBAAwB,EAAE,WAAW,EACnD,OAAO,EAAE,kBAAkB,KACxB,OAAO,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC;CAChD;AAMD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAC3B,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,CAAC,GAAG;IAC/C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC3C,CACF,CAAC"}
1
+ {"version":3,"file":"config.schemas.d.ts","sourceRoot":"","sources":["../../src/definitions/config.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAahD,MAAM,WAAW,gBAAgB;IAK/B,EAAE,EAAE,MAAM,CAAC;IAMX,OAAO,EAAE,MAAM,CAAC,mBAAmB,CAAC;IASpC,MAAM,EAAE,KAAK,CACX;QAEE,EAAE,EAAE,MAAM,CAAC;KACZ,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAC9C,CAAC;CACH;AAMD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;iBAqBvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAC3B,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACzD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1C,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B,CACF,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAChC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACzD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1C,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B,CACF,CAAC"}
@@ -1,13 +1,7 @@
1
- import { z } from 'zod';
2
- import { databaseAdapterSchema } from './database-adapter.schemas.js';
3
- import { stripePriceSchema } from './stripe-price.schemas.js';
4
- import { stripeProductSchema } from './stripe-product.schemas.js';
5
- export const subscriptionPlanSchema = z.object({
6
- product: stripeProductSchema,
7
- prices: z.array(stripePriceSchema).min(1),
8
- });
1
+ import { z } from "zod";
2
+ import { databaseAdapterSchema } from "./database-adapter.schemas.js";
9
3
  export const configSchema = z.object({
10
- plans: z.array(subscriptionPlanSchema),
4
+ plans: z.array(z.any()),
11
5
  env: z.object({
12
6
  stripeSecretKey: z.string(),
13
7
  }),
@@ -15,16 +9,16 @@ export const configSchema = z.object({
15
9
  productIds: z.record(z.string(), z.string()).optional(),
16
10
  metadata: z
17
11
  .object({
18
- productIdField: z.string().default('internal_product_id'),
19
- priceIdField: z.string().default('internal_price_id'),
20
- managedByField: z.string().default('managed_by'),
21
- managedByValue: z.string().default('@makeco/stripe-kit'),
12
+ productIdField: z.string().default("internal_product_id"),
13
+ priceIdField: z.string().default("internal_price_id"),
14
+ managedByField: z.string().default("managed_by"),
15
+ managedByValue: z.string().default("@makeco/stripe-kit"),
22
16
  })
23
17
  .default({
24
- productIdField: 'internal_product_id',
25
- priceIdField: 'internal_price_id',
26
- managedByField: 'managed_by',
27
- managedByValue: '@makeco/stripe-kit',
18
+ productIdField: "internal_product_id",
19
+ priceIdField: "internal_price_id",
20
+ managedByField: "managed_by",
21
+ managedByValue: "@makeco/stripe-kit",
28
22
  }),
29
23
  });
30
24
  //# sourceMappingURL=config.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.schemas.js","sourceRoot":"","sources":["../../src/definitions/config.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAO/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAE7C,OAAO,EAAE,mBAAmB;IAG5B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1C,CAAC,CAAC;AA6BH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC5B,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvD,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC;QACrD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;QAChD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC;KACzD,CAAC;SACD,OAAO,CAAC;QACP,cAAc,EAAE,qBAAqB;QACrC,YAAY,EAAE,mBAAmB;QACjC,cAAc,EAAE,YAAY;QAC5B,cAAc,EAAE,oBAAoB;KACrC,CAAC;CACL,CAAC,CAAC"}
1
+ {"version":3,"file":"config.schemas.js","sourceRoot":"","sources":["../../src/definitions/config.schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA+CnE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAEnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACvB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC5B,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvD,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC;QACrD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;QAChD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC;KACzD,CAAC;SACD,OAAO,CAAC;QACP,cAAc,EAAE,qBAAqB;QACrC,YAAY,EAAE,mBAAmB;QACjC,cAAc,EAAE,YAAY;QAC5B,cAAc,EAAE,oBAAoB;KACrC,CAAC;CACL,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
- import type Stripe from 'stripe';
2
- import type { Config, StripeMappers } from './config.schemas.js';
3
- import type { DatabaseAdapter } from './database-adapter.schemas.js';
1
+ import type Stripe from "stripe";
2
+ import type { Config } from "./config.schemas.js";
3
+ import type { DatabaseAdapter } from "./database-adapter.schemas.js";
4
4
  export interface Logger {
5
5
  info(message: string | object, ...args: unknown[]): void;
6
6
  error(message: string | object, ...args: unknown[]): void;
@@ -10,7 +10,6 @@ export interface Logger {
10
10
  export interface Context {
11
11
  logger: Logger;
12
12
  env: Record<string, string | undefined>;
13
- mappers: StripeMappers;
14
13
  adapter: DatabaseAdapter;
15
14
  stripeClient: Stripe;
16
15
  config: Config;
@@ -1 +1 @@
1
- {"version":3,"file":"context.types.d.ts","sourceRoot":"","sources":["../../src/definitions/context.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAMlE,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"context.types.d.ts","sourceRoot":"","sources":["../../src/definitions/context.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAMlE,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -1,5 +1,5 @@
1
- import type Stripe from 'stripe';
2
- import { z } from 'zod';
1
+ import type Stripe from "stripe";
2
+ import { z } from "zod";
3
3
  export interface DatabaseAdapter {
4
4
  syncProducts(products: Stripe.Product[]): Promise<void>;
5
5
  syncPrices(prices: Stripe.Price[]): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  export const databaseAdapterSchema = z.object({
3
3
  syncProducts: z.any().transform((t) => t),
4
4
  syncPrices: z.any().transform((t) => t),
@@ -1,8 +1,8 @@
1
1
  export const ENVIRONMENTS = {
2
- TEST: 'test',
3
- DEV: 'dev',
4
- STAGING: 'staging',
5
- PROD: 'prod',
2
+ TEST: "test",
3
+ DEV: "dev",
4
+ STAGING: "staging",
5
+ PROD: "prod",
6
6
  };
7
7
  export const VALID_ENVIRONMENTS = Object.values(ENVIRONMENTS);
8
8
  export const ENV_CHOICES = VALID_ENVIRONMENTS;
@@ -1,9 +1,7 @@
1
- export * from './action.constants.js';
2
- export * from './config.schemas.js';
3
- export * from './context.types.js';
4
- export * from './database-adapter.schemas.js';
5
- export * from './env.constants.js';
6
- export * from './stripe-price.schemas.js';
7
- export * from './stripe-product.schemas.js';
8
- export * from './utility.types.js';
1
+ export * from "./action.constants.js";
2
+ export * from "./config.schemas.js";
3
+ export * from "./context.types.js";
4
+ export * from "./database-adapter.schemas.js";
5
+ export * from "./env.constants.js";
6
+ export * from "./utility.types.js";
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -1,9 +1,7 @@
1
- export * from './action.constants.js';
2
- export * from './config.schemas.js';
3
- export * from './context.types.js';
4
- export * from './database-adapter.schemas.js';
5
- export * from './env.constants.js';
6
- export * from './stripe-price.schemas.js';
7
- export * from './stripe-product.schemas.js';
8
- export * from './utility.types.js';
1
+ export * from "./action.constants.js";
2
+ export * from "./config.schemas.js";
3
+ export * from "./context.types.js";
4
+ export * from "./database-adapter.schemas.js";
5
+ export * from "./env.constants.js";
6
+ export * from "./utility.types.js";
9
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './definitions/index.js';
2
- export { defineConfig } from './utils/define-config.js';
1
+ export * from "./definitions/index.js";
2
+ export { defineConfig } from "./utils/define-config.js";
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './definitions/index.js';
2
- export { defineConfig } from './utils/define-config.js';
1
+ export * from "./definitions/index.js";
2
+ export { defineConfig } from "./utils/define-config.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { Config, Context, DatabaseAdapter } from '../definitions/index.js';
1
+ import type { Config, Context, DatabaseAdapter } from "../definitions/index.js";
2
2
  export declare function createContext(input: {
3
3
  adapter: DatabaseAdapter;
4
4
  config: Config;
@@ -1 +1 @@
1
- {"version":3,"file":"create-context.d.ts","sourceRoot":"","sources":["../../src/utils/create-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAQtE,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAsBV"}
1
+ {"version":3,"file":"create-context.d.ts","sourceRoot":"","sources":["../../src/utils/create-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOtE,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAkBV"}
@@ -1,6 +1,5 @@
1
- import { createLogger } from './create-logger.js';
2
- import { createMappers } from './create-mappers.js';
3
- import { createStripeClient } from './stripe-client.js';
1
+ import { createLogger } from "./create-logger.js";
2
+ import { createStripeClient } from "./stripe-client.js";
4
3
  export function createContext(input) {
5
4
  const { adapter, config } = input;
6
5
  const logger = createLogger();
@@ -8,11 +7,9 @@ export function createContext(input) {
8
7
  const stripeClient = createStripeClient({
9
8
  STRIPE_SECRET_KEY: stripeSecretKey,
10
9
  });
11
- const mappers = createMappers(config);
12
10
  return {
13
11
  logger,
14
12
  stripeClient,
15
- mappers,
16
13
  adapter,
17
14
  env: process.env,
18
15
  config,
@@ -1 +1 @@
1
- {"version":3,"file":"create-context.js","sourceRoot":"","sources":["../../src/utils/create-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD,MAAM,UAAU,aAAa,CAAC,KAG7B;IACC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAElC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;IAEnD,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,iBAAiB,EAAE,eAAe;KACnC,CAAC,CAAC;IAGH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtC,OAAO;QACL,MAAM;QACN,YAAY;QACZ,OAAO;QACP,OAAO;QACP,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,MAAM;KACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"create-context.js","sourceRoot":"","sources":["../../src/utils/create-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD,MAAM,UAAU,aAAa,CAAC,KAG7B;IACC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAElC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;IAEnD,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,iBAAiB,EAAE,eAAe;KACnC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,YAAY;QACZ,OAAO;QACP,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { Logger } from '../definitions/index.js';
1
+ import type { Logger } from "../definitions/index.js";
2
2
  export declare function createLogger(): Logger;
3
3
  //# sourceMappingURL=create-logger.d.ts.map
@@ -1,36 +1,36 @@
1
- import chalk from 'chalk';
1
+ import chalk from "chalk";
2
2
  export function createLogger() {
3
3
  return {
4
4
  info(message, ...args) {
5
- if (typeof message === 'object') {
6
- console.log(chalk.blue('[INFO]'), message, ...args);
5
+ if (typeof message === "object") {
6
+ console.log(chalk.blue("[INFO]"), message, ...args);
7
7
  }
8
8
  else {
9
- console.log(chalk.blue('[INFO]'), message, ...args);
9
+ console.log(chalk.blue("[INFO]"), message, ...args);
10
10
  }
11
11
  },
12
12
  error(message, ...args) {
13
- if (typeof message === 'object') {
14
- console.error(chalk.red('[ERROR]'), message, ...args);
13
+ if (typeof message === "object") {
14
+ console.error(chalk.red("[ERROR]"), message, ...args);
15
15
  }
16
16
  else {
17
- console.error(chalk.red('[ERROR]'), message, ...args);
17
+ console.error(chalk.red("[ERROR]"), message, ...args);
18
18
  }
19
19
  },
20
20
  warn(message, ...args) {
21
- if (typeof message === 'object') {
22
- console.warn(chalk.yellow('[WARN]'), message, ...args);
21
+ if (typeof message === "object") {
22
+ console.warn(chalk.yellow("[WARN]"), message, ...args);
23
23
  }
24
24
  else {
25
- console.warn(chalk.yellow('[WARN]'), message, ...args);
25
+ console.warn(chalk.yellow("[WARN]"), message, ...args);
26
26
  }
27
27
  },
28
28
  debug(message, ...args) {
29
- if (typeof message === 'object') {
30
- console.log(chalk.gray('[DEBUG]'), message, ...args);
29
+ if (typeof message === "object") {
30
+ console.log(chalk.gray("[DEBUG]"), message, ...args);
31
31
  }
32
32
  else {
33
- console.log(chalk.gray('[DEBUG]'), message, ...args);
33
+ console.log(chalk.gray("[DEBUG]"), message, ...args);
34
34
  }
35
35
  },
36
36
  };
@@ -1,3 +1,3 @@
1
- import type { Config } from '../definitions/index.js';
1
+ import type { Config } from "../definitions/index.js";
2
2
  export declare function defineConfig(config: Config): Config;
3
3
  //# sourceMappingURL=define-config.d.ts.map
@@ -1,4 +1,4 @@
1
- import { configSchema } from '../definitions/index.js';
1
+ import { configSchema } from "../definitions/index.js";
2
2
  export function defineConfig(config) {
3
3
  const validatedConfig = configSchema.parse(config);
4
4
  return validatedConfig;