recurrente-js 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const node_fs_1 = __importDefault(require("node:fs"));
16
+ const node_path_1 = __importDefault(require("node:path"));
17
+ // --- Configuration ---
18
+ const OUTPUT_DIR = "ai-context";
19
+ const ALLOWED_EXTENSIONS = [
20
+ ".ts",
21
+ ".tsx",
22
+ ".js",
23
+ ".jsx",
24
+ ".json",
25
+ ".md",
26
+ ".css",
27
+ ".prisma",
28
+ ".env.example",
29
+ ".sql",
30
+ ".gitignore",
31
+ ];
32
+ // CORRECTED: This list is now for both files and directories.
33
+ const IGNORED_ITEMS = [
34
+ "node_modules",
35
+ ".next",
36
+ ".vercel",
37
+ "dist",
38
+ "build",
39
+ ".git",
40
+ ".cache",
41
+ "scripts",
42
+ "react-email-starter",
43
+ "package-lock.json", // This will now be correctly ignored
44
+ ];
45
+ // --------------------
46
+ /**
47
+ * Recursively finds all files in a directory that match the allowed extensions.
48
+ */
49
+ function getAllFiles(dirPath, arrayOfFiles = []) {
50
+ const items = node_fs_1.default.readdirSync(dirPath, { withFileTypes: true });
51
+ for (const item of items) {
52
+ // *** FIX: Check EVERY item (file or directory) against the ignore list first ***
53
+ if (IGNORED_ITEMS.includes(item.name)) {
54
+ continue; // Skip this item entirely
55
+ }
56
+ const fullPath = node_path_1.default.join(dirPath, item.name);
57
+ if (item.isDirectory()) {
58
+ // The ignore check is already done, so we just recurse.
59
+ getAllFiles(fullPath, arrayOfFiles);
60
+ }
61
+ else {
62
+ // It's a file. The ignore check was already done.
63
+ // Now, we just check its extension.
64
+ if (ALLOWED_EXTENSIONS.includes(node_path_1.default.extname(item.name))) {
65
+ arrayOfFiles.push(fullPath);
66
+ }
67
+ }
68
+ }
69
+ return arrayOfFiles;
70
+ }
71
+ /**
72
+ * Generates a timestamp string in the format YYYYMMDD_HHMMSS.
73
+ */
74
+ function getFormattedTimestamp() {
75
+ const now = new Date();
76
+ const YYYY = now.getFullYear();
77
+ const MM = String(now.getMonth() + 1).padStart(2, "0");
78
+ const DD = String(now.getDate()).padStart(2, "0");
79
+ const HH = String(now.getHours()).padStart(2, "0");
80
+ const mm = String(now.getMinutes()).padStart(2, "0");
81
+ const ss = String(now.getSeconds()).padStart(2, "0");
82
+ return `${YYYY}${MM}${DD}_${HH}${mm}${ss}`;
83
+ }
84
+ /**
85
+ * Main script logic.
86
+ */
87
+ function main() {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const targetPath = process.argv[2];
90
+ if (!targetPath) {
91
+ console.error("❌ Error: Please provide a file or directory path as an argument.");
92
+ console.log(" Example: npm run context -- .");
93
+ process.exit(1);
94
+ }
95
+ const fullPath = node_path_1.default.resolve(targetPath);
96
+ if (!node_fs_1.default.existsSync(fullPath)) {
97
+ console.error(`❌ Error: Path not found: ${fullPath}`);
98
+ process.exit(1);
99
+ }
100
+ let filesToProcess = [];
101
+ const stats = node_fs_1.default.statSync(fullPath);
102
+ if (stats.isDirectory()) {
103
+ console.log(`🔎 Scanning directory: ${targetPath}`);
104
+ filesToProcess = getAllFiles(fullPath);
105
+ }
106
+ else if (stats.isFile()) {
107
+ // *** FIX: Also check if a single targeted file is on the ignore list ***
108
+ if (IGNORED_ITEMS.includes(node_path_1.default.basename(fullPath))) {
109
+ console.log(`🟡 File '${targetPath}' is in the ignore list. Exiting.`);
110
+ return;
111
+ }
112
+ console.log(`🎯 Targeting single file: ${targetPath}`);
113
+ if (ALLOWED_EXTENSIONS.includes(node_path_1.default.extname(fullPath))) {
114
+ filesToProcess = [fullPath];
115
+ }
116
+ }
117
+ if (filesToProcess.length === 0) {
118
+ console.log("🟡 No relevant files found to process. Exiting.");
119
+ return;
120
+ }
121
+ console.log(`📚 Found ${filesToProcess.length} file(s) to process.`);
122
+ const outputData = {
123
+ metadata: {
124
+ sourcePath: targetPath,
125
+ timestamp: new Date().toISOString(),
126
+ fileCount: filesToProcess.length,
127
+ },
128
+ files: {},
129
+ };
130
+ for (const file of filesToProcess) {
131
+ const relativePath = node_path_1.default.relative(process.cwd(), file);
132
+ try {
133
+ const content = node_fs_1.default.readFileSync(file, "utf-8");
134
+ outputData.files[relativePath] = content;
135
+ }
136
+ catch (error) {
137
+ console.warn(`⚠️ Could not read file: ${relativePath}`, error);
138
+ }
139
+ }
140
+ // Ensure the output directory exists
141
+ if (!node_fs_1.default.existsSync(OUTPUT_DIR)) {
142
+ node_fs_1.default.mkdirSync(OUTPUT_DIR);
143
+ }
144
+ const baseName = node_path_1.default.basename(targetPath).replace(/[.\\/]/g, "_");
145
+ const timestamp = getFormattedTimestamp();
146
+ const outputFilename = `context-${baseName}-${timestamp}.json`;
147
+ const outputFilePath = node_path_1.default.join(OUTPUT_DIR, outputFilename);
148
+ node_fs_1.default.writeFileSync(outputFilePath, JSON.stringify(outputData, null, 2));
149
+ console.log(`\n✅ Success! Context saved to: ${outputFilePath}`);
150
+ });
151
+ }
152
+ main().catch(console.error);
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.handleWebhookEvent = handleWebhookEvent;
7
4
  exports.verifySvixSignature = verifySvixSignature;
