@makeco/stripe-kit 0.1.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 (263) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +201 -0
  3. package/dist/cli-prompts/action.d.ts +5 -0
  4. package/dist/cli-prompts/action.d.ts.map +1 -0
  5. package/dist/cli-prompts/action.js +36 -0
  6. package/dist/cli-prompts/action.js.map +1 -0
  7. package/dist/cli-prompts/adapter.d.ts +9 -0
  8. package/dist/cli-prompts/adapter.d.ts.map +1 -0
  9. package/dist/cli-prompts/adapter.js +53 -0
  10. package/dist/cli-prompts/adapter.js.map +1 -0
  11. package/dist/cli-prompts/confirmation.d.ts +6 -0
  12. package/dist/cli-prompts/confirmation.d.ts.map +1 -0
  13. package/dist/cli-prompts/confirmation.js +27 -0
  14. package/dist/cli-prompts/confirmation.js.map +1 -0
  15. package/dist/cli-prompts/environment.d.ts +5 -0
  16. package/dist/cli-prompts/environment.d.ts.map +1 -0
  17. package/dist/cli-prompts/environment.js +43 -0
  18. package/dist/cli-prompts/environment.js.map +1 -0
  19. package/dist/cli-prompts/index.d.ts +5 -0
  20. package/dist/cli-prompts/index.d.ts.map +1 -0
  21. package/dist/cli-prompts/index.js +5 -0
  22. package/dist/cli-prompts/index.js.map +1 -0
  23. package/dist/cli.d.ts +3 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +33 -0
  26. package/dist/cli.js.map +1 -0
  27. package/dist/commands/archive/archive.action.d.ts +5 -0
  28. package/dist/commands/archive/archive.action.d.ts.map +1 -0
  29. package/dist/commands/archive/archive.action.js +73 -0
  30. package/dist/commands/archive/archive.action.js.map +1 -0
  31. package/dist/commands/archive/archive.command.d.ts +3 -0
  32. package/dist/commands/archive/archive.command.d.ts.map +1 -0
  33. package/dist/commands/archive/archive.command.js +23 -0
  34. package/dist/commands/archive/archive.command.js.map +1 -0
  35. package/dist/commands/archive/archive.preflight.d.ts +13 -0
  36. package/dist/commands/archive/archive.preflight.d.ts.map +1 -0
  37. package/dist/commands/archive/archive.preflight.js +27 -0
  38. package/dist/commands/archive/archive.preflight.js.map +1 -0
  39. package/dist/commands/archive/index.d.ts +2 -0
  40. package/dist/commands/archive/index.d.ts.map +1 -0
  41. package/dist/commands/archive/index.js +2 -0
  42. package/dist/commands/archive/index.js.map +1 -0
  43. package/dist/commands/config/config.command.d.ts +3 -0
  44. package/dist/commands/config/config.command.d.ts.map +1 -0
  45. package/dist/commands/config/config.command.js +33 -0
  46. package/dist/commands/config/config.command.js.map +1 -0
  47. package/dist/commands/config/index.d.ts +2 -0
  48. package/dist/commands/config/index.d.ts.map +1 -0
  49. package/dist/commands/config/index.js +2 -0
  50. package/dist/commands/config/index.js.map +1 -0
  51. package/dist/commands/create/create.action.d.ts +5 -0
  52. package/dist/commands/create/create.action.d.ts.map +1 -0
  53. package/dist/commands/create/create.action.js +53 -0
  54. package/dist/commands/create/create.action.js.map +1 -0
  55. package/dist/commands/create/create.command.d.ts +3 -0
  56. package/dist/commands/create/create.command.d.ts.map +1 -0
  57. package/dist/commands/create/create.command.js +21 -0
  58. package/dist/commands/create/create.command.js.map +1 -0
  59. package/dist/commands/create/create.preflight.d.ts +13 -0
  60. package/dist/commands/create/create.preflight.d.ts.map +1 -0
  61. package/dist/commands/create/create.preflight.js +24 -0
  62. package/dist/commands/create/create.preflight.js.map +1 -0
  63. package/dist/commands/create/index.d.ts +2 -0
  64. package/dist/commands/create/index.d.ts.map +1 -0
  65. package/dist/commands/create/index.js +2 -0
  66. package/dist/commands/create/index.js.map +1 -0
  67. package/dist/commands/db/db.command.d.ts +3 -0
  68. package/dist/commands/db/db.command.d.ts.map +1 -0
  69. package/dist/commands/db/db.command.js +13 -0
  70. package/dist/commands/db/db.command.js.map +1 -0
  71. package/dist/commands/db/index.d.ts +4 -0
  72. package/dist/commands/db/index.d.ts.map +1 -0
  73. package/dist/commands/db/index.js +4 -0
  74. package/dist/commands/db/index.js.map +1 -0
  75. package/dist/commands/db/purge/index.d.ts +2 -0
  76. package/dist/commands/db/purge/index.d.ts.map +1 -0
  77. package/dist/commands/db/purge/index.js +2 -0
  78. package/dist/commands/db/purge/index.js.map +1 -0
  79. package/dist/commands/db/purge/purge.action.d.ts +3 -0
  80. package/dist/commands/db/purge/purge.action.d.ts.map +1 -0
  81. package/dist/commands/db/purge/purge.action.js +17 -0
  82. package/dist/commands/db/purge/purge.action.js.map +1 -0
  83. package/dist/commands/db/purge/purge.command.d.ts +3 -0
  84. package/dist/commands/db/purge/purge.command.d.ts.map +1 -0
  85. package/dist/commands/db/purge/purge.command.js +22 -0
  86. package/dist/commands/db/purge/purge.command.js.map +1 -0
  87. package/dist/commands/db/purge/purge.preflight.d.ts +12 -0
  88. package/dist/commands/db/purge/purge.preflight.d.ts.map +1 -0
  89. package/dist/commands/db/purge/purge.preflight.js +27 -0
  90. package/dist/commands/db/purge/purge.preflight.js.map +1 -0
  91. package/dist/commands/db/sync/index.d.ts +2 -0
  92. package/dist/commands/db/sync/index.d.ts.map +1 -0
  93. package/dist/commands/db/sync/index.js +2 -0
  94. package/dist/commands/db/sync/index.js.map +1 -0
  95. package/dist/commands/db/sync/sync.action.d.ts +3 -0
  96. package/dist/commands/db/sync/sync.action.d.ts.map +1 -0
  97. package/dist/commands/db/sync/sync.action.js +24 -0
  98. package/dist/commands/db/sync/sync.action.js.map +1 -0
  99. package/dist/commands/db/sync/sync.command.d.ts +3 -0
  100. package/dist/commands/db/sync/sync.command.d.ts.map +1 -0
  101. package/dist/commands/db/sync/sync.command.js +22 -0
  102. package/dist/commands/db/sync/sync.command.js.map +1 -0
  103. package/dist/commands/db/sync/sync.preflight.d.ts +12 -0
  104. package/dist/commands/db/sync/sync.preflight.d.ts.map +1 -0
  105. package/dist/commands/db/sync/sync.preflight.js +33 -0
  106. package/dist/commands/db/sync/sync.preflight.js.map +1 -0
  107. package/dist/commands/index.d.ts +8 -0
  108. package/dist/commands/index.d.ts.map +1 -0
  109. package/dist/commands/index.js +8 -0
  110. package/dist/commands/index.js.map +1 -0
  111. package/dist/commands/list/index.d.ts +4 -0
  112. package/dist/commands/list/index.d.ts.map +1 -0
  113. package/dist/commands/list/index.js +4 -0
  114. package/dist/commands/list/index.js.map +1 -0
  115. package/dist/commands/list/list.command.d.ts +3 -0
  116. package/dist/commands/list/list.command.d.ts.map +1 -0
  117. package/dist/commands/list/list.command.js +13 -0
  118. package/dist/commands/list/list.command.js.map +1 -0
  119. package/dist/commands/list/prices/index.d.ts +2 -0
  120. package/dist/commands/list/prices/index.d.ts.map +1 -0
  121. package/dist/commands/list/prices/index.js +2 -0
  122. package/dist/commands/list/prices/index.js.map +1 -0
  123. package/dist/commands/list/prices/prices.action.d.ts +5 -0
  124. package/dist/commands/list/prices/prices.action.d.ts.map +1 -0
  125. package/dist/commands/list/prices/prices.action.js +40 -0
  126. package/dist/commands/list/prices/prices.action.js.map +1 -0
  127. package/dist/commands/list/prices/prices.command.d.ts +3 -0
  128. package/dist/commands/list/prices/prices.command.d.ts.map +1 -0
  129. package/dist/commands/list/prices/prices.command.js +21 -0
  130. package/dist/commands/list/prices/prices.command.js.map +1 -0
  131. package/dist/commands/list/prices/prices.preflight.d.ts +13 -0
  132. package/dist/commands/list/prices/prices.preflight.d.ts.map +1 -0
  133. package/dist/commands/list/prices/prices.preflight.js +19 -0
  134. package/dist/commands/list/prices/prices.preflight.js.map +1 -0
  135. package/dist/commands/list/products/index.d.ts +2 -0
  136. package/dist/commands/list/products/index.d.ts.map +1 -0
  137. package/dist/commands/list/products/index.js +2 -0
  138. package/dist/commands/list/products/index.js.map +1 -0
  139. package/dist/commands/list/products/products.action.d.ts +5 -0
  140. package/dist/commands/list/products/products.action.d.ts.map +1 -0
  141. package/dist/commands/list/products/products.action.js +32 -0
  142. package/dist/commands/list/products/products.action.js.map +1 -0
  143. package/dist/commands/list/products/products.command.d.ts +3 -0
  144. package/dist/commands/list/products/products.command.d.ts.map +1 -0
  145. package/dist/commands/list/products/products.command.js +21 -0
  146. package/dist/commands/list/products/products.command.js.map +1 -0
  147. package/dist/commands/list/products/products.preflight.d.ts +13 -0
  148. package/dist/commands/list/products/products.preflight.d.ts.map +1 -0
  149. package/dist/commands/list/products/products.preflight.js +19 -0
  150. package/dist/commands/list/products/products.preflight.js.map +1 -0
  151. package/dist/commands/update/index.d.ts +2 -0
  152. package/dist/commands/update/index.d.ts.map +1 -0
  153. package/dist/commands/update/index.js +2 -0
  154. package/dist/commands/update/index.js.map +1 -0
  155. package/dist/commands/update/update.action.d.ts +3 -0
  156. package/dist/commands/update/update.action.d.ts.map +1 -0
  157. package/dist/commands/update/update.action.js +84 -0
  158. package/dist/commands/update/update.action.js.map +1 -0
  159. package/dist/commands/update/update.command.d.ts +3 -0
  160. package/dist/commands/update/update.command.d.ts.map +1 -0
  161. package/dist/commands/update/update.command.js +21 -0
  162. package/dist/commands/update/update.command.js.map +1 -0
  163. package/dist/commands/update/update.preflight.d.ts +12 -0
  164. package/dist/commands/update/update.preflight.d.ts.map +1 -0
  165. package/dist/commands/update/update.preflight.js +36 -0
  166. package/dist/commands/update/update.preflight.js.map +1 -0
  167. package/dist/commands/urls/index.d.ts +2 -0
  168. package/dist/commands/urls/index.d.ts.map +1 -0
  169. package/dist/commands/urls/index.js +2 -0
  170. package/dist/commands/urls/index.js.map +1 -0
  171. package/dist/commands/urls/urls.action.d.ts +4 -0
  172. package/dist/commands/urls/urls.action.d.ts.map +1 -0
  173. package/dist/commands/urls/urls.action.js +65 -0
  174. package/dist/commands/urls/urls.action.js.map +1 -0
  175. package/dist/commands/urls/urls.command.d.ts +6 -0
  176. package/dist/commands/urls/urls.command.d.ts.map +1 -0
  177. package/dist/commands/urls/urls.command.js +19 -0
  178. package/dist/commands/urls/urls.command.js.map +1 -0
  179. package/dist/definitions/action.constants.d.ts +14 -0
  180. package/dist/definitions/action.constants.d.ts.map +1 -0
  181. package/dist/definitions/action.constants.js +22 -0
  182. package/dist/definitions/action.constants.js.map +1 -0
  183. package/dist/definitions/config.schemas.d.ts +278 -0
  184. package/dist/definitions/config.schemas.d.ts.map +1 -0
  185. package/dist/definitions/config.schemas.js +30 -0
  186. package/dist/definitions/config.schemas.js.map +1 -0
  187. package/dist/definitions/context.types.d.ts +18 -0
  188. package/dist/definitions/context.types.d.ts.map +1 -0
  189. package/dist/definitions/context.types.js +2 -0
  190. package/dist/definitions/context.types.js.map +1 -0
  191. package/dist/definitions/database-adapter.schemas.d.ts +20 -0
  192. package/dist/definitions/database-adapter.schemas.d.ts.map +1 -0
  193. package/dist/definitions/database-adapter.schemas.js +18 -0
  194. package/dist/definitions/database-adapter.schemas.js.map +1 -0
  195. package/dist/definitions/env.constants.d.ts +9 -0
  196. package/dist/definitions/env.constants.d.ts.map +1 -0
  197. package/dist/definitions/env.constants.js +8 -0
  198. package/dist/definitions/env.constants.js.map +1 -0
  199. package/dist/definitions/index.d.ts +9 -0
  200. package/dist/definitions/index.d.ts.map +1 -0
  201. package/dist/definitions/index.js +9 -0
  202. package/dist/definitions/index.js.map +1 -0
  203. package/dist/definitions/stripe-price.schemas.d.ts +132 -0
  204. package/dist/definitions/stripe-price.schemas.d.ts.map +1 -0
  205. package/dist/definitions/stripe-price.schemas.js +50 -0
  206. package/dist/definitions/stripe-price.schemas.js.map +1 -0
  207. package/dist/definitions/stripe-product.schemas.d.ts +87 -0
  208. package/dist/definitions/stripe-product.schemas.d.ts.map +1 -0
  209. package/dist/definitions/stripe-product.schemas.js +42 -0
  210. package/dist/definitions/stripe-product.schemas.js.map +1 -0
  211. package/dist/definitions/utility.types.d.ts +4 -0
  212. package/dist/definitions/utility.types.d.ts.map +1 -0
  213. package/dist/definitions/utility.types.js +2 -0
  214. package/dist/definitions/utility.types.js.map +1 -0
  215. package/dist/index.d.ts +3 -0
  216. package/dist/index.d.ts.map +1 -0
  217. package/dist/index.js +3 -0
  218. package/dist/index.js.map +1 -0
  219. package/dist/utils/create-context.d.ts +6 -0
  220. package/dist/utils/create-context.d.ts.map +1 -0
  221. package/dist/utils/create-context.js +21 -0
  222. package/dist/utils/create-context.js.map +1 -0
  223. package/dist/utils/create-logger.d.ts +3 -0
  224. package/dist/utils/create-logger.d.ts.map +1 -0
  225. package/dist/utils/create-logger.js +38 -0
  226. package/dist/utils/create-logger.js.map +1 -0
  227. package/dist/utils/create-mappers.d.ts +3 -0
  228. package/dist/utils/create-mappers.d.ts.map +1 -0
  229. package/dist/utils/create-mappers.js +98 -0
  230. package/dist/utils/create-mappers.js.map +1 -0
  231. package/dist/utils/define-config.d.ts +3 -0
  232. package/dist/utils/define-config.d.ts.map +1 -0
  233. package/dist/utils/define-config.js +6 -0
  234. package/dist/utils/define-config.js.map +1 -0
  235. package/dist/utils/find-env-directories.d.ts +2 -0
  236. package/dist/utils/find-env-directories.d.ts.map +1 -0
  237. package/dist/utils/find-env-directories.js +84 -0
  238. package/dist/utils/find-env-directories.js.map +1 -0
  239. package/dist/utils/index.d.ts +12 -0
  240. package/dist/utils/index.d.ts.map +1 -0
  241. package/dist/utils/index.js +12 -0
  242. package/dist/utils/index.js.map +1 -0
  243. package/dist/utils/load-config.d.ts +6 -0
  244. package/dist/utils/load-config.d.ts.map +1 -0
  245. package/dist/utils/load-config.js +84 -0
  246. package/dist/utils/load-config.js.map +1 -0
  247. package/dist/utils/load-env.d.ts +3 -0
  248. package/dist/utils/load-env.d.ts.map +1 -0
  249. package/dist/utils/load-env.js +54 -0
  250. package/dist/utils/load-env.js.map +1 -0
  251. package/dist/utils/stripe-client.d.ts +3 -0
  252. package/dist/utils/stripe-client.d.ts.map +1 -0
  253. package/dist/utils/stripe-client.js +10 -0
  254. package/dist/utils/stripe-client.js.map +1 -0
  255. package/dist/utils/stripe-repository.d.ts +16 -0
  256. package/dist/utils/stripe-repository.d.ts.map +1 -0
  257. package/dist/utils/stripe-repository.js +73 -0
  258. package/dist/utils/stripe-repository.js.map +1 -0
  259. package/dist/utils/user-preferences.d.ts +10 -0
  260. package/dist/utils/user-preferences.d.ts.map +1 -0
  261. package/dist/utils/user-preferences.js +40 -0
  262. package/dist/utils/user-preferences.js.map +1 -0
  263. package/package.json +84 -0
