diff --git a/components/stripe/actions/cancel-subscription/cancel-subscription.mjs b/components/stripe/actions/cancel-subscription/cancel-subscription.mjs new file mode 100644 index 0000000000000..71ab44173edc4 --- /dev/null +++ b/components/stripe/actions/cancel-subscription/cancel-subscription.mjs @@ -0,0 +1,25 @@ +import stripe from "../../stripe.app.mjs"; + +export default { + key: "stripe-cancel-subscription", + name: "Cancel Subscription", + description: "Cancel a subscription. [See the documentation](https://docs.stripe.com/api/subscriptions/cancel?lang=node)", + version: "0.0.1", + type: "action", + props: { + stripe, + subscriptionId: { + propDefinition: [ + stripe, + "subscription", + ], + }, + }, + async run({ $ }) { + const response = await this.stripe.sdk().subscriptions.cancel(this.subscriptionId); + + $.export("$summary", `Cancelled subscription ${this.subscriptionId}`); + + return response; + }, +}; diff --git a/components/stripe/actions/search-subscriptions/search-subscriptions.mjs b/components/stripe/actions/search-subscriptions/search-subscriptions.mjs new file mode 100644 index 0000000000000..a96b5f6d9fa6c --- /dev/null +++ b/components/stripe/actions/search-subscriptions/search-subscriptions.mjs @@ -0,0 +1,52 @@ +import stripe from "../../stripe.app.mjs"; + +export default { + key: "stripe-search-subscriptions", + name: "Search Subscriptions", + description: "Search for subscriptions. [See the documentation](https://docs.stripe.com/api/subscriptions/search?lang=node)", + version: "0.0.1", + type: "action", + props: { + stripe, + query: { + type: "string", + label: "Query", + description: "The search query string. See [search query language](https://docs.stripe.com/search#search-query-language) and the list of supported [query fields for subscriptions](https://docs.stripe.com/search#query-fields-for-subscriptions).", + }, + maxResults: { + type: "integer", + label: "Max Results", + description: "The maximum number of results to return", + default: 100, + optional: true, + }, + }, + async run({ $ }) { + const params = { + query: this.query, + limit: 100, + }; + let hasMore, count = 0; + + const results = []; + do { + const response = await this.stripe.sdk().subscriptions.search(params); + if (!response?.data?.length) { + break; + } + for (const subscription of response.data) { + results.push(subscription); + count++; + if (count >= this.maxResults) { + break; + } + } + hasMore = response.has_more; + params.page = response.next_page; + } while (hasMore && count < this.maxResults); + + $.export("$summary", `Retrieved ${results.length} subscriptions`); + + return results; + }, +}; diff --git a/components/stripe/package.json b/components/stripe/package.json index b6443685a8356..6413c50787b5a 100644 --- a/components/stripe/package.json +++ b/components/stripe/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/stripe", - "version": "0.7.2", + "version": "0.8.0", "description": "Pipedream Stripe Components", "main": "stripe.app.mjs", "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8919f705cc00e..e216aeb7a6237 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13364,8 +13364,7 @@ importers: specifier: ^4.0.0 version: 4.0.1 - components/sperse: - specifiers: {} + components/sperse: {} components/spider: dependencies: @@ -16442,14 +16441,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk': @@ -31938,22 +31929,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net supports-color@10.0.0: resolution: {integrity: sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==}