8
5
  exports.registerWebhookHandler = registerWebhookHandler;
9
6
  const svix_1 = require("svix");
10
7
  const conversion_1 = require("../utils/conversion");
11
- const dotenv_1 = __importDefault(require("dotenv"));
12
- // Load environment variables from .env file if they are not already set
13
- dotenv_1.default.config();
14
8
  /**
15
9
  * A record to store the user-registered webhook handlers.
16
10
  * Each event type is mapped to its corresponding handler function.
@@ -1,4 +1,4 @@
1
- import { ProductSubscription, CreateSubscriptionResponse, SubscriptionStatusResponse, CreateProductRequest, CreateProductResponse, GetProductResponse, GetAllProductsResponse, UpdateProductRequest, CreateCheckoutRequest, CreateCheckoutResponse, CreateRefundRequest, CreateRefundResponse } from '../types/globals';
1
+ import { ProductSubscription, CreateSubscriptionResponse, SubscriptionStatusResponse, CreateProductRequest, CreateProductResponse, GetProductResponse, GetAllProductsResponse, UpdateProductRequest } from '../types/globals';
2
2
  /**
3
3
  * Recurrente API utility for managing product subscriptions, cancellations, and product deletions.
4
4
  *
@@ -15,8 +15,6 @@ import { ProductSubscription, CreateSubscriptionResponse, SubscriptionStatusResp
15
15
  * @property {Function} createSubscription - Creates a new subscription for a product.
16
16
  * @property {Function} cancelSubscription - Cancels an existing subscription by its ID.
17
17
  * @property {Function} getSubscription - Retrieves details of a specific subscription by its ID.
18
- * @property {Function} createCheckout - Creates a new checkout with provided product ID.
19
- * @property {Function} createRefund - Creates a new refund for a specific payment intent.
20
18
  */