@@ -0,0 +1,36 @@
1
+ import { determineAdapter, determineEnvironment, requireProductionConfirmation, } from '../../cli-prompts/index.js';
2
+ import { createContext, loadConfig, loadEnvironment } from '../../utils/index.js';
3
+ export async function runUpdatePreflight(options, command) {
4
+ const globalOptions = command.parent?.opts() || {};
5
+ const configPath = globalOptions.config;
6
+ const chosenEnv = await determineEnvironment({ envInput: options.env });
7
+ loadEnvironment(chosenEnv);
8
+ const config = await loadConfig({ configPath });
9
+ const adapterResult = await determineAdapter({
10
+ adapterInput: options.adapter,
11
+ availableAdapters: config.adapters,
12
+ });
13
+ const ctx = createContext({ adapter: adapterResult.adapter, config });
14
+ if (!ctx.stripeClient) {
15
+ throw new Error('Stripe client not available. Check STRIPE_SECRET_KEY environment variable.');
16
+ }
17
+ if (!ctx.config.env.stripeSecretKey) {
18
+ throw new Error('STRIPE_SECRET_KEY is not configured in environment');
19
+ }
20
+ if (!ctx.config.plans || ctx.config.plans.length === 0) {
21
+ throw new Error('No subscription plans configured. Check your config file.');
22
+ }
23
+ if (!(typeof ctx.mappers.mapSubscriptionPlanToStripeProduct === 'function' &&
24
+ typeof ctx.mappers.mapSubscriptionPlanToStripePrice === 'function')) {
25
+ throw new Error('Stripe mappers not available. Check your configuration.');
26
+ }
27
+ await requireProductionConfirmation({
28
+ action: 'update Stripe plans',
29
+ env: chosenEnv,
30
+ });
31
+ return {
32
+ ctx,
33
+ chosenEnv,
34
+ };
35
+ }
36
+ //# sourceMappingURL=update.preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.preflight.js","sourceRoot":"","sources":["../../../src/commands/update/update.preflight.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;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AM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAGD,MAAM,6BAA6B,CAAC;QAClC,MAAM,EAAE,qBAAqB;QAC7B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,OAAO;QACL,GAAG;QACH,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { urls } from './urls.command.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { urls } from './urls.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function showStripeUrlsAction(options: {
2
+ showAll: boolean;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=urls.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.action.d.ts","sourceRoot":"","sources":["../../../src/commands/urls/urls.action.ts"],"names":[],"mappings":"AAkFA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
@@ -0,0 +1,65 @@
1
+ import chalk from 'chalk';
2
+ import prompts from 'prompts';
3
+ const STRIPE_URLS = [
4
+ {
5
+ name: 'API Keys',
6
+ icon: '🔑',
7
+ live: 'https://dashboard.stripe.com/apikeys',
8
+ test: 'https://dashboard.stripe.com/test/apikeys',
9
+ },
10
+ {
11
+ name: 'Products',
12
+ icon: '📦',
13
+ live: 'https://dashboard.stripe.com/products',
14
+ test: 'https://dashboard.stripe.com/test/products',
15
+ },
16
+ {
17
+ name: 'Webhooks',
18
+ icon: '🔗',
19
+ live: 'https://dashboard.stripe.com/webhooks',
20
+ test: 'https://dashboard.stripe.com/test/webhooks',
21
+ },
22
+ ];
23
+ function showAllUrls() {
24
+ console.log(chalk.blue.bold('\n🔗 Stripe Dashboard URLs:\n'));
25
+ for (const urlItem of STRIPE_URLS) {
26
+ console.log(chalk.cyan(`${urlItem.icon} ${chalk.bold(urlItem.name)}:`));
27
+ console.log(chalk.green(` Live: ${urlItem.live}`));
28
+ console.log(chalk.yellow(` Test: ${urlItem.test}`));
29
+ console.log();
30
+ }
31
+ }
32
+ async function showUrlSelection() {
33
+ try {
34
+ const response = await prompts({
35
+ type: 'select',
36
+ name: 'value',
37
+ message: chalk.blue('Select Stripe dashboard page:'),
38
+ choices: STRIPE_URLS.map((urlItem) => ({
39
+ title: `${urlItem.icon} ${urlItem.name}`,
40
+ value: urlItem,
41
+ })),
42
+ initial: 0,
43
+ });
44
+ if (!response.value) {
45
+ process.exit(0);
46
+ }
47
+ console.log(chalk.cyan(`\n${response.value.icon} ${response.value.name}:`));
48
+ console.log(chalk.green(` Live: ${response.value.live}`));
49
+ console.log(chalk.yellow(` Test: ${response.value.test}`));
50
+ }
51
+ catch (error) {
52
+ console.error(chalk.red('Error during URL selection:'), error);
53
+ process.exit(1);
54
+ }
55
+ }
56
+ export async function showStripeUrlsAction(options) {
57
+ const { showAll } = options;
58
+ if (showAll) {
59
+ showAllUrls();
60
+ }
61
+ else {
62
+ await showUrlSelection();
63
+ }
64
+ }
65
+ //# sourceMappingURL=urls.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.action.js","sourceRoot":"","sources":["../../../src/commands/urls/urls.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAa9B,MAAM,WAAW,GAAgB;IAC/B;QACE,IAAI,EAAE,UAAU;QAChB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;gBACxC,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;YACH,OAAO,EAAE,CAAC;SACX,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAID,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAE1C;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,OAAO,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,MAAM,gBAAgB,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ export interface UrlsOptions {
3
+ all?: boolean;
4
+ }
5
+ export declare const urls: Command;
6
+ //# sourceMappingURL=urls.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.command.d.ts","sourceRoot":"","sources":["../../../src/commands/urls/urls.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,IAAI,SAcb,CAAC"}
@@ -0,0 +1,19 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import { showStripeUrlsAction } from './urls.action.js';
4
+ export const urls = new Command()
5
+ .name('urls')
6
+ .description('Show Stripe dashboard URLs')
7
+ .option('-a, --all', 'Show all URLs with labels')
8
+ .action(async (options) => {
9
+ try {
10
+ await showStripeUrlsAction({
11
+ showAll: !!options.all,
12
+ });
13
+ }
14
+ catch (error) {
15
+ console.error(chalk.red(`\nOperation failed: ${error}`));
16
+ process.exit(1);
17
+ }
18
+ });
19
+ //# sourceMappingURL=urls.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.command.js","sourceRoot":"","sources":["../../../src/commands/urls/urls.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAMrD,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE;KAC9B,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,WAAW,EAAE,2BAA2B,CAAC;KAChD,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;IACrC,IAAI,CAAC;QAEH,MAAM,oBAAoB,CAAC;YACzB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const ACTIONS: {
2
+ readonly CREATE: "create";
3
+ readonly ARCHIVE: "archive";
4
+ readonly SYNC: "sync";
5
+ readonly UPDATE: "update";
6
+ readonly CLEAR_DB_PLANS: "clear-db-plans";
7
+ readonly URL: "url";
8
+ readonly LIST_PRODUCTS: "list-products";
9
+ readonly LIST_PRICES: "list-prices";
10
+ };
11
+ export declare const VALID_ACTIONS: ("create" | "archive" | "sync" | "update" | "clear-db-plans" | "url" | "list-products" | "list-prices")[];
12
+ export type ActionKey = (typeof ACTIONS)[keyof typeof ACTIONS];
13
+ export declare const ACTION_DESCRIPTIONS: Record<ActionKey, string>;
14
+ //# sourceMappingURL=action.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.constants.d.ts","sourceRoot":"","sources":["../../src/definitions/action.constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO;;;;;;;;;CASV,CAAC;AAKX,eAAO,MAAM,aAAa,2GAAyB,CAAC;AAKpD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAS/D,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAUhD,CAAC"}
@@ -0,0 +1,22 @@
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',
10
+ };
11
+ export const VALID_ACTIONS = Object.values(ACTIONS);
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',
21
+ };
22
+ //# sourceMappingURL=action.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.constants.js","sourceRoot":"","sources":["../../src/definitions/action.constants.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,cAAc,EAAE,gBAAgB;IAChC,GAAG,EAAE,KAAK;IACV,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;CAClB,CAAC;AAKX,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAcpD,MAAM,CAAC,MAAM,mBAAmB,GAA8B;IAC5D,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,yDAAyD;IAC3E,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,8CAA8C;IACjE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,oDAAoD;IACpE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,4CAA4C;IAC9D,CAAC,OAAO,CAAC,cAAc,CAAC,EACtB,2DAA2D;IAC7D,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,kCAAkC;IACjD,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,uCAAuC;IAChE,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,mCAAmC;CAClD,CAAC"}
@@ -0,0 +1,278 @@
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;
134
+ }
135
+ 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>>;
256
+ env: z.ZodObject<{
257
+ stripeSecretKey: z.ZodString;
258
+ }, z.core.$strip>;
259
+ 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>>;
262
+ clearProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
263
+ clearPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
264
+ getProducts: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<(() => Promise<unknown[]>) | undefined, any>>>;
265
+ getPrices: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<(() => Promise<unknown[]>) | undefined, any>>>;
266
+ }, z.core.$strip>>;
267
+ productIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
268
+ metadata: z.ZodDefault<z.ZodObject<{
269
+ productIdField: z.ZodDefault<z.ZodString>;
270
+ priceIdField: z.ZodDefault<z.ZodString>;
271
+ managedByField: z.ZodDefault<z.ZodString>;
272
+ managedByValue: z.ZodDefault<z.ZodString>;
273
+ }, z.core.$strip>>;
274
+ }, z.core.$strip>;
275
+ export type Config = Prettify<Omit<z.infer<typeof configSchema>, 'adapters'> & {
276
+ adapters: Record<string, DatabaseAdapter>;
277
+ }>;
278
+ //# sourceMappingURL=config.schemas.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,30 @@
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
+ });
9
+ export const configSchema = z.object({
10
+ plans: z.array(subscriptionPlanSchema),
11
+ env: z.object({
12
+ stripeSecretKey: z.string(),
13
+ }),
14
+ adapters: z.record(z.string(), databaseAdapterSchema),
15
+ productIds: z.record(z.string(), z.string()).optional(),
16
+ metadata: z
17
+ .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'),
22
+ })
23
+ .default({
24
+ productIdField: 'internal_product_id',
25
+ priceIdField: 'internal_price_id',
26
+ managedByField: 'managed_by',
27
+ managedByValue: '@makeco/stripe-kit',
28
+ }),
29
+ });
30
+ //# sourceMappingURL=config.schemas.js.map
@@ -0,0 +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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emas.js';
3
+ import type { DatabaseAdapter } from './database-adapter.schemas.js';
4
+ export interface Logger {
5
+ info(message: string | object, ...args: unknown[]): void;
6
+ error(message: string | object, ...args: unknown[]): void;
7
+ warn(message: string | object, ...args: unknown[]): void;
8
+ debug(message: string | object, ...args: unknown[]): void;
9
+ }
10
+ export interface Context {
11
+ logger: Logger;
12
+ env: Record<string, string | undefined>;
13
+ mappers: StripeMappers;
14
+ adapter: DatabaseAdapter;
15
+ stripeClient: Stripe;
16
+ config: Config;
17
+ }
18
+ //# sourceMappingURL=context.types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.types.js","sourceRoot":"","sources":["../../src/definitions/context.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type Stripe from 'stripe';
2
+ import { z } from 'zod';
3
+ export interface DatabaseAdapter {
4
+ syncProducts(products: Stripe.Product[]): Promise<void>;
5
+ syncPrices(prices: Stripe.Price[]): Promise<void>;
6
+ clearProducts(): Promise<void>;
7
+ clearPrices(): Promise<void>;
8
+ getProducts?(): Promise<unknown[]>;
9
+ getPrices?(): Promise<unknown[]>;
10
+ }
11
+ export declare const databaseAdapterSchema: z.ZodObject<{
12
+ syncProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<(products: Stripe.Product[]) => Promise<void>, any>>;
13
+ syncPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<(prices: Stripe.Price[]) => Promise<void>, any>>;
14
+ clearProducts: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
15
+ clearPrices: z.ZodPipe<z.ZodAny, z.ZodTransform<() => Promise<void>, any>>;
16
+ getProducts: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<(() => Promise<unknown[]>) | undefined, any>>>;
17
+ getPrices: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<(() => Promise<unknown[]>) | undefined, any>>>;
18
+ }, z.core.$strip>;
19
+ export type DatabaseAdapterSchema = z.infer<typeof databaseAdapterSchema>;
20
+ //# sourceMappingURL=database-adapter.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-adapter.schemas.d.ts","sourceRoot":"","sources":["../../src/definitions/database-adapter.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;CAClC;AAGD,eAAO,MAAM,qBAAqB;gEATT,MAAM,CAAC,OAAO,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;4DACpC,MAAM,CAAC,KAAK,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;4DAChC,OAAO,CAAC,IAAI,CAAC;0DACf,OAAO,CAAC,IAAI,CAAC;yEACZ,OAAO,CAAC,OAAO,EAAE,CAAC;uEACpB,OAAO,CAAC,OAAO,EAAE,CAAC;iBAmBhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export const databaseAdapterSchema = z.object({
3
+ syncProducts: z.any().transform((t) => t),
4
+ syncPrices: z.any().transform((t) => t),
5
+ clearProducts: z
6
+ .any()
7
+ .transform((t) => t),
8
+ clearPrices: z.any().transform((t) => t),
9
+ getProducts: z
10
+ .any()
11
+ .transform((t) => t)
12
+ .optional(),
13
+ getPrices: z
14
+ .any()
15
+ .transform((t) => t)
16
+ .optional(),
17
+ });
18
+ //# sourceMappingURL=database-adapter.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-adapter.schemas.js","sourceRoot":"","sources":["../../src/definitions/database-adapter.schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAoC,CAAC;IAC5E,UAAU,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAkC,CAAC;IACxE,aAAa,EAAE,CAAC;SACb,GAAG,EAAE;SACL,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAqC,CAAC;IAC1D,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAmC,CAAC;IAC1E,WAAW,EAAE,CAAC;SACX,GAAG,EAAE;SACL,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAmC,CAAC;SACrD,QAAQ,EAAE;IACb,SAAS,EAAE,CAAC;SACT,GAAG,EAAE;SACL,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAiC,CAAC;SACnD,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const ENVIRONMENTS: {
2
+ readonly TEST: "test";
3
+ readonly DEV: "dev";
4
+ readonly STAGING: "staging";
5
+ readonly PROD: "prod";
6
+ };
7
+ export declare const VALID_ENVIRONMENTS: ("test" | "dev" | "staging" | "prod")[];
8
+ export type EnvironmentKey = (typeof ENVIRONMENTS)[keyof typeof ENVIRONMENTS];
9
+ //# sourceMappingURL=env.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.constants.d.ts","sourceRoot":"","sources":["../../src/definitions/env.constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAKX,eAAO,MAAM,kBAAkB,yCAA8B,CAAC;AAK9D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}