stripe 18.1.0 → 18.1.1

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/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
  # Changelog
2
+ ## 18.1.1 - 2025-05-19
3
+ * [#2308](https://github.com/stripe/stripe-node/pull/2308) RawRequest can use custom host
4
+ * RawRequest now allows you set `host` and `streaming` in request options.
5
+ ```typescript
6
+ const file = await stripe.rawRequest(
7
+ 'GET',
8
+ '/v1/files/file_123/contents',
9
+ {},
10
+ {host: 'files.stripe.com', streaming: true}
11
+ );
12
+ ```
13
+ * [#2320](https://github.com/stripe/stripe-node/pull/2320) fix: examples/webhook-signing/nestjs/package.json to reduce vulnerabi…
14
+ * [#2326](https://github.com/stripe/stripe-node/pull/2326) Adds CONTRIBUTING.md
15
+
2
16
  ## 18.1.0 - 2025-04-30
3
17
 
4
18
  This release changes the pinned API version to `2025-04-30.basil`.
package/README.md CHANGED
@@ -523,23 +523,23 @@ const stripe = new Stripe('sk_test_...', {
523
523
  });
524
524
  ```
525
525
 
526
- ### Beta SDKs
526
+ ### Public Preview SDKs
527
527
 
528
- Stripe has features in the beta phase that can be accessed via the beta version of this package.
529
- We would love for you to try these and share feedback with us before these features reach the stable phase.
530
- The beta versions can be installed in one of two ways
528
+ Stripe has features in the [public preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `15.2.0-beta.2`.
529
+ We would love for you to try these as we incrementally release new features and improve them based on your feedback.
531
530
 
532
- - To install the latest beta version, run the command `npm install stripe@beta --save`
533
- - To install a specific beta version, replace the term "beta" in the above command with the version number like `npm install stripe@1.2.3-beta.1 --save`
531
+ To install, choose the version that includes support for the preview feature you are interested in by reviewing the [releases page](https://github.com/stripe/stripe-node/releases/) and use it in the below command
534
532
 
535
- > **Note**
536
- > There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your package.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
533
+ ```
534
+ npm install stripe@<replace-with-the-version-of-your-choice> --save
535
+ ```
537
536
 
538
- We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
537
+ > **Note**
538
+ > There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your package.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest public preview SDK.
539
539
 
540
- The versions tab on the [stripe page on npm](https://www.npmjs.com/package/stripe) lists the current tags in use. The `beta` tag here corresponds to the the latest beta version of the package.
540
+ The versions tab on the [stripe page on npm](https://www.npmjs.com/package/stripe) lists the current tags in use. The `beta` tag here corresponds to the the latest public preview SDK.
541
541
 
542
- If your beta feature requires a `Stripe-Version` header to be sent, use the `apiVersion` property of `config` object to set it:
542
+ Some preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If your preview feature has this requirement, use the `apiVersion` property of `config` object to set it:
543
543
 
544
544
  ```js
545
545
  const stripe = new Stripe('sk_test_...', {
package/VERSION CHANGED
@@ -1 +1 @@
1
- 18.1.0
1
+ 18.1.1
@@ -310,8 +310,8 @@ class RequestSender {
310
310
  queryData: {},
311
311
  authenticator,
312
312
  headers,
313
- host: null,
314
- streaming: false,
313
+ host: calculatedOptions.host,
314
+ streaming: !!calculatedOptions.streaming,
315
315
  settings: {},
316
316
  usage: ['raw_request'],
317
317
  };
@@ -108,7 +108,7 @@ StripeResource.prototype = {
108
108
  const data = encode(Object.assign({}, dataFromArgs, overrideData));
109
109
  const options = (0, utils_js_1.getOptionsFromArgs)(args);
110
110
  const host = options.host || spec.host;
111
- const streaming = !!spec.streaming;
111
+ const streaming = !!spec.streaming || !!options.streaming;
112
112
  // Validate that there are no more args.
113
113
  if (args.filter((x) => x != null).length) {
114
114
  throw new Error(`Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)`);
@@ -36,7 +36,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
36
36
  ];
37
37
  const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
38
38
  function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
39
- Stripe.PACKAGE_VERSION = '18.1.0';
39
+ Stripe.PACKAGE_VERSION = '18.1.1';
40
40
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)());
41
41
  Stripe.StripeResource = StripeResource_js_1.StripeResource;
42
42
  Stripe.resources = resources;
package/cjs/utils.js CHANGED
@@ -13,6 +13,7 @@ const OPTIONS_KEYS = [
13
13
  'authenticator',
14
14
  'stripeContext',
15
15
  'additionalHeaders',
16
+ 'streaming',
16
17
  ];
17
18
  function isOptionsHash(o) {
18
19
  return (o &&
@@ -107,6 +108,7 @@ function getOptionsFromArgs(args) {
107
108
  host: null,
108
109
  headers: {},
109
110
  settings: {},
111
+ streaming: false,
110
112
  };
111
113
  if (args.length > 0) {
112
114
  const arg = args[args.length - 1];
@@ -159,6 +161,9 @@ function getOptionsFromArgs(args) {
159
161
  if (params.additionalHeaders) {
160
162
  opts.headers = params.additionalHeaders;
161
163
  }
164
+ if (params.streaming) {
165
+ opts.streaming = true;
166
+ }
162
167
  }
163
168
  }
164
169
  return opts;
@@ -307,8 +307,8 @@ export class RequestSender {
307
307
  queryData: {},
308
308
  authenticator,
309
309
  headers,
310
- host: null,
311
- streaming: false,
310
+ host: calculatedOptions.host,
311
+ streaming: !!calculatedOptions.streaming,
312
312
  settings: {},
313
313
  usage: ['raw_request'],
314
314
  };
@@ -104,7 +104,7 @@ StripeResource.prototype = {
104
104
  const data = encode(Object.assign({}, dataFromArgs, overrideData));
105
105
  const options = getOptionsFromArgs(args);
106
106
  const host = options.host || spec.host;
107
- const streaming = !!spec.streaming;
107
+ const streaming = !!spec.streaming || !!options.streaming;
108
108
  // Validate that there are no more args.
109
109
  if (args.filter((x) => x != null).length) {
110
110
  throw new Error(`Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)`);
@@ -33,7 +33,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
33
33
  ];
34
34
  const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
35
35
  export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
36
- Stripe.PACKAGE_VERSION = '18.1.0';
36
+ Stripe.PACKAGE_VERSION = '18.1.1';
37
37
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
38
38
  Stripe.StripeResource = StripeResource;
39
39
  Stripe.resources = resources;
package/esm/utils.js CHANGED
@@ -10,6 +10,7 @@ const OPTIONS_KEYS = [
10
10
  'authenticator',
11
11
  'stripeContext',
12
12
  'additionalHeaders',
13
+ 'streaming',
13
14
  ];
14
15
  export function isOptionsHash(o) {
15
16
  return (o &&
@@ -100,6 +101,7 @@ export function getOptionsFromArgs(args) {
100
101
  host: null,
101
102
  headers: {},
102
103
  settings: {},
104
+ streaming: false,
103
105
  };
104
106
  if (args.length > 0) {
105
107
  const arg = args[args.length - 1];
@@ -152,6 +154,9 @@ export function getOptionsFromArgs(args) {
152
154
  if (params.additionalHeaders) {
153
155
  opts.headers = params.additionalHeaders;
154
156
  }
157
+ if (params.streaming) {
158
+ opts.streaming = true;
159
+ }
155
160
  }
156
161
  }
157
162
  return opts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "18.1.0",
3
+ "version": "18.1.1",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",