21
19
  declare const recurrente: {
22
20
  /**
@@ -129,27 +127,5 @@ declare const recurrente: {
129
127
  * @see getSubscription
130
128
  */
131
129
  getSubscription: (subscriptionId: string) => Promise<SubscriptionStatusResponse>;
132
- /**
133
- * Creates a new checkout session.
134
- *
135
- * @function
136
- * @memberof recurrente.checkouts
137
- * @see createCheckout
138
- * @param {CreateCheckoutRequest} checkoutData - The details for the checkout session.
139
- * @returns {Promise<CreateCheckoutResponse>} A promise that resolves with the checkout ID and URL.
140
- * @throws {ErrorResponse} Throws an error if the checkout creation fails.
141
- */
142
- createCheckout: (checkoutData: CreateCheckoutRequest) => Promise<CreateCheckoutResponse>;
143
- /**
144
- * Creates a new refund for a specific payment intent.
145
- *
146
- * @function
147
- * @memberof recurrente
148
- * @see createRefund
149
- * @param {CreateRefundRequest} refundData - The data containing the paymentIntentId to refund.
150
- * @returns {Promise<CreateRefundResponse>} A promise that resolves with the refund details.
151
- * @throws {ErrorResponse} Throws an error if the refund creation fails.
152
- */
153
- createRefund: (refundData: CreateRefundRequest) => Promise<CreateRefundResponse>;
154
130
  };
155
131
  export default recurrente;
@@ -13,29 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
- const axiosInstance_1 = __importDefault(require("../config/axiosInstance"));
16
+ // CHANGED: We now import the factory function instead of the direct instance.
17
+ const axiosInstance_1 = require("../config/axiosInstance");
17
18
  const conversion_1 = require("../utils/conversion");
18
- /**
19
- * Creates a new checkout session.
20
- *
21
- * This function takes checkout data, including items (by product_id or details),
22
- * converts it to snake_case, and sends it to the API to create a new checkout session.
23
- * It returns the checkout ID and the URL for redirection.
24
- *
25
- * @param {CreateCheckoutRequest} checkoutData - The details for the checkout session.
26
- * @returns {Promise<CreateCheckoutResponse>} The response containing the checkout ID and URL.
27
- * @throws {ErrorResponse} Throws an error if the checkout creation fails.
28
- */
29
- const createCheckout = (checkoutData) => __awaiter(void 0, void 0, void 0, function* () {
30
- try {
31
- const checkoutDataInSnakeCase = (0, conversion_1.toSnakeCase)(checkoutData);
32
- const response = yield axiosInstance_1.default.post('/checkouts/', checkoutDataInSnakeCase);
33
- return (0, conversion_1.toCamelCase)(response.data);
34
- }
35
- catch (error) {
36
- throw handleAxiosError(error);
37
- }
38
- });
39
19
  /**
40
20
  * Creates a new product with a one-time payment.
41
21
  *
@@ -49,8 +29,9 @@ const createCheckout = (checkoutData) => __awaiter(void 0, void 0, void 0, funct
49
29
  */
