@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.
- package/LICENSE.md +21 -0
- package/README.md +201 -0
- package/dist/cli-prompts/action.d.ts +5 -0
- package/dist/cli-prompts/action.d.ts.map +1 -0
- package/dist/cli-prompts/action.js +36 -0
- package/dist/cli-prompts/action.js.map +1 -0
- package/dist/cli-prompts/adapter.d.ts +9 -0
- package/dist/cli-prompts/adapter.d.ts.map +1 -0
- package/dist/cli-prompts/adapter.js +53 -0
- package/dist/cli-prompts/adapter.js.map +1 -0
- package/dist/cli-prompts/confirmation.d.ts +6 -0
- package/dist/cli-prompts/confirmation.d.ts.map +1 -0
- package/dist/cli-prompts/confirmation.js +27 -0
- package/dist/cli-prompts/confirmation.js.map +1 -0
- package/dist/cli-prompts/environment.d.ts +5 -0
- package/dist/cli-prompts/environment.d.ts.map +1 -0
- package/dist/cli-prompts/environment.js +43 -0
- package/dist/cli-prompts/environment.js.map +1 -0
- package/dist/cli-prompts/index.d.ts +5 -0
- package/dist/cli-prompts/index.d.ts.map +1 -0
- package/dist/cli-prompts/index.js +5 -0
- package/dist/cli-prompts/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +33 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/archive/archive.action.d.ts +5 -0
- package/dist/commands/archive/archive.action.d.ts.map +1 -0
- package/dist/commands/archive/archive.action.js +73 -0
- package/dist/commands/archive/archive.action.js.map +1 -0
- package/dist/commands/archive/archive.command.d.ts +3 -0
- package/dist/commands/archive/archive.command.d.ts.map +1 -0
- package/dist/commands/archive/archive.command.js +23 -0
- package/dist/commands/archive/archive.command.js.map +1 -0
- package/dist/commands/archive/archive.preflight.d.ts +13 -0
- package/dist/commands/archive/archive.preflight.d.ts.map +1 -0
- package/dist/commands/archive/archive.preflight.js +27 -0
- package/dist/commands/archive/archive.preflight.js.map +1 -0
- package/dist/commands/archive/index.d.ts +2 -0
- package/dist/commands/archive/index.d.ts.map +1 -0
- package/dist/commands/archive/index.js +2 -0
- package/dist/commands/archive/index.js.map +1 -0
- package/dist/commands/config/config.command.d.ts +3 -0
- package/dist/commands/config/config.command.d.ts.map +1 -0
- package/dist/commands/config/config.command.js +33 -0
- package/dist/commands/config/config.command.js.map +1 -0
- package/dist/commands/config/index.d.ts +2 -0
- package/dist/commands/config/index.d.ts.map +1 -0
- package/dist/commands/config/index.js +2 -0
- package/dist/commands/config/index.js.map +1 -0
- package/dist/commands/create/create.action.d.ts +5 -0
- package/dist/commands/create/create.action.d.ts.map +1 -0
- package/dist/commands/create/create.action.js +53 -0
- package/dist/commands/create/create.action.js.map +1 -0
- package/dist/commands/create/create.command.d.ts +3 -0
- package/dist/commands/create/create.command.d.ts.map +1 -0
- package/dist/commands/create/create.command.js +21 -0
- package/dist/commands/create/create.command.js.map +1 -0
- package/dist/commands/create/create.preflight.d.ts +13 -0
- package/dist/commands/create/create.preflight.d.ts.map +1 -0
- package/dist/commands/create/create.preflight.js +24 -0
- package/dist/commands/create/create.preflight.js.map +1 -0
- package/dist/commands/create/index.d.ts +2 -0
- package/dist/commands/create/index.d.ts.map +1 -0
- package/dist/commands/create/index.js +2 -0
- package/dist/commands/create/index.js.map +1 -0
- package/dist/commands/db/db.command.d.ts +3 -0
- package/dist/commands/db/db.command.d.ts.map +1 -0
- package/dist/commands/db/db.command.js +13 -0
- package/dist/commands/db/db.command.js.map +1 -0
- package/dist/commands/db/index.d.ts +4 -0
- package/dist/commands/db/index.d.ts.map +1 -0
- package/dist/commands/db/index.js +4 -0
- package/dist/commands/db/index.js.map +1 -0
- package/dist/commands/db/purge/index.d.ts +2 -0
- package/dist/commands/db/purge/index.d.ts.map +1 -0
- package/dist/commands/db/purge/index.js +2 -0
- package/dist/commands/db/purge/index.js.map +1 -0
- package/dist/commands/db/purge/purge.action.d.ts +3 -0
- package/dist/commands/db/purge/purge.action.d.ts.map +1 -0
- package/dist/commands/db/purge/purge.action.js +17 -0
- package/dist/commands/db/purge/purge.action.js.map +1 -0
- package/dist/commands/db/purge/purge.command.d.ts +3 -0
- package/dist/commands/db/purge/purge.command.d.ts.map +1 -0
- package/dist/commands/db/purge/purge.command.js +22 -0
- package/dist/commands/db/purge/purge.command.js.map +1 -0
- package/dist/commands/db/purge/purge.preflight.d.ts +12 -0
- package/dist/commands/db/purge/purge.preflight.d.ts.map +1 -0
- package/dist/commands/db/purge/purge.preflight.js +27 -0
- package/dist/commands/db/purge/purge.preflight.js.map +1 -0
- package/dist/commands/db/sync/index.d.ts +2 -0
- package/dist/commands/db/sync/index.d.ts.map +1 -0
- package/dist/commands/db/sync/index.js +2 -0
- package/dist/commands/db/sync/index.js.map +1 -0
- package/dist/commands/db/sync/sync.action.d.ts +3 -0
- package/dist/commands/db/sync/sync.action.d.ts.map +1 -0
- package/dist/commands/db/sync/sync.action.js +24 -0
- package/dist/commands/db/sync/sync.action.js.map +1 -0
- package/dist/commands/db/sync/sync.command.d.ts +3 -0
- package/dist/commands/db/sync/sync.command.d.ts.map +1 -0
- package/dist/commands/db/sync/sync.command.js +22 -0
- package/dist/commands/db/sync/sync.command.js.map +1 -0
- package/dist/commands/db/sync/sync.preflight.d.ts +12 -0
- package/dist/commands/db/sync/sync.preflight.d.ts.map +1 -0
- package/dist/commands/db/sync/sync.preflight.js +33 -0
- package/dist/commands/db/sync/sync.preflight.js.map +1 -0
- package/dist/commands/index.d.ts +8 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/list/index.d.ts +4 -0
- package/dist/commands/list/index.d.ts.map +1 -0
- package/dist/commands/list/index.js +4 -0
- package/dist/commands/list/index.js.map +1 -0
- package/dist/commands/list/list.command.d.ts +3 -0
- package/dist/commands/list/list.command.d.ts.map +1 -0
- package/dist/commands/list/list.command.js +13 -0
- package/dist/commands/list/list.command.js.map +1 -0
- package/dist/commands/list/prices/index.d.ts +2 -0
- package/dist/commands/list/prices/index.d.ts.map +1 -0
- package/dist/commands/list/prices/index.js +2 -0
- package/dist/commands/list/prices/index.js.map +1 -0
- package/dist/commands/list/prices/prices.action.d.ts +5 -0
- package/dist/commands/list/prices/prices.action.d.ts.map +1 -0
- package/dist/commands/list/prices/prices.action.js +40 -0
- package/dist/commands/list/prices/prices.action.js.map +1 -0
- package/dist/commands/list/prices/prices.command.d.ts +3 -0
- package/dist/commands/list/prices/prices.command.d.ts.map +1 -0
- package/dist/commands/list/prices/prices.command.js +21 -0
- package/dist/commands/list/prices/prices.command.js.map +1 -0
- package/dist/commands/list/prices/prices.preflight.d.ts +13 -0
- package/dist/commands/list/prices/prices.preflight.d.ts.map +1 -0
- package/dist/commands/list/prices/prices.preflight.js +19 -0
- package/dist/commands/list/prices/prices.preflight.js.map +1 -0
- package/dist/commands/list/products/index.d.ts +2 -0
- package/dist/commands/list/products/index.d.ts.map +1 -0
- package/dist/commands/list/products/index.js +2 -0
- package/dist/commands/list/products/index.js.map +1 -0
- package/dist/commands/list/products/products.action.d.ts +5 -0
- package/dist/commands/list/products/products.action.d.ts.map +1 -0
- package/dist/commands/list/products/products.action.js +32 -0
- package/dist/commands/list/products/products.action.js.map +1 -0
- package/dist/commands/list/products/products.command.d.ts +3 -0
- package/dist/commands/list/products/products.command.d.ts.map +1 -0
- package/dist/commands/list/products/products.command.js +21 -0
- package/dist/commands/list/products/products.command.js.map +1 -0
- package/dist/commands/list/products/products.preflight.d.ts +13 -0
- package/dist/commands/list/products/products.preflight.d.ts.map +1 -0
- package/dist/commands/list/products/products.preflight.js +19 -0
- package/dist/commands/list/products/products.preflight.js.map +1 -0
- package/dist/commands/update/index.d.ts +2 -0
- package/dist/commands/update/index.d.ts.map +1 -0
- package/dist/commands/update/index.js +2 -0
- package/dist/commands/update/index.js.map +1 -0
- package/dist/commands/update/update.action.d.ts +3 -0
- package/dist/commands/update/update.action.d.ts.map +1 -0
- package/dist/commands/update/update.action.js +84 -0
- package/dist/commands/update/update.action.js.map +1 -0
- package/dist/commands/update/update.command.d.ts +3 -0
- package/dist/commands/update/update.command.d.ts.map +1 -0
- package/dist/commands/update/update.command.js +21 -0
- package/dist/commands/update/update.command.js.map +1 -0
- package/dist/commands/update/update.preflight.d.ts +12 -0
- package/dist/commands/update/update.preflight.d.ts.map +1 -0
- package/dist/commands/update/update.preflight.js +36 -0
- package/dist/commands/update/update.preflight.js.map +1 -0
- package/dist/commands/urls/index.d.ts +2 -0
- package/dist/commands/urls/index.d.ts.map +1 -0
- package/dist/commands/urls/index.js +2 -0
- package/dist/commands/urls/index.js.map +1 -0
- package/dist/commands/urls/urls.action.d.ts +4 -0
- package/dist/commands/urls/urls.action.d.ts.map +1 -0
- package/dist/commands/urls/urls.action.js +65 -0
- package/dist/commands/urls/urls.action.js.map +1 -0
- package/dist/commands/urls/urls.command.d.ts +6 -0
- package/dist/commands/urls/urls.command.d.ts.map +1 -0
- package/dist/commands/urls/urls.command.js +19 -0
- package/dist/commands/urls/urls.command.js.map +1 -0
- package/dist/definitions/action.constants.d.ts +14 -0
- package/dist/definitions/action.constants.d.ts.map +1 -0
- package/dist/definitions/action.constants.js +22 -0
- package/dist/definitions/action.constants.js.map +1 -0
- package/dist/definitions/config.schemas.d.ts +278 -0
- package/dist/definitions/config.schemas.d.ts.map +1 -0
- package/dist/definitions/config.schemas.js +30 -0
- package/dist/definitions/config.schemas.js.map +1 -0
- package/dist/definitions/context.types.d.ts +18 -0
- package/dist/definitions/context.types.d.ts.map +1 -0
- package/dist/definitions/context.types.js +2 -0
- package/dist/definitions/context.types.js.map +1 -0
- package/dist/definitions/database-adapter.schemas.d.ts +20 -0
- package/dist/definitions/database-adapter.schemas.d.ts.map +1 -0
- package/dist/definitions/database-adapter.schemas.js +18 -0
- package/dist/definitions/database-adapter.schemas.js.map +1 -0
- package/dist/definitions/env.constants.d.ts +9 -0
- package/dist/definitions/env.constants.d.ts.map +1 -0
- package/dist/definitions/env.constants.js +8 -0
- package/dist/definitions/env.constants.js.map +1 -0
- package/dist/definitions/index.d.ts +9 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/index.js +9 -0
- package/dist/definitions/index.js.map +1 -0
- package/dist/definitions/stripe-price.schemas.d.ts +132 -0
- package/dist/definitions/stripe-price.schemas.d.ts.map +1 -0
- package/dist/definitions/stripe-price.schemas.js +50 -0
- package/dist/definitions/stripe-price.schemas.js.map +1 -0
- package/dist/definitions/stripe-product.schemas.d.ts +87 -0
- package/dist/definitions/stripe-product.schemas.d.ts.map +1 -0
- package/dist/definitions/stripe-product.schemas.js +42 -0
- package/dist/definitions/stripe-product.schemas.js.map +1 -0
- package/dist/definitions/utility.types.d.ts +4 -0
- package/dist/definitions/utility.types.d.ts.map +1 -0
- package/dist/definitions/utility.types.js +2 -0
- package/dist/definitions/utility.types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/create-context.d.ts +6 -0
- package/dist/utils/create-context.d.ts.map +1 -0
- package/dist/utils/create-context.js +21 -0
- package/dist/utils/create-context.js.map +1 -0
- package/dist/utils/create-logger.d.ts +3 -0
- package/dist/utils/create-logger.d.ts.map +1 -0
- package/dist/utils/create-logger.js +38 -0
- package/dist/utils/create-logger.js.map +1 -0
- package/dist/utils/create-mappers.d.ts +3 -0
- package/dist/utils/create-mappers.d.ts.map +1 -0
- package/dist/utils/create-mappers.js +98 -0
- package/dist/utils/create-mappers.js.map +1 -0
- package/dist/utils/define-config.d.ts +3 -0
- package/dist/utils/define-config.d.ts.map +1 -0
- package/dist/utils/define-config.js +6 -0
- package/dist/utils/define-config.js.map +1 -0
- package/dist/utils/find-env-directories.d.ts +2 -0
- package/dist/utils/find-env-directories.d.ts.map +1 -0
- package/dist/utils/find-env-directories.js +84 -0
- package/dist/utils/find-env-directories.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/load-config.d.ts +6 -0
- package/dist/utils/load-config.d.ts.map +1 -0
- package/dist/utils/load-config.js +84 -0
- package/dist/utils/load-config.js.map +1 -0
- package/dist/utils/load-env.d.ts +3 -0
- package/dist/utils/load-env.d.ts.map +1 -0
- package/dist/utils/load-env.js +54 -0
- package/dist/utils/load-env.js.map +1 -0
- package/dist/utils/stripe-client.d.ts +3 -0
- package/dist/utils/stripe-client.d.ts.map +1 -0
- package/dist/utils/stripe-client.js +10 -0
- package/dist/utils/stripe-client.js.map +1 -0
- package/dist/utils/stripe-repository.d.ts +16 -0
- package/dist/utils/stripe-repository.d.ts.map +1 -0
- package/dist/utils/stripe-repository.js +73 -0
- package/dist/utils/stripe-repository.js.map +1 -0
- package/dist/utils/user-preferences.d.ts +10 -0
- package/dist/utils/user-preferences.d.ts.map +1 -0
- package/dist/utils/user-preferences.js +40 -0
- package/dist/utils/user-preferences.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.preflight.d.ts","sourceRoot":"","sources":["../../../../src/commands/db/sync/sync.preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG7D,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,mBAAmB,CAAC,CAyD9B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { determineAdapter, determineEnvironment, requireProductionConfirmation, } from '../../../cli-prompts/index.js';
|
|
2
|
+
import { createContext, loadConfig, loadEnvironment } from '../../../utils/index.js';
|
|
3
|
+
export async function runSyncPreflight(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 (!(typeof ctx.adapter.syncProducts === 'function' &&
|
|
18
|
+
typeof ctx.adapter.syncPrices === 'function')) {
|
|
19
|
+
throw new Error('Database adapter must implement syncProducts and syncPrices methods');
|
|
20
|
+
}
|
|
21
|
+
if (!ctx.config.env.stripeSecretKey) {
|
|
22
|
+
throw new Error('STRIPE_SECRET_KEY is not configured in environment');
|
|
23
|
+
}
|
|
24
|
+
await requireProductionConfirmation({
|
|
25
|
+
action: 'sync Stripe plans to database',
|
|
26
|
+
env: chosenEnv,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
ctx,
|
|
30
|
+
chosenEnv,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=sync.preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.preflight.js","sourceRoot":"","sources":["../../../../src/commands/db/sync/sync.preflight.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,eAAe,CAAC;A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AAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,OAAO;QACL,GAAG;QACH,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './archive/index.js';
|
|
2
|
+
export * from './config/index.js';
|
|
3
|
+
export * from './create/index.js';
|
|
4
|
+
export * from './db/index.js';
|
|
5
|
+
export * from './list/index.js';
|
|
6
|
+
export * from './update/index.js';
|
|
7
|
+
export * from './urls/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './archive/index.js';
|
|
2
|
+
export * from './config/index.js';
|
|
3
|
+
export * from './create/index.js';
|
|
4
|
+
export * from './db/index.js';
|
|
5
|
+
export * from './list/index.js';
|
|
6
|
+
export * from './update/index.js';
|
|
7
|
+
export * from './urls/index.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/list/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/list/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.command.d.ts","sourceRoot":"","sources":["../../../src/commands/list/list.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,IAAI,SAQb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { prices } from './prices/index.js';
|
|
3
|
+
import { products } from './products/index.js';
|
|
4
|
+
export const list = new Command()
|
|
5
|
+
.name('list')
|
|
6
|
+
.description('List Stripe resources')
|
|
7
|
+
.addCommand(products)
|
|
8
|
+
.addCommand(prices)
|
|
9
|
+
.action(() => {
|
|
10
|
+
list.help();
|
|
11
|
+
process.exit(0);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=list.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.command.js","sourceRoot":"","sources":["../../../src/commands/list/list.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE;KAC9B,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,uBAAuB,CAAC;KACpC,UAAU,CAAC,QAAQ,CAAC;KACpB,UAAU,CAAC,MAAM,CAAC;KAClB,MAAM,CAAC,GAAG,EAAE;IACX,IAAI,CAAC,IAAI,EAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/prices/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/list/prices/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.action.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM7C,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CAyDf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { listStripePrices } from '../../../utils/index.js';
|
|
3
|
+
export async function listStripePricesAction(ctx, options = {}) {
|
|
4
|
+
const { showAll = false } = options;
|
|
5
|
+
try {
|
|
6
|
+
const prices = await listStripePrices(ctx, { showAll });
|
|
7
|
+
if (prices.length === 0) {
|
|
8
|
+
ctx.logger.info('No prices found in Stripe.');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
ctx.logger.info(`Found ${prices.length} ${showAll ? '' : 'managed '}prices in Stripe:`);
|
|
12
|
+
for (const price of prices) {
|
|
13
|
+
const isManaged = price.metadata?.[ctx.config.metadata.priceIdField] &&
|
|
14
|
+
price.metadata?.[ctx.config.metadata.managedByField] ===
|
|
15
|
+
ctx.config.metadata.managedByValue;
|
|
16
|
+
console.log(`${chalk.bold(price.id)}`);
|
|
17
|
+
console.log(` ${chalk.dim('Product:')} ${price.product}`);
|
|
18
|
+
console.log(` ${chalk.dim('Active:')} ${price.active}`);
|
|
19
|
+
console.log(` ${chalk.dim('Currency:')} ${price.currency.toUpperCase()}`);
|
|
20
|
+
console.log(` ${chalk.dim('Type:')} ${price.type}`);
|
|
21
|
+
if (price.type === 'recurring') {
|
|
22
|
+
console.log(` ${chalk.dim('Interval:')} ${price.recurring?.interval}`);
|
|
23
|
+
console.log(` ${chalk.dim('Interval Count:')} ${price.recurring?.interval_count}`);
|
|
24
|
+
}
|
|
25
|
+
if (typeof price.unit_amount === 'number') {
|
|
26
|
+
console.log(` ${chalk.dim('Amount:')} ${(price.unit_amount / 100).toFixed(2)} ${price.currency.toUpperCase()}`);
|
|
27
|
+
}
|
|
28
|
+
console.log(` ${chalk.dim('Internal ID:')} ${price.metadata?.[ctx.config.metadata.priceIdField] || 'N/A'}`);
|
|
29
|
+
if (showAll) {
|
|
30
|
+
console.log(` Managed: ${isManaged ? chalk.green('Yes') : chalk.yellow('No')}`);
|
|
31
|
+
}
|
|
32
|
+
console.log('');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
ctx.logger.error('Error listing prices:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=prices.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.action.js","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK3C,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAAY,EACZ,UAAiC,EAAE;IAEnC,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO,CAA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K,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,MAAM,SAqBf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { listStripePricesAction } from './prices.action.js';
|
|
4
|
+
import { runListPricesPreflight, } from './prices.preflight.js';
|
|
5
|
+
export const prices = new Command()
|
|
6
|
+
.name('prices')
|
|
7
|
+
.description('List Stripe prices')
|
|
8
|
+
.option('-e, --env <environment>', 'Target environment (test, dev, staging, prod)')
|
|
9
|
+
.option('--all', 'Show all items in Stripe account')
|
|
10
|
+
.action(async (options, command) => {
|
|
11
|
+
try {
|
|
12
|
+
const { ctx, showAll } = await runListPricesPreflight(options, command);
|
|
13
|
+
await listStripePricesAction(ctx, { showAll });
|
|
14
|
+
console.log(chalk.green('\nOperation completed successfully.'));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error(chalk.red(`\nOperation failed: ${error}`));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=prices.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.command.js","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAEL,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE;KAChC,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,oBAAoB,CAAC;KACjC,MAAM,CACL,yBAAyB,EACzB,+CAA+C,CAChD;KACA,MAAM,CAAC,OAAO,EAAE,kCAAkC,CAAC;KACnD,MAAM,CAAC,KAAK,EAAE,OAA0B,EAAE,OAAO,EAAE,EAAE;IACpD,IAAI,CAAC;QAEH,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAGxE,MAAM,sBAAsB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAE/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAClE,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,13 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { Context, EnvironmentKey } from '../../../definitions/index.js';
|
|
3
|
+
export interface ListPricesOptions {
|
|
4
|
+
env?: EnvironmentKey;
|
|
5
|
+
all?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ListPricesPreflightResult {
|
|
8
|
+
ctx: Context;
|
|
9
|
+
showAll: boolean;
|
|
10
|
+
chosenEnv: EnvironmentKey;
|
|
11
|
+
}
|
|
12
|
+
export declare function runListPricesPreflight(options: ListPricesOptions, command: Command): Promise<ListPricesPreflightResult>;
|
|
13
|
+
//# sourceMappingURL=prices.preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.preflight.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAmB,cAAc,EAAE,MAAM,eAAe,CAAC;AAG9E,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,CAAC,CAyBpC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { determineEnvironment } from '../../../cli-prompts/index.js';
|
|
2
|
+
import { createContext, loadConfig, loadEnvironment } from '../../../utils/index.js';
|
|
3
|
+
export async function runListPricesPreflight(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 ctx = createContext({
|
|
10
|
+
adapter: Object.values(config.adapters)[0],
|
|
11
|
+
config,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
ctx,
|
|
15
|
+
showAll: !!options.all,
|
|
16
|
+
chosenEnv,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=prices.preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prices.preflight.js","sourceRoot":"","sources":["../../../../src/commands/list/prices/prices.preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAarE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAA0B,EAC1B,OAAgB;IAGhB,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;IAGxC,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAGxE,eAAe,CAAC,SAAS,CAAC,CAAC;IAG3B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;IAGhD,MAAM,GAAG,GAAG,aAAa,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAoB;QAC7D,MAAM;KACP,CAAC,CAAC;IAEH,OAAO;QACL,GAAG;QACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG;QACtB,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/products/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/list/products/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.action.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/products/products.action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM7C,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { listStripeProducts } from '../../../utils/index.js';
|
|
3
|
+
export async function listStripeProductsAction(ctx, options = {}) {
|
|
4
|
+
const { showAll = false } = options;
|
|
5
|
+
try {
|
|
6
|
+
const products = await listStripeProducts(ctx, { showAll });
|
|
7
|
+
if (products.length === 0) {
|
|
8
|
+
ctx.logger.info('No products found in Stripe.');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
ctx.logger.info(`Found ${products.length} ${showAll ? '' : 'managed '}products in Stripe:`);
|
|
12
|
+
for (const product of products) {
|
|
13
|
+
const isManaged = product.metadata?.[ctx.config.metadata.productIdField] &&
|
|
14
|
+
product.metadata?.[ctx.config.metadata.managedByField] ===
|
|
15
|
+
ctx.config.metadata.managedByValue;
|
|
16
|
+
console.log(`${chalk.bold(product.id)}`);
|
|
17
|
+
console.log(` ${chalk.dim('Name:')} ${product.name}`);
|
|
18
|
+
console.log(` ${chalk.dim('Active:')} ${product.active}`);
|
|
19
|
+
console.log(` ${chalk.dim('Description:')} ${product.description || 'N/A'}`);
|
|
20
|
+
console.log(` ${chalk.dim('Internal ID:')} ${product.metadata?.[ctx.config.metadata.productIdField] || 'N/A'}`);
|
|
21
|
+
if (showAll) {
|
|
22
|
+
console.log(` Managed: ${isManaged ? chalk.green('Yes') : chalk.yellow('No')}`);
|
|
23
|
+
}
|
|
24
|
+
console.log('');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
ctx.logger.error('Error listing products:', error);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=products.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.action.js","sourceRoot":"","sources":["../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AS,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,EAAE,CACjE,CAAC;YACF,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,KAAK,EAAE,CACpG,CAAC;YAEF,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CACT,cAAc,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CACpE,CAAC;YACJ,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QACnD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/products/products.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,QAAQ,SAqBjB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { listStripeProductsAction } from './products.action.js';
|
|
4
|
+
import { runListProductsPreflight, } from './products.preflight.js';
|
|
5
|
+
export const products = new Command()
|
|
6
|
+
.name('products')
|
|
7
|
+
.description('List Stripe products')
|
|
8
|
+
.option('-e, --env <environment>', 'Target environment (test, dev, staging, prod)')
|
|
9
|
+
.option('--all', 'Show all items in Stripe account')
|
|
10
|
+
.action(async (options, command) => {
|
|
11
|
+
try {
|
|
12
|
+
const { ctx, showAll } = await runListProductsPreflight(options, command);
|
|
13
|
+
await listStripeProductsAction(ctx, { showAll });
|
|
14
|
+
console.log(chalk.green('\nOperation completed successfully.'));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error(chalk.red(`\nOperation failed: ${error}`));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=products.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.command.js","sourceRoot":"","sources":["../../../../src/commands/list/products/products.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAEL,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAE;KAClC,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,sBAAsB,CAAC;KACnC,MAAM,CACL,yBAAyB,EACzB,+CAA+C,CAChD;KACA,MAAM,CAAC,OAAO,EAAE,kCAAkC,CAAC;KACnD,MAAM,CAAC,KAAK,EAAE,OAA4B,EAAE,OAAO,EAAE,EAAE;IACtD,IAAI,CAAC;QAEH,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAG1E,MAAM,wBAAwB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAEjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAClE,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,13 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { Context, EnvironmentKey } from '../../../definitions/index.js';
|
|
3
|
+
export interface ListProductsOptions {
|
|
4
|
+
env?: EnvironmentKey;
|
|
5
|
+
all?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ListProductsPreflightResult {
|
|
8
|
+
ctx: Context;
|
|
9
|
+
showAll: boolean;
|
|
10
|
+
chosenEnv: EnvironmentKey;
|
|
11
|
+
}
|
|
12
|
+
export declare function runListProductsPreflight(options: ListProductsOptions, command: Command): Promise<ListProductsPreflightResult>;
|
|
13
|
+
//# sourceMappingURL=products.preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.preflight.d.ts","sourceRoot":"","sources":["../../../../src/commands/list/products/products.preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAmB,cAAc,EAAE,MAAM,eAAe,CAAC;AAG9E,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,2BAA2B,CAAC,CAyBtC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { determineEnvironment } from '../../../cli-prompts/index.js';
|
|
2
|
+
import { createContext, loadConfig, loadEnvironment } from '../../../utils/index.js';
|
|
3
|
+
export async function runListProductsPreflight(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 ctx = createContext({
|
|
10
|
+
adapter: Object.values(config.adapters)[0],
|
|
11
|
+
config,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
ctx,
|
|
15
|
+
showAll: !!options.all,
|
|
16
|
+
chosenEnv,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=products.preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.preflight.js","sourceRoot":"","sources":["../../../../src/commands/list/products/products.preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAarE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAA4B,EAC5B,OAAgB;IAGhB,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;IAGxC,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAGxE,eAAe,CAAC,SAAS,CAAC,CAAC;IAG3B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;IAGhD,MAAM,GAAG,GAAG,aAAa,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAoB;QAC7D,MAAM;KACP,CAAC,CAAC;IAEH,OAAO;QACL,GAAG;QACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG;QACtB,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/update/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/update/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.action.d.ts","sourceRoot":"","sources":["../../../src/commands/update/update.action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,eAAe,CAAC;AA8H/D,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,IAAI,CAAC,CAgCf"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { listStripePrices, listStripeProducts } from '../../utils/index.js';
|
|
2
|
+
async function updateStripeProduct(ctx, plan, allStripeProducts) {
|
|
3
|
+
try {
|
|
4
|
+
const stripeProductParams = ctx.mappers.mapSubscriptionPlanToStripeProduct(plan);
|
|
5
|
+
const stripeProduct = allStripeProducts.find((product) => product.metadata?.[ctx.config.metadata.productIdField] ===
|
|
6
|
+
plan.product.id &&
|
|
7
|
+
product.metadata?.[ctx.config.metadata.managedByField] ===
|
|
8
|
+
ctx.config.metadata.managedByValue);
|
|
9
|
+
if (!stripeProduct) {
|
|
10
|
+
ctx.logger.warn(`Stripe product not found for ${plan.product.id}. Skipping update.`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
await ctx.stripeClient.products.update(stripeProduct.id, {
|
|
14
|
+
name: stripeProductParams.name,
|
|
15
|
+
description: stripeProductParams.description,
|
|
16
|
+
active: stripeProductParams.active,
|
|
17
|
+
metadata: stripeProductParams.metadata,
|
|
18
|
+
});
|
|
19
|
+
ctx.logger.info(`Updated Stripe product: ${stripeProduct.id}`);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
ctx.logger.error({
|
|
23
|
+
message: 'Error updating Stripe product',
|
|
24
|
+
error,
|
|
25
|
+
productId: plan.product.id,
|
|
26
|
+
});
|
|
27
|
+
throw new Error(`Failed to update Stripe product: ${error}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function updateStripePrices(ctx, plan, allStripePrices) {
|
|
31
|
+
try {
|
|
32
|
+
for (const planPrice of plan.prices) {
|
|
33
|
+
const stripePrice = allStripePrices.find((price) => price.metadata?.[ctx.config.metadata.priceIdField] === planPrice.id &&
|
|
34
|
+
price.metadata?.[ctx.config.metadata.managedByField] ===
|
|
35
|
+
ctx.config.metadata.managedByValue);
|
|
36
|
+
if (!stripePrice) {
|
|
37
|
+
ctx.logger.warn(`Stripe price not found for ${planPrice.id}. Skipping update.`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const stripeProductId = typeof stripePrice.product === 'string'
|
|
41
|
+
? stripePrice.product
|
|
42
|
+
: stripePrice.product.id;
|
|
43
|
+
const stripePriceParams = ctx.mappers.mapSubscriptionPlanToStripePrice(planPrice, {
|
|
44
|
+
planName: plan.product.name,
|
|
45
|
+
tier: plan.product.id,
|
|
46
|
+
internalProductId: plan.product.id,
|
|
47
|
+
stripeProductId,
|
|
48
|
+
});
|
|
49
|
+
await ctx.stripeClient.prices.update(stripePrice.id, {
|
|
50
|
+
active: stripePriceParams.active,
|
|
51
|
+
metadata: stripePriceParams.metadata,
|
|
52
|
+
});
|
|
53
|
+
ctx.logger.info(`Updated Stripe price: ${stripePrice.id}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
ctx.logger.error({
|
|
58
|
+
message: 'Error updating Stripe prices',
|
|
59
|
+
error,
|
|
60
|
+
planId: plan.product.id,
|
|
61
|
+
});
|
|
62
|
+
throw new Error(`Failed to update Stripe prices: ${error}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export async function updateStripeSubscriptionPlansAction(ctx) {
|
|
66
|
+
const plans = ctx.config.plans;
|
|
67
|
+
ctx.logger.info(`Updating ${plans.length} subscription plans in Stripe...`);
|
|
68
|
+
try {
|
|
69
|
+
const allStripeProducts = await listStripeProducts(ctx, { showAll: false });
|
|
70
|
+
const allStripePrices = await listStripePrices(ctx, { showAll: false });
|
|
71
|
+
ctx.logger.info(`Found ${allStripeProducts.length} managed products and ${allStripePrices.length} managed prices in Stripe`);
|
|
72
|
+
for (const plan of plans) {
|
|
73
|
+
ctx.logger.info(`Updating plan: ${plan.product.name} (Internal ID: ${plan.product.id})...`);
|
|
74
|
+
await updateStripeProduct(ctx, plan, allStripeProducts);
|
|
75
|
+
await updateStripePrices(ctx, plan, allStripePrices);
|
|
76
|
+
}
|
|
77
|
+
ctx.logger.info('Finished updating subscription plans in Stripe');
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
ctx.logger.error('Error updating Stripe subscription plans:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=update.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.action.js","sourceRoot":"","sources":["../../../src/commands/update/update.action.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAU/D,KAAK,UAAU,mBAAmB,CAChC,GAAY,EACZ,IAAsB,EACtB,iBAA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C;QAED,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.command.d.ts","sourceRoot":"","sources":["../../../src/commands/update/update.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,MAAM,SAqBf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { updateStripeSubscriptionPlansAction } from './update.action.js';
|
|
4
|
+
import { runUpdatePreflight } from './update.preflight.js';
|
|
5
|
+
export const update = new Command()
|
|
6
|
+
.name('update')
|
|
7
|
+
.description('Update Stripe subscription plans')
|
|
8
|
+
.option('-e, --env <environment>', 'Target environment (test, dev, staging, prod)')
|
|
9
|
+
.option('-a, --adapter <name>', 'Database adapter name')
|
|
10
|
+
.action(async (options, command) => {
|
|
11
|
+
try {
|
|
12
|
+
const { ctx } = await runUpdatePreflight(options, command);
|
|
13
|
+
await updateStripeSubscriptionPlansAction(ctx);
|
|
14
|
+
console.log(chalk.green('\nOperation completed successfully.'));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error(chalk.red(`\nOperation failed: ${error}`));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=update.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.command.js","sourceRoot":"","sources":["../../../src/commands/update/update.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAE5E,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE;KAChC,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,kCAAkC,CAAC;KAC/C,MAAM,CACL,yBAAyB,EACzB,+CAA+C,CAChD;KACA,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;KACvD,MAAM,CAAC,KAAK,EAAE,OAAsB,EAAE,OAAO,EAAE,EAAE;IAChD,IAAI,CAAC;QAEH,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAG3D,MAAM,mCAAmC,CAAC,GAAG,CAAC,CAAC;QAE/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAClE,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,12 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { Context, EnvironmentKey } from '../../definitions/index.js';
|
|
3
|
+
export interface UpdateOptions {
|
|
4
|
+
env?: EnvironmentKey;
|
|
5
|
+
adapter?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdatePreflightResult {
|
|
8
|
+
ctx: Context;
|
|
9
|
+
chosenEnv: EnvironmentKey;
|
|
10
|
+
}
|
|
11
|
+
export declare function runUpdatePreflight(options: UpdateOptions, command: Command): Promise<UpdatePreflightResult>;
|
|
12
|
+
//# sourceMappingURL=update.preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.preflight.d.ts","sourceRoot":"","sources":["../../../src/commands/update/update.preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG7D,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC,CA8DhC"}
|