@profullstack/stripe-config 1.0.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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Core type definitions for the Stripe configuration tool
3
+ */
4
+ /**
5
+ * Custom error class for configuration errors
6
+ */
7
+ export class ConfigError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'ConfigError';
11
+ }
12
+ }
13
+ /**
14
+ * Custom error class for Stripe API errors
15
+ */
16
+ export class StripeClientError extends Error {
17
+ statusCode;
18
+ code;
19
+ constructor(message, statusCode, code) {
20
+ super(message);
21
+ this.statusCode = statusCode;
22
+ this.code = code;
23
+ this.name = 'StripeClientError';
24
+ }
25
+ }
26
+ /**
27
+ * Custom error class for validation errors
28
+ */
29
+ export class ValidationError extends Error {
30
+ field;
31
+ constructor(message, field) {
32
+ super(message);
33
+ this.field = field;
34
+ this.name = 'ValidationError';
35
+ }
36
+ }
37
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+LH;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAGjC;IACA;IAHT,YACE,OAAe,EACR,UAAmB,EACnB,IAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,SAAI,GAAJ,IAAI,CAAS;QAGpB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAG/B;IAFT,YACE,OAAe,EACR,KAAc;QAErB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,UAAK,GAAL,KAAK,CAAS;QAGrB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @profullstack/stripe-config
3
+ *
4
+ * ESM module for programmatic access to Stripe configuration and management
5
+ */
6
+ export { ConfigManager } from './core/config-manager.js';
7
+ export { StripeClient } from './core/stripe-client.js';
8
+ export type { ProjectConfig, Config, CreateProductInput, UpdateProductInput, CreatePriceInput, UpdatePriceInput, RecurringConfig, TierConfig, TransformQuantityConfig, ListOptions, PriceListOptions, } from './core/types.js';
9
+ export { ConfigError, StripeClientError, ValidationError } from './core/types.js';
10
+ /**
11
+ * Product Manager - High-level API for product operations
12
+ */
13
+ export declare class ProductManager {
14
+ private stripeClient;
15
+ constructor(project: ProjectConfig);
16
+ /**
17
+ * Create a new product
18
+ */
19
+ create(input: CreateProductInput): Promise<import("stripe").Stripe.Product>;
20
+ /**
21
+ * Get a product by ID
22
+ */
23
+ get(productId: string): Promise<import("stripe").Stripe.Product>;
24
+ /**
25
+ * Update a product
26
+ */
27
+ update(productId: string, updates: UpdateProductInput): Promise<import("stripe").Stripe.Product>;
28
+ /**
29
+ * Delete a product
30
+ */
31
+ delete(productId: string): Promise<void>;
32
+ /**
33
+ * List products
34
+ */
35
+ list(options?: ListOptions): Promise<import("stripe").Stripe.Product[]>;
36
+ }
37
+ /**
38
+ * Price Manager - High-level API for price operations
39
+ */
40
+ export declare class PriceManager {
41
+ private stripeClient;
42
+ constructor(project: ProjectConfig);
43
+ /**
44
+ * Create a new price
45
+ */
46
+ create(input: CreatePriceInput): Promise<import("stripe").Stripe.Price>;
47
+ /**
48
+ * Get a price by ID
49
+ */
50
+ get(priceId: string): Promise<import("stripe").Stripe.Price>;
51
+ /**
52
+ * Update a price
53
+ */
54
+ update(priceId: string, updates: UpdatePriceInput): Promise<import("stripe").Stripe.Price>;
55
+ /**
56
+ * Archive a price (set to inactive)
57
+ */
58
+ archive(priceId: string): Promise<import("stripe").Stripe.Price>;
59
+ /**
60
+ * List prices
61
+ */
62
+ list(options?: PriceListOptions): Promise<import("stripe").Stripe.Price[]>;
63
+ /**
64
+ * List prices for a specific product
65
+ */
66
+ listByProduct(productId: string): Promise<import("stripe").Stripe.Price[]>;
67
+ }
68
+ import type { ProjectConfig, CreateProductInput, UpdateProductInput, CreatePriceInput, UpdatePriceInput, ListOptions, PriceListOptions } from './core/types.js';
69
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,YAAY,EACV,aAAa,EACb,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,uBAAuB,EACvB,WAAW,EACX,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElF;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAe;gBAEvB,OAAO,EAAE,aAAa;IAIlC;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,kBAAkB;IAItC;;OAEG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM;IAI3B;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB;IAI3D;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM;IAI9B;;OAEG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW;CAGjC;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAe;gBAEvB,OAAO,EAAE,aAAa;IAIlC;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,gBAAgB;IAIpC;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM;IAIzB;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB;IAIvD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM;IAI7B;;OAEG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAIrC;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM;CAGtC;AAGD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @profullstack/stripe-config
3
+ *
4
+ * ESM module for programmatic access to Stripe configuration and management
5
+ */
6
+ // Export core classes
7
+ export { ConfigManager } from './core/config-manager.js';
8
+ export { StripeClient } from './core/stripe-client.js';
9
+ // Export custom errors
10
+ export { ConfigError, StripeClientError, ValidationError } from './core/types.js';
11
+ /**
12
+ * Product Manager - High-level API for product operations
13
+ */
14
+ export class ProductManager {
15
+ stripeClient;
16
+ constructor(project) {
17
+ this.stripeClient = new StripeClient(project);
18
+ }
19
+ /**
20
+ * Create a new product
21
+ */
22
+ async create(input) {
23
+ return this.stripeClient.createProduct(input);
24
+ }
25
+ /**
26
+ * Get a product by ID
27
+ */
28
+ async get(productId) {
29
+ return this.stripeClient.getProduct(productId);
30
+ }
31
+ /**
32
+ * Update a product
33
+ */
34
+ async update(productId, updates) {
35
+ return this.stripeClient.updateProduct(productId, updates);
36
+ }
37
+ /**
38
+ * Delete a product
39
+ */
40
+ async delete(productId) {
41
+ return this.stripeClient.deleteProduct(productId);
42
+ }
43
+ /**
44
+ * List products
45
+ */
46
+ async list(options) {
47
+ return this.stripeClient.listProducts(options);
48
+ }
49
+ }
50
+ /**
51
+ * Price Manager - High-level API for price operations
52
+ */
53
+ export class PriceManager {
54
+ stripeClient;
55
+ constructor(project) {
56
+ this.stripeClient = new StripeClient(project);
57
+ }
58
+ /**
59
+ * Create a new price
60
+ */
61
+ async create(input) {
62
+ return this.stripeClient.createPrice(input);
63
+ }
64
+ /**
65
+ * Get a price by ID
66
+ */
67
+ async get(priceId) {
68
+ return this.stripeClient.getPrice(priceId);
69
+ }
70
+ /**
71
+ * Update a price
72
+ */
73
+ async update(priceId, updates) {
74
+ return this.stripeClient.updatePrice(priceId, updates);
75
+ }
76
+ /**
77
+ * Archive a price (set to inactive)
78
+ */
79
+ async archive(priceId) {
80
+ return this.stripeClient.archivePrice(priceId);
81
+ }
82
+ /**
83
+ * List prices
84
+ */
85
+ async list(options) {
86
+ return this.stripeClient.listPrices(options);
87
+ }
88
+ /**
89
+ * List prices for a specific product
90
+ */
91
+ async listByProduct(productId) {
92
+ return this.stripeClient.listPrices({ product: productId });
93
+ }
94
+ }
95
+ import { StripeClient } from './core/stripe-client.js';
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sBAAsB;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAiBvD,uBAAuB;AACvB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElF;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,YAAY,CAAe;IAEnC,YAAY,OAAsB;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAAyB;QACpC,OAAO,IAAI,CA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AAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AAID,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@profullstack/stripe-config",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool and ESM module for managing Stripe products and prices across multiple projects",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "stripeconf": "./dist/cli/index.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "keywords": [
23
+ "stripe",
24
+ "cli",
25
+ "products",
26
+ "prices",
27
+ "configuration",
28
+ "management"
29
+ ],
30
+ "author": "",
31
+ "license": "ISC",
32
+ "engines": {
33
+ "node": ">=20.0.0"
34
+ },
35
+ "dependencies": {
36
+ "stripe": "^14.0.0",
37
+ "commander": "^11.0.0",
38
+ "inquirer": "^9.0.0",
39
+ "chalk": "^5.0.0",
40
+ "ora": "^7.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^20.0.0",
44
+ "@types/inquirer": "^9.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
46
+ "@typescript-eslint/parser": "^6.0.0",
47
+ "@vitest/coverage-v8": "^1.0.0",
48
+ "@vitest/ui": "^1.0.0",
49
+ "eslint": "^8.0.0",
50
+ "eslint-config-prettier": "^9.0.0",
51
+ "eslint-plugin-prettier": "^5.0.0",
52
+ "prettier": "^3.0.0",
53
+ "typescript": "^5.3.0",
54
+ "vitest": "^1.0.0"
55
+ },
56
+ "scripts": {
57
+ "build": "tsc",
58
+ "dev": "tsc --watch",
59
+ "test": "vitest",
60
+ "test:coverage": "vitest --coverage",
61
+ "test:ui": "vitest --ui",
62
+ "lint": "eslint src/**/*.ts",
63
+ "lint:fix": "eslint src/**/*.ts --fix",
64
+ "format": "prettier --write \"src/**/*.ts\""
65
+ }
66
+ }