50
30
  const createProduct = (productData) => __awaiter(void 0, void 0, void 0, function* () {
51
31
  try {
32
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
52
33
  const productDataInSnakeCase = (0, conversion_1.toSnakeCase)(productData);
53
- const response = yield axiosInstance_1.default.post('/products/', productDataInSnakeCase);
34
+ const response = yield client.post('/products/', productDataInSnakeCase);
54
35
  return (0, conversion_1.toCamelCase)(response.data); // Return the created product's details
55
36
  }
56
37
  catch (error) {
@@ -70,7 +51,8 @@ const createProduct = (productData) => __awaiter(void 0, void 0, void 0, functio
70
51
  */
71
52
  const getProduct = (productId) => __awaiter(void 0, void 0, void 0, function* () {
72
53
  try {
73
- const response = yield axiosInstance_1.default.get(`/products/${productId}`);
54
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
55
+ const response = yield client.get(`/products/${productId}`);
74
56
  return (0, conversion_1.toCamelCase)(response.data);
75
57
  }
76
58
  catch (error) {
@@ -90,7 +72,8 @@ const getProduct = (productId) => __awaiter(void 0, void 0, void 0, function* ()
90
72
  */
91
73
  const getAllProducts = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (page = 1) {
92
74
  try {
93
- const response = yield axiosInstance_1.default.get(`/products?page=${page}`);
75
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
76
+ const response = yield client.get(`/products?page=${page}`);
94
77
  return (0, conversion_1.toCamelCase)(response.data);
95
78
  }
96
79
  catch (error) {
@@ -111,8 +94,9 @@ const getAllProducts = (...args_1) => __awaiter(void 0, [...args_1], void 0, fun
111
94
  */
112
95
  const updateProduct = (productId, productData) => __awaiter(void 0, void 0, void 0, function* () {
113
96
  try {
97
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
114
98
  const productDataInSnakeCase = (0, conversion_1.toSnakeCase)(productData);
115
- const response = yield axiosInstance_1.default.patch(`/products/${productId}`, productDataInSnakeCase);
99
+ const response = yield client.patch(`/products/${productId}`, productDataInSnakeCase);
116
100
  return (0, conversion_1.toCamelCase)(response.data); // Return the updated product's details
117
101
  }
118
102
  catch (error) {
@@ -132,8 +116,9 @@ const updateProduct = (productId, productData) => __awaiter(void 0, void 0, void
132
116
  */
133
117
  const createSubscription = (productData) => __awaiter(void 0, void 0, void 0, function* () {
134
118
  try {
119
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
135
120
  const productDataInSnakeCase = (0, conversion_1.toSnakeCase)(productData);
136
- const response = yield axiosInstance_1.default.post('/products/', productDataInSnakeCase);
121
+ const response = yield client.post('/products/', productDataInSnakeCase);
137
122
  return (0, conversion_1.toCamelCase)(response.data); // Return the success response only
138
123
  }
139
124
  catch (error) {
@@ -153,7 +138,8 @@ const createSubscription = (productData) => __awaiter(void 0, void 0, void 0, fu
153
138
  */
154
139
  const cancelSubscription = (subscriptionId) => __awaiter(void 0, void 0, void 0, function* () {
155
140
  try {
156
- const response = yield axiosInstance_1.default.delete(`/subscriptions/${subscriptionId}`);
141
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
142
+ const response = yield client.delete(`/subscriptions/${subscriptionId}`);
157
143
  return {
158
144
  message: `Subscription canceled successfully. Status: ${response.status}`,
159
145
  };
@@ -174,7 +160,8 @@ const cancelSubscription = (subscriptionId) => __awaiter(void 0, void 0, void 0,
174
160
  */
175
161
  const deleteProduct = (productId) => __awaiter(void 0, void 0, void 0, function* () {
176
162
  try {
177
- yield axiosInstance_1.default.delete(`/products/${productId}`);
163
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
164
+ yield client.delete(`/products/${productId}`);
178
165
  return { message: 'Product deleted successfully' };
179
166
  }
180
167
  catch (error) {
@@ -193,7 +180,8 @@ const deleteProduct = (productId) => __awaiter(void 0, void 0, void 0, function*
193
180
  */
194
181
  const getSubscription = (subscriptionId) => __awaiter(void 0, void 0, void 0, function* () {
195
182
  try {
196
- const response = yield axiosInstance_1.default.get(`/subscriptions/${subscriptionId}`);
183
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
184
+ const response = yield client.get(`/subscriptions/${subscriptionId}`);
197
185
  return (0, conversion_1.toCamelCase)(response.data);
198
186
  }
199
187
  catch (error) {
@@ -241,7 +229,8 @@ function handleAxiosError(error) {
241
229
  */
242
230
  const test = () => __awaiter(void 0, void 0, void 0, function* () {
243
231
  try {
244
- const response = yield axiosInstance_1.default.get('/test');
232
+ const client = (0, axiosInstance_1.getClient)(); // <-- Get client instance at runtime
233
+ const response = yield client.get('/test');
245
234
  return {
246
235
  message: `Test request succeeded. Status: ${response.data.message}`,
247
236
  };
@@ -250,26 +239,6 @@ const test = () => __awaiter(void 0, void 0, void 0, function* () {
250
239
  throw handleAxiosError(error);
251
240
  }
252
241
  });
253
- /**
254
- * Creates a new refund for a specific payment intent.
255
- *
256
- * This function takes a payment_intent_id, converts the payload to snake_case,
257
- * and sends it to the API to process a refund.
258
- *
259
- * @param {CreateRefundRequest} refundData - The data containing the paymentIntentId to refund.
260
- * @returns {Promise<CreateRefundResponse>} The response containing the details of the created refund.
261
- * @throws {ErrorResponse} Throws an error if the refund creation fails.
262
- */
263
- const createRefund = (refundData) => __awaiter(void 0, void 0, void 0, function* () {
264
- try {
265
- const refundDataInSnakeCase = (0, conversion_1.toSnakeCase)(refundData);
266
- const response = yield axiosInstance_1.default.post('/refunds/', refundDataInSnakeCase);
267
- return (0, conversion_1.toCamelCase)(response.data);
268
- }
269
- catch (error) {
270
- throw handleAxiosError(error);
271
- }
272
- });
273
242
  /**
274
243
  * Recurrente API utility for managing product subscriptions, cancellations, and product deletions.
275
244
  *
@@ -286,8 +255,6 @@ const createRefund = (refundData) => __awaiter(void 0, void 0, void 0, function*
286
255
  * @property {Function} createSubscription - Creates a new subscription for a product.
287
256
  * @property {Function} cancelSubscription - Cancels an existing subscription by its ID.
288
257
  * @property {Function} getSubscription - Retrieves details of a specific subscription by its ID.
289
- * @property {Function} createCheckout - Creates a new checkout with provided product ID.
290
- * @property {Function} createRefund - Creates a new refund for a specific payment intent.
291
258
  */
292
259
  const recurrente = {
293
260
  /**
@@ -394,27 +361,5 @@ const recurrente = {
394
361
  * @see getSubscription
395
362
  */
396
363
  getSubscription,
397
- /**
398
- * Creates a new checkout session.
399
- *
400
- * @function
401
- * @memberof recurrente.checkouts
402
- * @see createCheckout
403
- * @param {CreateCheckoutRequest} checkoutData - The details for the checkout session.
404
- * @returns {Promise<CreateCheckoutResponse>} A promise that resolves with the checkout ID and URL.
405
- * @throws {ErrorResponse} Throws an error if the checkout creation fails.
406
- */
407
- createCheckout,
408
- /**
409
- * Creates a new refund for a specific payment intent.
410
- *
411
- * @function
412
- * @memberof recurrente
413
- * @see createRefund
414
- * @param {CreateRefundRequest} refundData - The data containing the paymentIntentId to refund.
415
- * @returns {Promise<CreateRefundResponse>} A promise that resolves with the refund details.
416
- * @throws {ErrorResponse} Throws an error if the refund creation fails.
417
- */
418
- createRefund,
419
364
  };
420
365
  exports.default = recurrente;
@@ -0,0 +1,8 @@
1
+ import { type AxiosInstance } from 'axios';
2
+ /**
3
+ * Factory function to get a configured Axios instance for Recurrente.
4
+ * It uses a singleton pattern to ensure the client is only created once per server instance.
5
+ * @returns {AxiosInstance} The configured Axios client.
6
+ * @throws {Error} If environment variables are missing AT RUNTIME.
7
+ */
8
+ export declare function getClient(): AxiosInstance;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getClient = getClient;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ // 1. This variable will hold our single client instance. It starts as null.
9
+ let _clientInstance = null;
10
+ /**
11
+ * Factory function to get a configured Axios instance for Recurrente.
12
+ * It uses a singleton pattern to ensure the client is only created once per server instance.
13
+ * @returns {AxiosInstance} The configured Axios client.
14
+ * @throws {Error} If environment variables are missing AT RUNTIME.
15
+ */
16
+ function getClient() {
17
+ // 2. If the instance already exists, return it immediately.
18
+ if (_clientInstance) {
19
+ return _clientInstance;
20
+ }
21
+ // 3. If it doesn't exist, this is the first time the function is called.
22
+ // Now, and only now, do we read the environment variables.
23
+ const baseURL = process.env.RECURRENTE_BASE_URL;
24
+ const publicKey = process.env.RECURRENTE_PUBLIC_KEY;
25
+ const secretKey = process.env.RECURRENTE_SECRET_KEY;
26
+ // 4. Validate the secrets. This will throw a clear error at runtime if they are missing.
27
+ if (!baseURL) {
28
+ throw new Error('Missing Recurrente base URL at runtime. Check your environment variables.');
29
+ }
30
+ if (!publicKey) {
31
+ throw new Error('Missing Recurrente Public Key at runtime. Check your environment variables.');
32
+ }
33
+ if (!secretKey) {
34
+ throw new Error('Missing Recurrente Secret Key at runtime. Check your environment variables.');
35
+ }
36
+ // 5. Create the new Axios instance.
37
+ const client = axios_1.default.create({
38
+ baseURL: `${baseURL}/api`,
39
+ headers: {
40
+ 'X-PUBLIC-KEY': publicKey,
41
+ 'X-SECRET-KEY': secretKey,
42
+ 'Content-Type': 'application/json',
43
+ },
44
+ });
45
+ // 6. Store the newly created instance in our private variable and return it.
46
+ _clientInstance = client;
47
+ return _clientInstance;
48
+ }
package/package.json CHANGED
@@ -1,15 +1,22 @@
1
1
  {
2
2
  "name": "recurrente-js",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "./dist/index.js",
5
- "types": "./dist/globals.d.ts",
5
+ "types": "./dist/index.d.ts",
6
6
  "exports": {
7
- ".": "./dist/index.js",
8
- "./webhooks": "./dist/webhooks.js"
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./webhooks": {
13
+ "import": "./dist/webhooks.js",
14
+ "require": "./dist/webhooks.js",
15
+ "types": "./dist/webhooks.d.ts"
16
+ }
9
17
  },
10
18
  "files": [
11
- "dist/**/*",
12
- "src/**/*.d.ts"
19
+ "dist/**/*"
13
20
  ],
14
21
  "scripts": {
15
22
  "test": "jest",
@@ -17,10 +24,10 @@
17
24
  "clean": "gts clean",
18
25
  "compile": "tsc",
19
26
  "fix": "gts fix",
20
- "prepare": "npm.cmd run compile",
21
- "pretest": "npm.cmd run compile",
22
- "posttest": "npm.cmd run lint",
23
- "dev": "nodemon -w *.ts -e ts -x ts-node --files -H -T ./src/index.ts"
27
+ "prepare": "npm run compile",
28
+ "pretest": "npm run compile",
29
+ "posttest": "npm run lint",
30
+ "context": "ts-node scripts/generate-context.cts"
24
31
  },
25
32
  "author": "Axel Aguilar",
26
33
  "license": "MIT",
@@ -41,3 +48,5 @@
41
48
  "svix": "^1.34.0"
42
49
  }
43
50
  }
51
+
52
+
@@ -1,3 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- declare const client: AxiosInstance;
3
- export default client;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const axios_1 = __importDefault(require("axios"));
40
- const dotenv = __importStar(require("dotenv"));
41
- // Load environment variables from .env file
42
- dotenv.config();
43
- const baseURL = process.env.RECURRENTE_BASE_URL;
44
- const publicKey = process.env.RECURRENTE_PUBLIC_KEY;
45
- const secretKey = process.env.RECURRENTE_SECRET_KEY;
46
- if (!baseURL) {
47
- throw new Error('Missing Recurrente base URL');
48
- }
49
- if (!publicKey) {
50
- throw new Error('Missing Recurrente Public Key');
51
- }
52
- if (!secretKey) {
53
- throw new Error('Missing Recurrente Secret Key');
54
- }
55
- // Create an Axios instance with configuration
56
- const client = axios_1.default.create({
57
- baseURL: `${baseURL}/api`,
58
- headers: {
59
- 'X-PUBLIC-KEY': publicKey,
60
- 'X-SECRET-KEY': secretKey,
61
- 'Content-Type': 'application/json',
62
- },
63
- });
64
- // Export the Axios instance for use in other parts of the package
65
- exports.default = client;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes