Initial project import
This commit is contained in:
4755
node_modules/stripe/CHANGELOG.md
generated
vendored
Normal file
4755
node_modules/stripe/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
20
node_modules/stripe/LICENSE
generated
vendored
Normal file
20
node_modules/stripe/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (C) 2011 Ask Bjørn Hansen
|
||||
Copyright (C) 2013 Stripe, Inc. (https://stripe.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
node_modules/stripe/OPENAPI_VERSION
generated
vendored
Normal file
1
node_modules/stripe/OPENAPI_VERSION
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
v2277
|
||||
706
node_modules/stripe/README.md
generated
vendored
Normal file
706
node_modules/stripe/README.md
generated
vendored
Normal file
@@ -0,0 +1,706 @@
|
||||
# Stripe Node.js Library
|
||||
|
||||
[](https://www.npmjs.org/package/stripe)
|
||||
[](https://github.com/stripe/stripe-node/actions?query=branch%3Amaster)
|
||||
[](https://www.npmjs.com/package/stripe)
|
||||
|
||||
> [!TIP]
|
||||
> Want to chat live with Stripe engineers? Join us on our [Discord server](https://stripe.com/go/discord/node).
|
||||
|
||||
The Stripe Node library provides convenient access to the Stripe API from
|
||||
applications written in server-side JavaScript.
|
||||
|
||||
For collecting customer and payment information in the browser, use [Stripe.js][stripe-js].
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [`stripe-node` API docs](https://stripe.com/docs/api?lang=node) for Node.js.
|
||||
|
||||
## Requirements
|
||||
|
||||
Per our [Language Version Support Policy](https://docs.stripe.com/sdks/versioning?lang=node#stripe-sdk-language-version-support-policy), we currently support all LTS versions of **Node.js 18+**.
|
||||
|
||||
Read more and see the full schedule in the docs: https://docs.stripe.com/sdks/versioning?lang=node#stripe-sdk-language-version-support-policy
|
||||
|
||||
## Installation
|
||||
|
||||
Install the package with:
|
||||
|
||||
```sh
|
||||
npm install stripe
|
||||
# or
|
||||
yarn add stripe
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The package needs to be configured with your account's secret key, which is
|
||||
available in the [Stripe Dashboard][api-keys]. Require it with the key's
|
||||
value:
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
import Stripe from 'stripe';
|
||||
const stripeClient = new Stripe('sk_test_...');
|
||||
|
||||
const customer = await stripeClient.customers.create({
|
||||
email: 'customer@example.com',
|
||||
});
|
||||
|
||||
console.log(customer.id);
|
||||
```
|
||||
|
||||
Or using CJS:
|
||||
```js
|
||||
const Stripe = require('stripe');
|
||||
const stripeClient = Stripe('sk_test_...');
|
||||
|
||||
stripeClient.customers.create({
|
||||
email: 'customer@example.com',
|
||||
})
|
||||
.then(customer => console.log(customer.id))
|
||||
.catch(error => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
> [!WARNING]
|
||||
> If you're using `v17.x.x` or later and getting an error about a missing API key despite being sure it's available, it's likely you're importing the file that instantiates `Stripe` while the key isn't present (for instance, during a build step).
|
||||
> If that's the case, consider instantiating the client lazily:
|
||||
>
|
||||
> ```ts
|
||||
> import Stripe from 'stripe';
|
||||
>
|
||||
> let _stripe: Stripe | null = null;
|
||||
> const getStripeClient = (): Stripe => {
|
||||
> if (!_stripe) {
|
||||
> _stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
|
||||
> // ...
|
||||
> });
|
||||
> }
|
||||
> return _stripe;
|
||||
> };
|
||||
>
|
||||
> const getCustomers = () => getStripeClient().customers.list();
|
||||
> ```
|
||||
>
|
||||
> Alternatively, you can provide a placeholder for the real key (which will be enough to get the code through a build step):
|
||||
>
|
||||
> ```ts
|
||||
> import Stripe from 'stripe';
|
||||
>
|
||||
> export const stripeClient = new Stripe(
|
||||
> process.env.STRIPE_SECRET_KEY || 'api_key_placeholder',
|
||||
> {
|
||||
> // ...
|
||||
> }
|
||||
> );
|
||||
> ```
|
||||
|
||||
### Usage with TypeScript
|
||||
|
||||
As of 8.0.1, Stripe maintains types for the latest [API version][api-versions].
|
||||
|
||||
Import Stripe as a default import (not `* as Stripe`, unlike the DefinitelyTyped version)
|
||||
and instantiate it as `new Stripe()` with the latest API version.
|
||||
|
||||
```ts
|
||||
import Stripe from 'stripe';
|
||||
const stripeClient = new Stripe('sk_test_...');
|
||||
|
||||
const createCustomer = async () => {
|
||||
const params: Stripe.CustomerCreateParams = {
|
||||
description: 'test customer',
|
||||
};
|
||||
|
||||
const customer: Stripe.Customer = await stripeClient.customers.create(params);
|
||||
|
||||
console.log(customer.id);
|
||||
};
|
||||
createCustomer();
|
||||
```
|
||||
|
||||
You can find a full TS server example in [stripe-samples](https://github.com/stripe-samples/accept-a-payment/tree/main/custom-payment-flow/server/node-typescript).
|
||||
|
||||
#### Using old API versions with TypeScript
|
||||
|
||||
Types can change between API versions (e.g., Stripe may have changed a field from a string to a hash),
|
||||
so our types only reflect the latest API version.
|
||||
|
||||
We therefore encourage [upgrading your API version][api-version-upgrading]
|
||||
if you would like to take advantage of Stripe's TypeScript definitions.
|
||||
|
||||
If you are on an older API version (e.g., `2019-10-17`) and not able to upgrade,
|
||||
you may pass another version and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here
|
||||
and anywhere the types differ between your API version and the latest.
|
||||
When you upgrade, you should remove these comments.
|
||||
|
||||
We also recommend using `// @ts-ignore` if you have access to a beta feature and need to send parameters beyond the type definitions.
|
||||
|
||||
#### Using `expand` with TypeScript
|
||||
|
||||
[Expandable][expanding_objects] fields are typed as `string | Foo`,
|
||||
so you must cast them appropriately, e.g.,
|
||||
|
||||
```ts
|
||||
const paymentIntent: Stripe.PaymentIntent = await stripeClient.paymentIntents.retrieve(
|
||||
'pi_123456789',
|
||||
{
|
||||
expand: ['customer'],
|
||||
}
|
||||
);
|
||||
const customerEmail: string = (paymentIntent.customer as Stripe.Customer).email;
|
||||
|
||||
// Define and use this helper method if you extract `id` often
|
||||
function getId(stripeObject: {id: string} | string) {
|
||||
return typeof stripeObject === 'string' ? stripeObject : stripeObject.id;
|
||||
}
|
||||
|
||||
const customerId: string = getId(paymentIntent.customer);
|
||||
```
|
||||
|
||||
#### TypeScript and the stripe-node versioning policy
|
||||
|
||||
The TypeScript types in stripe-node always reflect the latest shape of the Stripe API. When the Stripe API changes in a [backwards-incompatible way](https://stripe.com/docs/upgrades#what-changes-does-stripe-consider-to-be-backwards-compatible), there is a new Stripe API version, and we release a new major version of stripe-node. Sometimes, though, the Stripe API changes in a way that weakens the guarantees provided by the TypeScript types, but that cannot result in any backwards incompatibility at runtime. For example, we might add a new enum value on a response, along with a new parameter to a request. Adding a new value to a response enum weakens the TypeScript type. However, if the new enum value is only returned when the new parameter is provided, this cannot break any existing usages and so would not be considered a breaking API change. In stripe-node, we do NOT consider such changes to be breaking under our current versioning policy. This means that you might see new type errors from TypeScript as you upgrade minor versions of stripe-node, that you can resolve by adding additional type guards.
|
||||
|
||||
Please feel welcome to share your thoughts about the versioning policy in a Github issue. For now, we judge it to be better than the two alternatives: outdated, inaccurate types, or vastly more frequent major releases, which would distract from any future breaking changes with potentially more disruptive runtime implications.
|
||||
|
||||
### Using Promises
|
||||
|
||||
Every method returns a chainable promise which can be used instead of a regular
|
||||
callback:
|
||||
|
||||
```js
|
||||
// Create a new customer and then create an invoice item then invoice it:
|
||||
stripeClient.customers
|
||||
.create({
|
||||
email: 'customer@example.com',
|
||||
})
|
||||
.then((customer) => {
|
||||
// have access to the customer object
|
||||
return stripe.invoiceItems
|
||||
.create({
|
||||
customer: customer.id, // set the customer id
|
||||
amount: 2500, // 25
|
||||
currency: 'usd',
|
||||
description: 'One-time setup fee',
|
||||
})
|
||||
.then((invoiceItem) => {
|
||||
return stripe.invoices.create({
|
||||
collection_method: 'send_invoice',
|
||||
customer: invoiceItem.customer,
|
||||
});
|
||||
})
|
||||
.then((invoice) => {
|
||||
// New invoice created on a new customer
|
||||
})
|
||||
.catch((err) => {
|
||||
// Deal with an error
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Usage with Deno
|
||||
|
||||
As of 11.16.0, stripe-node provides a `deno` export target. In your Deno project, import stripe-node using an npm specifier:
|
||||
|
||||
Import using npm specifiers:
|
||||
|
||||
```js
|
||||
import Stripe from 'npm:stripe';
|
||||
```
|
||||
|
||||
Please see https://github.com/stripe-samples/stripe-node-deno-samples for more detailed examples and instructions on how to use stripe-node in Deno.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Initialize with config object
|
||||
|
||||
The package can be initialized with several options:
|
||||
|
||||
```js
|
||||
import ProxyAgent from 'https-proxy-agent';
|
||||
|
||||
const stripe = Stripe('sk_test_...', {
|
||||
maxNetworkRetries: 1,
|
||||
httpAgent: new ProxyAgent(process.env.http_proxy),
|
||||
timeout: 1000,
|
||||
host: 'api.example.com',
|
||||
port: 123,
|
||||
telemetry: true,
|
||||
});
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `apiVersion` | `null` | Stripe API version to be used. If not set, stripe-node will use the latest version at the time of release. |
|
||||
| `maxNetworkRetries` | 1 | The amount of times a request should be [retried](#network-retries). |
|
||||
| `httpAgent` | `null` | [Proxy](#configuring-a-proxy) agent to be used by the library. |
|
||||
| `timeout` | 80000 | [Maximum time each request can take in ms.](#configuring-timeout) |
|
||||
| `host` | `'api.stripe.com'` | Host that requests are made to. |
|
||||
| `port` | 443 | Port that requests are made to. |
|
||||
| `protocol` | `'https'` | `'https'` or `'http'`. `http` is never appropriate for sending requests to Stripe servers, and we strongly discourage `http`, even in local testing scenarios, as this can result in your credentials being transmitted over an insecure channel. |
|
||||
| `telemetry` | `true` | Allow Stripe to send [telemetry](#telemetry). |
|
||||
|
||||
> **Note**
|
||||
> Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.
|
||||
|
||||
### Configuring Timeout
|
||||
|
||||
Timeout can be set globally via the config object:
|
||||
|
||||
```js
|
||||
const stripeClient = Stripe('sk_test_...', {
|
||||
timeout: 20 * 1000, // 20 seconds
|
||||
});
|
||||
```
|
||||
|
||||
And overridden on a per-request basis:
|
||||
|
||||
```js
|
||||
stripeClient.customers.create(
|
||||
{
|
||||
email: 'customer@example.com',
|
||||
},
|
||||
{
|
||||
timeout: 1000, // 1 second
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Configuring For Connect
|
||||
|
||||
A per-request `Stripe-Account` header for use with [Stripe Connect][connect]
|
||||
can be added to any method:
|
||||
|
||||
```js
|
||||
// List the balance transactions for a connected account:
|
||||
stripeClient.balanceTransactions.list(
|
||||
{
|
||||
limit: 10,
|
||||
},
|
||||
{
|
||||
stripeAccount: 'acct_foo',
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Configuring a Proxy
|
||||
|
||||
To use stripe behind a proxy you can pass an [https-proxy-agent][https-proxy-agent] on initialization:
|
||||
|
||||
```js
|
||||
if (process.env.http_proxy) {
|
||||
const ProxyAgent = require('https-proxy-agent');
|
||||
|
||||
const stripe = Stripe('sk_test_...', {
|
||||
httpAgent: new ProxyAgent(process.env.http_proxy),
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Network retries
|
||||
|
||||
As of [v13](https://github.com/stripe/stripe-node/releases/tag/v13.0.0) stripe-node will automatically do one reattempt for failed requests that are safe to retry. Automatic network retries can be disabled by setting the `maxNetworkRetries` config option to `0`. You can also set a higher number to reattempt multiple times, with exponential backoff. [Idempotency keys](https://stripe.com/docs/api/idempotent_requests) are added where appropriate to prevent duplication.
|
||||
|
||||
```js
|
||||
const stripeClient = Stripe('sk_test_...', {
|
||||
maxNetworkRetries: 0, // Disable retries
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
const stripeClient = Stripe('sk_test_...', {
|
||||
maxNetworkRetries: 2, // Retry a request twice before giving up
|
||||
});
|
||||
```
|
||||
|
||||
Network retries can also be set on a per-request basis:
|
||||
|
||||
```js
|
||||
stripeClient.customers.create(
|
||||
{
|
||||
email: 'customer@example.com',
|
||||
},
|
||||
{
|
||||
maxNetworkRetries: 2, // Retry this specific request twice before giving up
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Examining Responses
|
||||
|
||||
Some information about the response which generated a resource is available
|
||||
with the `lastResponse` property:
|
||||
|
||||
```js
|
||||
customer.lastResponse.requestId; // see: https://stripe.com/docs/api/request_ids?lang=node
|
||||
customer.lastResponse.statusCode;
|
||||
```
|
||||
|
||||
### `request` and `response` events
|
||||
|
||||
The Stripe object emits `request` and `response` events. You can use them like this:
|
||||
|
||||
```js
|
||||
const Stripe = require('stripe');
|
||||
const stripeClient = Stripe('sk_test_...');
|
||||
|
||||
const onRequest = (request) => {
|
||||
// Do something.
|
||||
};
|
||||
|
||||
// Add the event handler function:
|
||||
stripeClient.on('request', onRequest);
|
||||
|
||||
// Remove the event handler function:
|
||||
stripeClient.off('request', onRequest);
|
||||
```
|
||||
|
||||
#### `request` object
|
||||
|
||||
```js
|
||||
{
|
||||
api_version: 'latest',
|
||||
account: 'acct_TEST', // Only present if provided
|
||||
idempotency_key: 'abc123', // Only present if provided
|
||||
method: 'POST',
|
||||
path: '/v1/customers',
|
||||
body: {name: 'test'}, // Only present if emitEventBodies is true
|
||||
request_start_time: 1565125303932 // Unix timestamp in milliseconds
|
||||
}
|
||||
```
|
||||
|
||||
#### `response` object
|
||||
|
||||
```js
|
||||
{
|
||||
api_version: 'latest',
|
||||
account: 'acct_TEST', // Only present if provided
|
||||
idempotency_key: 'abc123', // Only present if provided
|
||||
method: 'POST',
|
||||
path: '/v1/customers',
|
||||
status: 200,
|
||||
request_id: 'req_Ghc9r26ts73DRf',
|
||||
body: {id: 'cus_123', object: 'customer'}, // Only present if emitEventBodies is true
|
||||
elapsed: 445, // Elapsed time in milliseconds
|
||||
request_start_time: 1565125303932, // Unix timestamp in milliseconds
|
||||
request_end_time: 1565125304377 // Unix timestamp in milliseconds
|
||||
}
|
||||
```
|
||||
|
||||
### Webhook signing
|
||||
|
||||
Stripe can optionally sign the webhook events it sends to your endpoint, allowing you to validate that they were not sent by a third-party. You can read more about it [here](https://stripe.com/docs/webhooks/signatures).
|
||||
|
||||
Please note that you must pass the _raw_ request body, exactly as received from Stripe, to the `constructEvent()` function; this will not work with a parsed (i.e., JSON) request body.
|
||||
|
||||
You can find an example of how to use this with various JavaScript frameworks in [`examples/webhook-signing`](examples/webhook-signing) folder, but here's what it looks like:
|
||||
|
||||
```js
|
||||
const event = stripeClient.webhooks.constructEvent(
|
||||
webhookRawBody,
|
||||
webhookStripeSignatureHeader,
|
||||
webhookSecret
|
||||
);
|
||||
```
|
||||
|
||||
#### Testing Webhook signing
|
||||
|
||||
You can use `stripeClient.webhooks.generateTestHeaderString` to mock webhook events that come from Stripe:
|
||||
|
||||
```js
|
||||
const payload = {
|
||||
id: 'evt_test_webhook',
|
||||
object: 'event',
|
||||
};
|
||||
|
||||
const payloadString = JSON.stringify(payload, null, 2);
|
||||
const secret = 'whsec_test_secret';
|
||||
|
||||
const header = stripeClient.webhooks.generateTestHeaderString({
|
||||
payload: payloadString,
|
||||
secret,
|
||||
});
|
||||
|
||||
const event = stripeClient.webhooks.constructEvent(payloadString, header, secret);
|
||||
|
||||
// Do something with mocked signed event
|
||||
expect(event.id).to.equal(payload.id);
|
||||
```
|
||||
|
||||
### How to use undocumented parameters and properties
|
||||
|
||||
In some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.
|
||||
This might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.
|
||||
See [undocumented params and properties](https://docs.stripe.com/sdks/server-side?lang=node#undocumented-params-and-fields) to send those parameters or access those fields.
|
||||
|
||||
### Writing a Plugin
|
||||
|
||||
If you're writing a plugin that uses the library, we'd appreciate it if you instantiated your stripe client with `appInfo`, eg;
|
||||
|
||||
With ES modules or TypeScript:
|
||||
```js
|
||||
import Stripe from "stripe";
|
||||
const stripeClient = new Stripe(apiKey, {
|
||||
appInfo: {
|
||||
name: 'MyAwesomePlugin',
|
||||
version: '1.2.34', // Optional
|
||||
url: 'https://myawesomeplugin.info', // Optional
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Or using CJS:
|
||||
```js
|
||||
const Stripe = require('stripe');
|
||||
const stripeClient = Stripe('sk_test_...', {
|
||||
appInfo: {
|
||||
name: 'MyAwesomePlugin',
|
||||
version: '1.2.34', // Optional
|
||||
url: 'https://myawesomeplugin.info', // Optional
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
This information is passed along when the library makes calls to the Stripe API.
|
||||
|
||||
### Auto-pagination
|
||||
|
||||
We provide a few different APIs for this to aid with a variety of node versions and styles.
|
||||
|
||||
#### Async iterators (`for-await-of`)
|
||||
|
||||
If you are in a Node environment that has support for [async iteration](https://github.com/tc39/proposal-async-iteration#the-async-iteration-statement-for-await-of),
|
||||
such as Node 10+ or [babel](https://babeljs.io/docs/en/babel-plugin-transform-async-generator-functions),
|
||||
the following will auto-paginate:
|
||||
|
||||
```js
|
||||
for await (const customer of stripeClient.customers.list()) {
|
||||
doSomething(customer);
|
||||
if (shouldStop()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### `autoPagingEach`
|
||||
|
||||
If you are in a Node environment that has support for `await`, such as Node 7.9 and greater,
|
||||
you may pass an async function to `.autoPagingEach`:
|
||||
|
||||
```js
|
||||
await stripeClient.customers.list().autoPagingEach(async (customer) => {
|
||||
await doSomething(customer);
|
||||
if (shouldBreak()) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
console.log('Done iterating.');
|
||||
```
|
||||
|
||||
Equivalently, without `await`, you may return a Promise, which can resolve to `false` to break:
|
||||
|
||||
```js
|
||||
stripeClient.customers
|
||||
.list()
|
||||
.autoPagingEach((customer) => {
|
||||
return doSomething(customer).then(() => {
|
||||
if (shouldBreak()) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
console.log('Done iterating.');
|
||||
})
|
||||
.catch(handleError);
|
||||
```
|
||||
|
||||
#### `autoPagingToArray`
|
||||
|
||||
This is a convenience for cases where you expect the number of items
|
||||
to be relatively small; accordingly, you must pass a `limit` option
|
||||
to prevent runaway list growth from consuming too much memory. Once the
|
||||
`limit` number of items have been fetched, auto-pagination will stop.
|
||||
|
||||
Returns a promise of an array of all items across pages for a list request.
|
||||
|
||||
```js
|
||||
const allNewCustomers = await stripeClient.customers
|
||||
.list({created: {gt: lastMonth}, limit: 100}) // 100 items per page
|
||||
.autoPagingToArray({limit: 10000}); // Stop after 10000 items total
|
||||
```
|
||||
|
||||
### Telemetry
|
||||
|
||||
By default, the library sends request telemetry to Stripe regarding request
|
||||
latency and feature usage. These
|
||||
numbers help Stripe improve the overall latency of its API for all users, and
|
||||
improve popular features.
|
||||
|
||||
You can disable this behavior if you prefer:
|
||||
|
||||
```js
|
||||
const stripeClient = new Stripe('sk_test_...', {
|
||||
telemetry: false,
|
||||
});
|
||||
```
|
||||
|
||||
### Public Preview SDKs
|
||||
|
||||
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 `18.6.0-beta.1`.
|
||||
We would love for you to try these as we incrementally release new features and improve them based on your feedback.
|
||||
|
||||
The easiest way to install a public-preview release is to use the dedicated npm tag:
|
||||
|
||||
```
|
||||
npm install stripe@public-preview --save-exact
|
||||
```
|
||||
|
||||
Or, to install a specific version from the [releases page](https://github.com/stripe/stripe-node/releases/), you can specify that version explicitly:
|
||||
|
||||
```
|
||||
npm install stripe@<some-version>
|
||||
# for example:
|
||||
# npm install stripe@18.6.0-beta.1
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> 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 (i.e. using --save-exact) 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.
|
||||
|
||||
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:
|
||||
|
||||
```js
|
||||
const stripeClient = new Stripe('sk_test_...', {
|
||||
apiVersion: '2022-08-01; feature_beta=v3',
|
||||
});
|
||||
```
|
||||
|
||||
### Private Preview SDKs
|
||||
|
||||
Stripe has features in the [private preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `-alpha.X` suffix like `18.6.0-alpha.1`. You can install the private preview SDKs by following the same instructions as for the [public preview SDKs](#public-preview-sdks) above and replacing the term `public-preview` with `private-preview`. Note that access to specific private preview API features may require separate approval:
|
||||
|
||||
```
|
||||
npm install stripe@private-preview --save-exact
|
||||
```
|
||||
|
||||
### Custom requests
|
||||
|
||||
> This feature is only available from version 17 of this SDK.
|
||||
|
||||
If you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `rawRequest` method on the StripeClient object.
|
||||
|
||||
Using ES modules and `async`/`await`:
|
||||
|
||||
```javascript
|
||||
import Stripe from 'stripe';
|
||||
const stripe = new Stripe('sk_test_...');
|
||||
|
||||
const response = await stripe.rawRequest(
|
||||
'POST',
|
||||
'/v1/beta_endpoint',
|
||||
{param: 123},
|
||||
{apiVersion: '2022-11-15; feature_beta=v3'}
|
||||
);
|
||||
|
||||
// handle response
|
||||
```
|
||||
|
||||
Or using CJS and promises:
|
||||
|
||||
```javascript
|
||||
const stripeClient = new Stripe('sk_test_...');
|
||||
|
||||
stripeClient.rawRequest(
|
||||
'POST',
|
||||
'/v1/beta_endpoint',
|
||||
{ param: 123 },
|
||||
{ apiVersion: '2022-11-15; feature_beta=v3' }
|
||||
)
|
||||
.then((response) => /* handle response */ )
|
||||
.catch((error) => console.error(error));
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
New features and bug fixes are released on the latest major version of the `stripe` package. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
|
||||
|
||||
## More Information
|
||||
|
||||
- [REST API Version](https://github.com/stripe/stripe-node/wiki/REST-API-Version)
|
||||
- [Error Handling](https://github.com/stripe/stripe-node/wiki/Error-Handling)
|
||||
- [Passing Options](https://github.com/stripe/stripe-node/wiki/Passing-Options)
|
||||
- [Using Stripe Connect](https://github.com/stripe/stripe-node/wiki/Using-Stripe-Connect-with-node.js)
|
||||
|
||||
## Development
|
||||
|
||||
[Contribution guidelines for this project](CONTRIBUTING.md)
|
||||
|
||||
The tests depend on [stripe-mock][stripe-mock], so make sure to fetch and
|
||||
run it from a background terminal ([stripe-mock's README][stripe-mock-usage]
|
||||
also contains instructions for installing via Homebrew and other methods):
|
||||
|
||||
```bash
|
||||
go get -u github.com/stripe/stripe-mock
|
||||
stripe-mock
|
||||
```
|
||||
|
||||
We use [just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`.
|
||||
|
||||
Run all tests (installing the dependencies first, if needed)
|
||||
|
||||
```bash
|
||||
just test
|
||||
# or: yarn && yarn test
|
||||
```
|
||||
|
||||
If you do not have `yarn` installed, consult its [installation instructions](https://classic.yarnpkg.com/lang/en/docs/install/).
|
||||
|
||||
Run a single test suite:
|
||||
|
||||
```bash
|
||||
just test test/Error.spec.ts
|
||||
# or: yarn test test/Error.spec.ts
|
||||
```
|
||||
|
||||
Run a single test (case sensitive) in watch mode:
|
||||
|
||||
```bash
|
||||
just test test/Error.spec.ts --grep 'StripeError' --watch
|
||||
# or: yarn test test/Error.spec.ts --grep 'StripeError' --watch
|
||||
```
|
||||
|
||||
If you wish, you may run tests using your Stripe _Test_ API key by setting the
|
||||
environment variable `STRIPE_TEST_API_KEY` before running the tests:
|
||||
|
||||
```bash
|
||||
export STRIPE_TEST_API_KEY='sk_test....'
|
||||
just test
|
||||
# or: yarn test
|
||||
```
|
||||
|
||||
Run prettier:
|
||||
|
||||
Add an [editor integration](https://prettier.io/docs/en/editors.html) or:
|
||||
|
||||
```bash
|
||||
just format
|
||||
# or: yarn prettier src/**/*.ts --write
|
||||
```
|
||||
|
||||
[api-keys]: https://dashboard.stripe.com/account/apikeys
|
||||
[api-versions]: https://stripe.com/docs/api/versioning
|
||||
[api-version-upgrading]: https://stripe.com/docs/upgrades#how-can-i-upgrade-my-api
|
||||
[connect]: https://stripe.com/connect
|
||||
[expanding_objects]: https://stripe.com/docs/api/expanding_objects
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
[stripe-js]: https://stripe.com/docs/js
|
||||
[stripe-mock]: https://github.com/stripe/stripe-mock
|
||||
[stripe-mock-usage]: https://github.com/stripe/stripe-mock#usage
|
||||
|
||||
<!--
|
||||
# vim: set tw=79:
|
||||
-->
|
||||
1
node_modules/stripe/VERSION
generated
vendored
Normal file
1
node_modules/stripe/VERSION
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
22.2.1
|
||||
532
node_modules/stripe/cjs/Decimal.d.ts
generated
vendored
Normal file
532
node_modules/stripe/cjs/Decimal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,532 @@
|
||||
declare const __brand: unique symbol;
|
||||
declare const __stripeType: unique symbol;
|
||||
/**
|
||||
* Rounding direction for Decimal operations.
|
||||
*
|
||||
* @remarks
|
||||
* Seven modes corresponding to
|
||||
* {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
|
||||
* rounding-direction attributes:
|
||||
*
|
||||
* | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
|
||||
* | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
|
||||
* | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
|
||||
* | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
|
||||
* | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
|
||||
* | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
|
||||
* | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
|
||||
* | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
|
||||
* | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type RoundDirection = 'ceil' | 'floor' | 'round-down' | 'round-up' | 'half-up' | 'half-down' | 'half-even';
|
||||
/**
|
||||
* Precision specification for {@link DecimalImpl.round}.
|
||||
*
|
||||
* @remarks
|
||||
* Two modes are supported:
|
||||
* - `"decimal-places"` — round to a fixed number of digits after the decimal point.
|
||||
* - `"significant-figures"` — round to a fixed number of significant digits.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Round to 2 decimal places
|
||||
* amount.round('half-even', { mode: 'decimal-places', value: 2 });
|
||||
*
|
||||
* // Round to 4 significant figures
|
||||
* amount.round('half-up', { mode: 'significant-figures', value: 4 });
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DecimalRoundingOptions {
|
||||
mode: 'decimal-places' | 'significant-figures';
|
||||
value: number;
|
||||
}
|
||||
/**
|
||||
* Built-in rounding presets keyed by semantic name.
|
||||
*
|
||||
* @remarks
|
||||
* This is an **open interface** — consumers can extend it via declaration
|
||||
* merging to register custom presets that are accepted by
|
||||
* {@link DecimalImpl.round}:
|
||||
*
|
||||
* ```ts
|
||||
* declare module '@stripe/apps-extensibility-sdk/stdlib' {
|
||||
* interface DecimalRoundingPresets {
|
||||
* 'my-custom-preset': DecimalRoundingOptions;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Built-in presets:
|
||||
*
|
||||
* | Preset | Equivalent DecimalRoundingOptions |
|
||||
* | ------------------- | ------------------------------------------------------ |
|
||||
* | `"ubb-usage-count"` | `{ mode: "significant-figures", value: 15 }` |
|
||||
* | `"v1-api"` | `{ mode: "decimal-places", value: 12 }` |
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DecimalRoundingPresets {
|
||||
'ubb-usage-count': DecimalRoundingOptions;
|
||||
'v1-api': DecimalRoundingOptions;
|
||||
}
|
||||
/**
|
||||
* The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
|
||||
* precision for {@link DecimalImpl.div} when full precision is desired.
|
||||
*
|
||||
* @remarks
|
||||
* Pass this as the `precision` argument to `div()` when you want the
|
||||
* maximum available precision. Division requires explicit precision —
|
||||
* no invisible defaults in financial code.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Use the full decimal128 precision explicitly
|
||||
* a.div(b, DEFAULT_DIV_PRECISION, 'half-even');
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const DEFAULT_DIV_PRECISION = 34;
|
||||
/**
|
||||
* Internal implementation of arbitrary-precision decimal arithmetic.
|
||||
*
|
||||
* @remarks
|
||||
* Represents a decimal value as `coefficient × 10^exponent` using
|
||||
* native `BigInt` for the coefficient, giving unlimited precision with
|
||||
* no rounding on construction. Instances are always
|
||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | frozen}
|
||||
* and all arithmetic produces new instances.
|
||||
*
|
||||
* This class is **not** exported directly — consumers interact with
|
||||
* the branded {@link Decimal} type and the {@link Decimal | Decimal companion object}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
declare class DecimalImpl {
|
||||
/** @internal */
|
||||
private readonly _coefficient;
|
||||
/** @internal */
|
||||
private readonly _exponent;
|
||||
/**
|
||||
* Construct and normalise a decimal value.
|
||||
*
|
||||
* @param coefficient - The unscaled integer value.
|
||||
* @param exponent - The power-of-ten scale factor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(coefficient: bigint, exponent: number);
|
||||
/**
|
||||
* Strip trailing zeros from `coefficient`, incrementing `exponent`
|
||||
* for each zero removed. Zero always normalises to `(0n, 0)`.
|
||||
*
|
||||
* @param coefficient - Raw coefficient before normalisation.
|
||||
* @param exponent - Raw exponent before normalisation.
|
||||
* @returns A `[coefficient, exponent]` tuple with trailing zeros removed.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private static normalize;
|
||||
/**
|
||||
* Apply rounding to the result of an integer division.
|
||||
*
|
||||
* @remarks
|
||||
* BigInt division truncates toward zero. This helper inspects the
|
||||
* `remainder` to decide whether to adjust the truncated `quotient`
|
||||
* by ±1 according to the chosen {@link RoundDirection}.
|
||||
*
|
||||
* The rounding direction is derived from the signs of `remainder`
|
||||
* and `divisor`: when they agree the exact fractional part is
|
||||
* positive (the truncation point is below the true value, so +1
|
||||
* rounds to nearest); when they disagree the fractional part is
|
||||
* negative (−1 rounds to nearest).
|
||||
*
|
||||
* @param quotient - Truncated integer quotient (`dividend / divisor`).
|
||||
* @param remainder - Division remainder (`dividend % divisor`).
|
||||
* @param divisor - The divisor used in the division.
|
||||
* @param direction - The rounding strategy to apply.
|
||||
* @returns The rounded quotient.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private static roundDivision;
|
||||
/**
|
||||
* Return the sum of this value and `other`.
|
||||
*
|
||||
* @param other - The addend.
|
||||
* @returns A new {@link Decimal} equal to `this + other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
add(other: Decimal): Decimal;
|
||||
/**
|
||||
* Return the difference of this value and `other`.
|
||||
*
|
||||
* @param other - The subtrahend.
|
||||
* @returns A new {@link Decimal} equal to `this - other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
sub(other: Decimal): Decimal;
|
||||
/**
|
||||
* Return the product of this value and `other`.
|
||||
*
|
||||
* @param other - The multiplicand.
|
||||
* @returns A new {@link Decimal} equal to `this × other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
mul(other: Decimal): Decimal;
|
||||
/**
|
||||
* Return the quotient of this value divided by `other`.
|
||||
*
|
||||
* @remarks
|
||||
* Division scales the dividend to produce `precision` decimal digits
|
||||
* in the result, then applies integer division and rounds the
|
||||
* remainder according to `direction`.
|
||||
*
|
||||
* Division requires explicit rounding control — no invisible defaults
|
||||
* in financial code. For full precision use {@link DEFAULT_DIV_PRECISION}
|
||||
* (34, matching the IEEE 754 decimal128 coefficient size).
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1').div(Decimal.from('3'), 5, 'half-up'); // "0.33333"
|
||||
* Decimal.from('5').div(Decimal.from('2'), 0, 'half-up'); // "3"
|
||||
* Decimal.from('5').div(Decimal.from('2'), 0, 'half-even'); // "2"
|
||||
* ```
|
||||
*
|
||||
* @param other - The divisor. Must not be zero.
|
||||
* @param precision - Maximum number of decimal digits in the result.
|
||||
* @param direction - How to round when the exact quotient cannot
|
||||
* be represented at the requested precision.
|
||||
* @returns A new {@link Decimal} equal to `this ÷ other`, rounded to
|
||||
* `precision` decimal places.
|
||||
* @throws {@link Error} if `other` is zero.
|
||||
* @throws {@link Error} if `precision` is negative or non-integer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
div(other: Decimal, precision: number, direction: RoundDirection): Decimal;
|
||||
/**
|
||||
* Three-way comparison of this value with `other`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const a = Decimal.from('1.5');
|
||||
* const b = Decimal.from('2');
|
||||
* a.cmp(b); // -1
|
||||
* b.cmp(a); // 1
|
||||
* a.cmp(a); // 0
|
||||
* ```
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `-1` if `this \< other`, `0` if equal, `1` if `this \> other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
cmp(other: Decimal): -1 | 0 | 1;
|
||||
/**
|
||||
* Return `true` if this value is numerically equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this === other` in value, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
eq(other: Decimal): boolean;
|
||||
/**
|
||||
* Return `true` if this value is strictly less than `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this \< other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
lt(other: Decimal): boolean;
|
||||
/**
|
||||
* Return `true` if this value is less than or equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this ≤ other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
lte(other: Decimal): boolean;
|
||||
/**
|
||||
* Return `true` if this value is strictly greater than `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this \> other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
gt(other: Decimal): boolean;
|
||||
/**
|
||||
* Return `true` if this value is greater than or equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this ≥ other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
gte(other: Decimal): boolean;
|
||||
/**
|
||||
* Return `true` if this value is exactly zero.
|
||||
*
|
||||
* @returns `true` if the value is zero, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isZero(): boolean;
|
||||
/**
|
||||
* Return `true` if this value is strictly less than zero.
|
||||
*
|
||||
* @returns `true` if negative, `false` if zero or positive.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isNegative(): boolean;
|
||||
/**
|
||||
* Return `true` if this value is strictly greater than zero.
|
||||
*
|
||||
* @returns `true` if positive, `false` if zero or negative.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isPositive(): boolean;
|
||||
/**
|
||||
* Return the additive inverse of this value.
|
||||
*
|
||||
* @returns A new {@link Decimal} equal to `-this`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
neg(): Decimal;
|
||||
/**
|
||||
* Return the absolute value.
|
||||
*
|
||||
* @returns A new {@link Decimal} equal to `|this|`. If this value is
|
||||
* already non-negative, returns `this` (no allocation).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
abs(): Decimal;
|
||||
/**
|
||||
* Round this value to a specified precision.
|
||||
*
|
||||
* @remarks
|
||||
* **Rounding directions** (IEEE 754-2019 §4.3):
|
||||
*
|
||||
* | Direction | Behavior |
|
||||
* | -------------- | ---------------------------------------------- |
|
||||
* | `'ceil'` | 1.1→2, -1.1→-1, 1.0→1 (toward +∞) |
|
||||
* | `'floor'` | 1.9→1, -1.1→-2, 1.0→1 (toward -∞) |
|
||||
* | `'round-down'` | 1.9→1, -1.9→-1 (toward zero / truncate) |
|
||||
* | `'round-up'` | 1.1→2, -1.1→-2 (away from zero) |
|
||||
* | `'half-up'` | 0.5→1, 1.5→2, -0.5→-1 (ties away from zero) |
|
||||
* | `'half-down'` | 0.5→0, 1.5→1, -0.5→0 (ties toward zero) |
|
||||
* | `'half-even'` | 0.5→0, 1.5→2, 2.5→2, 3.5→4 (ties to even) |
|
||||
*
|
||||
* **Precision** is specified as a {@link DecimalRoundingOptions} object
|
||||
* or a preset name from {@link DecimalRoundingPresets}:
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Using a preset
|
||||
* amount.round('half-even', 'v1-api');
|
||||
*
|
||||
* // Using explicit options
|
||||
* amount.round('half-even', { mode: 'decimal-places', value: 2 });
|
||||
* amount.round('half-up', { mode: 'significant-figures', value: 4 });
|
||||
* ```
|
||||
*
|
||||
* @param direction - How to round.
|
||||
* @param options - A {@link DecimalRoundingOptions} object or key of {@link DecimalRoundingPresets}.
|
||||
* @returns A new {@link Decimal} rounded to the specified precision.
|
||||
* @throws {@link Error} if `options.value` is negative or non-integer.
|
||||
* @throws {@link Error} if the preset name is not recognized.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
round(direction: RoundDirection, options: keyof DecimalRoundingPresets | DecimalRoundingOptions): Decimal;
|
||||
/**
|
||||
* Return a human-readable string representation.
|
||||
*
|
||||
* @remarks
|
||||
* Plain notation for values whose digit count is at most 30, and
|
||||
* scientific notation (`1.23E+40`) for larger values. Trailing zeros
|
||||
* are never present because the internal representation is normalised.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Return the JSON-serialisable representation.
|
||||
*
|
||||
* @remarks
|
||||
* Returns a plain string matching the Stripe API convention where
|
||||
* decimal values are serialised as strings in JSON. Called
|
||||
* automatically by `JSON.stringify`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toJSON(): string;
|
||||
/**
|
||||
* Convert to a JavaScript `number`.
|
||||
*
|
||||
* @remarks
|
||||
* This is an explicit, intentionally lossy conversion. Use it only
|
||||
* when you need a numeric value for display or interop with APIs
|
||||
* that require `number`. Prefer {@link Decimal.toString | toString}
|
||||
* or {@link Decimal.toFixed | toFixed} for lossless output.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toNumber(): number;
|
||||
/**
|
||||
* Format this value as a fixed-point string with exactly
|
||||
* `decimalPlaces` digits after the decimal point.
|
||||
*
|
||||
* @remarks
|
||||
* Values are rounded according to `direction` when the internal
|
||||
* precision exceeds the requested number of decimal places.
|
||||
* The rounding direction is always required — no invisible defaults
|
||||
* in financial code.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1.235').toFixed(2, 'half-up'); // "1.24"
|
||||
* Decimal.from('1.225').toFixed(2, 'half-even'); // "1.22"
|
||||
* Decimal.from('42').toFixed(3, 'half-up'); // "42.000"
|
||||
* ```
|
||||
*
|
||||
* @param decimalPlaces - Number of digits after the decimal point.
|
||||
* Must be a non-negative integer.
|
||||
* @param direction - How to round when truncating excess digits.
|
||||
* @returns A string with exactly `decimalPlaces` fractional digits.
|
||||
* @throws {@link Error} if `decimalPlaces` is negative or non-integer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toFixed(decimalPlaces: number, direction: RoundDirection): string;
|
||||
/**
|
||||
* Return a string primitive when the runtime coerces the value.
|
||||
*
|
||||
* @remarks
|
||||
* Deliberately returns a `string` (not a `number`) to discourage
|
||||
* silent precision loss through implicit arithmetic coercion.
|
||||
* When used in a numeric context (for example, `+myDecimal`), the
|
||||
* JavaScript runtime will first call this method and then coerce
|
||||
* the resulting string to a `number`, which may lose precision.
|
||||
* Callers should prefer the explicit
|
||||
* {@link Decimal.toNumber | toNumber} method when an IEEE 754
|
||||
* `number` is required.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
valueOf(): string;
|
||||
}
|
||||
/**
|
||||
* Arbitrary-precision decimal type for billing calculations.
|
||||
*
|
||||
* @remarks
|
||||
* `Decimal` is a branded wrapper around an internal class that stores
|
||||
* values as `coefficient × 10^exponent` using `BigInt`. It avoids
|
||||
* every common binary floating-point pitfall — `Decimal.from('0.1').add(Decimal.from('0.2'))`
|
||||
* is exactly `0.3`.
|
||||
*
|
||||
* Instances are immutable (frozen) and all arithmetic returns a new
|
||||
* `Decimal`. The type carries two brand symbols so the type system
|
||||
* prevents accidental assignment from plain `number`, `string`, or
|
||||
* `bigint`.
|
||||
*
|
||||
* Create values via the companion object:
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { Decimal, RoundDirection } from '@stripe/apps-extensibility-sdk/stdlib';
|
||||
*
|
||||
* const price = Decimal.from('19.99');
|
||||
* const tax = price.mul(Decimal.from('0.0825'));
|
||||
* const total = price.add(tax);
|
||||
*
|
||||
* console.log(total.toFixed(2, 'half-up')); // "21.64"
|
||||
* console.log(JSON.stringify({ total })); // '{"total":"21.639175"}'
|
||||
* console.log(total.toFixed(2, 'half-even')); // "21.64"
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type Decimal = DecimalImpl & {
|
||||
readonly [__brand]: 'Decimal';
|
||||
readonly [__stripeType]: 'decimal';
|
||||
};
|
||||
/**
|
||||
* Check whether a value is a {@link Decimal} instance.
|
||||
*
|
||||
* @remarks
|
||||
* Use this instead of `instanceof` — the underlying class is not
|
||||
* publicly exported, so `instanceof` checks are not available to
|
||||
* consumers.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* if (isDecimal(value)) {
|
||||
* value.add(Decimal.from('1')); // value is Decimal
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function isDecimal(value: unknown): value is Decimal;
|
||||
/**
|
||||
* Companion object for creating {@link Decimal} instances.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const Decimal: {
|
||||
/**
|
||||
* Create a {@link Decimal} from a string, number, or bigint.
|
||||
*
|
||||
* @remarks
|
||||
* - **string**: Parsed as a decimal literal. Accepts an optional sign,
|
||||
* integer digits, an optional fractional part, and an optional `e`/`E`
|
||||
* exponent. Leading/trailing whitespace is trimmed.
|
||||
* - **number**: Must be finite. Converted via `Number.prototype.toString()`
|
||||
* then parsed, so `Decimal.from(0.1)` produces `"0.1"` (not the
|
||||
* 53-bit binary approximation).
|
||||
* - **bigint**: Treated as an integer with exponent 0.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1.23'); // string
|
||||
* Decimal.from(42); // number
|
||||
* Decimal.from(100n); // bigint
|
||||
* Decimal.from('1.5e3'); // scientific notation → 1500
|
||||
* ```
|
||||
*
|
||||
* @param value - The value to convert.
|
||||
* @returns A new frozen {@link Decimal} instance.
|
||||
* @throws {@link Error} if `value` is a non-finite number, an empty
|
||||
* string, or a string that does not match the decimal literal grammar.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
from(value: string | number | bigint): Decimal;
|
||||
/**
|
||||
* The {@link Decimal} value representing zero.
|
||||
*
|
||||
* @remarks
|
||||
* Pre-allocated singleton — prefer `Decimal.zero` over
|
||||
* `Decimal.from(0)` to avoid an unnecessary allocation.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
zero: Decimal;
|
||||
};
|
||||
export {};
|
||||
855
node_modules/stripe/cjs/Decimal.js
generated
vendored
Normal file
855
node_modules/stripe/cjs/Decimal.js
generated
vendored
Normal file
@@ -0,0 +1,855 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Decimal = exports.isDecimal = exports.DEFAULT_DIV_PRECISION = void 0;
|
||||
/**
|
||||
* Maps built-in preset names to their {@link DecimalRoundingOptions}.
|
||||
* Used internally by {@link DecimalImpl.round}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const ROUNDING_PRESETS = {
|
||||
'ubb-usage-count': { mode: 'significant-figures', value: 15 },
|
||||
'v1-api': { mode: 'decimal-places', value: 12 },
|
||||
};
|
||||
/**
|
||||
* The IEEE 754 decimal128 coefficient size (34 digits) — the recommended
|
||||
* precision for {@link DecimalImpl.div} when full precision is desired.
|
||||
*
|
||||
* @remarks
|
||||
* Pass this as the `precision` argument to `div()` when you want the
|
||||
* maximum available precision. Division requires explicit precision —
|
||||
* no invisible defaults in financial code.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Use the full decimal128 precision explicitly
|
||||
* a.div(b, DEFAULT_DIV_PRECISION, 'half-even');
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
exports.DEFAULT_DIV_PRECISION = 34;
|
||||
/**
|
||||
* Maximum number of digits in plain (non-exponential) notation produced
|
||||
* by {@link DecimalImpl.toString}. Values exceeding this threshold are
|
||||
* emitted in scientific notation (`1.23E+40`).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const PLAIN_NOTATION_DIGIT_LIMIT = 30;
|
||||
/**
|
||||
* Maximum absolute value for the internal exponent.
|
||||
*
|
||||
* @remarks
|
||||
* This bound also implicitly limits exponent differences used in
|
||||
* arithmetic (e.g., scaling by `10^exponentDiff`), preventing
|
||||
* astronomically large BigInt allocations that could hang or
|
||||
* exhaust the process.
|
||||
*
|
||||
* The chosen limit is intentionally conservative but still far beyond
|
||||
* any magnitude needed for typical financial or billing calculations.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const MAX_EXPONENT = 1000000;
|
||||
/**
|
||||
* Internal implementation of arbitrary-precision decimal arithmetic.
|
||||
*
|
||||
* @remarks
|
||||
* Represents a decimal value as `coefficient × 10^exponent` using
|
||||
* native `BigInt` for the coefficient, giving unlimited precision with
|
||||
* no rounding on construction. Instances are always
|
||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | frozen}
|
||||
* and all arithmetic produces new instances.
|
||||
*
|
||||
* This class is **not** exported directly — consumers interact with
|
||||
* the branded {@link Decimal} type and the {@link Decimal | Decimal companion object}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DecimalImpl {
|
||||
/**
|
||||
* Construct and normalise a decimal value.
|
||||
*
|
||||
* @param coefficient - The unscaled integer value.
|
||||
* @param exponent - The power-of-ten scale factor.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(coefficient, exponent) {
|
||||
const [normalizedCoef, normalizedExp] = DecimalImpl.normalize(coefficient, exponent);
|
||||
this._coefficient = normalizedCoef;
|
||||
this._exponent = normalizedExp;
|
||||
Object.freeze(this);
|
||||
}
|
||||
/**
|
||||
* Strip trailing zeros from `coefficient`, incrementing `exponent`
|
||||
* for each zero removed. Zero always normalises to `(0n, 0)`.
|
||||
*
|
||||
* @param coefficient - Raw coefficient before normalisation.
|
||||
* @param exponent - Raw exponent before normalisation.
|
||||
* @returns A `[coefficient, exponent]` tuple with trailing zeros removed.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static normalize(coefficient, exponent) {
|
||||
if (coefficient === 0n) {
|
||||
return [0n, 0];
|
||||
}
|
||||
let coef = coefficient;
|
||||
let exp = exponent;
|
||||
while (coef !== 0n && coef % 10n === 0n) {
|
||||
coef /= 10n;
|
||||
exp += 1;
|
||||
}
|
||||
return [coef, exp];
|
||||
}
|
||||
/**
|
||||
* Apply rounding to the result of an integer division.
|
||||
*
|
||||
* @remarks
|
||||
* BigInt division truncates toward zero. This helper inspects the
|
||||
* `remainder` to decide whether to adjust the truncated `quotient`
|
||||
* by ±1 according to the chosen {@link RoundDirection}.
|
||||
*
|
||||
* The rounding direction is derived from the signs of `remainder`
|
||||
* and `divisor`: when they agree the exact fractional part is
|
||||
* positive (the truncation point is below the true value, so +1
|
||||
* rounds to nearest); when they disagree the fractional part is
|
||||
* negative (−1 rounds to nearest).
|
||||
*
|
||||
* @param quotient - Truncated integer quotient (`dividend / divisor`).
|
||||
* @param remainder - Division remainder (`dividend % divisor`).
|
||||
* @param divisor - The divisor used in the division.
|
||||
* @param direction - The rounding strategy to apply.
|
||||
* @returns The rounded quotient.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static roundDivision(quotient, remainder, divisor, direction) {
|
||||
if (remainder === 0n) {
|
||||
return quotient;
|
||||
}
|
||||
// 'round-down': truncate toward zero — BigInt division already does this.
|
||||
if (direction === 'round-down') {
|
||||
return quotient;
|
||||
}
|
||||
// The sign of remainder/divisor tells us which side of the truncation
|
||||
// point the exact value lies on.
|
||||
// Same sign → fractional part is positive (exact value > quotient) → +1 adjusts upward.
|
||||
// Opposite sign → fractional part is negative (exact value < quotient) → -1 adjusts downward.
|
||||
const roundDir = remainder > 0n === divisor > 0n ? 1n : -1n;
|
||||
// 'round-up': away from zero whenever there is any remainder.
|
||||
if (direction === 'round-up') {
|
||||
return quotient + roundDir;
|
||||
}
|
||||
// 'ceil': toward positive infinity.
|
||||
// If the fractional part is positive (roundDir === 1n), round up.
|
||||
// If the fractional part is negative (roundDir === -1n), truncation already went toward +∞.
|
||||
if (direction === 'ceil') {
|
||||
return roundDir === 1n ? quotient + 1n : quotient;
|
||||
}
|
||||
// 'floor': toward negative infinity.
|
||||
// If the fractional part is negative (roundDir === -1n), round down.
|
||||
// If the fractional part is positive (roundDir === 1n), truncation already went toward -∞.
|
||||
if (direction === 'floor') {
|
||||
return roundDir === -1n ? quotient - 1n : quotient;
|
||||
}
|
||||
// For the half-* modes we need to compare the remainder to exactly half the divisor.
|
||||
const absRemainder = remainder < 0n ? -remainder : remainder;
|
||||
const absDivisor = divisor < 0n ? -divisor : divisor;
|
||||
const doubled = absRemainder * 2n;
|
||||
let cmp;
|
||||
if (doubled === absDivisor) {
|
||||
cmp = 0;
|
||||
}
|
||||
else if (doubled < absDivisor) {
|
||||
cmp = -1;
|
||||
}
|
||||
else {
|
||||
cmp = 1;
|
||||
}
|
||||
if (cmp < 0) {
|
||||
// Less than half — truncation is already the nearest value.
|
||||
return quotient;
|
||||
}
|
||||
if (cmp > 0) {
|
||||
// More than half — round to nearest (away from truncation point).
|
||||
return quotient + roundDir;
|
||||
}
|
||||
// Exactly half — tie-breaking depends on the chosen mode.
|
||||
if (direction === 'half-up') {
|
||||
// Round away from zero.
|
||||
return quotient + roundDir;
|
||||
}
|
||||
if (direction === 'half-down') {
|
||||
// Round toward zero — stay at the truncated quotient.
|
||||
return quotient;
|
||||
}
|
||||
// HALF_EVEN: round to nearest even.
|
||||
if (quotient % 2n === 0n) {
|
||||
// Already even — stay at truncation.
|
||||
return quotient;
|
||||
}
|
||||
else {
|
||||
// Odd — adjust to make even.
|
||||
return quotient + roundDir;
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Arithmetic
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Return the sum of this value and `other`.
|
||||
*
|
||||
* @param other - The addend.
|
||||
* @returns A new {@link Decimal} equal to `this + other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
add(other) {
|
||||
const otherImpl = other;
|
||||
// Align exponents — use the smaller (more precision) exponent as target.
|
||||
if (this._exponent === otherImpl._exponent) {
|
||||
return new DecimalImpl(this._coefficient + otherImpl._coefficient, this._exponent);
|
||||
}
|
||||
if (this._exponent < otherImpl._exponent) {
|
||||
const scale = 10n ** BigInt(otherImpl._exponent - this._exponent);
|
||||
return new DecimalImpl(this._coefficient + otherImpl._coefficient * scale, this._exponent);
|
||||
}
|
||||
else {
|
||||
const scale = 10n ** BigInt(this._exponent - otherImpl._exponent);
|
||||
return new DecimalImpl(this._coefficient * scale + otherImpl._coefficient, otherImpl._exponent);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the difference of this value and `other`.
|
||||
*
|
||||
* @param other - The subtrahend.
|
||||
* @returns A new {@link Decimal} equal to `this - other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
sub(other) {
|
||||
const otherImpl = other;
|
||||
if (this._exponent === otherImpl._exponent) {
|
||||
return new DecimalImpl(this._coefficient - otherImpl._coefficient, this._exponent);
|
||||
}
|
||||
if (this._exponent < otherImpl._exponent) {
|
||||
const scale = 10n ** BigInt(otherImpl._exponent - this._exponent);
|
||||
return new DecimalImpl(this._coefficient - otherImpl._coefficient * scale, this._exponent);
|
||||
}
|
||||
else {
|
||||
const scale = 10n ** BigInt(this._exponent - otherImpl._exponent);
|
||||
return new DecimalImpl(this._coefficient * scale - otherImpl._coefficient, otherImpl._exponent);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the product of this value and `other`.
|
||||
*
|
||||
* @param other - The multiplicand.
|
||||
* @returns A new {@link Decimal} equal to `this × other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
mul(other) {
|
||||
const otherImpl = other;
|
||||
return new DecimalImpl(this._coefficient * otherImpl._coefficient, this._exponent + otherImpl._exponent);
|
||||
}
|
||||
/**
|
||||
* Return the quotient of this value divided by `other`.
|
||||
*
|
||||
* @remarks
|
||||
* Division scales the dividend to produce `precision` decimal digits
|
||||
* in the result, then applies integer division and rounds the
|
||||
* remainder according to `direction`.
|
||||
*
|
||||
* Division requires explicit rounding control — no invisible defaults
|
||||
* in financial code. For full precision use {@link DEFAULT_DIV_PRECISION}
|
||||
* (34, matching the IEEE 754 decimal128 coefficient size).
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1').div(Decimal.from('3'), 5, 'half-up'); // "0.33333"
|
||||
* Decimal.from('5').div(Decimal.from('2'), 0, 'half-up'); // "3"
|
||||
* Decimal.from('5').div(Decimal.from('2'), 0, 'half-even'); // "2"
|
||||
* ```
|
||||
*
|
||||
* @param other - The divisor. Must not be zero.
|
||||
* @param precision - Maximum number of decimal digits in the result.
|
||||
* @param direction - How to round when the exact quotient cannot
|
||||
* be represented at the requested precision.
|
||||
* @returns A new {@link Decimal} equal to `this ÷ other`, rounded to
|
||||
* `precision` decimal places.
|
||||
* @throws {@link Error} if `other` is zero.
|
||||
* @throws {@link Error} if `precision` is negative or non-integer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
div(other, precision, direction) {
|
||||
if (precision < 0 || !Number.isInteger(precision)) {
|
||||
throw new Error('precision must be a non-negative integer');
|
||||
}
|
||||
const otherImpl = other;
|
||||
if (otherImpl._coefficient === 0n) {
|
||||
throw new Error('Division by zero');
|
||||
}
|
||||
// result_coefficient = this.coefficient × 10^(thisExp - otherExp + precision) / other.coefficient
|
||||
// result_exponent = -precision
|
||||
const scale = this._exponent - otherImpl._exponent + precision;
|
||||
let quotient;
|
||||
let remainder;
|
||||
let roundingDivisor;
|
||||
if (scale >= 0) {
|
||||
const scaledDividend = this._coefficient * 10n ** BigInt(scale);
|
||||
quotient = scaledDividend / otherImpl._coefficient;
|
||||
remainder = scaledDividend % otherImpl._coefficient;
|
||||
roundingDivisor = otherImpl._coefficient;
|
||||
}
|
||||
else {
|
||||
// Negative scale: shift the power onto the divisor side to avoid
|
||||
// BigInt exponentiation with a negative exponent (which throws).
|
||||
const scaledDivisor = otherImpl._coefficient * 10n ** BigInt(-scale);
|
||||
quotient = this._coefficient / scaledDivisor;
|
||||
remainder = this._coefficient % scaledDivisor;
|
||||
roundingDivisor = scaledDivisor;
|
||||
}
|
||||
const roundedQuotient = DecimalImpl.roundDivision(quotient, remainder, roundingDivisor, direction);
|
||||
return new DecimalImpl(roundedQuotient, -precision);
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Comparison
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Three-way comparison of this value with `other`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const a = Decimal.from('1.5');
|
||||
* const b = Decimal.from('2');
|
||||
* a.cmp(b); // -1
|
||||
* b.cmp(a); // 1
|
||||
* a.cmp(a); // 0
|
||||
* ```
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `-1` if `this \< other`, `0` if equal, `1` if `this \> other`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
cmp(other) {
|
||||
const otherImpl = other;
|
||||
if (this._exponent === otherImpl._exponent) {
|
||||
if (this._coefficient < otherImpl._coefficient)
|
||||
return -1;
|
||||
if (this._coefficient > otherImpl._coefficient)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
if (this._exponent < otherImpl._exponent) {
|
||||
// this has smaller exponent — scale other's coefficient to match.
|
||||
const scale = 10n ** BigInt(otherImpl._exponent - this._exponent);
|
||||
const scaledOther = otherImpl._coefficient * scale;
|
||||
if (this._coefficient < scaledOther)
|
||||
return -1;
|
||||
if (this._coefficient > scaledOther)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
// other has smaller exponent — scale this's coefficient to match.
|
||||
const scale = 10n ** BigInt(this._exponent - otherImpl._exponent);
|
||||
const scaledThis = this._coefficient * scale;
|
||||
if (scaledThis < otherImpl._coefficient)
|
||||
return -1;
|
||||
if (scaledThis > otherImpl._coefficient)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is numerically equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this === other` in value, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
eq(other) {
|
||||
return this.cmp(other) === 0;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is strictly less than `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this \< other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
lt(other) {
|
||||
return this.cmp(other) === -1;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is less than or equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this ≤ other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
lte(other) {
|
||||
return this.cmp(other) <= 0;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is strictly greater than `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this \> other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
gt(other) {
|
||||
return this.cmp(other) === 1;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is greater than or equal to `other`.
|
||||
*
|
||||
* @param other - The value to compare against.
|
||||
* @returns `true` if `this ≥ other`, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
gte(other) {
|
||||
return this.cmp(other) >= 0;
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Predicates
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Return `true` if this value is exactly zero.
|
||||
*
|
||||
* @returns `true` if the value is zero, `false` otherwise.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isZero() {
|
||||
return this._coefficient === 0n;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is strictly less than zero.
|
||||
*
|
||||
* @returns `true` if negative, `false` if zero or positive.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isNegative() {
|
||||
return this._coefficient < 0n;
|
||||
}
|
||||
/**
|
||||
* Return `true` if this value is strictly greater than zero.
|
||||
*
|
||||
* @returns `true` if positive, `false` if zero or negative.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
isPositive() {
|
||||
return this._coefficient > 0n;
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Unary operations
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Return the additive inverse of this value.
|
||||
*
|
||||
* @returns A new {@link Decimal} equal to `-this`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
neg() {
|
||||
return new DecimalImpl(-this._coefficient, this._exponent);
|
||||
}
|
||||
/**
|
||||
* Return the absolute value.
|
||||
*
|
||||
* @returns A new {@link Decimal} equal to `|this|`. If this value is
|
||||
* already non-negative, returns `this` (no allocation).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
abs() {
|
||||
if (this._coefficient < 0n) {
|
||||
return new DecimalImpl(-this._coefficient, this._exponent);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Rounding
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Round this value to a specified precision.
|
||||
*
|
||||
* @remarks
|
||||
* **Rounding directions** (IEEE 754-2019 §4.3):
|
||||
*
|
||||
* | Direction | Behavior |
|
||||
* | -------------- | ---------------------------------------------- |
|
||||
* | `'ceil'` | 1.1→2, -1.1→-1, 1.0→1 (toward +∞) |
|
||||
* | `'floor'` | 1.9→1, -1.1→-2, 1.0→1 (toward -∞) |
|
||||
* | `'round-down'` | 1.9→1, -1.9→-1 (toward zero / truncate) |
|
||||
* | `'round-up'` | 1.1→2, -1.1→-2 (away from zero) |
|
||||
* | `'half-up'` | 0.5→1, 1.5→2, -0.5→-1 (ties away from zero) |
|
||||
* | `'half-down'` | 0.5→0, 1.5→1, -0.5→0 (ties toward zero) |
|
||||
* | `'half-even'` | 0.5→0, 1.5→2, 2.5→2, 3.5→4 (ties to even) |
|
||||
*
|
||||
* **Precision** is specified as a {@link DecimalRoundingOptions} object
|
||||
* or a preset name from {@link DecimalRoundingPresets}:
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Using a preset
|
||||
* amount.round('half-even', 'v1-api');
|
||||
*
|
||||
* // Using explicit options
|
||||
* amount.round('half-even', { mode: 'decimal-places', value: 2 });
|
||||
* amount.round('half-up', { mode: 'significant-figures', value: 4 });
|
||||
* ```
|
||||
*
|
||||
* @param direction - How to round.
|
||||
* @param options - A {@link DecimalRoundingOptions} object or key of {@link DecimalRoundingPresets}.
|
||||
* @returns A new {@link Decimal} rounded to the specified precision.
|
||||
* @throws {@link Error} if `options.value` is negative or non-integer.
|
||||
* @throws {@link Error} if the preset name is not recognized.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
round(direction, options) {
|
||||
const resolved = typeof options === 'string'
|
||||
? // Declaration merging allows consumers to add keys at compile time, but
|
||||
// ROUNDING_PRESETS only knows about built-in keys at runtime. The double
|
||||
// cast through `unknown` is intentional: we want an undefined-safe lookup
|
||||
// so the runtime guard below can produce a clear error for unrecognised
|
||||
// (e.g. declaration-merged) preset names that were not also added to
|
||||
// ROUNDING_PRESETS.
|
||||
ROUNDING_PRESETS[options]
|
||||
: options;
|
||||
if (resolved === undefined) {
|
||||
throw new Error(`Unknown rounding preset: "${options}"`);
|
||||
}
|
||||
if (resolved.value < 0 || !Number.isInteger(resolved.value)) {
|
||||
throw new Error('DecimalRoundingOptions.value must be a non-negative integer');
|
||||
}
|
||||
if (resolved.mode === 'decimal-places') {
|
||||
// Reuse toFixed logic: round to resolved.value decimal places then re-parse.
|
||||
const fixed = this.toFixed(resolved.value, direction);
|
||||
return exports.Decimal.from(fixed);
|
||||
}
|
||||
// significant-figures: round to resolved.value total significant digits.
|
||||
if (this._coefficient === 0n) {
|
||||
return this;
|
||||
}
|
||||
const coeffStr = this._coefficient < 0n
|
||||
? (-this._coefficient).toString()
|
||||
: this._coefficient.toString();
|
||||
const currentSigFigs = coeffStr.length;
|
||||
if (resolved.value === 0) {
|
||||
// 0 significant figures is a degenerate case — return zero.
|
||||
return exports.Decimal.zero;
|
||||
}
|
||||
if (currentSigFigs <= resolved.value) {
|
||||
// Already at or below requested precision — no rounding needed.
|
||||
return this;
|
||||
}
|
||||
// We need to reduce the number of significant figures.
|
||||
// The number of digits to drop from the coefficient:
|
||||
const digitsToTrim = currentSigFigs - resolved.value;
|
||||
const divisor = 10n ** BigInt(digitsToTrim);
|
||||
const quotient = this._coefficient / divisor;
|
||||
const remainder = this._coefficient % divisor;
|
||||
const rounded = DecimalImpl.roundDivision(quotient, remainder, divisor, direction);
|
||||
// The new exponent shifts to account for trimmed digits.
|
||||
return new DecimalImpl(rounded, this._exponent + digitsToTrim);
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// Conversion / serialisation
|
||||
// -------------------------------------------------------------------
|
||||
/**
|
||||
* Return a human-readable string representation.
|
||||
*
|
||||
* @remarks
|
||||
* Plain notation for values whose digit count is at most 30, and
|
||||
* scientific notation (`1.23E+40`) for larger values. Trailing zeros
|
||||
* are never present because the internal representation is normalised.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toString() {
|
||||
if (this._coefficient === 0n) {
|
||||
return '0';
|
||||
}
|
||||
const coeffStr = this._coefficient.toString();
|
||||
const isNeg = coeffStr.startsWith('-');
|
||||
const absCoeffStr = isNeg ? coeffStr.slice(1) : coeffStr;
|
||||
if (this._exponent < 0) {
|
||||
const decimalPlaces = -this._exponent;
|
||||
// Guard against unbounded string allocation for extreme negative
|
||||
// exponents (e.g. 1e-1000000 would otherwise produce a million-char
|
||||
// string of leading zeros). Switch to scientific notation when the
|
||||
// number of leading zeros alone exceeds the digit limit. Normal
|
||||
// fractional values (e.g. 34-digit division results) pass through.
|
||||
const leadingZeroCount = decimalPlaces >= absCoeffStr.length
|
||||
? decimalPlaces - absCoeffStr.length
|
||||
: 0;
|
||||
if (leadingZeroCount > PLAIN_NOTATION_DIGIT_LIMIT) {
|
||||
if (absCoeffStr.length === 1) {
|
||||
return `${coeffStr}E${String(this._exponent)}`;
|
||||
}
|
||||
const intPart = absCoeffStr[0] ?? '';
|
||||
const fracPart = absCoeffStr.slice(1);
|
||||
const adjustedExp = this._exponent + absCoeffStr.length - 1;
|
||||
return `${isNeg ? '-' : ''}${intPart}.${fracPart}E${String(adjustedExp)}`;
|
||||
}
|
||||
if (decimalPlaces >= absCoeffStr.length) {
|
||||
const leadingZeros = '0'.repeat(decimalPlaces - absCoeffStr.length);
|
||||
return `${isNeg ? '-' : ''}0.${leadingZeros}${absCoeffStr}`;
|
||||
}
|
||||
else {
|
||||
const integerPart = absCoeffStr.slice(0, absCoeffStr.length - decimalPlaces);
|
||||
const fractionalPart = absCoeffStr.slice(absCoeffStr.length - decimalPlaces);
|
||||
return `${isNeg ? '-' : ''}${integerPart}.${fractionalPart}`;
|
||||
}
|
||||
}
|
||||
const plainLength = absCoeffStr.length + this._exponent;
|
||||
if (plainLength <= PLAIN_NOTATION_DIGIT_LIMIT) {
|
||||
if (this._exponent === 0) {
|
||||
return coeffStr;
|
||||
}
|
||||
const trailingZeros = '0'.repeat(this._exponent);
|
||||
return `${isNeg ? '-' : ''}${absCoeffStr}${trailingZeros}`;
|
||||
}
|
||||
else {
|
||||
if (absCoeffStr.length === 1) {
|
||||
return `${coeffStr}E+${String(this._exponent)}`;
|
||||
}
|
||||
const integerPart = absCoeffStr[0] ?? '';
|
||||
const fractionalPart = absCoeffStr.slice(1);
|
||||
const adjustedExponent = this._exponent + absCoeffStr.length - 1;
|
||||
return `${isNeg ? '-' : ''}${integerPart}.${fractionalPart}E+${String(adjustedExponent)}`;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the JSON-serialisable representation.
|
||||
*
|
||||
* @remarks
|
||||
* Returns a plain string matching the Stripe API convention where
|
||||
* decimal values are serialised as strings in JSON. Called
|
||||
* automatically by `JSON.stringify`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toJSON() {
|
||||
return this.toString();
|
||||
}
|
||||
/**
|
||||
* Convert to a JavaScript `number`.
|
||||
*
|
||||
* @remarks
|
||||
* This is an explicit, intentionally lossy conversion. Use it only
|
||||
* when you need a numeric value for display or interop with APIs
|
||||
* that require `number`. Prefer {@link Decimal.toString | toString}
|
||||
* or {@link Decimal.toFixed | toFixed} for lossless output.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toNumber() {
|
||||
return Number(this.toString());
|
||||
}
|
||||
/**
|
||||
* Format this value as a fixed-point string with exactly
|
||||
* `decimalPlaces` digits after the decimal point.
|
||||
*
|
||||
* @remarks
|
||||
* Values are rounded according to `direction` when the internal
|
||||
* precision exceeds the requested number of decimal places.
|
||||
* The rounding direction is always required — no invisible defaults
|
||||
* in financial code.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1.235').toFixed(2, 'half-up'); // "1.24"
|
||||
* Decimal.from('1.225').toFixed(2, 'half-even'); // "1.22"
|
||||
* Decimal.from('42').toFixed(3, 'half-up'); // "42.000"
|
||||
* ```
|
||||
*
|
||||
* @param decimalPlaces - Number of digits after the decimal point.
|
||||
* Must be a non-negative integer.
|
||||
* @param direction - How to round when truncating excess digits.
|
||||
* @returns A string with exactly `decimalPlaces` fractional digits.
|
||||
* @throws {@link Error} if `decimalPlaces` is negative or non-integer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
toFixed(decimalPlaces, direction) {
|
||||
if (decimalPlaces < 0 || !Number.isInteger(decimalPlaces)) {
|
||||
throw new Error('decimalPlaces must be a non-negative integer');
|
||||
}
|
||||
const formatFixed = (coef) => {
|
||||
const coeffStr = coef.toString();
|
||||
const isNeg = coeffStr.startsWith('-');
|
||||
const absCoeffStr = isNeg ? coeffStr.slice(1) : coeffStr;
|
||||
if (decimalPlaces === 0) {
|
||||
return coeffStr;
|
||||
}
|
||||
if (decimalPlaces >= absCoeffStr.length) {
|
||||
const leadingZeros = '0'.repeat(decimalPlaces - absCoeffStr.length);
|
||||
return `${isNeg ? '-' : ''}0.${leadingZeros}${absCoeffStr}`;
|
||||
}
|
||||
else {
|
||||
const integerPart = absCoeffStr.slice(0, absCoeffStr.length - decimalPlaces);
|
||||
const fractionalPart = absCoeffStr.slice(absCoeffStr.length - decimalPlaces);
|
||||
return `${isNeg ? '-' : ''}${integerPart}.${fractionalPart}`;
|
||||
}
|
||||
};
|
||||
const targetExponent = -decimalPlaces;
|
||||
if (this._exponent === targetExponent) {
|
||||
return formatFixed(this._coefficient);
|
||||
}
|
||||
if (this._exponent < targetExponent) {
|
||||
// Need to reduce precision — round the excess digits.
|
||||
const scaleDiff = targetExponent - this._exponent;
|
||||
const divisor = 10n ** BigInt(scaleDiff);
|
||||
const quotient = this._coefficient / divisor;
|
||||
const remainder = this._coefficient % divisor;
|
||||
const rounded = DecimalImpl.roundDivision(quotient, remainder, divisor, direction);
|
||||
return formatFixed(rounded);
|
||||
}
|
||||
else {
|
||||
// Need to increase precision — pad with trailing zeros.
|
||||
const scaleDiff = this._exponent - targetExponent;
|
||||
const scaled = this._coefficient * 10n ** BigInt(scaleDiff);
|
||||
return formatFixed(scaled);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return a string primitive when the runtime coerces the value.
|
||||
*
|
||||
* @remarks
|
||||
* Deliberately returns a `string` (not a `number`) to discourage
|
||||
* silent precision loss through implicit arithmetic coercion.
|
||||
* When used in a numeric context (for example, `+myDecimal`), the
|
||||
* JavaScript runtime will first call this method and then coerce
|
||||
* the resulting string to a `number`, which may lose precision.
|
||||
* Callers should prefer the explicit
|
||||
* {@link Decimal.toNumber | toNumber} method when an IEEE 754
|
||||
* `number` is required.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
valueOf() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check whether a value is a {@link Decimal} instance.
|
||||
*
|
||||
* @remarks
|
||||
* Use this instead of `instanceof` — the underlying class is not
|
||||
* publicly exported, so `instanceof` checks are not available to
|
||||
* consumers.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* if (isDecimal(value)) {
|
||||
* value.add(Decimal.from('1')); // value is Decimal
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function isDecimal(value) {
|
||||
return value instanceof DecimalImpl;
|
||||
}
|
||||
exports.isDecimal = isDecimal;
|
||||
/**
|
||||
* Companion object for creating {@link Decimal} instances.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
exports.Decimal = {
|
||||
/**
|
||||
* Create a {@link Decimal} from a string, number, or bigint.
|
||||
*
|
||||
* @remarks
|
||||
* - **string**: Parsed as a decimal literal. Accepts an optional sign,
|
||||
* integer digits, an optional fractional part, and an optional `e`/`E`
|
||||
* exponent. Leading/trailing whitespace is trimmed.
|
||||
* - **number**: Must be finite. Converted via `Number.prototype.toString()`
|
||||
* then parsed, so `Decimal.from(0.1)` produces `"0.1"` (not the
|
||||
* 53-bit binary approximation).
|
||||
* - **bigint**: Treated as an integer with exponent 0.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Decimal.from('1.23'); // string
|
||||
* Decimal.from(42); // number
|
||||
* Decimal.from(100n); // bigint
|
||||
* Decimal.from('1.5e3'); // scientific notation → 1500
|
||||
* ```
|
||||
*
|
||||
* @param value - The value to convert.
|
||||
* @returns A new frozen {@link Decimal} instance.
|
||||
* @throws {@link Error} if `value` is a non-finite number, an empty
|
||||
* string, or a string that does not match the decimal literal grammar.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
from(value) {
|
||||
if (typeof value === 'bigint') {
|
||||
return new DecimalImpl(value, 0);
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
if (!Number.isFinite(value)) {
|
||||
throw new Error('Number must be finite');
|
||||
}
|
||||
return exports.Decimal.from(value.toString());
|
||||
}
|
||||
// Parse string.
|
||||
const trimmed = value.trim();
|
||||
if (trimmed === '') {
|
||||
throw new Error('Cannot parse empty string as Decimal');
|
||||
}
|
||||
// Match: optional sign, integer digits, optional fraction, optional exponent.
|
||||
const match = /^([+-]?)(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(trimmed);
|
||||
if (!match) {
|
||||
throw new Error(`Invalid decimal string: ${value}`);
|
||||
}
|
||||
const sign = match[1] === '-' ? -1n : 1n;
|
||||
const integerPart = match[2] ?? '';
|
||||
const fractionalPart = match[3] ?? '';
|
||||
const exponentPart = match[4] ? Number(match[4]) : 0;
|
||||
if (!Number.isSafeInteger(exponentPart) ||
|
||||
exponentPart > MAX_EXPONENT ||
|
||||
exponentPart < -MAX_EXPONENT) {
|
||||
throw new Error(`Exponent out of range: ${String(match[4])} exceeds safe integer bounds`);
|
||||
}
|
||||
const coefficientStr = integerPart + fractionalPart;
|
||||
const coefficient = sign * BigInt(coefficientStr);
|
||||
const exponent = exponentPart - fractionalPart.length;
|
||||
if (!Number.isSafeInteger(exponent) ||
|
||||
exponent > MAX_EXPONENT ||
|
||||
exponent < -MAX_EXPONENT) {
|
||||
throw new Error(`Computed exponent out of range: ${String(exponent)} exceeds safe integer bounds`);
|
||||
}
|
||||
return new DecimalImpl(coefficient, exponent);
|
||||
},
|
||||
/**
|
||||
* The {@link Decimal} value representing zero.
|
||||
*
|
||||
* @remarks
|
||||
* Pre-allocated singleton — prefer `Decimal.zero` over
|
||||
* `Decimal.from(0)` to avoid an unnecessary allocation.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
zero: new DecimalImpl(0n, 0),
|
||||
};
|
||||
//# sourceMappingURL=Decimal.js.map
|
||||
1
node_modules/stripe/cjs/Decimal.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/Decimal.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
163
node_modules/stripe/cjs/Error.d.ts
generated
vendored
Normal file
163
node_modules/stripe/cjs/Error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import { HttpClientResponseError } from './RequestSender.js';
|
||||
import { RawErrorType, StripeRawError } from './Types.js';
|
||||
export declare const generateV1Error: (rawStripeError: StripeRawError) => StripeError;
|
||||
export declare const generateOAuthError: (rawStripeError: StripeRawError) => StripeError;
|
||||
export declare const generateV2Error: (rawStripeError: StripeRawError) => StripeError;
|
||||
/**
|
||||
* StripeError is the base error from which all other more specific Stripe errors derive.
|
||||
* Specifically for errors returned from Stripe's REST API.
|
||||
*/
|
||||
export declare class StripeError extends Error {
|
||||
readonly message: string;
|
||||
readonly userMessage?: string;
|
||||
readonly type: string;
|
||||
readonly raw: unknown;
|
||||
readonly rawType?: RawErrorType;
|
||||
readonly headers?: {
|
||||
[header: string]: string;
|
||||
};
|
||||
readonly requestId?: string;
|
||||
readonly code?: string;
|
||||
readonly doc_url?: string;
|
||||
readonly param?: string;
|
||||
readonly detail?: string | Error | HttpClientResponseError;
|
||||
readonly statusCode?: number;
|
||||
readonly charge?: string;
|
||||
readonly decline_code?: string;
|
||||
readonly payment_method_type?: string;
|
||||
readonly payment_intent?: any;
|
||||
readonly payment_method?: any;
|
||||
readonly setup_intent?: any;
|
||||
readonly source?: any;
|
||||
constructor(raw?: StripeRawError, type?: string | null);
|
||||
/**
|
||||
* Helper factory which takes raw stripe errors and outputs wrapping instances
|
||||
*/
|
||||
static generate: (rawStripeError: StripeRawError) => StripeError;
|
||||
}
|
||||
/**
|
||||
* CardError is raised when a user enters a card that can't be charged for
|
||||
* some reason.
|
||||
*/
|
||||
export declare class StripeCardError extends StripeError {
|
||||
readonly decline_code: string;
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* InvalidRequestError is raised when a request is initiated with invalid
|
||||
* parameters.
|
||||
*/
|
||||
export declare class StripeInvalidRequestError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* APIError is a generic error that may be raised in cases where none of the
|
||||
* other named errors cover the problem. It could also be raised in the case
|
||||
* that a new error has been introduced in the API, but this version of the
|
||||
* Node.JS SDK doesn't know how to handle it.
|
||||
*/
|
||||
export declare class StripeAPIError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* AuthenticationError is raised when invalid credentials are used to connect
|
||||
* to Stripe's servers.
|
||||
*/
|
||||
export declare class StripeAuthenticationError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* PermissionError is raised in cases where access was attempted on a resource
|
||||
* that wasn't allowed.
|
||||
*/
|
||||
export declare class StripePermissionError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* RateLimitError is raised in cases where an account is putting too much load
|
||||
* on Stripe's API servers (usually by performing too many requests). Please
|
||||
* back off on request rate.
|
||||
*/
|
||||
export declare class StripeRateLimitError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* StripeConnectionError is raised in the event that the SDK can't connect to
|
||||
* Stripe's servers. That can be for a variety of different reasons from a
|
||||
* downed network to a bad TLS certificate.
|
||||
*/
|
||||
export declare class StripeConnectionError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* SignatureVerificationError is raised when the signature verification for a
|
||||
* webhook fails
|
||||
*/
|
||||
export declare class StripeSignatureVerificationError extends StripeError {
|
||||
header: string | Uint8Array;
|
||||
payload: string | Uint8Array;
|
||||
constructor(header: string | Uint8Array, payload: string | Uint8Array, raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* IdempotencyError is raised in cases where an idempotency key was used
|
||||
* improperly.
|
||||
*/
|
||||
export declare class StripeIdempotencyError extends StripeError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* StripeOAuthError is the base error for OAuth-specific errors.
|
||||
*/
|
||||
export declare class StripeOAuthError extends StripeError {
|
||||
constructor(raw?: StripeRawError, type?: string);
|
||||
}
|
||||
/**
|
||||
* InvalidGrantError is raised when a specified code doesn't exist, is
|
||||
* expired, has been used, or doesn't belong to you; a refresh token doesn't
|
||||
* exist, or doesn't belong to you; or if an API key's mode (live or test)
|
||||
* doesn't match the mode of a code or refresh token.
|
||||
*/
|
||||
export declare class StripeInvalidGrantError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* InvalidClientError is raised when the client_id does not belong to you,
|
||||
* or an API key is required but not provided.
|
||||
*/
|
||||
export declare class StripeInvalidClientError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* OAuthInvalidRequestError is raised when a required parameter is missing,
|
||||
* or an unsupported parameter or value is provided in the OAuth request.
|
||||
*/
|
||||
export declare class StripeOAuthInvalidRequestError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* InvalidScopeError is raised when an invalid scope is provided in the
|
||||
* OAuth request.
|
||||
*/
|
||||
export declare class StripeInvalidScopeError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* UnsupportedGrantTypeError is raised when an unsupported grant_type is
|
||||
* provided in the OAuth request.
|
||||
*/
|
||||
export declare class StripeUnsupportedGrantTypeError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
/**
|
||||
* UnsupportedResponseTypeError is raised when an unsupported response_type
|
||||
* is provided in the OAuth request.
|
||||
*/
|
||||
export declare class StripeUnsupportedResponseTypeError extends StripeOAuthError {
|
||||
constructor(raw?: StripeRawError);
|
||||
}
|
||||
export declare class RateLimitError extends StripeError {
|
||||
constructor(rawStripeError?: StripeRawError);
|
||||
}
|
||||
export declare class TemporarySessionExpiredError extends StripeError {
|
||||
constructor(rawStripeError?: StripeRawError);
|
||||
}
|
||||
286
node_modules/stripe/cjs/Error.js
generated
vendored
Normal file
286
node_modules/stripe/cjs/Error.js
generated
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
"use strict";
|
||||
/* eslint-disable camelcase */
|
||||
/* eslint-disable no-warning-comments */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TemporarySessionExpiredError = exports.RateLimitError = exports.StripeUnsupportedResponseTypeError = exports.StripeUnsupportedGrantTypeError = exports.StripeInvalidScopeError = exports.StripeOAuthInvalidRequestError = exports.StripeInvalidClientError = exports.StripeInvalidGrantError = exports.StripeOAuthError = exports.StripeIdempotencyError = exports.StripeSignatureVerificationError = exports.StripeConnectionError = exports.StripeRateLimitError = exports.StripePermissionError = exports.StripeAuthenticationError = exports.StripeAPIError = exports.StripeInvalidRequestError = exports.StripeCardError = exports.StripeError = exports.generateV2Error = exports.generateOAuthError = exports.generateV1Error = void 0;
|
||||
const generateV1Error = (rawStripeError) => {
|
||||
const statusCode = rawStripeError.statusCode;
|
||||
if (statusCode === 429 ||
|
||||
(statusCode === 400 && rawStripeError.code === 'rate_limit')) {
|
||||
return new StripeRateLimitError(rawStripeError);
|
||||
}
|
||||
if (statusCode === 400 || statusCode === 404) {
|
||||
if (rawStripeError.type === 'idempotency_error') {
|
||||
return new StripeIdempotencyError(rawStripeError);
|
||||
}
|
||||
return new StripeInvalidRequestError(rawStripeError);
|
||||
}
|
||||
if (statusCode === 401) {
|
||||
return new StripeAuthenticationError(rawStripeError);
|
||||
}
|
||||
if (statusCode === 402) {
|
||||
return new StripeCardError(rawStripeError);
|
||||
}
|
||||
if (statusCode === 403) {
|
||||
return new StripePermissionError(rawStripeError);
|
||||
}
|
||||
return new StripeAPIError(rawStripeError);
|
||||
};
|
||||
exports.generateV1Error = generateV1Error;
|
||||
const generateOAuthError = (rawStripeError) => {
|
||||
const oauthType = rawStripeError.type;
|
||||
switch (oauthType) {
|
||||
case 'invalid_grant':
|
||||
return new StripeInvalidGrantError(rawStripeError);
|
||||
case 'invalid_client':
|
||||
return new StripeInvalidClientError(rawStripeError);
|
||||
case 'invalid_request':
|
||||
return new StripeOAuthInvalidRequestError(rawStripeError);
|
||||
case 'invalid_scope':
|
||||
return new StripeInvalidScopeError(rawStripeError);
|
||||
case 'unsupported_grant_type':
|
||||
return new StripeUnsupportedGrantTypeError(rawStripeError);
|
||||
case 'unsupported_response_type':
|
||||
return new StripeUnsupportedResponseTypeError(rawStripeError);
|
||||
default:
|
||||
return new StripeOAuthError(rawStripeError);
|
||||
}
|
||||
};
|
||||
exports.generateOAuthError = generateOAuthError;
|
||||
const generateV2Error = (rawStripeError) => {
|
||||
switch (rawStripeError.type) {
|
||||
case 'idempotency_error':
|
||||
return new StripeIdempotencyError(rawStripeError);
|
||||
// switchCases: The beginning of the section generated from our OpenAPI spec
|
||||
case 'rate_limit':
|
||||
return new RateLimitError(rawStripeError);
|
||||
case 'temporary_session_expired':
|
||||
return new TemporarySessionExpiredError(rawStripeError);
|
||||
// switchCases: The end of the section generated from our OpenAPI spec
|
||||
}
|
||||
// Special handling for requests with missing required fields in V2 APIs.
|
||||
// invalid_field response in V2 APIs returns the field 'code' instead of 'type'.
|
||||
switch (rawStripeError.code) {
|
||||
case 'invalid_fields':
|
||||
return new StripeInvalidRequestError(rawStripeError);
|
||||
}
|
||||
return (0, exports.generateV1Error)(rawStripeError);
|
||||
};
|
||||
exports.generateV2Error = generateV2Error;
|
||||
/**
|
||||
* StripeError is the base error from which all other more specific Stripe errors derive.
|
||||
* Specifically for errors returned from Stripe's REST API.
|
||||
*/
|
||||
class StripeError extends Error {
|
||||
constructor(raw = {}, type = null) {
|
||||
super(raw.message);
|
||||
this.type = type || this.constructor.name;
|
||||
this.raw = raw;
|
||||
this.rawType = raw.type;
|
||||
this.code = raw.code;
|
||||
this.doc_url = raw.doc_url;
|
||||
this.param = raw.param;
|
||||
this.detail = raw.detail;
|
||||
this.headers = raw.headers;
|
||||
this.requestId = raw.requestId;
|
||||
this.statusCode = raw.statusCode;
|
||||
this.message = raw.message ?? '';
|
||||
this.userMessage = raw.user_message;
|
||||
this.charge = raw.charge;
|
||||
this.decline_code = raw.decline_code;
|
||||
this.payment_intent = raw.payment_intent;
|
||||
this.payment_method = raw.payment_method;
|
||||
this.payment_method_type = raw.payment_method_type;
|
||||
this.setup_intent = raw.setup_intent;
|
||||
this.source = raw.source;
|
||||
}
|
||||
}
|
||||
exports.StripeError = StripeError;
|
||||
/**
|
||||
* Helper factory which takes raw stripe errors and outputs wrapping instances
|
||||
*/
|
||||
StripeError.generate = exports.generateV1Error;
|
||||
// Specific Stripe Error types:
|
||||
/**
|
||||
* CardError is raised when a user enters a card that can't be charged for
|
||||
* some reason.
|
||||
*/
|
||||
class StripeCardError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeCardError');
|
||||
this.decline_code = raw.decline_code ?? '';
|
||||
}
|
||||
}
|
||||
exports.StripeCardError = StripeCardError;
|
||||
/**
|
||||
* InvalidRequestError is raised when a request is initiated with invalid
|
||||
* parameters.
|
||||
*/
|
||||
class StripeInvalidRequestError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeInvalidRequestError');
|
||||
}
|
||||
}
|
||||
exports.StripeInvalidRequestError = StripeInvalidRequestError;
|
||||
/**
|
||||
* APIError is a generic error that may be raised in cases where none of the
|
||||
* other named errors cover the problem. It could also be raised in the case
|
||||
* that a new error has been introduced in the API, but this version of the
|
||||
* Node.JS SDK doesn't know how to handle it.
|
||||
*/
|
||||
class StripeAPIError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeAPIError');
|
||||
}
|
||||
}
|
||||
exports.StripeAPIError = StripeAPIError;
|
||||
/**
|
||||
* AuthenticationError is raised when invalid credentials are used to connect
|
||||
* to Stripe's servers.
|
||||
*/
|
||||
class StripeAuthenticationError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeAuthenticationError');
|
||||
}
|
||||
}
|
||||
exports.StripeAuthenticationError = StripeAuthenticationError;
|
||||
/**
|
||||
* PermissionError is raised in cases where access was attempted on a resource
|
||||
* that wasn't allowed.
|
||||
*/
|
||||
class StripePermissionError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripePermissionError');
|
||||
}
|
||||
}
|
||||
exports.StripePermissionError = StripePermissionError;
|
||||
/**
|
||||
* RateLimitError is raised in cases where an account is putting too much load
|
||||
* on Stripe's API servers (usually by performing too many requests). Please
|
||||
* back off on request rate.
|
||||
*/
|
||||
class StripeRateLimitError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeRateLimitError');
|
||||
}
|
||||
}
|
||||
exports.StripeRateLimitError = StripeRateLimitError;
|
||||
/**
|
||||
* StripeConnectionError is raised in the event that the SDK can't connect to
|
||||
* Stripe's servers. That can be for a variety of different reasons from a
|
||||
* downed network to a bad TLS certificate.
|
||||
*/
|
||||
class StripeConnectionError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeConnectionError');
|
||||
}
|
||||
}
|
||||
exports.StripeConnectionError = StripeConnectionError;
|
||||
/**
|
||||
* SignatureVerificationError is raised when the signature verification for a
|
||||
* webhook fails
|
||||
*/
|
||||
class StripeSignatureVerificationError extends StripeError {
|
||||
constructor(header, payload, raw = {}) {
|
||||
super(raw, 'StripeSignatureVerificationError');
|
||||
this.header = header;
|
||||
this.payload = payload;
|
||||
}
|
||||
}
|
||||
exports.StripeSignatureVerificationError = StripeSignatureVerificationError;
|
||||
/**
|
||||
* IdempotencyError is raised in cases where an idempotency key was used
|
||||
* improperly.
|
||||
*/
|
||||
class StripeIdempotencyError extends StripeError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeIdempotencyError');
|
||||
}
|
||||
}
|
||||
exports.StripeIdempotencyError = StripeIdempotencyError;
|
||||
/**
|
||||
* StripeOAuthError is the base error for OAuth-specific errors.
|
||||
*/
|
||||
class StripeOAuthError extends StripeError {
|
||||
constructor(raw = {}, type = 'StripeOAuthError') {
|
||||
super(raw, type);
|
||||
}
|
||||
}
|
||||
exports.StripeOAuthError = StripeOAuthError;
|
||||
/**
|
||||
* InvalidGrantError is raised when a specified code doesn't exist, is
|
||||
* expired, has been used, or doesn't belong to you; a refresh token doesn't
|
||||
* exist, or doesn't belong to you; or if an API key's mode (live or test)
|
||||
* doesn't match the mode of a code or refresh token.
|
||||
*/
|
||||
class StripeInvalidGrantError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeInvalidGrantError');
|
||||
}
|
||||
}
|
||||
exports.StripeInvalidGrantError = StripeInvalidGrantError;
|
||||
/**
|
||||
* InvalidClientError is raised when the client_id does not belong to you,
|
||||
* or an API key is required but not provided.
|
||||
*/
|
||||
class StripeInvalidClientError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeInvalidClientError');
|
||||
}
|
||||
}
|
||||
exports.StripeInvalidClientError = StripeInvalidClientError;
|
||||
/**
|
||||
* OAuthInvalidRequestError is raised when a required parameter is missing,
|
||||
* or an unsupported parameter or value is provided in the OAuth request.
|
||||
*/
|
||||
class StripeOAuthInvalidRequestError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeOAuthInvalidRequestError');
|
||||
}
|
||||
}
|
||||
exports.StripeOAuthInvalidRequestError = StripeOAuthInvalidRequestError;
|
||||
/**
|
||||
* InvalidScopeError is raised when an invalid scope is provided in the
|
||||
* OAuth request.
|
||||
*/
|
||||
class StripeInvalidScopeError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeInvalidScopeError');
|
||||
}
|
||||
}
|
||||
exports.StripeInvalidScopeError = StripeInvalidScopeError;
|
||||
/**
|
||||
* UnsupportedGrantTypeError is raised when an unsupported grant_type is
|
||||
* provided in the OAuth request.
|
||||
*/
|
||||
class StripeUnsupportedGrantTypeError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeUnsupportedGrantTypeError');
|
||||
}
|
||||
}
|
||||
exports.StripeUnsupportedGrantTypeError = StripeUnsupportedGrantTypeError;
|
||||
/**
|
||||
* UnsupportedResponseTypeError is raised when an unsupported response_type
|
||||
* is provided in the OAuth request.
|
||||
*/
|
||||
class StripeUnsupportedResponseTypeError extends StripeOAuthError {
|
||||
constructor(raw = {}) {
|
||||
super(raw, 'StripeUnsupportedResponseTypeError');
|
||||
}
|
||||
}
|
||||
exports.StripeUnsupportedResponseTypeError = StripeUnsupportedResponseTypeError;
|
||||
// classDefinitions: The beginning of the section generated from our OpenAPI spec
|
||||
class RateLimitError extends StripeError {
|
||||
constructor(rawStripeError = {}) {
|
||||
super(rawStripeError, 'RateLimitError');
|
||||
}
|
||||
}
|
||||
exports.RateLimitError = RateLimitError;
|
||||
class TemporarySessionExpiredError extends StripeError {
|
||||
constructor(rawStripeError = {}) {
|
||||
super(rawStripeError, 'TemporarySessionExpiredError');
|
||||
}
|
||||
}
|
||||
exports.TemporarySessionExpiredError = TemporarySessionExpiredError;
|
||||
// classDefinitions: The end of the section generated from our OpenAPI spec
|
||||
//# sourceMappingURL=Error.js.map
|
||||
1
node_modules/stripe/cjs/Error.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/Error.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
node_modules/stripe/cjs/RequestSender.d.ts
generated
vendored
Normal file
60
node_modules/stripe/cjs/RequestSender.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { RequestHeaders, RequestEvent, ResponseEvent, RequestCallback, RequestCallbackReturn, RequestData, RequestDataProcessor, InternalRequestOptions, RequestSettings, RequestAuthenticator, ApiMode } from './Types.js';
|
||||
import { RawRequestOptions } from './lib.js';
|
||||
import { HttpClientResponseInterface } from './net/HttpClient.js';
|
||||
import { Stripe } from './stripe.core.js';
|
||||
export type HttpClientResponseError = {
|
||||
code: string;
|
||||
};
|
||||
export declare class RequestSender {
|
||||
protected _stripe: Stripe;
|
||||
private readonly _maxBufferedRequestMetric;
|
||||
constructor(stripe: Stripe, maxBufferedRequestMetric: number);
|
||||
private _normalizeStripeContext;
|
||||
_addHeadersDirectlyToObject(obj: any, headers: RequestHeaders): void;
|
||||
_makeResponseEvent(requestEvent: RequestEvent, statusCode: number, headers: RequestHeaders): ResponseEvent;
|
||||
_getRequestId(headers: RequestHeaders): string;
|
||||
private _emitStripeNotice;
|
||||
/**
|
||||
* Used by methods with spec.streaming === true. For these methods, we do not
|
||||
* buffer successful responses into memory or do parse them into stripe
|
||||
* objects, we delegate that all of that to the user and pass back the raw
|
||||
* http.Response object to the callback.
|
||||
*
|
||||
* (Unsuccessful responses shouldn't make it here, they should
|
||||
* still be buffered/parsed and handled by _jsonResponseHandler -- see
|
||||
* makeRequest)
|
||||
*/
|
||||
_streamingResponseHandler(requestEvent: RequestEvent, usage: Array<string>, callback: RequestCallback): (res: HttpClientResponseInterface) => RequestCallbackReturn;
|
||||
/**
|
||||
* Default handler for Stripe responses. Buffers the response into memory,
|
||||
* parses the JSON and returns it (i.e. passes it to the callback) if there
|
||||
* is no "error" field. Otherwise constructs/passes an appropriate Error.
|
||||
*/
|
||||
_jsonResponseHandler(requestEvent: RequestEvent, apiMode: 'v1' | 'v2', usage: Array<string>, callback: RequestCallback): (res: HttpClientResponseInterface) => void;
|
||||
static _generateConnectionErrorMessage(requestRetries: number): string;
|
||||
static _shouldRetry(res: null | HttpClientResponseInterface, numRetries: number, maxRetries: number, error?: HttpClientResponseError): boolean;
|
||||
_getSleepTimeInMS(numRetries: number, retryAfter?: number): number;
|
||||
_getMaxNetworkRetries(settings?: RequestSettings): number;
|
||||
_defaultIdempotencyKey(method: string, settings: RequestSettings, apiMode: ApiMode): string | null;
|
||||
_makeHeaders({ contentType, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings, stripeAccount, stripeContext, apiMode, }: {
|
||||
contentType: string;
|
||||
contentLength: number;
|
||||
apiVersion: string | null;
|
||||
clientUserAgent: string;
|
||||
method: string;
|
||||
userSuppliedHeaders: RequestHeaders | null;
|
||||
userSuppliedSettings: RequestSettings;
|
||||
stripeAccount: string | null;
|
||||
stripeContext: string | null;
|
||||
apiMode: ApiMode;
|
||||
}): RequestHeaders;
|
||||
_getUserAgentString(apiMode: string): string;
|
||||
_getTelemetryHeader(): string | undefined;
|
||||
_recordRequestMetrics(requestId: string, requestDurationMs: number, usage: Array<string>): void;
|
||||
_rawRequest(method: string, path: string, params?: RequestData, options?: RawRequestOptions, usage?: Array<string>): Promise<any>;
|
||||
_getContentLength(data: string | Uint8Array): number;
|
||||
/**
|
||||
* This is the main HTTP method that all resources eventually call
|
||||
*/
|
||||
_request(method: string, host: string | null, path: string, data: RequestData | null, authenticator: RequestAuthenticator | null, options: InternalRequestOptions, usage: string[] | undefined, callback: RequestCallback, requestDataProcessor?: RequestDataProcessor | null): void;
|
||||
}
|
||||
481
node_modules/stripe/cjs/RequestSender.js
generated
vendored
Normal file
481
node_modules/stripe/cjs/RequestSender.js
generated
vendored
Normal file
@@ -0,0 +1,481 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RequestSender = void 0;
|
||||
const Error_js_1 = require("./Error.js");
|
||||
const HttpClient_js_1 = require("./net/HttpClient.js");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
const MAX_RETRY_AFTER_WAIT = 60;
|
||||
class RequestSender {
|
||||
constructor(stripe, maxBufferedRequestMetric) {
|
||||
this._stripe = stripe;
|
||||
this._maxBufferedRequestMetric = maxBufferedRequestMetric;
|
||||
}
|
||||
_normalizeStripeContext(optsContext, clientContext) {
|
||||
if (optsContext) {
|
||||
return optsContext.toString() || null; // return null for empty strings
|
||||
}
|
||||
return clientContext?.toString() || null; // return null for empty strings
|
||||
}
|
||||
_addHeadersDirectlyToObject(obj, headers) {
|
||||
// For convenience, make some headers easily accessible on
|
||||
// lastResponse.
|
||||
// NOTE: Stripe responds with lowercase header names/keys.
|
||||
obj.requestId = headers['request-id'];
|
||||
obj.stripeAccount = obj.stripeAccount || headers['stripe-account'];
|
||||
obj.apiVersion = obj.apiVersion || headers['stripe-version'];
|
||||
obj.idempotencyKey = obj.idempotencyKey || headers['idempotency-key'];
|
||||
}
|
||||
_makeResponseEvent(requestEvent, statusCode, headers) {
|
||||
const requestEndTime = Date.now();
|
||||
const requestDurationMs = requestEndTime - requestEvent.request_start_time;
|
||||
return (0, utils_js_1.removeNullish)({
|
||||
api_version: headers['stripe-version'],
|
||||
account: headers['stripe-account'],
|
||||
idempotency_key: headers['idempotency-key'],
|
||||
method: requestEvent.method,
|
||||
path: requestEvent.path,
|
||||
status: statusCode,
|
||||
request_id: this._getRequestId(headers),
|
||||
elapsed: requestDurationMs,
|
||||
request_start_time: requestEvent.request_start_time,
|
||||
request_end_time: requestEndTime,
|
||||
});
|
||||
}
|
||||
_getRequestId(headers) {
|
||||
return headers['request-id'];
|
||||
}
|
||||
_emitStripeNotice(headers) {
|
||||
const notice = headers['stripe-notice'];
|
||||
if (notice) {
|
||||
this._stripe._platformFunctions.emitWarning(typeof notice === 'string' ? notice : notice[0]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Used by methods with spec.streaming === true. For these methods, we do not
|
||||
* buffer successful responses into memory or do parse them into stripe
|
||||
* objects, we delegate that all of that to the user and pass back the raw
|
||||
* http.Response object to the callback.
|
||||
*
|
||||
* (Unsuccessful responses shouldn't make it here, they should
|
||||
* still be buffered/parsed and handled by _jsonResponseHandler -- see
|
||||
* makeRequest)
|
||||
*/
|
||||
_streamingResponseHandler(requestEvent, usage, callback) {
|
||||
return (res) => {
|
||||
const headers = res.getHeaders();
|
||||
this._emitStripeNotice(headers);
|
||||
const streamCompleteCallback = () => {
|
||||
const responseEvent = this._makeResponseEvent(requestEvent, res.getStatusCode(), headers);
|
||||
this._stripe._emitter.emit('response', responseEvent);
|
||||
this._recordRequestMetrics(this._getRequestId(headers), responseEvent.elapsed, usage);
|
||||
};
|
||||
const stream = res.toStream(streamCompleteCallback);
|
||||
// This is here for backwards compatibility, as the stream is a raw
|
||||
// HTTP response in Node and the legacy behavior was to mutate this
|
||||
// response.
|
||||
this._addHeadersDirectlyToObject(stream, headers);
|
||||
return callback(null, stream);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Default handler for Stripe responses. Buffers the response into memory,
|
||||
* parses the JSON and returns it (i.e. passes it to the callback) if there
|
||||
* is no "error" field. Otherwise constructs/passes an appropriate Error.
|
||||
*/
|
||||
_jsonResponseHandler(requestEvent, apiMode, usage, callback) {
|
||||
return (res) => {
|
||||
const headers = res.getHeaders();
|
||||
this._emitStripeNotice(headers);
|
||||
const requestId = this._getRequestId(headers);
|
||||
const statusCode = res.getStatusCode();
|
||||
const responseEvent = this._makeResponseEvent(requestEvent, statusCode, headers);
|
||||
res
|
||||
.toJSON()
|
||||
.then((jsonResponse) => {
|
||||
if (this._stripe.getEmitEventBodiesEnabled()) {
|
||||
responseEvent.body = jsonResponse;
|
||||
}
|
||||
if (jsonResponse.error) {
|
||||
const isOAuth = typeof jsonResponse.error === 'string';
|
||||
if (isOAuth) {
|
||||
jsonResponse.error = {
|
||||
type: jsonResponse.error,
|
||||
message: jsonResponse.error_description,
|
||||
};
|
||||
}
|
||||
jsonResponse.error.headers = headers;
|
||||
jsonResponse.error.statusCode = statusCode;
|
||||
jsonResponse.error.requestId = requestId;
|
||||
let err;
|
||||
if (isOAuth) {
|
||||
err = (0, Error_js_1.generateOAuthError)(jsonResponse.error);
|
||||
}
|
||||
else if (apiMode === 'v2') {
|
||||
err = (0, Error_js_1.generateV2Error)(jsonResponse.error);
|
||||
}
|
||||
else {
|
||||
err = (0, Error_js_1.generateV1Error)(jsonResponse.error);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return jsonResponse;
|
||||
}, (e) => {
|
||||
if (this._stripe.getEmitEventBodiesEnabled() &&
|
||||
e.rawBody) {
|
||||
responseEvent.body = e.rawBody;
|
||||
}
|
||||
throw new Error_js_1.StripeAPIError({
|
||||
message: 'Invalid JSON received from the Stripe API',
|
||||
exception: e,
|
||||
requestId: headers['request-id'],
|
||||
});
|
||||
})
|
||||
.then((jsonResponse) => {
|
||||
this._stripe._emitter.emit('response', responseEvent);
|
||||
this._recordRequestMetrics(requestId, responseEvent.elapsed, usage);
|
||||
// Expose raw response object.
|
||||
const rawResponse = res.getRawResponse();
|
||||
this._addHeadersDirectlyToObject(rawResponse, headers);
|
||||
Object.defineProperty(jsonResponse, 'lastResponse', {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: rawResponse,
|
||||
});
|
||||
callback(null, jsonResponse);
|
||||
}, (e) => {
|
||||
this._stripe._emitter.emit('response', responseEvent);
|
||||
callback(e, null);
|
||||
});
|
||||
};
|
||||
}
|
||||
static _generateConnectionErrorMessage(requestRetries) {
|
||||
return `An error occurred with our connection to Stripe.${requestRetries > 0 ? ` Request was retried ${requestRetries} times.` : ''}`;
|
||||
}
|
||||
// For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency
|
||||
static _shouldRetry(res, numRetries, maxRetries, error) {
|
||||
if (error &&
|
||||
numRetries === 0 &&
|
||||
HttpClient_js_1.HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)) {
|
||||
return true;
|
||||
}
|
||||
// Do not retry if we are out of retries.
|
||||
if (numRetries >= maxRetries) {
|
||||
return false;
|
||||
}
|
||||
// Retry on connection error.
|
||||
if (!res) {
|
||||
return true;
|
||||
}
|
||||
// The API may ask us not to retry (e.g., if doing so would be a no-op)
|
||||
// or advise us to retry (e.g., in cases of lock timeouts); we defer to that.
|
||||
if (res.getHeaders()['stripe-should-retry'] === 'false') {
|
||||
return false;
|
||||
}
|
||||
if (res.getHeaders()['stripe-should-retry'] === 'true') {
|
||||
return true;
|
||||
}
|
||||
// Retry on conflict errors.
|
||||
if (res.getStatusCode() === 409) {
|
||||
return true;
|
||||
}
|
||||
// Retry on 500, 503, and other internal errors.
|
||||
//
|
||||
// Note that we expect the stripe-should-retry header to be false
|
||||
// in most cases when a 500 is returned, since our idempotency framework
|
||||
// would typically replay it anyway.
|
||||
if (res.getStatusCode() >= 500) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
_getSleepTimeInMS(numRetries, retryAfter) {
|
||||
const initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay();
|
||||
const maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay();
|
||||
// Apply exponential backoff with initialNetworkRetryDelay on the
|
||||
// number of numRetries so far as inputs. Do not allow the number to exceed
|
||||
// maxNetworkRetryDelay.
|
||||
let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(2, numRetries - 1), maxNetworkRetryDelay);
|
||||
// Apply some jitter by randomizing the value in the range of
|
||||
// (sleepSeconds / 2) to (sleepSeconds).
|
||||
sleepSeconds *= 0.5 * (1 + Math.random());
|
||||
// But never sleep less than the base sleep seconds.
|
||||
sleepSeconds = Math.max(initialNetworkRetryDelay, sleepSeconds);
|
||||
// And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask.
|
||||
if (Number.isInteger(retryAfter) && retryAfter <= MAX_RETRY_AFTER_WAIT) {
|
||||
sleepSeconds = Math.max(sleepSeconds, retryAfter);
|
||||
}
|
||||
return sleepSeconds * 1000;
|
||||
}
|
||||
// Max retries can be set on a per request basis. Favor those over the global setting
|
||||
_getMaxNetworkRetries(settings = {}) {
|
||||
return settings.maxNetworkRetries !== undefined &&
|
||||
Number.isInteger(settings.maxNetworkRetries)
|
||||
? settings.maxNetworkRetries
|
||||
: this._stripe.getMaxNetworkRetries();
|
||||
}
|
||||
_defaultIdempotencyKey(method, settings, apiMode) {
|
||||
// If this is a POST and we allow multiple retries, ensure an idempotency key.
|
||||
const maxRetries = this._getMaxNetworkRetries(settings);
|
||||
const genKey = () => `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`;
|
||||
// more verbose than it needs to be, but gives clear separation between V1 and V2 behavior
|
||||
if (apiMode === 'v2') {
|
||||
if (method === 'POST' || method === 'DELETE') {
|
||||
return genKey();
|
||||
}
|
||||
}
|
||||
else if (apiMode === 'v1') {
|
||||
if (method === 'POST' && maxRetries > 0) {
|
||||
return genKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
_makeHeaders({ contentType, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings, stripeAccount, stripeContext, apiMode, }) {
|
||||
const defaultHeaders = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': contentType,
|
||||
'User-Agent': this._getUserAgentString(apiMode),
|
||||
'X-Stripe-Client-User-Agent': clientUserAgent,
|
||||
'X-Stripe-Client-Telemetry': this._getTelemetryHeader(),
|
||||
'Stripe-Version': apiVersion,
|
||||
'Stripe-Account': stripeAccount,
|
||||
'Stripe-Context': stripeContext,
|
||||
'Idempotency-Key': this._defaultIdempotencyKey(method, userSuppliedSettings, apiMode),
|
||||
};
|
||||
// As per https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2:
|
||||
// A user agent SHOULD send a Content-Length in a request message when
|
||||
// no Transfer-Encoding is sent and the request method defines a meaning
|
||||
// for an enclosed payload body. For example, a Content-Length header
|
||||
// field is normally sent in a POST request even when the value is 0
|
||||
// (indicating an empty payload body). A user agent SHOULD NOT send a
|
||||
// Content-Length header field when the request message does not contain
|
||||
// a payload body and the method semantics do not anticipate such a
|
||||
// body.
|
||||
//
|
||||
// These method types are expected to have bodies and so we should always
|
||||
// include a Content-Length.
|
||||
const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH';
|
||||
// If a content length was specified, we always include it regardless of
|
||||
// whether the method semantics anticipate such a body. This keeps us
|
||||
// consistent with historical behavior. We do however want to warn on this
|
||||
// and fix these cases as they are semantically incorrect.
|
||||
if (methodHasPayload || contentLength) {
|
||||
if (!methodHasPayload) {
|
||||
this._stripe._platformFunctions.emitWarning(`${method} method had non-zero contentLength but no payload is expected for this verb`);
|
||||
}
|
||||
defaultHeaders['Content-Length'] = contentLength;
|
||||
}
|
||||
return Object.assign((0, utils_js_1.removeNullish)(defaultHeaders),
|
||||
// If the user supplied, say 'idempotency-key', override instead of appending by ensuring caps are the same.
|
||||
(0, utils_js_1.normalizeHeaders)(userSuppliedHeaders));
|
||||
}
|
||||
_getUserAgentString(apiMode) {
|
||||
const packageVersion = this._stripe.getConstant('PACKAGE_VERSION');
|
||||
const appInfo = this._stripe._appInfo
|
||||
? this._stripe.getAppInfoAsString()
|
||||
: '';
|
||||
const aiAgent = this._stripe.getConstant('AI_AGENT');
|
||||
let uaString = `Stripe/${apiMode} NodeBindings/${packageVersion}`;
|
||||
if (appInfo) {
|
||||
uaString += ` ${appInfo}`;
|
||||
}
|
||||
if (aiAgent) {
|
||||
uaString += ` AIAgent/${aiAgent}`;
|
||||
}
|
||||
return uaString;
|
||||
}
|
||||
_getTelemetryHeader() {
|
||||
if (this._stripe.getTelemetryEnabled() &&
|
||||
this._stripe._prevRequestMetrics.length > 0) {
|
||||
const metrics = this._stripe._prevRequestMetrics.shift();
|
||||
return JSON.stringify({
|
||||
last_request_metrics: metrics,
|
||||
});
|
||||
}
|
||||
}
|
||||
_recordRequestMetrics(requestId, requestDurationMs, usage) {
|
||||
if (this._stripe.getTelemetryEnabled() && requestId) {
|
||||
if (this._stripe._prevRequestMetrics.length > this._maxBufferedRequestMetric) {
|
||||
this._stripe._platformFunctions.emitWarning('Request metrics buffer is full, dropping telemetry message.');
|
||||
}
|
||||
else {
|
||||
const m = {
|
||||
request_id: requestId,
|
||||
request_duration_ms: requestDurationMs,
|
||||
};
|
||||
if (usage && usage.length > 0) {
|
||||
m.usage = usage;
|
||||
}
|
||||
this._stripe._prevRequestMetrics.push(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
_rawRequest(method, path, params, options, usage) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const requestMethod = method.toUpperCase();
|
||||
if (requestMethod !== 'POST' &&
|
||||
params &&
|
||||
Object.keys(params).length !== 0) {
|
||||
throw new Error('rawRequest only supports params on POST requests. Please pass null and add your parameters to path.');
|
||||
}
|
||||
const data = requestMethod === 'POST' ? Object.assign({}, params) : null;
|
||||
const processed = (0, utils_js_1.processOptions)(options);
|
||||
// Handle additionalHeaders from RawRequestOptions
|
||||
if (options?.additionalHeaders) {
|
||||
Object.assign(processed.headers, options.additionalHeaders);
|
||||
}
|
||||
const apiBase = processed.apiBase || (options?.apiBase ?? null);
|
||||
const host = apiBase ? this._stripe.resolveBaseAddress(apiBase) : null;
|
||||
this._request(requestMethod, host, path, data, processed.authenticator, {
|
||||
headers: processed.headers,
|
||||
settings: processed.settings,
|
||||
streaming: processed.streaming,
|
||||
}, usage || ['raw_request'], (err, response) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
_getContentLength(data) {
|
||||
// if we calculate this wrong, the server treats it as invalid json
|
||||
// or if content length is too big, the request never finishes and it
|
||||
// times out.
|
||||
return typeof data === 'string'
|
||||
? new TextEncoder().encode(data).length
|
||||
: data.length;
|
||||
}
|
||||
/**
|
||||
* This is the main HTTP method that all resources eventually call
|
||||
*/
|
||||
_request(method, host, path, data, authenticator, options, usage = [], callback, requestDataProcessor = null) {
|
||||
let requestData;
|
||||
authenticator = authenticator ?? this._stripe._authenticator;
|
||||
const apiMode = (0, utils_js_1.getAPIMode)(path);
|
||||
const retryRequest = (requestFn, apiVersion, headers, requestRetries, retryAfter) => {
|
||||
return setTimeout(requestFn, this._getSleepTimeInMS(requestRetries, retryAfter), apiVersion, headers, requestRetries + 1);
|
||||
};
|
||||
const makeRequest = (apiVersion, headers, numRetries) => {
|
||||
// timeout can be set on a per-request basis. Favor that over the global setting
|
||||
const timeout = options.settings &&
|
||||
options.settings.timeout &&
|
||||
Number.isInteger(options.settings.timeout) &&
|
||||
options.settings.timeout >= 0
|
||||
? options.settings.timeout
|
||||
: this._stripe.getApiField('timeout');
|
||||
const request = {
|
||||
host: host || this._stripe.getApiField('host'),
|
||||
port: this._stripe.getApiField('port'),
|
||||
path: path,
|
||||
method: method,
|
||||
headers: Object.assign({}, headers),
|
||||
body: requestData,
|
||||
protocol: this._stripe.getApiField('protocol'),
|
||||
};
|
||||
if (!authenticator) {
|
||||
throw Error("Authenticator was't initialized. Please pass an API Key or an Authenticator when initializing StripeClient.");
|
||||
}
|
||||
authenticator(request)
|
||||
.then(() => {
|
||||
const req = this._stripe
|
||||
.getApiField('httpClient')
|
||||
.makeRequest(request.host, request.port, request.path, request.method, request.headers, request.body, request.protocol, timeout);
|
||||
const requestStartTime = Date.now();
|
||||
const requestEvent = (0, utils_js_1.removeNullish)({
|
||||
api_version: apiVersion,
|
||||
account: (0, utils_js_1.parseHttpHeaderAsString)(headers['Stripe-Account']),
|
||||
idempotency_key: (0, utils_js_1.parseHttpHeaderAsString)(headers['Idempotency-Key']),
|
||||
method,
|
||||
path,
|
||||
body: this._stripe.getEmitEventBodiesEnabled()
|
||||
? data ?? undefined
|
||||
: undefined,
|
||||
request_start_time: requestStartTime,
|
||||
});
|
||||
const requestRetries = numRetries || 0;
|
||||
const maxRetries = this._getMaxNetworkRetries(options.settings || {});
|
||||
this._stripe._emitter.emit('request', requestEvent);
|
||||
req
|
||||
.then((res) => {
|
||||
if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) {
|
||||
return retryRequest(makeRequest, apiVersion, headers, requestRetries, (0, utils_js_1.parseHttpHeaderAsNumber)(res.getHeaders()['retry-after']));
|
||||
}
|
||||
else if (options.streaming && res.getStatusCode() < 400) {
|
||||
return this._streamingResponseHandler(requestEvent, usage, callback)(res);
|
||||
}
|
||||
else {
|
||||
return this._jsonResponseHandler(requestEvent, apiMode, usage, callback)(res);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (RequestSender._shouldRetry(null, requestRetries, maxRetries, error)) {
|
||||
return retryRequest(makeRequest, apiVersion, headers, requestRetries);
|
||||
}
|
||||
else {
|
||||
const isTimeoutError = error.code && error.code === HttpClient_js_1.HttpClient.TIMEOUT_ERROR_CODE;
|
||||
return callback(new Error_js_1.StripeConnectionError({
|
||||
message: isTimeoutError
|
||||
? `Request aborted due to timeout being reached (${timeout}ms)`
|
||||
: RequestSender._generateConnectionErrorMessage(requestRetries),
|
||||
detail: error,
|
||||
}));
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
throw new Error_js_1.StripeError({
|
||||
message: 'Unable to authenticate the request',
|
||||
exception: e,
|
||||
});
|
||||
});
|
||||
};
|
||||
const prepareAndMakeRequest = (error, data) => {
|
||||
if (error) {
|
||||
return callback(error);
|
||||
}
|
||||
requestData = data;
|
||||
this._stripe.getClientUserAgent((clientUserAgent) => {
|
||||
const apiVersion = this._stripe.getApiField('version');
|
||||
const headers = this._makeHeaders({
|
||||
contentType: apiMode == 'v2'
|
||||
? 'application/json'
|
||||
: 'application/x-www-form-urlencoded',
|
||||
contentLength: this._getContentLength(data),
|
||||
apiVersion: apiVersion,
|
||||
clientUserAgent,
|
||||
method,
|
||||
// other callers expect null, but .headers being optional means it's undefined if not supplied. So we normalize to null.
|
||||
userSuppliedHeaders: options.headers ?? null,
|
||||
userSuppliedSettings: options.settings ?? {},
|
||||
stripeAccount: options.stripeAccount ?? this._stripe.getApiField('stripeAccount'),
|
||||
stripeContext: this._normalizeStripeContext(options.stripeContext, this._stripe.getApiField('stripeContext')),
|
||||
apiMode: apiMode,
|
||||
});
|
||||
makeRequest(apiVersion, headers, 0);
|
||||
});
|
||||
};
|
||||
if (requestDataProcessor) {
|
||||
requestDataProcessor(method, data, options.headers, prepareAndMakeRequest);
|
||||
}
|
||||
else {
|
||||
let stringifiedData;
|
||||
if (apiMode == 'v2') {
|
||||
stringifiedData = data ? (0, utils_js_1.jsonStringifyRequestData)(data) : '';
|
||||
}
|
||||
else {
|
||||
stringifiedData = (0, utils_js_1.queryStringifyRequestData)(data || {});
|
||||
}
|
||||
prepareAndMakeRequest(null, stringifiedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.RequestSender = RequestSender;
|
||||
//# sourceMappingURL=RequestSender.js.map
|
||||
1
node_modules/stripe/cjs/RequestSender.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/RequestSender.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/stripe/cjs/ResourceNamespace.d.ts
generated
vendored
Normal file
6
node_modules/stripe/cjs/ResourceNamespace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Stripe } from './stripe.core.js';
|
||||
import { StripeResourceObject } from './Types.js';
|
||||
export type StripeResourceNamespaceObject = {
|
||||
[key: string]: StripeResourceObject | StripeResourceNamespaceObject;
|
||||
};
|
||||
export declare function resourceNamespace(namespace: string, resources: Record<string, new (...args: any[]) => StripeResourceObject | StripeResourceNamespaceObject>): new (stripe: Stripe) => StripeResourceNamespaceObject;
|
||||
22
node_modules/stripe/cjs/ResourceNamespace.js
generated
vendored
Normal file
22
node_modules/stripe/cjs/ResourceNamespace.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
// ResourceNamespace allows you to create nested resources, i.e. `stripe.issuing.cards`.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resourceNamespace = void 0;
|
||||
// It also works recursively, so you could do i.e. `stripe.billing.invoicing.pay`.
|
||||
function ResourceNamespace(stripe, resources) {
|
||||
for (const name in resources) {
|
||||
if (!Object.prototype.hasOwnProperty.call(resources, name)) {
|
||||
continue;
|
||||
}
|
||||
const camelCaseName = name[0].toLowerCase() + name.substring(1);
|
||||
const resource = new resources[name](stripe);
|
||||
this[camelCaseName] = resource;
|
||||
}
|
||||
}
|
||||
function resourceNamespace(namespace, resources) {
|
||||
return function (stripe) {
|
||||
return new ResourceNamespace(stripe, resources);
|
||||
};
|
||||
}
|
||||
exports.resourceNamespace = resourceNamespace;
|
||||
//# sourceMappingURL=ResourceNamespace.js.map
|
||||
1
node_modules/stripe/cjs/ResourceNamespace.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/ResourceNamespace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ResourceNamespace.js","sourceRoot":"","sources":["../src/ResourceNamespace.ts"],"names":[],"mappings":";AAAA,wFAAwF;;;AASxF,kFAAkF;AAClF,SAAS,iBAAiB,CAExB,MAAc,EACd,SAGC;IAED,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAC1D,SAAS;SACV;QACD,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;QAE7C,IAAI,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;KAChC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,SAGC;IAED,OAAO,UAAS,MAAc;QAC5B,OAAO,IAAK,iBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAQ,CAAC;AACX,CAAC;AAVD,8CAUC"}
|
||||
32
node_modules/stripe/cjs/StripeContext.d.ts
generated
vendored
Normal file
32
node_modules/stripe/cjs/StripeContext.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* The StripeContext class provides an immutable container and convenience methods for interacting with the `Stripe-Context` header. All methods return a new instance of StripeContext.
|
||||
* You can use it whenever you're initializing a `Stripe` instance or sending `stripeContext` with a request. It's also found in the `EventNotification.context` property.
|
||||
*/
|
||||
export declare class StripeContext {
|
||||
private readonly _segments;
|
||||
/**
|
||||
* Creates a new StripeContext with the given segments.
|
||||
*/
|
||||
constructor(segments?: string[]);
|
||||
/**
|
||||
* Gets a copy of the segments of this Context.
|
||||
*/
|
||||
get segments(): Array<string>;
|
||||
/**
|
||||
* Creates a new StripeContext with an additional segment appended.
|
||||
*/
|
||||
push(segment: string): StripeContext;
|
||||
/**
|
||||
* Creates a new StripeContext with the last segment removed.
|
||||
* If there are no segments, throws an error.
|
||||
*/
|
||||
pop(): StripeContext;
|
||||
/**
|
||||
* Converts this context to its string representation.
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Parses a context string into a StripeContext instance.
|
||||
*/
|
||||
static parse(contextStr?: string | null): StripeContext;
|
||||
}
|
||||
57
node_modules/stripe/cjs/StripeContext.js
generated
vendored
Normal file
57
node_modules/stripe/cjs/StripeContext.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StripeContext = void 0;
|
||||
/**
|
||||
* The StripeContext class provides an immutable container and convenience methods for interacting with the `Stripe-Context` header. All methods return a new instance of StripeContext.
|
||||
* You can use it whenever you're initializing a `Stripe` instance or sending `stripeContext` with a request. It's also found in the `EventNotification.context` property.
|
||||
*/
|
||||
class StripeContext {
|
||||
/**
|
||||
* Creates a new StripeContext with the given segments.
|
||||
*/
|
||||
constructor(segments = []) {
|
||||
this._segments = [...segments];
|
||||
}
|
||||
/**
|
||||
* Gets a copy of the segments of this Context.
|
||||
*/
|
||||
get segments() {
|
||||
return [...this._segments];
|
||||
}
|
||||
/**
|
||||
* Creates a new StripeContext with an additional segment appended.
|
||||
*/
|
||||
push(segment) {
|
||||
if (!segment) {
|
||||
throw new Error('Segment cannot be null or undefined');
|
||||
}
|
||||
return new StripeContext([...this._segments, segment]);
|
||||
}
|
||||
/**
|
||||
* Creates a new StripeContext with the last segment removed.
|
||||
* If there are no segments, throws an error.
|
||||
*/
|
||||
pop() {
|
||||
if (this._segments.length === 0) {
|
||||
throw new Error('Cannot pop from an empty context');
|
||||
}
|
||||
return new StripeContext(this._segments.slice(0, -1));
|
||||
}
|
||||
/**
|
||||
* Converts this context to its string representation.
|
||||
*/
|
||||
toString() {
|
||||
return this._segments.join('/');
|
||||
}
|
||||
/**
|
||||
* Parses a context string into a StripeContext instance.
|
||||
*/
|
||||
static parse(contextStr) {
|
||||
if (!contextStr) {
|
||||
return new StripeContext([]);
|
||||
}
|
||||
return new StripeContext(contextStr.split('/'));
|
||||
}
|
||||
}
|
||||
exports.StripeContext = StripeContext;
|
||||
//# sourceMappingURL=StripeContext.js.map
|
||||
1
node_modules/stripe/cjs/StripeContext.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/StripeContext.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"StripeContext.js","sourceRoot":"","sources":["../src/StripeContext.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,aAAa;IAGxB;;OAEG;IACH,YAAY,WAAqB,EAAE;QACjC,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,GAAG;QACD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,UAA0B;QACrC,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC;SAC9B;QACD,OAAO,IAAI,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;CACF;AAtDD,sCAsDC"}
|
||||
23
node_modules/stripe/cjs/StripeEmitter.d.ts
generated
vendored
Normal file
23
node_modules/stripe/cjs/StripeEmitter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { RequestEvent, ResponseEvent } from './Types.js';
|
||||
/**
|
||||
* @private
|
||||
* (For internal use in stripe-node.)
|
||||
* Wrapper around the Event Web API.
|
||||
*/
|
||||
declare class _StripeEvent extends Event {
|
||||
data?: RequestEvent | ResponseEvent;
|
||||
constructor(eventName: string, data: any);
|
||||
}
|
||||
type Listener = (...args: any[]) => any;
|
||||
type ListenerWrapper = (event: _StripeEvent) => void;
|
||||
/** Minimal EventEmitter wrapper around EventTarget. */
|
||||
export declare class StripeEmitter {
|
||||
eventTarget: EventTarget;
|
||||
listenerMapping: Map<Listener, ListenerWrapper>;
|
||||
constructor();
|
||||
on(eventName: string, listener: Listener): void;
|
||||
removeListener(eventName: string, listener: Listener): void;
|
||||
once(eventName: string, listener: Listener): void;
|
||||
emit(eventName: string, data: RequestEvent | ResponseEvent): boolean;
|
||||
}
|
||||
export {};
|
||||
47
node_modules/stripe/cjs/StripeEmitter.js
generated
vendored
Normal file
47
node_modules/stripe/cjs/StripeEmitter.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StripeEmitter = void 0;
|
||||
/**
|
||||
* @private
|
||||
* (For internal use in stripe-node.)
|
||||
* Wrapper around the Event Web API.
|
||||
*/
|
||||
class _StripeEvent extends Event {
|
||||
constructor(eventName, data) {
|
||||
super(eventName);
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
/** Minimal EventEmitter wrapper around EventTarget. */
|
||||
class StripeEmitter {
|
||||
constructor() {
|
||||
this.eventTarget = new EventTarget();
|
||||
this.listenerMapping = new Map();
|
||||
}
|
||||
on(eventName, listener) {
|
||||
const listenerWrapper = (event) => {
|
||||
listener(event.data);
|
||||
};
|
||||
this.listenerMapping.set(listener, listenerWrapper);
|
||||
return this.eventTarget.addEventListener(eventName, listenerWrapper);
|
||||
}
|
||||
removeListener(eventName, listener) {
|
||||
const listenerWrapper = this.listenerMapping.get(listener);
|
||||
this.listenerMapping.delete(listener);
|
||||
return this.eventTarget.removeEventListener(eventName, listenerWrapper);
|
||||
}
|
||||
once(eventName, listener) {
|
||||
const listenerWrapper = (event) => {
|
||||
listener(event.data);
|
||||
};
|
||||
this.listenerMapping.set(listener, listenerWrapper);
|
||||
return this.eventTarget.addEventListener(eventName, listenerWrapper, {
|
||||
once: true,
|
||||
});
|
||||
}
|
||||
emit(eventName, data) {
|
||||
return this.eventTarget.dispatchEvent(new _StripeEvent(eventName, data));
|
||||
}
|
||||
}
|
||||
exports.StripeEmitter = StripeEmitter;
|
||||
//# sourceMappingURL=StripeEmitter.js.map
|
||||
1
node_modules/stripe/cjs/StripeEmitter.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/StripeEmitter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"StripeEmitter.js","sourceRoot":"","sources":["../src/StripeEmitter.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,MAAM,YAAa,SAAQ,KAAK;IAE9B,YAAY,SAAiB,EAAE,IAAS;QACtC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAKD,uDAAuD;AACvD,MAAa,aAAa;IAIxB;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,EAAE,CAAC,SAAiB,EAAE,QAAkB;QACtC,MAAM,eAAe,GAAoB,CAAC,KAAmB,EAAQ,EAAE;YACrE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACvE,CAAC;IAED,cAAc,CAAC,SAAiB,EAAE,QAAkB;QAClD,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAgB,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,SAAiB,EAAE,QAAkB;QACxC,MAAM,eAAe,GAAoB,CAAC,KAAmB,EAAQ,EAAE;YACrE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,EAAE;YACnE,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,SAAiB,EAAE,IAAkC;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF;AApCD,sCAoCC"}
|
||||
18
node_modules/stripe/cjs/StripeResource.d.ts
generated
vendored
Normal file
18
node_modules/stripe/cjs/StripeResource.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { StripeResourceObject, MakeRequestSpec, RequestData, UrlInterpolator } from './Types.js';
|
||||
import { Stripe } from './stripe.core.js';
|
||||
import { RequestOptions } from './lib.js';
|
||||
/**
|
||||
* Encapsulates request logic for a Stripe Resource
|
||||
*/
|
||||
declare class StripeResource implements StripeResourceObject {
|
||||
static MAX_BUFFERED_REQUEST_METRICS: number;
|
||||
_stripe: Stripe;
|
||||
path: UrlInterpolator;
|
||||
resourcePath: string;
|
||||
basePath: UrlInterpolator;
|
||||
requestDataProcessor: any;
|
||||
constructor(stripe: Stripe, deprecatedUrlData?: never);
|
||||
initialize(_stripe?: Stripe, _deprecatedUrlData?: never): void;
|
||||
_makeRequest(method: string, path: string, params: RequestData | undefined, options: RequestOptions | undefined, spec?: MakeRequestSpec): Promise<any>;
|
||||
}
|
||||
export { StripeResource };
|
||||
101
node_modules/stripe/cjs/StripeResource.js
generated
vendored
Normal file
101
node_modules/stripe/cjs/StripeResource.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StripeResource = void 0;
|
||||
const utils_js_1 = require("./utils.js");
|
||||
const V2Coercion_js_1 = require("./V2Coercion.js");
|
||||
const autoPagination_js_1 = require("./autoPagination.js");
|
||||
/**
|
||||
* Encapsulates request logic for a Stripe Resource
|
||||
*/
|
||||
class StripeResource {
|
||||
constructor(stripe, deprecatedUrlData) {
|
||||
this.resourcePath = '';
|
||||
// Function to override the default data processor. This allows full control
|
||||
// over how a StripeResource's request data will get converted into an HTTP
|
||||
// body. This is useful for non-standard HTTP requests. The function should
|
||||
// take method name, data, and headers as arguments.
|
||||
this.requestDataProcessor = null;
|
||||
this._stripe = stripe;
|
||||
if (deprecatedUrlData) {
|
||||
throw new Error('Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids.');
|
||||
}
|
||||
this.basePath = (0, utils_js_1.makeURLInterpolator)(
|
||||
// @ts-expect-error changing type of basePath
|
||||
this.basePath || stripe.getApiField('basePath'));
|
||||
// @ts-ignore changing type of path - path comes from prototype as string, convert to interpolator
|
||||
const rawPath = this.path || '';
|
||||
this.resourcePath = rawPath;
|
||||
this.path = (0, utils_js_1.makeURLInterpolator)(rawPath);
|
||||
this.initialize(stripe, deprecatedUrlData);
|
||||
}
|
||||
initialize(_stripe, _deprecatedUrlData) { }
|
||||
_makeRequest(method, path, params, options, spec) {
|
||||
const requestMethod = method.toUpperCase();
|
||||
const encode = spec?.encode || ((data) => data);
|
||||
const data = encode(params ? { ...params } : {});
|
||||
const processed = (0, utils_js_1.processOptions)(options);
|
||||
const apiBase = processed.apiBase || spec?.apiBase || null;
|
||||
const host = apiBase ? this._stripe.resolveBaseAddress(apiBase) : null;
|
||||
const streaming = processed.streaming || !!spec?.streaming;
|
||||
const headers = Object.assign(processed.headers, spec?.headers);
|
||||
const usage = spec?.usage || [];
|
||||
const dataInQuery = requestMethod === 'GET' || requestMethod === 'DELETE';
|
||||
let bodyData = dataInQuery ? null : data;
|
||||
const queryData = dataInQuery ? data : {};
|
||||
try {
|
||||
if (spec?.validator) {
|
||||
spec.validator(data, { headers });
|
||||
}
|
||||
// Coerce int64_string/decimal_string fields in request body
|
||||
if (spec?.requestSchema && bodyData) {
|
||||
bodyData = (0, V2Coercion_js_1.coerceV2RequestData)(bodyData, spec.requestSchema);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
// Capture the caller's stack trace before the async boundary so errors can
|
||||
// include the user's call site, not just SDK internals.
|
||||
const callSiteStack = new Error().stack;
|
||||
const innerPromise = new Promise((resolve, reject) => {
|
||||
function requestCallback(err, response) {
|
||||
if (err) {
|
||||
(0, utils_js_1.attachCallSiteToError)(err, callSiteStack);
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
if (spec?.responseSchema) {
|
||||
(0, V2Coercion_js_1.coerceV2ResponseData)(response, spec.responseSchema);
|
||||
}
|
||||
resolve(spec?.transformResponseData
|
||||
? spec.transformResponseData(response)
|
||||
: response);
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
const emptyQuery = Object.keys(queryData).length === 0;
|
||||
const fullPath = [
|
||||
path,
|
||||
emptyQuery ? '' : '?',
|
||||
(0, utils_js_1.queryStringifyRequestData)(queryData),
|
||||
].join('');
|
||||
this._stripe._requestSender._request(requestMethod, host, fullPath, bodyData, processed.authenticator, {
|
||||
headers,
|
||||
settings: processed.settings,
|
||||
streaming,
|
||||
}, usage, requestCallback, this.requestDataProcessor?.bind(this));
|
||||
});
|
||||
// Attach auto-pagination methods for list/search endpoints
|
||||
if (spec?.methodType) {
|
||||
Object.assign(innerPromise, (0, autoPagination_js_1.makeAutoPaginationMethods)(this, params ? { ...params } : {}, options, requestMethod, path, spec, innerPromise));
|
||||
}
|
||||
return innerPromise;
|
||||
}
|
||||
}
|
||||
exports.StripeResource = StripeResource;
|
||||
StripeResource.MAX_BUFFERED_REQUEST_METRICS = 100;
|
||||
//# sourceMappingURL=StripeResource.js.map
|
||||
1
node_modules/stripe/cjs/StripeResource.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/StripeResource.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"StripeResource.js","sourceRoot":"","sources":["../src/StripeResource.ts"],"names":[],"mappings":"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"}
|
||||
191
node_modules/stripe/cjs/Types.d.ts
generated
vendored
Normal file
191
node_modules/stripe/cjs/Types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { HttpClientInterface, HttpClientResponseInterface } from './net/HttpClient.js';
|
||||
import { HttpClientResponseError } from './RequestSender.js';
|
||||
import { StripeContext } from './StripeContext.js';
|
||||
import { Stripe } from './stripe.core.js';
|
||||
import { AppInfo } from './lib.js';
|
||||
export type ApiMode = 'v1' | 'v2';
|
||||
export type BaseAddress = 'api' | 'files' | 'connect' | 'meter_events';
|
||||
export declare const DEFAULT_BASE_ADDRESSES: Record<BaseAddress, string>;
|
||||
export type BufferedFile = {
|
||||
name: string;
|
||||
type: string;
|
||||
file: {
|
||||
data: Uint8Array;
|
||||
};
|
||||
};
|
||||
export type V2RuntimeSchema = {
|
||||
kind: 'int64_string';
|
||||
} | {
|
||||
kind: 'decimal_string';
|
||||
} | {
|
||||
kind: 'object';
|
||||
fields: Record<string, V2RuntimeSchema>;
|
||||
} | {
|
||||
kind: 'array';
|
||||
element: V2RuntimeSchema;
|
||||
} | {
|
||||
kind: 'nullable';
|
||||
inner: V2RuntimeSchema;
|
||||
};
|
||||
export type MethodSpec = {
|
||||
method: string;
|
||||
methodType?: string;
|
||||
urlParams?: Array<string>;
|
||||
path?: string;
|
||||
fullPath?: string;
|
||||
encode?: (data: RequestData) => RequestData;
|
||||
validator?: (data: RequestData, options: {
|
||||
headers: RequestHeaders;
|
||||
}) => void;
|
||||
headers?: Record<string, string>;
|
||||
streaming?: boolean;
|
||||
apiBase?: BaseAddress;
|
||||
transformResponseData?: (response: HttpClientResponseInterface) => any;
|
||||
usage?: Array<string>;
|
||||
requestSchema?: V2RuntimeSchema;
|
||||
responseSchema?: V2RuntimeSchema;
|
||||
};
|
||||
export type MultipartRequestData = RequestData | StreamingFile | BufferedFile;
|
||||
export type RawErrorType = 'card_error' | 'invalid_request_error' | 'api_error' | 'idempotency_error' | 'rate_limit_error' | 'authentication_error' | 'invalid_grant' | 'invalid_client' | 'invalid_request' | 'invalid_scope' | 'unsupported_grant_type' | 'unsupported_response_type' | 'rate_limit' | 'temporary_session_expired';
|
||||
export type RequestArgs = Array<any>;
|
||||
export type StripeRequest = {
|
||||
host: string;
|
||||
port: string;
|
||||
path: string;
|
||||
method: string;
|
||||
headers: RequestHeaders;
|
||||
body: string;
|
||||
protocol: string;
|
||||
};
|
||||
export type RequestAuthenticator = (request: StripeRequest) => Promise<void>;
|
||||
export type RequestCallback = (this: void, error: Error | null, response?: any) => RequestCallbackReturn;
|
||||
export type RequestCallbackReturn = any;
|
||||
export type RequestData = Record<string, any>;
|
||||
export type RequestEvent = {
|
||||
api_version?: string;
|
||||
account?: string;
|
||||
idempotency_key?: string;
|
||||
method?: string;
|
||||
path?: string;
|
||||
body?: RequestData;
|
||||
request_start_time: number;
|
||||
usage?: Array<string>;
|
||||
};
|
||||
export type RequestHeaders = Record<string, string | number | string[]>;
|
||||
/**
|
||||
* this is similar but distinct from the user-facing `RequestOptions`
|
||||
*/
|
||||
export type InternalRequestOptions = {
|
||||
settings?: RequestSettings;
|
||||
streaming?: boolean;
|
||||
headers?: RequestHeaders;
|
||||
stripeContext?: string | StripeContext;
|
||||
stripeAccount?: string;
|
||||
};
|
||||
export type RequestOpts = {
|
||||
authenticator: RequestAuthenticator | null;
|
||||
requestMethod: string;
|
||||
requestPath: string;
|
||||
bodyData: RequestData | null;
|
||||
queryData: RequestData;
|
||||
headers: RequestHeaders;
|
||||
host: string | null;
|
||||
streaming: boolean;
|
||||
settings: RequestSettings;
|
||||
usage: Array<string>;
|
||||
};
|
||||
export type RequestSettings = {
|
||||
timeout?: number;
|
||||
maxNetworkRetries?: number;
|
||||
};
|
||||
export type ResponseEvent = {
|
||||
api_version?: string;
|
||||
account?: string;
|
||||
idempotency_key?: string;
|
||||
method?: string;
|
||||
path?: string;
|
||||
status?: number;
|
||||
request_id?: string;
|
||||
body?: Record<string, any> | string;
|
||||
elapsed: number;
|
||||
request_start_time?: number;
|
||||
request_end_time?: number;
|
||||
};
|
||||
export type ResponseHeaderValue = string | string[];
|
||||
export type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
||||
export type StreamingFile = {
|
||||
name: string;
|
||||
type: string;
|
||||
file: {
|
||||
data: EventEmitter;
|
||||
};
|
||||
};
|
||||
export type StripeRawError = {
|
||||
message?: string;
|
||||
user_message?: string;
|
||||
type?: RawErrorType;
|
||||
headers?: {
|
||||
[header: string]: string;
|
||||
};
|
||||
statusCode?: number;
|
||||
requestId?: string;
|
||||
code?: string;
|
||||
doc_url?: string;
|
||||
decline_code?: string;
|
||||
param?: string;
|
||||
detail?: string | Error | HttpClientResponseError;
|
||||
charge?: string;
|
||||
payment_method_type?: string;
|
||||
payment_intent?: any;
|
||||
payment_method?: any;
|
||||
setup_intent?: any;
|
||||
source?: any;
|
||||
exception?: any;
|
||||
};
|
||||
/**
|
||||
* Stripe-generated ways to affect how a request works.
|
||||
*/
|
||||
export type MakeRequestSpec = {
|
||||
methodType?: 'search' | 'list';
|
||||
streaming?: boolean;
|
||||
validator?: (data: RequestData, options: {
|
||||
headers: RequestHeaders;
|
||||
}) => void;
|
||||
headers?: Record<string, string>;
|
||||
apiBase?: BaseAddress;
|
||||
encode?: (data: RequestData) => RequestData;
|
||||
usage?: Array<string>;
|
||||
requestSchema?: V2RuntimeSchema;
|
||||
responseSchema?: V2RuntimeSchema;
|
||||
transformResponseData?: (response: HttpClientResponseInterface) => any;
|
||||
};
|
||||
export type StripeResourceObject = {
|
||||
_stripe: Stripe;
|
||||
basePath: UrlInterpolator;
|
||||
path: UrlInterpolator;
|
||||
resourcePath: string;
|
||||
initialize: (...args: Array<any>) => void;
|
||||
requestDataProcessor: null | RequestDataProcessor;
|
||||
_makeRequest(method: string, path: string, params: RequestData | undefined, options: import('./lib.js').RequestOptions | undefined, spec?: MakeRequestSpec): Promise<any>;
|
||||
};
|
||||
export type RequestDataProcessor = (method: string, data: RequestData | null, headers: RequestHeaders | undefined, prepareAndMakeRequest: (error: Error | null, data: string) => void) => void;
|
||||
export type UrlInterpolator = (params: Record<string, unknown>) => string;
|
||||
export type UserProvidedConfig = {
|
||||
authenticator?: RequestAuthenticator;
|
||||
apiVersion?: string;
|
||||
protocol?: string;
|
||||
host?: string;
|
||||
httpAgent?: any;
|
||||
timeout?: number;
|
||||
port?: string | number;
|
||||
maxNetworkRetries?: number;
|
||||
httpClient?: HttpClientInterface;
|
||||
stripeAccount?: string;
|
||||
stripeContext?: string | StripeContext;
|
||||
typescript?: boolean;
|
||||
telemetry?: boolean;
|
||||
emitEventBodies?: boolean;
|
||||
appInfo?: AppInfo;
|
||||
};
|
||||
10
node_modules/stripe/cjs/Types.js
generated
vendored
Normal file
10
node_modules/stripe/cjs/Types.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DEFAULT_BASE_ADDRESSES = void 0;
|
||||
exports.DEFAULT_BASE_ADDRESSES = {
|
||||
api: 'api.stripe.com',
|
||||
files: 'files.stripe.com',
|
||||
connect: 'connect.stripe.com',
|
||||
meter_events: 'meter-events.stripe.com',
|
||||
};
|
||||
//# sourceMappingURL=Types.js.map
|
||||
1
node_modules/stripe/cjs/Types.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/Types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":";;;AAgBa,QAAA,sBAAsB,GAAgC;IACjE,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,oBAAoB;IAC7B,YAAY,EAAE,yBAAyB;CACxC,CAAC"}
|
||||
17
node_modules/stripe/cjs/V2Coercion.d.ts
generated
vendored
Normal file
17
node_modules/stripe/cjs/V2Coercion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { V2RuntimeSchema } from './Types.js';
|
||||
/**
|
||||
* Coerces outbound V2 request data by converting bigint (or number)
|
||||
* int64_string fields to strings, matching the wire format expected by the API.
|
||||
*
|
||||
* Walks the schema tree and only touches fields that are marked as
|
||||
* int64_string. All other values are left unchanged.
|
||||
*/
|
||||
export declare const coerceV2RequestData: (data: unknown, schema: V2RuntimeSchema) => unknown;
|
||||
/**
|
||||
* Coerces inbound V2 response data by converting string int64_string fields
|
||||
* to bigints, matching the SDK's public type contract.
|
||||
*
|
||||
* Walks the schema tree and only touches fields that are marked as
|
||||
* int64_string. All other values are left unchanged.
|
||||
*/
|
||||
export declare const coerceV2ResponseData: (data: unknown, schema: V2RuntimeSchema) => unknown;
|
||||
110
node_modules/stripe/cjs/V2Coercion.js
generated
vendored
Normal file
110
node_modules/stripe/cjs/V2Coercion.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.coerceV2ResponseData = exports.coerceV2RequestData = void 0;
|
||||
const Decimal_js_1 = require("./Decimal.js");
|
||||
/**
|
||||
* Coerces outbound V2 request data by converting bigint (or number)
|
||||
* int64_string fields to strings, matching the wire format expected by the API.
|
||||
*
|
||||
* Walks the schema tree and only touches fields that are marked as
|
||||
* int64_string. All other values are left unchanged.
|
||||
*/
|
||||
const coerceV2RequestData = (data, schema) => {
|
||||
if (data == null) {
|
||||
return data;
|
||||
}
|
||||
switch (schema.kind) {
|
||||
case 'int64_string':
|
||||
return typeof data === 'bigint' || typeof data === 'number'
|
||||
? String(data)
|
||||
: data;
|
||||
case 'decimal_string':
|
||||
// Duck-type check: Decimal instances have toFixed() and isZero() methods.
|
||||
return typeof data.toFixed === 'function' &&
|
||||
typeof data.isZero === 'function'
|
||||
? data.toString()
|
||||
: data;
|
||||
case 'object': {
|
||||
if (typeof data !== 'object' || Array.isArray(data)) {
|
||||
return data;
|
||||
}
|
||||
const obj = data;
|
||||
const result = {};
|
||||
for (const key of Object.keys(obj)) {
|
||||
const fieldSchema = schema.fields[key];
|
||||
result[key] = fieldSchema
|
||||
? (0, exports.coerceV2RequestData)(obj[key], fieldSchema)
|
||||
: obj[key];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
case 'array': {
|
||||
if (!Array.isArray(data)) {
|
||||
return data;
|
||||
}
|
||||
return data.map((element) => (0, exports.coerceV2RequestData)(element, schema.element));
|
||||
}
|
||||
case 'nullable':
|
||||
return (0, exports.coerceV2RequestData)(data, schema.inner);
|
||||
}
|
||||
};
|
||||
exports.coerceV2RequestData = coerceV2RequestData;
|
||||
/**
|
||||
* Coerces inbound V2 response data by converting string int64_string fields
|
||||
* to bigints, matching the SDK's public type contract.
|
||||
*
|
||||
* Walks the schema tree and only touches fields that are marked as
|
||||
* int64_string. All other values are left unchanged.
|
||||
*/
|
||||
const coerceV2ResponseData = (data, schema) => {
|
||||
if (data == null) {
|
||||
return data;
|
||||
}
|
||||
switch (schema.kind) {
|
||||
case 'int64_string':
|
||||
if (typeof data === 'string') {
|
||||
try {
|
||||
return BigInt(data);
|
||||
}
|
||||
catch {
|
||||
throw new Error(`Failed to coerce int64_string value: expected an integer string, got '${data}'`);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
case 'decimal_string':
|
||||
if (typeof data === 'string') {
|
||||
try {
|
||||
return Decimal_js_1.Decimal.from(data);
|
||||
}
|
||||
catch {
|
||||
throw new Error(`Failed to coerce decimal_string value: expected a decimal string, got '${data}'`);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
case 'object': {
|
||||
if (typeof data !== 'object' || Array.isArray(data)) {
|
||||
return data;
|
||||
}
|
||||
const obj = data;
|
||||
for (const key of Object.keys(schema.fields)) {
|
||||
if (key in obj) {
|
||||
obj[key] = (0, exports.coerceV2ResponseData)(obj[key], schema.fields[key]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
case 'array': {
|
||||
if (!Array.isArray(data)) {
|
||||
return data;
|
||||
}
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
data[i] = (0, exports.coerceV2ResponseData)(data[i], schema.element);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
case 'nullable':
|
||||
return (0, exports.coerceV2ResponseData)(data, schema.inner);
|
||||
}
|
||||
};
|
||||
exports.coerceV2ResponseData = coerceV2ResponseData;
|
||||
//# sourceMappingURL=V2Coercion.js.map
|
||||
1
node_modules/stripe/cjs/V2Coercion.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/V2Coercion.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"V2Coercion.js","sourceRoot":"","sources":["../src/V2Coercion.ts"],"names":[],"mappings":"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"}
|
||||
37
node_modules/stripe/cjs/Webhooks.d.ts
generated
vendored
Normal file
37
node_modules/stripe/cjs/Webhooks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { CryptoProvider } from './crypto/CryptoProvider.js';
|
||||
import { PlatformFunctions } from './platform/PlatformFunctions.js';
|
||||
import { Event } from './resources/Events.js';
|
||||
/**
|
||||
* Value of the `stripe-signature` header from Stripe.
|
||||
* Typically a string.
|
||||
*
|
||||
* Note that this is typed to accept an array of strings
|
||||
* so that it works seamlessly with express's types,
|
||||
* but will throw if an array is passed in practice
|
||||
* since express should never return this header as an array,
|
||||
* only a string.
|
||||
*/
|
||||
type WebhookHeader = string | string[] | Uint8Array;
|
||||
type WebhookTestHeaderOptions = {
|
||||
timestamp?: number;
|
||||
payload: string;
|
||||
secret: string;
|
||||
scheme?: string;
|
||||
signature?: string;
|
||||
cryptoProvider?: CryptoProvider;
|
||||
};
|
||||
type WebhookPayload = string | Uint8Array;
|
||||
type WebhookSignatureObject = {
|
||||
verifyHeader: (encodedPayload: WebhookPayload, encodedHeader: WebhookHeader, secret: string, tolerance?: number, cryptoProvider?: CryptoProvider, receivedAt?: number) => boolean;
|
||||
verifyHeaderAsync: (encodedPayload: WebhookPayload, encodedHeader: WebhookHeader, secret: string, tolerance?: number, cryptoProvider?: CryptoProvider, receivedAt?: number) => Promise<boolean>;
|
||||
};
|
||||
export type WebhookObject = {
|
||||
DEFAULT_TOLERANCE: number;
|
||||
signature: WebhookSignatureObject | null;
|
||||
constructEvent: (payload: WebhookPayload, header: WebhookHeader, secret: string, tolerance?: number, cryptoProvider?: CryptoProvider, receivedAt?: number) => Event;
|
||||
constructEventAsync: (payload: WebhookPayload, header: WebhookHeader, secret: string, tolerance?: number, cryptoProvider?: CryptoProvider, receivedAt?: number) => Promise<Event>;
|
||||
generateTestHeaderString: (opts: WebhookTestHeaderOptions) => string;
|
||||
generateTestHeaderStringAsync: (opts: WebhookTestHeaderOptions) => Promise<string>;
|
||||
};
|
||||
export declare function createWebhooks(platformFunctions: PlatformFunctions): WebhookObject;
|
||||
export {};
|
||||
265
node_modules/stripe/cjs/Webhooks.js
generated
vendored
Normal file
265
node_modules/stripe/cjs/Webhooks.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createWebhooks = void 0;
|
||||
const Error_js_1 = require("./Error.js");
|
||||
const CryptoProvider_js_1 = require("./crypto/CryptoProvider.js");
|
||||
function createWebhooks(platformFunctions) {
|
||||
const Webhook = {
|
||||
DEFAULT_TOLERANCE: 300,
|
||||
signature: null,
|
||||
constructEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt) {
|
||||
try {
|
||||
if (!this.signature) {
|
||||
throw new Error('ERR: missing signature helper, unable to verify');
|
||||
}
|
||||
cryptoProvider = cryptoProvider || getCryptoProvider();
|
||||
this.signature.verifyHeader(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider, receivedAt);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof CryptoProvider_js_1.CryptoProviderOnlySupportsAsyncError) {
|
||||
e.message +=
|
||||
'\nUse `await constructEventAsync(...)` instead of `constructEvent(...)`';
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
const jsonPayload = payload instanceof Uint8Array
|
||||
? JSON.parse(new TextDecoder('utf8').decode(payload))
|
||||
: JSON.parse(payload);
|
||||
if (jsonPayload && jsonPayload.object === 'v2.core.event') {
|
||||
throw new Error('You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotification instead.');
|
||||
}
|
||||
return jsonPayload;
|
||||
},
|
||||
async constructEventAsync(payload, header, secret, tolerance, cryptoProvider, receivedAt) {
|
||||
if (!this.signature) {
|
||||
throw new Error('ERR: missing signature helper, unable to verify');
|
||||
}
|
||||
cryptoProvider = cryptoProvider || getCryptoProvider();
|
||||
await this.signature.verifyHeaderAsync(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider, receivedAt);
|
||||
const jsonPayload = payload instanceof Uint8Array
|
||||
? JSON.parse(new TextDecoder('utf8').decode(payload))
|
||||
: JSON.parse(payload);
|
||||
if (jsonPayload && jsonPayload.object === 'v2.core.event') {
|
||||
throw new Error('You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotificationAsync instead.');
|
||||
}
|
||||
return jsonPayload;
|
||||
},
|
||||
/**
|
||||
* Generates a header to be used for webhook mocking
|
||||
*
|
||||
* @typedef {object} opts
|
||||
* @property {number} timestamp - Timestamp of the header. Defaults to Date.now()
|
||||
* @property {string} payload - JSON stringified payload object, containing the 'id' and 'object' parameters
|
||||
* @property {string} secret - Stripe webhook secret 'whsec_...'
|
||||
* @property {string} scheme - Version of API to hit. Defaults to 'v1'.
|
||||
* @property {string} signature - Computed webhook signature
|
||||
* @property {CryptoProvider} cryptoProvider - Crypto provider to use for computing the signature if none was provided. Defaults to NodeCryptoProvider.
|
||||
*/
|
||||
generateTestHeaderString: function (opts) {
|
||||
const preparedOpts = prepareOptions(opts);
|
||||
const signature = preparedOpts.signature ||
|
||||
preparedOpts.cryptoProvider.computeHMACSignature(preparedOpts.payloadString, preparedOpts.secret);
|
||||
return preparedOpts.generateHeaderString(signature);
|
||||
},
|
||||
generateTestHeaderStringAsync: async function (opts) {
|
||||
const preparedOpts = prepareOptions(opts);
|
||||
const signature = preparedOpts.signature ||
|
||||
(await preparedOpts.cryptoProvider.computeHMACSignatureAsync(preparedOpts.payloadString, preparedOpts.secret));
|
||||
return preparedOpts.generateHeaderString(signature);
|
||||
},
|
||||
};
|
||||
const signature = {
|
||||
EXPECTED_SCHEME: 'v1',
|
||||
verifyHeader(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider, receivedAt) {
|
||||
const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
|
||||
const secretContainsWhitespace = /\s/.test(secret);
|
||||
cryptoProvider = cryptoProvider || getCryptoProvider();
|
||||
const expectedSignature = cryptoProvider.computeHMACSignature(makeHMACContent(payload, details), secret);
|
||||
/**
|
||||
* TODO(MAJOR): https://go/j/DEVSDK-3087
|
||||
* Passing in 0 by default skips timestamp tolerance verifications. Although it is mostly used in test,
|
||||
* we should change the default behavior to pass DEFAULT_TOLERANCE instead of 0 in the next major.
|
||||
*/
|
||||
validateComputedSignature(payload, header, details, expectedSignature, tolerance || 0, suspectPayloadType, secretContainsWhitespace, receivedAt);
|
||||
return true;
|
||||
},
|
||||
async verifyHeaderAsync(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider, receivedAt) {
|
||||
const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
|
||||
const secretContainsWhitespace = /\s/.test(secret);
|
||||
cryptoProvider = cryptoProvider || getCryptoProvider();
|
||||
const expectedSignature = await cryptoProvider.computeHMACSignatureAsync(makeHMACContent(payload, details), secret);
|
||||
/**
|
||||
* TODO(MAJOR): https://go/j/DEVSDK-3087
|
||||
* Passing in 0 by default skips timestamp tolerance verifications. Although it is mostly used in test,
|
||||
* we should change the default behavior to pass DEFAULT_TOLERANCE instead of 0 in the next major.
|
||||
*/
|
||||
return validateComputedSignature(payload, header, details, expectedSignature, tolerance || 0, suspectPayloadType, secretContainsWhitespace, receivedAt);
|
||||
},
|
||||
};
|
||||
function makeHMACContent(payload, details) {
|
||||
return `${details.timestamp}.${payload}`;
|
||||
}
|
||||
function parseEventDetails(encodedPayload, encodedHeader, expectedScheme) {
|
||||
// Express's type for `Request#headers` is `string | []string`
|
||||
// which is because the `set-cookie` header is an array,
|
||||
// but no other headers are an array (docs: https://nodejs.org/api/http.html#http_message_headers)
|
||||
// (Express's Request class is an extension of http.IncomingMessage, and doesn't appear to be relevantly modified: https://github.com/expressjs/express/blob/master/lib/request.js#L31)
|
||||
if (Array.isArray(encodedHeader)) {
|
||||
throw new Error('Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.');
|
||||
}
|
||||
if (!encodedPayload) {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(encodedHeader, encodedPayload, {
|
||||
message: 'No webhook payload was provided.',
|
||||
});
|
||||
}
|
||||
const suspectPayloadType = typeof encodedPayload != 'string' &&
|
||||
!(encodedPayload instanceof Uint8Array);
|
||||
const textDecoder = new TextDecoder('utf8');
|
||||
const decodedPayload = encodedPayload instanceof Uint8Array
|
||||
? textDecoder.decode(encodedPayload)
|
||||
: encodedPayload;
|
||||
if (encodedHeader == null || encodedHeader == '') {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(encodedHeader, encodedPayload, {
|
||||
message: 'No stripe-signature header value was provided.',
|
||||
});
|
||||
}
|
||||
const decodedHeader = encodedHeader instanceof Uint8Array
|
||||
? textDecoder.decode(encodedHeader)
|
||||
: encodedHeader;
|
||||
const details = parseHeader(decodedHeader, expectedScheme);
|
||||
if (!details || details.timestamp === -1) {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(decodedHeader, decodedPayload, {
|
||||
message: 'Unable to extract timestamp and signatures from header',
|
||||
});
|
||||
}
|
||||
if (!details.signatures.length) {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(decodedHeader, decodedPayload, {
|
||||
message: 'No signatures found with expected scheme',
|
||||
});
|
||||
}
|
||||
return {
|
||||
decodedPayload,
|
||||
decodedHeader,
|
||||
details,
|
||||
suspectPayloadType,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Validates that at least one signature in the parsed header matches the
|
||||
* expected signature, and that the event timestamp is within the allowed
|
||||
* {@link tolerance} window (in seconds). Set `tolerance` to `0` to skip
|
||||
* timestamp verification.
|
||||
*
|
||||
* TODO(MAJOR): https://go/j/DEVSDK-3087 - Change this default behavior to use DEFAULT_TOLERANCE instead of 0.
|
||||
* By default, validateComputedSignature doesn't perform timestamp verification.
|
||||
*
|
||||
* This method is mostly meant for tests or offline processing where the delivery time
|
||||
* of the event isn't important.
|
||||
* Integrations that process webhooks as they come in should use constructEvent method instead.
|
||||
*
|
||||
* @param payload The decoded webhook payload string.
|
||||
* @param header The decoded `stripe-signature` header value.
|
||||
* @param details Parsed header containing timestamp and signatures.
|
||||
* @param expectedSignature HMAC signature computed from the payload and secret.
|
||||
* @param tolerance Maximum allowed age of the event in seconds. Use 0 to skip timestamp tolerance verification.
|
||||
* @param suspectPayloadType Whether the payload was not a string or Buffer.
|
||||
* @param secretContainsWhitespace Whether the signing secret contains whitespace.
|
||||
* @param receivedAt - Timestamp for age calculation
|
||||
* @returns `true` if the signature and timestamp are valid.
|
||||
*
|
||||
* @throws {StripeSignatureVerificationError} If verification fails.
|
||||
*/
|
||||
function validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType, secretContainsWhitespace, receivedAt) {
|
||||
const signatureFound = !!details.signatures.filter(platformFunctions.secureCompare.bind(platformFunctions, expectedSignature)).length;
|
||||
const docsLocation = '\nLearn more about webhook signing and explore webhook integration examples for various frameworks at ' +
|
||||
'https://docs.stripe.com/webhooks/signature';
|
||||
const whitespaceMessage = secretContainsWhitespace
|
||||
? '\n\nNote: The provided signing secret contains whitespace. This often indicates an extra newline or space is in the value'
|
||||
: '';
|
||||
if (!signatureFound) {
|
||||
if (suspectPayloadType) {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(header, payload, {
|
||||
message: 'Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.' +
|
||||
'Payload was provided as a parsed JavaScript object instead. \n' +
|
||||
'Signature verification is impossible without access to the original signed material. \n' +
|
||||
docsLocation +
|
||||
'\n' +
|
||||
whitespaceMessage,
|
||||
});
|
||||
}
|
||||
throw new Error_js_1.StripeSignatureVerificationError(header, payload, {
|
||||
message: 'No signatures found matching the expected signature for payload.' +
|
||||
' Are you passing the raw request body you received from Stripe? \n' +
|
||||
' If a webhook request is being forwarded by a third-party tool,' +
|
||||
' ensure that the exact request body, including JSON formatting and new line style, is preserved.\n' +
|
||||
docsLocation +
|
||||
'\n' +
|
||||
whitespaceMessage,
|
||||
});
|
||||
}
|
||||
const timestampAge = Math.floor((typeof receivedAt === 'number' ? receivedAt : Date.now()) / 1000) - details.timestamp;
|
||||
if (tolerance > 0 && timestampAge > tolerance) {
|
||||
throw new Error_js_1.StripeSignatureVerificationError(header, payload, {
|
||||
message: 'Timestamp outside the tolerance zone',
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function parseHeader(header, scheme) {
|
||||
if (typeof header !== 'string') {
|
||||
return null;
|
||||
}
|
||||
scheme = scheme || signature.EXPECTED_SCHEME;
|
||||
return header.split(',').reduce((accum, item) => {
|
||||
const kv = item.split('=');
|
||||
if (kv[0] === 't') {
|
||||
accum.timestamp = parseInt(kv[1], 10);
|
||||
}
|
||||
if (kv[0] === scheme) {
|
||||
accum.signatures.push(kv[1]);
|
||||
}
|
||||
return accum;
|
||||
}, {
|
||||
timestamp: -1,
|
||||
signatures: [],
|
||||
});
|
||||
}
|
||||
let webhooksCryptoProviderInstance = null;
|
||||
/**
|
||||
* Lazily instantiate a CryptoProvider instance. This is a stateless object
|
||||
* so a singleton can be used here.
|
||||
*/
|
||||
function getCryptoProvider() {
|
||||
if (!webhooksCryptoProviderInstance) {
|
||||
webhooksCryptoProviderInstance = platformFunctions.createDefaultCryptoProvider();
|
||||
}
|
||||
return webhooksCryptoProviderInstance;
|
||||
}
|
||||
function prepareOptions(opts) {
|
||||
if (!opts) {
|
||||
throw new Error_js_1.StripeError({
|
||||
message: 'Options are required',
|
||||
});
|
||||
}
|
||||
const timestamp = (opts.timestamp && Math.floor(opts.timestamp)) ||
|
||||
Math.floor(Date.now() / 1000);
|
||||
const scheme = opts.scheme || signature.EXPECTED_SCHEME;
|
||||
const cryptoProvider = opts.cryptoProvider || getCryptoProvider();
|
||||
const payloadString = `${timestamp}.${opts.payload}`;
|
||||
const generateHeaderString = (signature) => {
|
||||
return `t=${timestamp},${scheme}=${signature}`;
|
||||
};
|
||||
return {
|
||||
...opts,
|
||||
timestamp,
|
||||
scheme,
|
||||
cryptoProvider,
|
||||
payloadString,
|
||||
generateHeaderString,
|
||||
};
|
||||
}
|
||||
Webhook.signature = signature;
|
||||
return Webhook;
|
||||
}
|
||||
exports.createWebhooks = createWebhooks;
|
||||
//# sourceMappingURL=Webhooks.js.map
|
||||
1
node_modules/stripe/cjs/Webhooks.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/Webhooks.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/stripe/cjs/apiVersion.d.ts
generated
vendored
Normal file
2
node_modules/stripe/cjs/apiVersion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const ApiVersion = "2026-05-27.dahlia";
|
||||
export declare const ApiMajorVersion = "dahlia";
|
||||
7
node_modules/stripe/cjs/apiVersion.js
generated
vendored
Normal file
7
node_modules/stripe/cjs/apiVersion.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApiMajorVersion = exports.ApiVersion = void 0;
|
||||
exports.ApiVersion = '2026-05-27.dahlia';
|
||||
exports.ApiMajorVersion = 'dahlia';
|
||||
//# sourceMappingURL=apiVersion.js.map
|
||||
1
node_modules/stripe/cjs/apiVersion.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/apiVersion.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"apiVersion.js","sourceRoot":"","sources":["../src/apiVersion.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAE1B,QAAA,UAAU,GAAG,mBAAmB,CAAC;AACjC,QAAA,eAAe,GAAG,QAAQ,CAAC"}
|
||||
25
node_modules/stripe/cjs/autoPagination.d.ts
generated
vendored
Normal file
25
node_modules/stripe/cjs/autoPagination.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { RequestData, StripeResourceObject, MakeRequestSpec } from './Types.js';
|
||||
import { RequestOptions } from './lib.js';
|
||||
type IterationDoneCallback = (err?: any, result?: any) => void;
|
||||
type IterationItemCallback<T> = (item: T, next: any) => void | boolean | Promise<void | boolean>;
|
||||
type AutoPagingEach<T> = (onItem: IterationItemCallback<T>, onDone?: IterationDoneCallback) => Promise<void>;
|
||||
type AutoPagingToArrayOptions = {
|
||||
limit?: number;
|
||||
};
|
||||
type AutoPagingToArray<T> = (opts: AutoPagingToArrayOptions, onDone: IterationDoneCallback) => Promise<Array<T>>;
|
||||
type AutoPaginationMethods<T> = {
|
||||
autoPagingEach: AutoPagingEach<T>;
|
||||
autoPagingToArray: AutoPagingToArray<T>;
|
||||
next: () => Promise<IteratorResult<T>>;
|
||||
return: () => void;
|
||||
};
|
||||
type PageResult<T> = {
|
||||
data: Array<T>;
|
||||
has_more: boolean;
|
||||
next_page?: string | null;
|
||||
next_page_url?: string | null;
|
||||
};
|
||||
export declare const makeAutoPaginationMethods: <TItem extends {
|
||||
id: string;
|
||||
}>(stripeResource: StripeResourceObject, params: RequestData, options: RequestOptions | undefined, method: string, path: string, spec: MakeRequestSpec | undefined, firstPagePromise: Promise<PageResult<TItem>>) => AutoPaginationMethods<TItem> | null;
|
||||
export {};
|
||||
339
node_modules/stripe/cjs/autoPagination.js
generated
vendored
Normal file
339
node_modules/stripe/cjs/autoPagination.js
generated
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeAutoPaginationMethods = void 0;
|
||||
const utils_js_1 = require("./utils.js");
|
||||
class V1Iterator {
|
||||
constructor(firstPagePromise, params, options, method, path, spec, stripeResource) {
|
||||
this.index = 0;
|
||||
this.pagePromise = firstPagePromise;
|
||||
this.promiseCache = { currentPromise: null };
|
||||
this.params = params;
|
||||
this.options = options;
|
||||
this.method = method;
|
||||
this.path = path;
|
||||
this.spec = spec;
|
||||
this.stripeResource = stripeResource;
|
||||
}
|
||||
async iterate(pageResult) {
|
||||
if (!(pageResult &&
|
||||
pageResult.data &&
|
||||
typeof pageResult.data.length === 'number')) {
|
||||
throw Error('Unexpected: Stripe API response does not have a well-formed `data` array.');
|
||||
}
|
||||
const reverseIteration = !!this.params.ending_before;
|
||||
if (this.index < pageResult.data.length) {
|
||||
const idx = reverseIteration
|
||||
? pageResult.data.length - 1 - this.index
|
||||
: this.index;
|
||||
const value = pageResult.data[idx];
|
||||
this.index += 1;
|
||||
return { value, done: false };
|
||||
}
|
||||
else if (pageResult.has_more) {
|
||||
// Reset counter, request next page, and recurse.
|
||||
this.index = 0;
|
||||
this.pagePromise = this.getNextPage(pageResult);
|
||||
const nextPageResult = await this.pagePromise;
|
||||
return this.iterate(nextPageResult);
|
||||
}
|
||||
return { done: true, value: undefined };
|
||||
}
|
||||
/** @abstract */
|
||||
getNextPage(_pageResult) {
|
||||
throw new Error('Unimplemented');
|
||||
}
|
||||
async _next() {
|
||||
return this.iterate(await this.pagePromise);
|
||||
}
|
||||
next() {
|
||||
/**
|
||||
* If a user calls `.next()` multiple times in parallel,
|
||||
* return the same result until something has resolved
|
||||
* to prevent page-turning race conditions.
|
||||
*/
|
||||
if (this.promiseCache.currentPromise) {
|
||||
return this.promiseCache.currentPromise;
|
||||
}
|
||||
const nextPromise = (async () => {
|
||||
const ret = await this._next();
|
||||
this.promiseCache.currentPromise = null;
|
||||
return ret;
|
||||
})();
|
||||
this.promiseCache.currentPromise = nextPromise;
|
||||
return nextPromise;
|
||||
}
|
||||
}
|
||||
class V1ListIterator extends V1Iterator {
|
||||
getNextPage(pageResult) {
|
||||
const reverseIteration = !!this.params.ending_before;
|
||||
const lastId = getLastId(pageResult, reverseIteration);
|
||||
const nextParams = {
|
||||
...this.params,
|
||||
[reverseIteration ? 'ending_before' : 'starting_after']: lastId,
|
||||
};
|
||||
return this.stripeResource._makeRequest(this.method, this.path, nextParams, this.options, this.spec);
|
||||
}
|
||||
}
|
||||
class V1SearchIterator extends V1Iterator {
|
||||
getNextPage(pageResult) {
|
||||
if (!pageResult.next_page) {
|
||||
throw Error('Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.');
|
||||
}
|
||||
const nextParams = {
|
||||
...this.params,
|
||||
page: pageResult.next_page,
|
||||
};
|
||||
return this.stripeResource._makeRequest(this.method, this.path, nextParams, this.options, this.spec);
|
||||
}
|
||||
}
|
||||
class V2ListIterator {
|
||||
constructor(firstPagePromise, options, spec, stripeResource) {
|
||||
this.firstPagePromise = firstPagePromise;
|
||||
this.currentPageIterator = null;
|
||||
this.nextPageUrl = null;
|
||||
this.promiseCache = { currentPromise: null };
|
||||
this.options = options;
|
||||
this.spec = spec;
|
||||
this.stripeResource = stripeResource;
|
||||
}
|
||||
async initFirstPage() {
|
||||
if (this.firstPagePromise) {
|
||||
const page = await this.firstPagePromise;
|
||||
this.firstPagePromise = null;
|
||||
this.currentPageIterator = page.data[Symbol.iterator]();
|
||||
this.nextPageUrl = page.next_page_url || null;
|
||||
}
|
||||
}
|
||||
async turnPage() {
|
||||
if (!this.nextPageUrl)
|
||||
return null;
|
||||
const page = await this.stripeResource._makeRequest('GET', this.nextPageUrl, undefined, this.options, this.spec);
|
||||
this.nextPageUrl = page.next_page_url || null;
|
||||
this.currentPageIterator = page.data[Symbol.iterator]();
|
||||
return this.currentPageIterator;
|
||||
}
|
||||
async _next() {
|
||||
await this.initFirstPage();
|
||||
if (this.currentPageIterator) {
|
||||
const result = this.currentPageIterator.next();
|
||||
if (!result.done)
|
||||
return { done: false, value: result.value };
|
||||
}
|
||||
return this.nextFromNewPage();
|
||||
}
|
||||
async nextFromNewPage() {
|
||||
const nextPageIterator = await this.turnPage();
|
||||
if (!nextPageIterator) {
|
||||
return { done: true, value: undefined };
|
||||
}
|
||||
const result = nextPageIterator.next();
|
||||
if (!result.done)
|
||||
return { done: false, value: result.value };
|
||||
// Empty intermediate page — recurse to try the next page.
|
||||
return this.nextFromNewPage();
|
||||
}
|
||||
next() {
|
||||
/**
|
||||
* If a user calls `.next()` multiple times in parallel,
|
||||
* return the same result until something has resolved
|
||||
* to prevent page-turning race conditions.
|
||||
*/
|
||||
if (this.promiseCache.currentPromise) {
|
||||
return this.promiseCache.currentPromise;
|
||||
}
|
||||
const nextPromise = (async () => {
|
||||
try {
|
||||
return await this._next();
|
||||
}
|
||||
finally {
|
||||
this.promiseCache.currentPromise = null;
|
||||
}
|
||||
})();
|
||||
this.promiseCache.currentPromise = nextPromise;
|
||||
return nextPromise;
|
||||
}
|
||||
}
|
||||
const makeAutoPaginationMethods = (stripeResource, params, options, method, path, spec, firstPagePromise) => {
|
||||
const apiMode = (0, utils_js_1.getAPIMode)(path);
|
||||
const methodType = spec?.methodType;
|
||||
if (apiMode !== 'v2' && methodType === 'search') {
|
||||
return makeAutoPaginationMethodsFromIterator(new V1SearchIterator(firstPagePromise, params, options, method, path, spec, stripeResource));
|
||||
}
|
||||
if (apiMode !== 'v2' && methodType === 'list') {
|
||||
return makeAutoPaginationMethodsFromIterator(new V1ListIterator(firstPagePromise, params, options, method, path, spec, stripeResource));
|
||||
}
|
||||
if (apiMode === 'v2' && methodType === 'list') {
|
||||
return makeAutoPaginationMethodsFromIterator(new V2ListIterator(firstPagePromise, options, spec, stripeResource));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.makeAutoPaginationMethods = makeAutoPaginationMethods;
|
||||
const makeAutoPaginationMethodsFromIterator = (iterator) => {
|
||||
const autoPagingEach = makeAutoPagingEach((...args) => iterator.next(...args));
|
||||
const autoPagingToArray = makeAutoPagingToArray(autoPagingEach);
|
||||
const autoPaginationMethods = {
|
||||
autoPagingEach,
|
||||
autoPagingToArray,
|
||||
// Async iterator functions:
|
||||
next: () => iterator.next(),
|
||||
return: () => {
|
||||
// This is required for `break`.
|
||||
return {};
|
||||
},
|
||||
[getAsyncIteratorSymbol()]: () => {
|
||||
return autoPaginationMethods;
|
||||
},
|
||||
};
|
||||
return autoPaginationMethods;
|
||||
};
|
||||
/**
|
||||
* ----------------
|
||||
* Private Helpers:
|
||||
* ----------------
|
||||
*/
|
||||
function getAsyncIteratorSymbol() {
|
||||
if (typeof Symbol !== 'undefined' && Symbol.asyncIterator) {
|
||||
return Symbol.asyncIterator;
|
||||
}
|
||||
// Follow the convention from libraries like iterall: https://github.com/leebyron/iterall#asynciterator-1
|
||||
return '@@asyncIterator';
|
||||
}
|
||||
function getDoneCallback(args) {
|
||||
if (args.length < 2) {
|
||||
return null;
|
||||
}
|
||||
const onDone = args[1];
|
||||
if (typeof onDone !== 'function') {
|
||||
throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof onDone}`);
|
||||
}
|
||||
return onDone;
|
||||
}
|
||||
/**
|
||||
* We allow four forms of the `onItem` callback (the middle two being equivalent),
|
||||
*
|
||||
* 1. `.autoPagingEach((item) => { doSomething(item); return false; });`
|
||||
* 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });`
|
||||
* 3. `.autoPagingEach((item) => doSomething(item).then(() => false));`
|
||||
* 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });`
|
||||
*
|
||||
* In addition to standard validation, this helper
|
||||
* coalesces the former forms into the latter form.
|
||||
*/
|
||||
function getItemCallback(args) {
|
||||
if (args.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const onItem = args[0];
|
||||
if (typeof onItem !== 'function') {
|
||||
throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof onItem}`);
|
||||
}
|
||||
// 4. `.autoPagingEach((item, next) => { doSomething(item); next(false); });`
|
||||
if (onItem.length === 2) {
|
||||
return onItem;
|
||||
}
|
||||
if (onItem.length > 2) {
|
||||
throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${onItem}`);
|
||||
}
|
||||
// This magically handles all three of these usecases (the latter two being functionally identical):
|
||||
// 1. `.autoPagingEach((item) => { doSomething(item); return false; });`
|
||||
// 2. `.autoPagingEach(async (item) => { await doSomething(item); return false; });`
|
||||
// 3. `.autoPagingEach((item) => doSomething(item).then(() => false));`
|
||||
return function _onItem(item, next) {
|
||||
const shouldContinue = onItem(item);
|
||||
next(shouldContinue);
|
||||
};
|
||||
}
|
||||
function getLastId(listResult, reverseIteration) {
|
||||
const lastIdx = reverseIteration ? 0 : listResult.data.length - 1;
|
||||
const lastItem = listResult.data[lastIdx];
|
||||
const lastId = lastItem && lastItem.id;
|
||||
if (!lastId) {
|
||||
throw Error('Unexpected: No `id` found on the last item while auto-paging a list.');
|
||||
}
|
||||
return lastId;
|
||||
}
|
||||
function makeAutoPagingEach(asyncIteratorNext) {
|
||||
return function autoPagingEach( /* onItem?, onDone? */) {
|
||||
// Capture the caller's stack before the async boundary. For paginated
|
||||
// requests, _makeRequest is called from autopagination internals, so the
|
||||
// stack it captures only contains SDK frames. We replace that here with
|
||||
// the true user call site.
|
||||
const callSiteStack = new Error().stack;
|
||||
const args = [].slice.call(arguments);
|
||||
const onItem = getItemCallback(args);
|
||||
const onDone = getDoneCallback(args);
|
||||
if (args.length > 2) {
|
||||
throw Error(`autoPagingEach takes up to two arguments; received ${args}`);
|
||||
}
|
||||
const autoPagePromise = wrapAsyncIteratorWithCallback(asyncIteratorNext,
|
||||
// @ts-ignore we might need a null check
|
||||
onItem).catch((err) => {
|
||||
(0, utils_js_1.attachCallSiteToError)(err, callSiteStack);
|
||||
throw err;
|
||||
});
|
||||
if (onDone) {
|
||||
autoPagePromise.then(() => onDone(), (err) => onDone(err));
|
||||
}
|
||||
return autoPagePromise;
|
||||
};
|
||||
}
|
||||
function makeAutoPagingToArray(autoPagingEach) {
|
||||
return function autoPagingToArray(opts, onDone) {
|
||||
const callSiteStack = new Error().stack;
|
||||
const limit = opts && opts.limit;
|
||||
if (!limit) {
|
||||
throw Error('You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`.');
|
||||
}
|
||||
if (limit > 10000) {
|
||||
throw Error('You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.');
|
||||
}
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const items = [];
|
||||
autoPagingEach((item) => {
|
||||
items.push(item);
|
||||
if (items.length >= limit) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
resolve(items);
|
||||
})
|
||||
.catch((err) => {
|
||||
(0, utils_js_1.attachCallSiteToError)(err, callSiteStack);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
if (onDone) {
|
||||
promise.then((items) => onDone(null, items), (err) => onDone(err));
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
}
|
||||
function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) {
|
||||
return new Promise((resolve, reject) => {
|
||||
function handleIteration(iterResult) {
|
||||
if (iterResult.done) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
const item = iterResult.value;
|
||||
return new Promise((next) => {
|
||||
// Bit confusing, perhaps; we pass a `resolve` fn
|
||||
// to the user, so they can decide when and if to continue.
|
||||
// They can return false, or a promise which resolves to false, to break.
|
||||
onItem(item, next);
|
||||
}).then((shouldContinue) => {
|
||||
if (shouldContinue === false) {
|
||||
return handleIteration({ done: true, value: undefined });
|
||||
}
|
||||
else {
|
||||
return asyncIteratorNext().then(handleIteration);
|
||||
}
|
||||
});
|
||||
}
|
||||
asyncIteratorNext()
|
||||
.then(handleIteration)
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=autoPagination.js.map
|
||||
1
node_modules/stripe/cjs/autoPagination.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/autoPagination.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
node_modules/stripe/cjs/crypto/CryptoProvider.d.ts
generated
vendored
Normal file
44
node_modules/stripe/cjs/crypto/CryptoProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Interface encapsulating the various crypto computations used by the library,
|
||||
* allowing pluggable underlying crypto implementations.
|
||||
*
|
||||
* Implementations can choose which methods they want to implement (eg. a
|
||||
* CryptoProvider can be used which only implements the asynchronous
|
||||
* versions of each crypto computation).
|
||||
*/
|
||||
export declare class CryptoProvider {
|
||||
/**
|
||||
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
|
||||
* The output HMAC should be encoded in hexadecimal.
|
||||
*
|
||||
* Sample values for implementations:
|
||||
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
|
||||
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
|
||||
*/
|
||||
computeHMACSignature(payload: string, secret: string): string;
|
||||
/**
|
||||
* Asynchronous version of `computeHMACSignature`. Some implementations may
|
||||
* only allow support async signature computation.
|
||||
*
|
||||
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
|
||||
* The output HMAC should be encoded in hexadecimal.
|
||||
*
|
||||
* Sample values for implementations:
|
||||
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
|
||||
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
|
||||
*/
|
||||
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
|
||||
/**
|
||||
* Computes a SHA-256 hash of the data.
|
||||
*/
|
||||
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
/**
|
||||
* If the crypto provider only supports asynchronous operations,
|
||||
* throw CryptoProviderOnlySupportsAsyncError instead of
|
||||
* a generic error so that the caller can choose to provide
|
||||
* a more helpful error message to direct the user to use
|
||||
* an asynchronous pathway.
|
||||
*/
|
||||
export declare class CryptoProviderOnlySupportsAsyncError extends Error {
|
||||
}
|
||||
56
node_modules/stripe/cjs/crypto/CryptoProvider.js
generated
vendored
Normal file
56
node_modules/stripe/cjs/crypto/CryptoProvider.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CryptoProviderOnlySupportsAsyncError = exports.CryptoProvider = void 0;
|
||||
/**
|
||||
* Interface encapsulating the various crypto computations used by the library,
|
||||
* allowing pluggable underlying crypto implementations.
|
||||
*
|
||||
* Implementations can choose which methods they want to implement (eg. a
|
||||
* CryptoProvider can be used which only implements the asynchronous
|
||||
* versions of each crypto computation).
|
||||
*/
|
||||
class CryptoProvider {
|
||||
/**
|
||||
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
|
||||
* The output HMAC should be encoded in hexadecimal.
|
||||
*
|
||||
* Sample values for implementations:
|
||||
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
|
||||
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
|
||||
*/
|
||||
computeHMACSignature(payload, secret) {
|
||||
throw new Error('computeHMACSignature not implemented.');
|
||||
}
|
||||
/**
|
||||
* Asynchronous version of `computeHMACSignature`. Some implementations may
|
||||
* only allow support async signature computation.
|
||||
*
|
||||
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
|
||||
* The output HMAC should be encoded in hexadecimal.
|
||||
*
|
||||
* Sample values for implementations:
|
||||
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
|
||||
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
|
||||
*/
|
||||
computeHMACSignatureAsync(payload, secret) {
|
||||
throw new Error('computeHMACSignatureAsync not implemented.');
|
||||
}
|
||||
/**
|
||||
* Computes a SHA-256 hash of the data.
|
||||
*/
|
||||
computeSHA256Async(data) {
|
||||
throw new Error('computeSHA256 not implemented.');
|
||||
}
|
||||
}
|
||||
exports.CryptoProvider = CryptoProvider;
|
||||
/**
|
||||
* If the crypto provider only supports asynchronous operations,
|
||||
* throw CryptoProviderOnlySupportsAsyncError instead of
|
||||
* a generic error so that the caller can choose to provide
|
||||
* a more helpful error message to direct the user to use
|
||||
* an asynchronous pathway.
|
||||
*/
|
||||
class CryptoProviderOnlySupportsAsyncError extends Error {
|
||||
}
|
||||
exports.CryptoProviderOnlySupportsAsyncError = CryptoProviderOnlySupportsAsyncError;
|
||||
//# sourceMappingURL=CryptoProvider.js.map
|
||||
1
node_modules/stripe/cjs/crypto/CryptoProvider.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/crypto/CryptoProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/CryptoProvider.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,MAAa,cAAc;IACzB;;;;;;;OAOG;IACH,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;OAUG;IACH,yBAAyB,CAAC,OAAe,EAAE,MAAc;QACvD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,IAAgB;QACjC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CACF;AAlCD,wCAkCC;AAED;;;;;;GAMG;AACH,MAAa,oCAAqC,SAAQ,KAAK;CAAG;AAAlE,oFAAkE"}
|
||||
12
node_modules/stripe/cjs/crypto/NodeCryptoProvider.d.ts
generated
vendored
Normal file
12
node_modules/stripe/cjs/crypto/NodeCryptoProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CryptoProvider } from './CryptoProvider.js';
|
||||
/**
|
||||
* `CryptoProvider which uses the Node `crypto` package for its computations.
|
||||
*/
|
||||
export declare class NodeCryptoProvider extends CryptoProvider {
|
||||
/** @override */
|
||||
computeHMACSignature(payload: string, secret: string): string;
|
||||
/** @override */
|
||||
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
|
||||
/** @override */
|
||||
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
31
node_modules/stripe/cjs/crypto/NodeCryptoProvider.js
generated
vendored
Normal file
31
node_modules/stripe/cjs/crypto/NodeCryptoProvider.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeCryptoProvider = void 0;
|
||||
const crypto = require("crypto");
|
||||
const CryptoProvider_js_1 = require("./CryptoProvider.js");
|
||||
/**
|
||||
* `CryptoProvider which uses the Node `crypto` package for its computations.
|
||||
*/
|
||||
class NodeCryptoProvider extends CryptoProvider_js_1.CryptoProvider {
|
||||
/** @override */
|
||||
computeHMACSignature(payload, secret) {
|
||||
return crypto
|
||||
.createHmac('sha256', secret)
|
||||
.update(payload, 'utf8')
|
||||
.digest('hex');
|
||||
}
|
||||
/** @override */
|
||||
async computeHMACSignatureAsync(payload, secret) {
|
||||
const signature = await this.computeHMACSignature(payload, secret);
|
||||
return signature;
|
||||
}
|
||||
/** @override */
|
||||
async computeSHA256Async(data) {
|
||||
return new Uint8Array(await crypto
|
||||
.createHash('sha256')
|
||||
.update(data)
|
||||
.digest());
|
||||
}
|
||||
}
|
||||
exports.NodeCryptoProvider = NodeCryptoProvider;
|
||||
//# sourceMappingURL=NodeCryptoProvider.js.map
|
||||
1
node_modules/stripe/cjs/crypto/NodeCryptoProvider.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/crypto/NodeCryptoProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NodeCryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/NodeCryptoProvider.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,2DAAmD;AAEnD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,kCAAc;IACpD,gBAAgB;IAChB,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,OAAO,MAAM;aACV,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;aAC5B,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;aACvB,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,yBAAyB,CAC7B,OAAe,EACf,MAAc;QAEd,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,kBAAkB,CAAC,IAAgB;QACvC,OAAO,IAAI,UAAU,CACnB,MAAM,MAAM;aACT,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,IAAI,CAAC;aACZ,MAAM,EAAE,CACZ,CAAC;IACJ,CAAC;CACF;AA3BD,gDA2BC"}
|
||||
16
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.d.ts
generated
vendored
Normal file
16
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { CryptoProvider } from './CryptoProvider.js';
|
||||
/**
|
||||
* `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
|
||||
*
|
||||
* This only supports asynchronous operations.
|
||||
*/
|
||||
export declare class SubtleCryptoProvider extends CryptoProvider {
|
||||
subtleCrypto: SubtleCrypto;
|
||||
constructor(subtleCrypto?: SubtleCrypto);
|
||||
/** @override */
|
||||
computeHMACSignature(payload: string, secret: string): string;
|
||||
/** @override */
|
||||
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
|
||||
/** @override */
|
||||
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
52
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.js
generated
vendored
Normal file
52
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SubtleCryptoProvider = void 0;
|
||||
const CryptoProvider_js_1 = require("./CryptoProvider.js");
|
||||
/**
|
||||
* `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
|
||||
*
|
||||
* This only supports asynchronous operations.
|
||||
*/
|
||||
class SubtleCryptoProvider extends CryptoProvider_js_1.CryptoProvider {
|
||||
constructor(subtleCrypto) {
|
||||
super();
|
||||
// If no subtle crypto is interface, default to the global namespace. This
|
||||
// is to allow custom interfaces (eg. using the Node webcrypto interface in
|
||||
// tests).
|
||||
this.subtleCrypto = subtleCrypto || crypto.subtle;
|
||||
}
|
||||
/** @override */
|
||||
computeHMACSignature(payload, secret) {
|
||||
throw new CryptoProvider_js_1.CryptoProviderOnlySupportsAsyncError('SubtleCryptoProvider cannot be used in a synchronous context.');
|
||||
}
|
||||
/** @override */
|
||||
async computeHMACSignatureAsync(payload, secret) {
|
||||
const encoder = new TextEncoder();
|
||||
const key = await this.subtleCrypto.importKey('raw', encoder.encode(secret), {
|
||||
name: 'HMAC',
|
||||
hash: { name: 'SHA-256' },
|
||||
}, false, ['sign']);
|
||||
const signatureBuffer = await this.subtleCrypto.sign('hmac', key, encoder.encode(payload));
|
||||
// crypto.subtle returns the signature in base64 format. This must be
|
||||
// encoded in hex to match the CryptoProvider contract. We map each byte in
|
||||
// the buffer to its corresponding hex octet and then combine into a string.
|
||||
const signatureBytes = new Uint8Array(signatureBuffer);
|
||||
const signatureHexCodes = new Array(signatureBytes.length);
|
||||
for (let i = 0; i < signatureBytes.length; i++) {
|
||||
signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];
|
||||
}
|
||||
return signatureHexCodes.join('');
|
||||
}
|
||||
/** @override */
|
||||
async computeSHA256Async(data) {
|
||||
return new Uint8Array(await this.subtleCrypto.digest('SHA-256', data));
|
||||
}
|
||||
}
|
||||
exports.SubtleCryptoProvider = SubtleCryptoProvider;
|
||||
// Cached mapping of byte to hex representation. We do this once to avoid re-
|
||||
// computing every time we need to convert the result of a signature to hex.
|
||||
const byteHexMapping = new Array(256);
|
||||
for (let i = 0; i < byteHexMapping.length; i++) {
|
||||
byteHexMapping[i] = i.toString(16).padStart(2, '0');
|
||||
}
|
||||
//# sourceMappingURL=SubtleCryptoProvider.js.map
|
||||
1
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SubtleCryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/SubtleCryptoProvider.ts"],"names":[],"mappings":";;;AAAA,2DAG6B;AAE7B;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,kCAAc;IAGtD,YAAY,YAA2B;QACrC,KAAK,EAAE,CAAC;QAER,0EAA0E;QAC1E,2EAA2E;QAC3E,UAAU;QACV,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC;IACpD,CAAC;IAED,gBAAgB;IAChB,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,MAAM,IAAI,wDAAoC,CAC5C,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,yBAAyB,CAC7B,OAAe,EACf,MAAc;QAEd,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAC3C,KAAK,EACL,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EACtB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;SACxB,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAClD,MAAM,EACN,GAAG,EACH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CACxB,CAAC;QAEF,qEAAqE;QACrE,2EAA2E;QAC3E,4EAA4E;QAC5E,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC;QACvD,MAAM,iBAAiB,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1D;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,kBAAkB,CAAC,IAAgB;QACvC,OAAO,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACzE,CAAC;CACF;AA5DD,oDA4DC;AAED,6EAA6E;AAC7E,4EAA4E;AAC5E,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IAC9C,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;CACrD"}
|
||||
318
node_modules/stripe/cjs/lib.d.ts
generated
vendored
Normal file
318
node_modules/stripe/cjs/lib.d.ts
generated
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { Agent } from 'http';
|
||||
import { RequestAuthenticator } from './Types.js';
|
||||
import { ApiVersion } from './apiVersion.js';
|
||||
import { HttpClientInterface } from './net/HttpClient.js';
|
||||
import { StripeContext } from './StripeContext.js';
|
||||
export declare class StripeResource {
|
||||
static MAX_BUFFERED_REQUEST_METRICS: number;
|
||||
}
|
||||
export type LatestApiVersion = typeof ApiVersion;
|
||||
export type HttpAgent = Agent;
|
||||
export type HttpProtocol = 'http' | 'https';
|
||||
export interface StripeConfig {
|
||||
/**
|
||||
* This library's types only reflect the latest API version.
|
||||
*
|
||||
* We recommend upgrading your account's API Version to the latest version
|
||||
* if you wish to use TypeScript with this library.
|
||||
*
|
||||
* If you wish to remain on your account's default API version,
|
||||
* you may pass `null` or another version instead of the latest version,
|
||||
* and add a `@ts-ignore` comment here and anywhere the types differ between API versions.
|
||||
*
|
||||
* @docs https://stripe.com/docs/api/versioning
|
||||
*/
|
||||
apiVersion?: LatestApiVersion;
|
||||
/**
|
||||
* Provide a custom authenticator function for all requests.
|
||||
* Cannot be used together with apiKey (the first constructor argument).
|
||||
*/
|
||||
authenticator?: RequestAuthenticator;
|
||||
/**
|
||||
* Optionally indicate that you are using TypeScript.
|
||||
* This currently has no runtime effect other than adding "TypeScript" to your user-agent.
|
||||
*/
|
||||
typescript?: true;
|
||||
/**
|
||||
* Specifies maximum number of automatic network retries (default 1).
|
||||
* Retries will be attempted with exponential backoff.
|
||||
* Retries can be disabled by setting this option to 0.
|
||||
* [Idempotency keys](https://stripe.com/docs/api/idempotent_requests) are added where appropriate to prevent duplication.
|
||||
* @docs https://github.com/stripe/stripe-node#network-retries
|
||||
*/
|
||||
maxNetworkRetries?: number;
|
||||
/**
|
||||
* Use a custom http(s) agent.
|
||||
* Useful for making requests through a proxy.
|
||||
*/
|
||||
httpAgent?: HttpAgent;
|
||||
/**
|
||||
* Use a custom http client, rather than relying on Node libraries.
|
||||
* Useful for making requests in contexts other than NodeJS (eg. using
|
||||
* `fetch`).
|
||||
*/
|
||||
httpClient?: HttpClientInterface;
|
||||
/**
|
||||
* Request timeout in milliseconds.
|
||||
* The default is 80000
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Specify the host to use for API Requests.
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* Specify the port to use for API Requests.
|
||||
*/
|
||||
port?: string | number;
|
||||
/**
|
||||
* Specify the HTTP protool to use for API Requests.
|
||||
*/
|
||||
protocol?: HttpProtocol;
|
||||
/**
|
||||
* Pass `telemetry: false` to disable headers that provide Stripe
|
||||
* with data about usage of the API.
|
||||
* Currently, the only telemetry we send is latency metrics.
|
||||
*/
|
||||
telemetry?: boolean;
|
||||
/**
|
||||
* Pass `emitEventBodies: true` to include request and response bodies
|
||||
* in the `request` and `response` events emitted by the Stripe client.
|
||||
* Bodies may contain sensitive data. Defaults to false.
|
||||
*/
|
||||
emitEventBodies?: boolean;
|
||||
/**
|
||||
* For plugin authors to identify their code.
|
||||
* @docs https://stripe.com/docs/building-plugins?lang=node#setappinfo
|
||||
*/
|
||||
appInfo?: AppInfo;
|
||||
/**
|
||||
* An account id on whose behalf you wish to make every request.
|
||||
*/
|
||||
stripeAccount?: string;
|
||||
/**
|
||||
* An account on whose behalf you wish to make every request. See https://docs.stripe.com/context for more information.
|
||||
*/
|
||||
stripeContext?: string | StripeContext;
|
||||
}
|
||||
export interface RequestOptions {
|
||||
/**
|
||||
* Use a specific API Key for this request.
|
||||
* For Connect, we recommend using `stripeContext` instead.
|
||||
*/
|
||||
apiKey?: string;
|
||||
/**
|
||||
* See the [idempotency key docs](https://stripe.com/docs/api/idempotent_requests).
|
||||
*/
|
||||
idempotencyKey?: string;
|
||||
/**
|
||||
* An account id on whose behalf you wish to make a request.
|
||||
*
|
||||
* NOTE: prefer sending `stripeContext` instead of `stripeAccount` for new code. They're currently identical, but we will eventually discourage and (later) drop support for `stripeAccount`.
|
||||
*/
|
||||
stripeAccount?: string;
|
||||
/**
|
||||
* An account on whose behalf you wish to make a request. See https://docs.stripe.com/context for more information.
|
||||
*/
|
||||
stripeContext?: string | StripeContext;
|
||||
/**
|
||||
* The [API Version](https://stripe.com/docs/upgrades) to use for a given request (e.g., '2020-03-02').
|
||||
*/
|
||||
apiVersion?: string;
|
||||
/**
|
||||
* Specify the number of requests to retry in event of error.
|
||||
* This overrides a default set on the Stripe object's config argument.
|
||||
*/
|
||||
maxNetworkRetries?: number;
|
||||
/**
|
||||
* Specify a timeout for this request in milliseconds.
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Provide a custom authenticator function for this request.
|
||||
*/
|
||||
authenticator?: import('./Types.js').RequestAuthenticator;
|
||||
/**
|
||||
* Specify additional request headers.
|
||||
*/
|
||||
headers?: {
|
||||
[headerName: string]: string;
|
||||
};
|
||||
/**
|
||||
* Whether to stream the response body.
|
||||
*/
|
||||
streaming?: boolean;
|
||||
}
|
||||
export type RawRequestOptions = RequestOptions & {
|
||||
/**
|
||||
* Specify additional request headers. This is an experimental interface and is not yet stable.
|
||||
*/
|
||||
additionalHeaders?: {
|
||||
[headerName: string]: string;
|
||||
};
|
||||
/**
|
||||
* Specify which Stripe API base address to send this request to.
|
||||
* Allowed values: 'api', 'files', 'connect', 'meter_events'.
|
||||
*/
|
||||
apiBase?: 'api' | 'files' | 'connect' | 'meter_events';
|
||||
};
|
||||
export type Response<T> = T & {
|
||||
lastResponse: {
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
requestId: string;
|
||||
statusCode: number;
|
||||
apiVersion?: string;
|
||||
idempotencyKey?: string;
|
||||
stripeAccount?: string;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* A container for paginated lists of objects.
|
||||
* The array of objects is on the `.data` property,
|
||||
* and `.has_more` indicates whether there are additional objects beyond the end of this list.
|
||||
*
|
||||
* Learn more in Stripe's [pagination docs](https://stripe.com/docs/api/pagination?lang=node)
|
||||
* or, when iterating over many items, try [auto-pagination](https://github.com/stripe/stripe-node#auto-pagination) instead.
|
||||
*/
|
||||
export interface ApiList<T> {
|
||||
object: 'list';
|
||||
data: Array<T>;
|
||||
/**
|
||||
* True if this list has another page of items after this one that can be fetched.
|
||||
*/
|
||||
has_more: boolean;
|
||||
/**
|
||||
* The URL where this list can be accessed.
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
export interface ApiListPromise<T> extends Promise<Response<ApiList<T>>>, AsyncIterableIterator<T> {
|
||||
autoPagingEach(handler: (item: T) => boolean | void | Promise<boolean | void>, onDone?: (err: any) => void): Promise<void>;
|
||||
autoPagingToArray(opts: {
|
||||
limit: number;
|
||||
}, onDone?: (err: any) => void): Promise<Array<T>>;
|
||||
}
|
||||
/**
|
||||
* A container for paginated lists of V2 API objects.
|
||||
* The array of objects is on the `.data` property,
|
||||
* and `.next_page_url` provides the URL for the next page of results.
|
||||
*
|
||||
* Learn more in Stripe's [V2 list pagination docs](https://docs.stripe.com/api-v2-overview#list-pagination)
|
||||
* or, when iterating over many items, try [auto-pagination](https://github.com/stripe/stripe-node#auto-pagination) instead.
|
||||
*
|
||||
*/
|
||||
export interface V2List<T> {
|
||||
data: Array<T>;
|
||||
/**
|
||||
* The URL for the next page of results, or `null` if there are no more results.
|
||||
*/
|
||||
next_page_url: string | null;
|
||||
/**
|
||||
* The URL for the previous page of results, or `null` if this is the first page.
|
||||
*/
|
||||
previous_page_url: string | null;
|
||||
/**
|
||||
* TODO(DEVSDK-2534): remove these properties in our next major release.
|
||||
* these deprecated properties were copied from ApiList<T> to not break
|
||||
* existing code. these properties will continue to be not populated at
|
||||
* runtime.
|
||||
*/
|
||||
/**
|
||||
* @deprecated This property is not populated at runtime for v2 lists
|
||||
*/
|
||||
object: 'list';
|
||||
/**
|
||||
* True if this list has another page of items after this one that can be fetched.
|
||||
*
|
||||
* @deprecated This property is not populated at runtime for v2 lists
|
||||
*/
|
||||
has_more: boolean;
|
||||
/**
|
||||
* The URL where this list can be accessed.
|
||||
* @deprecated This property is not populated at runtime for v2 lists
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
export interface V2ListPromise<T> extends Promise<Response<V2List<T>>>, AsyncIterableIterator<T> {
|
||||
autoPagingEach(handler: (item: T) => boolean | void | Promise<boolean | void>, onDone?: (err: any) => void): Promise<void>;
|
||||
autoPagingToArray(opts: {
|
||||
limit: number;
|
||||
}, onDone?: (err: any) => void): Promise<Array<T>>;
|
||||
}
|
||||
/**
|
||||
* A container for paginated lists of search results.
|
||||
* The array of objects is on the `.data` property,
|
||||
* and `.has_more` indicates whether there are additional objects beyond the end of this list.
|
||||
* The `.next_page` field can be used to paginate forwards.
|
||||
*
|
||||
* Please note, ApiSearchResult<T> is beta functionality and is subject to change/removal
|
||||
* at any time.
|
||||
*/
|
||||
export interface ApiSearchResult<T> {
|
||||
object: 'search_result';
|
||||
data: Array<T>;
|
||||
/**
|
||||
* True if this list has another page of items after this one that can be fetched.
|
||||
*/
|
||||
has_more: boolean;
|
||||
/**
|
||||
* The URL where this list can be accessed.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The page token to use to get the next page of results. If `has_more` is
|
||||
* true, this will be set to a concrete string value.
|
||||
*/
|
||||
next_page: string | null;
|
||||
/**
|
||||
* The total number of search results. Only present when `expand` request
|
||||
* parameter contains `total_count`.
|
||||
*/
|
||||
total_count?: number;
|
||||
}
|
||||
export interface ApiSearchResultPromise<T> extends Promise<Response<ApiSearchResult<T>>>, AsyncIterableIterator<T> {
|
||||
autoPagingEach(handler: (item: T) => boolean | void | Promise<boolean | void>): Promise<void>;
|
||||
autoPagingToArray(opts: {
|
||||
limit: number;
|
||||
}): Promise<Array<T>>;
|
||||
}
|
||||
export type StripeStreamResponse = NodeJS.ReadableStream;
|
||||
export interface RequestEvent {
|
||||
api_version: string;
|
||||
account?: string;
|
||||
idempotency_key?: string;
|
||||
method: string;
|
||||
path: string;
|
||||
request_start_time: number;
|
||||
}
|
||||
export interface ResponseEvent {
|
||||
api_version: string;
|
||||
account?: string;
|
||||
idempotency_key?: string;
|
||||
method: string;
|
||||
path: string;
|
||||
status: number;
|
||||
request_id: string;
|
||||
elapsed: number;
|
||||
request_start_time: number;
|
||||
request_end_time: number;
|
||||
}
|
||||
/**
|
||||
* Identify your plugin.
|
||||
* @docs https://stripe.com/docs/building-plugins?lang=node#setappinfo
|
||||
*/
|
||||
export interface AppInfo {
|
||||
name: string;
|
||||
partner_id?: string;
|
||||
url?: string;
|
||||
version?: string;
|
||||
}
|
||||
export interface FileData {
|
||||
data: string | Uint8Array;
|
||||
name?: string;
|
||||
type?: string;
|
||||
}
|
||||
3
node_modules/stripe/cjs/lib.js
generated
vendored
Normal file
3
node_modules/stripe/cjs/lib.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=lib.js.map
|
||||
1
node_modules/stripe/cjs/lib.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/lib.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":""}
|
||||
5
node_modules/stripe/cjs/multipart.d.ts
generated
vendored
Normal file
5
node_modules/stripe/cjs/multipart.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { RequestData, RequestHeaders, StripeResourceObject } from './Types.js';
|
||||
type MultipartCallbackReturn = any;
|
||||
type MultipartCallback = (error: Error | null, data: Uint8Array | string | null) => MultipartCallbackReturn;
|
||||
export declare function multipartRequestDataProcessor(this: StripeResourceObject, method: string, data: RequestData, headers: RequestHeaders, callback: MultipartCallback): MultipartCallbackReturn;
|
||||
export {};
|
||||
62
node_modules/stripe/cjs/multipart.js
generated
vendored
Normal file
62
node_modules/stripe/cjs/multipart.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.multipartRequestDataProcessor = void 0;
|
||||
const utils_js_1 = require("./utils.js");
|
||||
// Method for formatting HTTP body for the multipart/form-data specification
|
||||
// Mostly taken from Fermata.js
|
||||
// https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343
|
||||
const multipartDataGenerator = (method, data, headers) => {
|
||||
const segno = (Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16)).toString();
|
||||
headers['Content-Type'] = `multipart/form-data; boundary=${segno}`;
|
||||
const textEncoder = new TextEncoder();
|
||||
let buffer = new Uint8Array(0);
|
||||
const endBuffer = textEncoder.encode('\r\n');
|
||||
function push(l) {
|
||||
const prevBuffer = buffer;
|
||||
const newBuffer = l instanceof Uint8Array ? l : new Uint8Array(textEncoder.encode(l));
|
||||
buffer = new Uint8Array(prevBuffer.length + newBuffer.length + 2);
|
||||
buffer.set(prevBuffer);
|
||||
buffer.set(newBuffer, prevBuffer.length);
|
||||
buffer.set(endBuffer, buffer.length - 2);
|
||||
}
|
||||
function q(s) {
|
||||
return `"${s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ')}"`;
|
||||
}
|
||||
const flattenedData = (0, utils_js_1.flattenAndStringify)(data);
|
||||
for (const k in flattenedData) {
|
||||
if (!Object.prototype.hasOwnProperty.call(flattenedData, k)) {
|
||||
continue;
|
||||
}
|
||||
const v = flattenedData[k];
|
||||
push(`--${segno}`);
|
||||
if (Object.prototype.hasOwnProperty.call(v, 'data')) {
|
||||
const typedEntry = v;
|
||||
push(`Content-Disposition: form-data; name=${q(k)}; filename=${q(typedEntry.name || 'blob')}`);
|
||||
push(`Content-Type: ${typedEntry.type || 'application/octet-stream'}`);
|
||||
push('');
|
||||
push(typedEntry.data);
|
||||
}
|
||||
else {
|
||||
push(`Content-Disposition: form-data; name=${q(k)}`);
|
||||
push('');
|
||||
push(v);
|
||||
}
|
||||
}
|
||||
push(`--${segno}--`);
|
||||
return buffer;
|
||||
};
|
||||
function multipartRequestDataProcessor(method, data, headers, callback) {
|
||||
data = data || {};
|
||||
if (method !== 'POST') {
|
||||
return callback(null, (0, utils_js_1.queryStringifyRequestData)(data));
|
||||
}
|
||||
this._stripe._platformFunctions
|
||||
.tryBufferData(data)
|
||||
.then((bufferedData) => {
|
||||
const buffer = multipartDataGenerator(method, bufferedData, headers);
|
||||
return callback(null, buffer);
|
||||
})
|
||||
.catch((err) => callback(err, null));
|
||||
}
|
||||
exports.multipartRequestDataProcessor = multipartRequestDataProcessor;
|
||||
//# sourceMappingURL=multipart.js.map
|
||||
1
node_modules/stripe/cjs/multipart.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/multipart.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../src/multipart.ts"],"names":[],"mappings":"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"}
|
||||
27
node_modules/stripe/cjs/net/FetchHttpClient.d.ts
generated
vendored
Normal file
27
node_modules/stripe/cjs/net/FetchHttpClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { RequestHeaders, ResponseHeaders } from '../Types.js';
|
||||
import { HttpClient, HttpClientResponse, FetchHttpClientInterface, FetchHttpClientResponseInterface } from './HttpClient.js';
|
||||
/**
|
||||
* HTTP client which uses a `fetch` function to issue requests.
|
||||
*
|
||||
* By default relies on the global `fetch` function, but an optional function
|
||||
* can be passed in. If passing in a function, it is expected to match the Web
|
||||
* Fetch API. As an example, this could be the function provided by the
|
||||
* node-fetch package (https://github.com/node-fetch/node-fetch).
|
||||
*/
|
||||
export declare class FetchHttpClient extends HttpClient implements FetchHttpClientInterface {
|
||||
private readonly _fetchFn;
|
||||
constructor(fetchFn?: typeof fetch);
|
||||
private static makeFetchWithRaceTimeout;
|
||||
private static makeFetchWithAbortTimeout;
|
||||
/** @override. */
|
||||
getClientName(): string;
|
||||
makeRequest(host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number): Promise<FetchHttpClientResponseInterface>;
|
||||
}
|
||||
export declare class FetchHttpClientResponse extends HttpClientResponse implements FetchHttpClientResponseInterface {
|
||||
_res: Response;
|
||||
constructor(res: Response);
|
||||
getRawResponse(): Response;
|
||||
toStream(streamCompleteCallback: () => void): ReadableStream<Uint8Array> | null;
|
||||
toJSON(): Promise<any>;
|
||||
static _transformHeadersToObject(headers: Headers): ResponseHeaders;
|
||||
}
|
||||
159
node_modules/stripe/cjs/net/FetchHttpClient.js
generated
vendored
Normal file
159
node_modules/stripe/cjs/net/FetchHttpClient.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FetchHttpClientResponse = exports.FetchHttpClient = void 0;
|
||||
const utils_js_1 = require("../utils.js");
|
||||
const HttpClient_js_1 = require("./HttpClient.js");
|
||||
/**
|
||||
* HTTP client which uses a `fetch` function to issue requests.
|
||||
*
|
||||
* By default relies on the global `fetch` function, but an optional function
|
||||
* can be passed in. If passing in a function, it is expected to match the Web
|
||||
* Fetch API. As an example, this could be the function provided by the
|
||||
* node-fetch package (https://github.com/node-fetch/node-fetch).
|
||||
*/
|
||||
class FetchHttpClient extends HttpClient_js_1.HttpClient {
|
||||
constructor(fetchFn) {
|
||||
super();
|
||||
// Default to global fetch if available
|
||||
if (!fetchFn) {
|
||||
if (!globalThis.fetch) {
|
||||
throw new Error('fetch() function not provided and is not defined in the global scope. ' +
|
||||
'You must provide a fetch implementation.');
|
||||
}
|
||||
fetchFn = globalThis.fetch;
|
||||
}
|
||||
// Both timeout behaviors differs from Node:
|
||||
// - Fetch uses a single timeout for the entire length of the request.
|
||||
// - Node is more fine-grained and resets the timeout after each stage of the request.
|
||||
if (globalThis.AbortController) {
|
||||
// Utilise native AbortController if available
|
||||
// AbortController was added in Node v15.0.0, v14.17.0
|
||||
this._fetchFn = FetchHttpClient.makeFetchWithAbortTimeout(fetchFn);
|
||||
}
|
||||
else {
|
||||
// Fall back to racing against a timeout promise if not available in the runtime
|
||||
// This does not actually cancel the underlying fetch operation or resources
|
||||
this._fetchFn = FetchHttpClient.makeFetchWithRaceTimeout(fetchFn);
|
||||
}
|
||||
}
|
||||
static makeFetchWithRaceTimeout(fetchFn) {
|
||||
return (url, init, timeout) => {
|
||||
let pendingTimeoutId;
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
pendingTimeoutId = setTimeout(() => {
|
||||
pendingTimeoutId = null;
|
||||
reject(HttpClient_js_1.HttpClient.makeTimeoutError());
|
||||
}, timeout);
|
||||
});
|
||||
const fetchPromise = fetchFn(url, init);
|
||||
return Promise.race([fetchPromise, timeoutPromise]).finally(() => {
|
||||
if (pendingTimeoutId) {
|
||||
clearTimeout(pendingTimeoutId);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
static makeFetchWithAbortTimeout(fetchFn) {
|
||||
return async (url, init, timeout) => {
|
||||
// Use AbortController because AbortSignal.timeout() was added later in Node v17.3.0, v16.14.0
|
||||
const abort = new AbortController();
|
||||
let timeoutId = setTimeout(() => {
|
||||
timeoutId = null;
|
||||
abort.abort(HttpClient_js_1.HttpClient.makeTimeoutError());
|
||||
}, timeout);
|
||||
try {
|
||||
return await fetchFn(url, {
|
||||
...init,
|
||||
signal: abort.signal,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
// Some implementations, like node-fetch, do not respect the reason passed to AbortController.abort()
|
||||
// and instead it always throws an AbortError
|
||||
// We catch this case to normalise all timeout errors
|
||||
if (err.name === 'AbortError') {
|
||||
throw HttpClient_js_1.HttpClient.makeTimeoutError();
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
/** @override. */
|
||||
getClientName() {
|
||||
return 'fetch';
|
||||
}
|
||||
async makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
|
||||
const isInsecureConnection = protocol === 'http';
|
||||
if (!path.startsWith('/')) {
|
||||
throw new Error(`Only relative paths are supported, got: "${path}"`);
|
||||
}
|
||||
const url = new URL(`${isInsecureConnection ? 'http' : 'https'}://${host}${path}`);
|
||||
url.port = port;
|
||||
// For methods which expect payloads, we should always pass a body value
|
||||
// even when it is empty. Without this, some JS runtimes (eg. Deno) will
|
||||
// inject a second Content-Length header. See https://github.com/stripe/stripe-node/issues/1519
|
||||
// for more details.
|
||||
const methodHasPayload = method == 'POST' || method == 'PUT' || method == 'PATCH';
|
||||
const body = requestData || (methodHasPayload ? '' : undefined);
|
||||
const res = await this._fetchFn(url.toString(), {
|
||||
method,
|
||||
headers: (0, utils_js_1.parseHeadersForFetch)(headers),
|
||||
body: body,
|
||||
}, timeout);
|
||||
return new FetchHttpClientResponse(res);
|
||||
}
|
||||
}
|
||||
exports.FetchHttpClient = FetchHttpClient;
|
||||
class FetchHttpClientResponse extends HttpClient_js_1.HttpClientResponse {
|
||||
constructor(res) {
|
||||
super(res.status, FetchHttpClientResponse._transformHeadersToObject(res.headers));
|
||||
this._res = res;
|
||||
}
|
||||
getRawResponse() {
|
||||
return this._res;
|
||||
}
|
||||
toStream(streamCompleteCallback) {
|
||||
// Unfortunately `fetch` does not have event handlers for when the stream is
|
||||
// completely read. We therefore invoke the streamCompleteCallback right
|
||||
// away. This callback emits a response event with metadata and completes
|
||||
// metrics, so it's ok to do this without waiting for the stream to be
|
||||
// completely read.
|
||||
streamCompleteCallback();
|
||||
// Fetch's `body` property is expected to be a readable stream of the body.
|
||||
return this._res.body;
|
||||
}
|
||||
toJSON() {
|
||||
return this._res.text().then((text) => {
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error) {
|
||||
e.rawBody = text;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
static _transformHeadersToObject(headers) {
|
||||
// Fetch uses a Headers instance so this must be converted to a barebones
|
||||
// JS object to meet the HttpClient interface.
|
||||
const headersObj = {};
|
||||
for (const entry of headers) {
|
||||
if (!Array.isArray(entry) || entry.length != 2) {
|
||||
throw new Error('Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.');
|
||||
}
|
||||
headersObj[entry[0]] = entry[1];
|
||||
}
|
||||
return headersObj;
|
||||
}
|
||||
}
|
||||
exports.FetchHttpClientResponse = FetchHttpClientResponse;
|
||||
//# sourceMappingURL=FetchHttpClient.js.map
|
||||
1
node_modules/stripe/cjs/net/FetchHttpClient.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/net/FetchHttpClient.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FetchHttpClient.js","sourceRoot":"","sources":["../../src/net/FetchHttpClient.ts"],"names":[],"mappings":"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"}
|
||||
63
node_modules/stripe/cjs/net/HttpClient.d.ts
generated
vendored
Normal file
63
node_modules/stripe/cjs/net/HttpClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/// <reference types="node" />
|
||||
import { RequestHeaders, ResponseHeaders } from '../Types.js';
|
||||
type TimeoutError = TypeError & {
|
||||
code?: string;
|
||||
};
|
||||
export interface HttpClientInterface {
|
||||
getClientName: () => string;
|
||||
makeRequest: (host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number) => Promise<HttpClientResponseInterface>;
|
||||
}
|
||||
export interface HttpClientResponseInterface {
|
||||
getStatusCode: () => number;
|
||||
getHeaders: () => ResponseHeaders;
|
||||
getRawResponse: () => unknown;
|
||||
toStream: (streamCompleteCallback: () => void) => unknown;
|
||||
toJSON: () => Promise<any>;
|
||||
}
|
||||
/**
|
||||
* Interface for Node HTTP client with Node-specific stream types.
|
||||
*/
|
||||
export interface NodeHttpClientInterface extends HttpClientInterface {
|
||||
makeRequest: (host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number) => Promise<NodeHttpClientResponseInterface>;
|
||||
}
|
||||
export interface NodeHttpClientResponseInterface extends HttpClientResponseInterface {
|
||||
toStream: (streamCompleteCallback: () => void) => NodeJS.ReadableStream;
|
||||
}
|
||||
/**
|
||||
* Interface for Fetch HTTP client with Web Streams API types.
|
||||
*/
|
||||
export interface FetchHttpClientInterface extends HttpClientInterface {
|
||||
makeRequest: (host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number) => Promise<FetchHttpClientResponseInterface>;
|
||||
}
|
||||
export interface FetchHttpClientResponseInterface extends HttpClientResponseInterface {
|
||||
toStream: (streamCompleteCallback: () => void) => ReadableStream<Uint8Array> | null;
|
||||
}
|
||||
/**
|
||||
* Encapsulates the logic for issuing a request to the Stripe API.
|
||||
*
|
||||
* A custom HTTP client should should implement:
|
||||
* 1. A response class which extends HttpClientResponse and wraps around their
|
||||
* own internal representation of a response.
|
||||
* 2. A client class which extends HttpClient and implements all methods,
|
||||
* returning their own response class when making requests.
|
||||
*/
|
||||
export declare class HttpClient implements HttpClientInterface {
|
||||
static CONNECTION_CLOSED_ERROR_CODES: string[];
|
||||
static TIMEOUT_ERROR_CODE: string;
|
||||
/** The client name used for diagnostics. */
|
||||
getClientName(): string;
|
||||
makeRequest(host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number): Promise<HttpClientResponseInterface>;
|
||||
/** Helper to make a consistent timeout error across implementations. */
|
||||
static makeTimeoutError(): TimeoutError;
|
||||
}
|
||||
export declare class HttpClientResponse implements HttpClientResponseInterface {
|
||||
_statusCode: number;
|
||||
_headers: ResponseHeaders;
|
||||
constructor(statusCode: number, headers: ResponseHeaders);
|
||||
getStatusCode(): number;
|
||||
getHeaders(): ResponseHeaders;
|
||||
getRawResponse(): unknown;
|
||||
toStream(streamCompleteCallback: () => void): unknown;
|
||||
toJSON(): any;
|
||||
}
|
||||
export {};
|
||||
54
node_modules/stripe/cjs/net/HttpClient.js
generated
vendored
Normal file
54
node_modules/stripe/cjs/net/HttpClient.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HttpClientResponse = exports.HttpClient = void 0;
|
||||
/**
|
||||
* Encapsulates the logic for issuing a request to the Stripe API.
|
||||
*
|
||||
* A custom HTTP client should should implement:
|
||||
* 1. A response class which extends HttpClientResponse and wraps around their
|
||||
* own internal representation of a response.
|
||||
* 2. A client class which extends HttpClient and implements all methods,
|
||||
* returning their own response class when making requests.
|
||||
*/
|
||||
class HttpClient {
|
||||
/** The client name used for diagnostics. */
|
||||
getClientName() {
|
||||
throw new Error('getClientName not implemented.');
|
||||
}
|
||||
makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
|
||||
throw new Error('makeRequest not implemented.');
|
||||
}
|
||||
/** Helper to make a consistent timeout error across implementations. */
|
||||
static makeTimeoutError() {
|
||||
const timeoutErr = new TypeError(HttpClient.TIMEOUT_ERROR_CODE);
|
||||
timeoutErr.code = HttpClient.TIMEOUT_ERROR_CODE;
|
||||
return timeoutErr;
|
||||
}
|
||||
}
|
||||
exports.HttpClient = HttpClient;
|
||||
// Public API accessible via Stripe.HttpClient
|
||||
HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE'];
|
||||
HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT';
|
||||
class HttpClientResponse {
|
||||
constructor(statusCode, headers) {
|
||||
this._statusCode = statusCode;
|
||||
this._headers = headers;
|
||||
}
|
||||
getStatusCode() {
|
||||
return this._statusCode;
|
||||
}
|
||||
getHeaders() {
|
||||
return this._headers;
|
||||
}
|
||||
getRawResponse() {
|
||||
throw new Error('getRawResponse not implemented.');
|
||||
}
|
||||
toStream(streamCompleteCallback) {
|
||||
throw new Error('toStream not implemented.');
|
||||
}
|
||||
toJSON() {
|
||||
throw new Error('toJSON not implemented.');
|
||||
}
|
||||
}
|
||||
exports.HttpClientResponse = HttpClientResponse;
|
||||
//# sourceMappingURL=HttpClient.js.map
|
||||
1
node_modules/stripe/cjs/net/HttpClient.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/net/HttpClient.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../src/net/HttpClient.ts"],"names":[],"mappings":";;;AAwEA;;;;;;;;GAQG;AACH,MAAa,UAAU;IAIrB,4CAA4C;IAC5C,aAAa;QACX,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,WAAW,CACT,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,OAAuB,EACvB,WAAmB,EACnB,QAAgB,EAChB,OAAe;QAEf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,gBAAgB;QACrB,MAAM,UAAU,GAAiB,IAAI,SAAS,CAC5C,UAAU,CAAC,kBAAkB,CAC9B,CAAC;QACF,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,kBAAkB,CAAC;QAChD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA9BD,gCA8BC;AAED,8CAA8C;AAC9C,UAAU,CAAC,6BAA6B,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACnE,UAAU,CAAC,kBAAkB,GAAG,WAAW,CAAC;AAE5C,MAAa,kBAAkB;IAI7B,YAAY,UAAkB,EAAE,OAAwB;QACtD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,CAAC,sBAAkC;QACzC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AA5BD,gDA4BC"}
|
||||
24
node_modules/stripe/cjs/net/NodeHttpClient.d.ts
generated
vendored
Normal file
24
node_modules/stripe/cjs/net/NodeHttpClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http_ from 'http';
|
||||
import * as https_ from 'https';
|
||||
import { RequestHeaders } from '../Types.js';
|
||||
import { HttpClient, HttpClientResponse, NodeHttpClientInterface, NodeHttpClientResponseInterface } from './HttpClient.js';
|
||||
/**
|
||||
* HTTP client which uses the Node `http` and `https` packages to issue
|
||||
* requests.`
|
||||
*/
|
||||
export declare class NodeHttpClient extends HttpClient implements NodeHttpClientInterface {
|
||||
_agent?: http_.Agent | https_.Agent | undefined;
|
||||
constructor(agent?: http_.Agent | https_.Agent);
|
||||
/** @override. */
|
||||
getClientName(): string;
|
||||
makeRequest(host: string, port: string, path: string, method: string, headers: RequestHeaders, requestData: string, protocol: string, timeout: number): Promise<NodeHttpClientResponseInterface>;
|
||||
}
|
||||
export declare class NodeHttpClientResponse extends HttpClientResponse implements NodeHttpClientResponseInterface {
|
||||
_res: http_.IncomingMessage;
|
||||
constructor(res: http_.IncomingMessage);
|
||||
getRawResponse(): http_.IncomingMessage;
|
||||
toStream(streamCompleteCallback: () => void): http_.IncomingMessage;
|
||||
toJSON(): any;
|
||||
}
|
||||
112
node_modules/stripe/cjs/net/NodeHttpClient.js
generated
vendored
Normal file
112
node_modules/stripe/cjs/net/NodeHttpClient.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeHttpClientResponse = exports.NodeHttpClient = void 0;
|
||||
const http_ = require("http");
|
||||
const https_ = require("https");
|
||||
const HttpClient_js_1 = require("./HttpClient.js");
|
||||
// `import * as http_ from 'http'` creates a "Module Namespace Exotic Object"
|
||||
// which is immune to monkey-patching, whereas http_.default (in an ES Module context)
|
||||
// will resolve to the same thing as require('http'), which is
|
||||
// monkey-patchable. We care about this because users in their test
|
||||
// suites might be using a library like "nock" which relies on the ability
|
||||
// to monkey-patch and intercept calls to http.request.
|
||||
const http = http_.default || http_;
|
||||
const https = https_.default || https_;
|
||||
const defaultHttpAgent = new http.Agent({ keepAlive: true });
|
||||
const defaultHttpsAgent = new https.Agent({ keepAlive: true });
|
||||
/**
|
||||
* HTTP client which uses the Node `http` and `https` packages to issue
|
||||
* requests.`
|
||||
*/
|
||||
class NodeHttpClient extends HttpClient_js_1.HttpClient {
|
||||
constructor(agent) {
|
||||
super();
|
||||
this._agent = agent;
|
||||
}
|
||||
/** @override. */
|
||||
getClientName() {
|
||||
return 'node';
|
||||
}
|
||||
makeRequest(host, port, path, method, headers, requestData, protocol, timeout) {
|
||||
const isInsecureConnection = protocol === 'http';
|
||||
let agent = this._agent;
|
||||
if (!agent) {
|
||||
agent = isInsecureConnection ? defaultHttpAgent : defaultHttpsAgent;
|
||||
}
|
||||
const requestPromise = new Promise((resolve, reject) => {
|
||||
const req = (isInsecureConnection ? http : https).request({
|
||||
host: host,
|
||||
port: port,
|
||||
path,
|
||||
method,
|
||||
agent,
|
||||
headers,
|
||||
ciphers: 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!MD5',
|
||||
});
|
||||
req.setTimeout(timeout, () => {
|
||||
req.destroy(HttpClient_js_1.HttpClient.makeTimeoutError());
|
||||
});
|
||||
req.on('response', (res) => {
|
||||
resolve(new NodeHttpClientResponse(res));
|
||||
});
|
||||
req.on('error', (error) => {
|
||||
reject(error);
|
||||
});
|
||||
req.once('socket', (socket) => {
|
||||
if (socket.connecting) {
|
||||
socket.once(isInsecureConnection ? 'connect' : 'secureConnect', () => {
|
||||
// Send payload; we're safe:
|
||||
req.write(requestData);
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
else {
|
||||
// we're already connected
|
||||
req.write(requestData);
|
||||
req.end();
|
||||
}
|
||||
});
|
||||
});
|
||||
return requestPromise;
|
||||
}
|
||||
}
|
||||
exports.NodeHttpClient = NodeHttpClient;
|
||||
class NodeHttpClientResponse extends HttpClient_js_1.HttpClientResponse {
|
||||
constructor(res) {
|
||||
// @ts-ignore
|
||||
super(res.statusCode, res.headers || {});
|
||||
this._res = res;
|
||||
}
|
||||
getRawResponse() {
|
||||
return this._res;
|
||||
}
|
||||
toStream(streamCompleteCallback) {
|
||||
// The raw response is itself the stream, so we just return that. To be
|
||||
// backwards compatible, we should invoke the streamCompleteCallback only
|
||||
// once the stream has been fully consumed.
|
||||
this._res.once('end', () => streamCompleteCallback());
|
||||
return this._res;
|
||||
}
|
||||
toJSON() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let response = '';
|
||||
this._res.setEncoding('utf8');
|
||||
this._res.on('data', (chunk) => {
|
||||
response += chunk;
|
||||
});
|
||||
this._res.once('end', () => {
|
||||
try {
|
||||
resolve(JSON.parse(response));
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error) {
|
||||
e.rawBody = response;
|
||||
}
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.NodeHttpClientResponse = NodeHttpClientResponse;
|
||||
//# sourceMappingURL=NodeHttpClient.js.map
|
||||
1
node_modules/stripe/cjs/net/NodeHttpClient.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/net/NodeHttpClient.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NodeHttpClient.js","sourceRoot":"","sources":["../../src/net/NodeHttpClient.ts"],"names":[],"mappings":"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"}
|
||||
1
node_modules/stripe/cjs/package.json
generated
vendored
Normal file
1
node_modules/stripe/cjs/package.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"type":"commonjs"}
|
||||
42
node_modules/stripe/cjs/platform/NodePlatformFunctions.d.ts
generated
vendored
Normal file
42
node_modules/stripe/cjs/platform/NodePlatformFunctions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import { CryptoProvider } from '../crypto/CryptoProvider.js';
|
||||
import { EventEmitter } from 'events';
|
||||
import { HttpClient, NodeHttpClientInterface } from '../net/HttpClient.js';
|
||||
import { PlatformFunctions } from './PlatformFunctions.js';
|
||||
import { MultipartRequestData, RequestData, BufferedFile } from '../Types.js';
|
||||
/**
|
||||
* Specializes WebPlatformFunctions using APIs available in Node.js.
|
||||
*/
|
||||
export declare class NodePlatformFunctions extends PlatformFunctions {
|
||||
/** @override */
|
||||
uuid4(): string;
|
||||
/** @override */
|
||||
getPlatformInfo(): string;
|
||||
/** @override */
|
||||
emitWarning(warning: string): void;
|
||||
/** @override */
|
||||
getEnv(): Record<string, string | undefined>;
|
||||
/** @override */
|
||||
getRuntimeVersion(): string;
|
||||
private getUname;
|
||||
/** @override */
|
||||
getSourceHash(): string | null;
|
||||
/**
|
||||
* @override
|
||||
* Secure compare, from https://github.com/freewil/scmp
|
||||
*/
|
||||
secureCompare(a: string, b: string): boolean;
|
||||
createEmitter(): EventEmitter;
|
||||
/** @override */
|
||||
tryBufferData(data: MultipartRequestData): Promise<RequestData | BufferedFile>;
|
||||
/** @override */
|
||||
createNodeHttpClient(agent?: http.Agent): NodeHttpClientInterface;
|
||||
/** @override */
|
||||
createDefaultHttpClient(): HttpClient;
|
||||
/** @override */
|
||||
createNodeCryptoProvider(): CryptoProvider;
|
||||
/** @override */
|
||||
createDefaultCryptoProvider(): CryptoProvider;
|
||||
}
|
||||
150
node_modules/stripe/cjs/platform/NodePlatformFunctions.js
generated
vendored
Normal file
150
node_modules/stripe/cjs/platform/NodePlatformFunctions.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodePlatformFunctions = void 0;
|
||||
const crypto = require("crypto");
|
||||
const os = require("os");
|
||||
const events_1 = require("events");
|
||||
const NodeCryptoProvider_js_1 = require("../crypto/NodeCryptoProvider.js");
|
||||
const NodeHttpClient_js_1 = require("../net/NodeHttpClient.js");
|
||||
const PlatformFunctions_js_1 = require("./PlatformFunctions.js");
|
||||
const Error_js_1 = require("../Error.js");
|
||||
const utils_js_1 = require("../utils.js");
|
||||
class StreamProcessingError extends Error_js_1.StripeError {
|
||||
}
|
||||
/**
|
||||
* Specializes WebPlatformFunctions using APIs available in Node.js.
|
||||
*/
|
||||
class NodePlatformFunctions extends PlatformFunctions_js_1.PlatformFunctions {
|
||||
/** @override */
|
||||
uuid4() {
|
||||
// available in: v14.17.x+
|
||||
if (crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
return super.uuid4();
|
||||
}
|
||||
/** @override */
|
||||
getPlatformInfo() {
|
||||
return `${process.platform} ${os.release()} ${os.arch()}`;
|
||||
}
|
||||
/** @override */
|
||||
emitWarning(warning) {
|
||||
if (typeof process.emitWarning === 'function') {
|
||||
process.emitWarning(warning, 'Stripe');
|
||||
}
|
||||
else {
|
||||
super.emitWarning(warning);
|
||||
}
|
||||
}
|
||||
/** @override */
|
||||
getEnv() {
|
||||
return process.env;
|
||||
}
|
||||
/** @override */
|
||||
getRuntimeVersion() {
|
||||
return process.version;
|
||||
}
|
||||
getUname() {
|
||||
try {
|
||||
const parts = [os.type(), os.release(), os.arch()];
|
||||
// os.version() returns detailed kernel version, available since Node 10.7.0
|
||||
// It may not exist in older typings, so access carefully
|
||||
const version = os.version?.();
|
||||
if (version)
|
||||
parts.push(version);
|
||||
try {
|
||||
parts.push(os.hostname());
|
||||
// eslint-disable-next-line no-empty
|
||||
}
|
||||
catch (_e) { }
|
||||
return parts.join(' ');
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/** @override */
|
||||
getSourceHash() {
|
||||
try {
|
||||
const uname = this.getUname();
|
||||
return uname
|
||||
? crypto
|
||||
.createHash('md5')
|
||||
.update(uname)
|
||||
.digest('hex')
|
||||
: null;
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @override
|
||||
* Secure compare, from https://github.com/freewil/scmp
|
||||
*/
|
||||
secureCompare(a, b) {
|
||||
if (!a || !b) {
|
||||
throw new Error('secureCompare must receive two arguments');
|
||||
}
|
||||
// return early here if buffer lengths are not equal since timingSafeEqual
|
||||
// will throw if buffer lengths are not equal
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
// use crypto.timingSafeEqual if available (since Node.js v6.6.0),
|
||||
// otherwise use our own scmp-internal function.
|
||||
if (crypto.timingSafeEqual) {
|
||||
const textEncoder = new TextEncoder();
|
||||
const aEncoded = textEncoder.encode(a);
|
||||
const bEncoded = textEncoder.encode(b);
|
||||
return crypto.timingSafeEqual(aEncoded, bEncoded);
|
||||
}
|
||||
return super.secureCompare(a, b);
|
||||
}
|
||||
createEmitter() {
|
||||
return new events_1.EventEmitter();
|
||||
}
|
||||
/** @override */
|
||||
tryBufferData(data) {
|
||||
if (!(data.file.data instanceof events_1.EventEmitter)) {
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
const bufferArray = [];
|
||||
return new Promise((resolve, reject) => {
|
||||
data.file.data
|
||||
.on('data', (line) => {
|
||||
bufferArray.push(line);
|
||||
})
|
||||
.once('end', () => {
|
||||
// @ts-ignore
|
||||
const bufferData = Object.assign({}, data);
|
||||
bufferData.file.data = (0, utils_js_1.concat)(bufferArray);
|
||||
resolve(bufferData);
|
||||
})
|
||||
.on('error', (err) => {
|
||||
reject(new StreamProcessingError({
|
||||
message: 'An error occurred while attempting to process the file for upload.',
|
||||
detail: err,
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
/** @override */
|
||||
createNodeHttpClient(agent) {
|
||||
return new NodeHttpClient_js_1.NodeHttpClient(agent);
|
||||
}
|
||||
/** @override */
|
||||
createDefaultHttpClient() {
|
||||
return new NodeHttpClient_js_1.NodeHttpClient();
|
||||
}
|
||||
/** @override */
|
||||
createNodeCryptoProvider() {
|
||||
return new NodeCryptoProvider_js_1.NodeCryptoProvider();
|
||||
}
|
||||
/** @override */
|
||||
createDefaultCryptoProvider() {
|
||||
return this.createNodeCryptoProvider();
|
||||
}
|
||||
}
|
||||
exports.NodePlatformFunctions = NodePlatformFunctions;
|
||||
//# sourceMappingURL=NodePlatformFunctions.js.map
|
||||
1
node_modules/stripe/cjs/platform/NodePlatformFunctions.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/platform/NodePlatformFunctions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NodePlatformFunctions.js","sourceRoot":"","sources":["../../src/platform/NodePlatformFunctions.ts"],"names":[],"mappings":"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"}
|
||||
78
node_modules/stripe/cjs/platform/PlatformFunctions.d.ts
generated
vendored
Normal file
78
node_modules/stripe/cjs/platform/PlatformFunctions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import { CryptoProvider } from '../crypto/CryptoProvider.js';
|
||||
import { EventEmitter } from 'events';
|
||||
import { HttpClient, NodeHttpClientInterface, FetchHttpClientInterface } from '../net/HttpClient.js';
|
||||
import { StripeEmitter } from '../StripeEmitter.js';
|
||||
import { MultipartRequestData, RequestData, BufferedFile } from '../Types.js';
|
||||
/**
|
||||
* Interface encapsulating various utility functions whose
|
||||
* implementations depend on the platform / JS runtime.
|
||||
*/
|
||||
export declare class PlatformFunctions {
|
||||
_fetchFn: any | null;
|
||||
_agent: http.Agent | null;
|
||||
constructor();
|
||||
/**
|
||||
* Returns platform info string for telemetry, or null if unavailable.
|
||||
*/
|
||||
getPlatformInfo(): string | null;
|
||||
getSourceHash(): string | null;
|
||||
/**
|
||||
* Emits a warning. Node.js uses process.emitWarning; other runtimes
|
||||
* fall back to console.warn.
|
||||
*/
|
||||
emitWarning(warning: string): void;
|
||||
/**
|
||||
* Returns environment variables, or null if unavailable.
|
||||
*/
|
||||
getEnv(): Record<string, string | undefined> | null;
|
||||
/**
|
||||
* Returns the runtime version string, or null if unavailable.
|
||||
*/
|
||||
getRuntimeVersion(): string | null;
|
||||
/**
|
||||
* Generates a v4 UUID. See https://stackoverflow.com/a/2117523
|
||||
*/
|
||||
uuid4(): string;
|
||||
/**
|
||||
* Compares strings in constant time.
|
||||
*/
|
||||
secureCompare(a: string, b: string): boolean;
|
||||
/**
|
||||
* Creates an event emitter.
|
||||
*/
|
||||
createEmitter(): StripeEmitter | EventEmitter;
|
||||
/**
|
||||
* Checks if the request data is a stream. If so, read the entire stream
|
||||
* to a buffer and return the buffer.
|
||||
*/
|
||||
tryBufferData(data: MultipartRequestData): Promise<RequestData | BufferedFile>;
|
||||
/**
|
||||
* Creates an HTTP client which uses the Node `http` and `https` packages
|
||||
* to issue requests.
|
||||
*/
|
||||
createNodeHttpClient(agent?: http.Agent): NodeHttpClientInterface;
|
||||
/**
|
||||
* Creates an HTTP client for issuing Stripe API requests which uses the Web
|
||||
* Fetch API.
|
||||
*
|
||||
* A fetch function can optionally be passed in as a parameter. If none is
|
||||
* passed, will default to the default `fetch` function in the global scope.
|
||||
*/
|
||||
createFetchHttpClient(fetchFn?: typeof fetch): FetchHttpClientInterface;
|
||||
/**
|
||||
* Creates an HTTP client using runtime-specific APIs.
|
||||
*/
|
||||
createDefaultHttpClient(): HttpClient;
|
||||
/**
|
||||
* Creates a CryptoProvider which uses the Node `crypto` package for its computations.
|
||||
*/
|
||||
createNodeCryptoProvider(): CryptoProvider;
|
||||
/**
|
||||
* Creates a CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
|
||||
*/
|
||||
createSubtleCryptoProvider(subtleCrypto?: typeof crypto.subtle): CryptoProvider;
|
||||
createDefaultCryptoProvider(): CryptoProvider;
|
||||
}
|
||||
123
node_modules/stripe/cjs/platform/PlatformFunctions.js
generated
vendored
Normal file
123
node_modules/stripe/cjs/platform/PlatformFunctions.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PlatformFunctions = void 0;
|
||||
const FetchHttpClient_js_1 = require("../net/FetchHttpClient.js");
|
||||
const SubtleCryptoProvider_js_1 = require("../crypto/SubtleCryptoProvider.js");
|
||||
/**
|
||||
* Interface encapsulating various utility functions whose
|
||||
* implementations depend on the platform / JS runtime.
|
||||
*/
|
||||
class PlatformFunctions {
|
||||
constructor() {
|
||||
this._fetchFn = null;
|
||||
this._agent = null;
|
||||
}
|
||||
/**
|
||||
* Returns platform info string for telemetry, or null if unavailable.
|
||||
*/
|
||||
getPlatformInfo() {
|
||||
return null;
|
||||
}
|
||||
getSourceHash() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Emits a warning. Node.js uses process.emitWarning; other runtimes
|
||||
* fall back to console.warn.
|
||||
*/
|
||||
emitWarning(warning) {
|
||||
/* eslint-disable no-console */
|
||||
console.warn(`Stripe: ${warning}`);
|
||||
/* eslint-enable no-console */
|
||||
}
|
||||
/**
|
||||
* Returns environment variables, or null if unavailable.
|
||||
*/
|
||||
getEnv() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns the runtime version string, or null if unavailable.
|
||||
*/
|
||||
getRuntimeVersion() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Generates a v4 UUID. See https://stackoverflow.com/a/2117523
|
||||
*/
|
||||
uuid4() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Compares strings in constant time.
|
||||
*/
|
||||
secureCompare(a, b) {
|
||||
// return early here if buffer lengths are not equal
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
const len = a.length;
|
||||
let result = 0;
|
||||
for (let i = 0; i < len; ++i) {
|
||||
result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
||||
}
|
||||
return result === 0;
|
||||
}
|
||||
/**
|
||||
* Creates an event emitter.
|
||||
*/
|
||||
createEmitter() {
|
||||
throw new Error('createEmitter not implemented.');
|
||||
}
|
||||
/**
|
||||
* Checks if the request data is a stream. If so, read the entire stream
|
||||
* to a buffer and return the buffer.
|
||||
*/
|
||||
tryBufferData(data) {
|
||||
throw new Error('tryBufferData not implemented.');
|
||||
}
|
||||
/**
|
||||
* Creates an HTTP client which uses the Node `http` and `https` packages
|
||||
* to issue requests.
|
||||
*/
|
||||
createNodeHttpClient(agent) {
|
||||
throw new Error('createNodeHttpClient not implemented.');
|
||||
}
|
||||
/**
|
||||
* Creates an HTTP client for issuing Stripe API requests which uses the Web
|
||||
* Fetch API.
|
||||
*
|
||||
* A fetch function can optionally be passed in as a parameter. If none is
|
||||
* passed, will default to the default `fetch` function in the global scope.
|
||||
*/
|
||||
createFetchHttpClient(fetchFn) {
|
||||
return new FetchHttpClient_js_1.FetchHttpClient(fetchFn);
|
||||
}
|
||||
/**
|
||||
* Creates an HTTP client using runtime-specific APIs.
|
||||
*/
|
||||
createDefaultHttpClient() {
|
||||
throw new Error('createDefaultHttpClient not implemented.');
|
||||
}
|
||||
/**
|
||||
* Creates a CryptoProvider which uses the Node `crypto` package for its computations.
|
||||
*/
|
||||
createNodeCryptoProvider() {
|
||||
throw new Error('createNodeCryptoProvider not implemented.');
|
||||
}
|
||||
/**
|
||||
* Creates a CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
|
||||
*/
|
||||
createSubtleCryptoProvider(subtleCrypto) {
|
||||
return new SubtleCryptoProvider_js_1.SubtleCryptoProvider(subtleCrypto);
|
||||
}
|
||||
createDefaultCryptoProvider() {
|
||||
throw new Error('createDefaultCryptoProvider not implemented.');
|
||||
}
|
||||
}
|
||||
exports.PlatformFunctions = PlatformFunctions;
|
||||
//# sourceMappingURL=PlatformFunctions.js.map
|
||||
1
node_modules/stripe/cjs/platform/PlatformFunctions.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/platform/PlatformFunctions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PlatformFunctions.js","sourceRoot":"","sources":["../../src/platform/PlatformFunctions.ts"],"names":[],"mappings":";;;AAOA,kEAA0D;AAO1D,+EAAuE;AAGvE;;;GAGG;AACH,MAAa,iBAAiB;IAI5B;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,OAAe;QACzB,+BAA+B;QAC/B,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;QACnC,8BAA8B;IAChC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACnE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,CAAS,EAAE,CAAS;QAChC,oDAAoD;QACpD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;YACzB,OAAO,KAAK,CAAC;SACd;QACD,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;QACrB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE;YAC5B,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SAC7C;QACD,OAAO,MAAM,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,aAAa,CACX,IAA0B;QAE1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,oBAAoB,CAAC,KAAkB;QACrC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACH,qBAAqB,CAAC,OAAsB;QAC1C,OAAO,IAAI,oCAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,wBAAwB;QACtB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,YAAmC;QAEnC,OAAO,IAAI,8CAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAED,2BAA2B;QACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;CACF;AArID,8CAqIC"}
|
||||
22
node_modules/stripe/cjs/platform/WebPlatformFunctions.d.ts
generated
vendored
Normal file
22
node_modules/stripe/cjs/platform/WebPlatformFunctions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CryptoProvider } from '../crypto/CryptoProvider.js';
|
||||
import { HttpClient, NodeHttpClientInterface } from '../net/HttpClient.js';
|
||||
import { PlatformFunctions } from './PlatformFunctions.js';
|
||||
import { StripeEmitter } from '../StripeEmitter.js';
|
||||
import { MultipartRequestData, RequestData, BufferedFile } from '../Types.js';
|
||||
/**
|
||||
* Specializes WebPlatformFunctions using APIs available in Web workers.
|
||||
*/
|
||||
export declare class WebPlatformFunctions extends PlatformFunctions {
|
||||
/** @override */
|
||||
createEmitter(): StripeEmitter;
|
||||
/** @override */
|
||||
tryBufferData(data: MultipartRequestData): Promise<RequestData | BufferedFile>;
|
||||
/** @override */
|
||||
createNodeHttpClient(): NodeHttpClientInterface;
|
||||
/** @override */
|
||||
createDefaultHttpClient(): HttpClient;
|
||||
/** @override */
|
||||
createNodeCryptoProvider(): CryptoProvider;
|
||||
/** @override */
|
||||
createDefaultCryptoProvider(): CryptoProvider;
|
||||
}
|
||||
39
node_modules/stripe/cjs/platform/WebPlatformFunctions.js
generated
vendored
Normal file
39
node_modules/stripe/cjs/platform/WebPlatformFunctions.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WebPlatformFunctions = void 0;
|
||||
const PlatformFunctions_js_1 = require("./PlatformFunctions.js");
|
||||
const StripeEmitter_js_1 = require("../StripeEmitter.js");
|
||||
/**
|
||||
* Specializes WebPlatformFunctions using APIs available in Web workers.
|
||||
*/
|
||||
class WebPlatformFunctions extends PlatformFunctions_js_1.PlatformFunctions {
|
||||
/** @override */
|
||||
createEmitter() {
|
||||
return new StripeEmitter_js_1.StripeEmitter();
|
||||
}
|
||||
/** @override */
|
||||
tryBufferData(data) {
|
||||
if (data.file.data instanceof ReadableStream) {
|
||||
throw new Error('Uploading a file as a stream is not supported in non-Node environments. Please open or upvote an issue at github.com/stripe/stripe-node if you use this, detailing your use-case.');
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
/** @override */
|
||||
createNodeHttpClient() {
|
||||
throw new Error('Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead.');
|
||||
}
|
||||
/** @override */
|
||||
createDefaultHttpClient() {
|
||||
return super.createFetchHttpClient();
|
||||
}
|
||||
/** @override */
|
||||
createNodeCryptoProvider() {
|
||||
throw new Error('Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead.');
|
||||
}
|
||||
/** @override */
|
||||
createDefaultCryptoProvider() {
|
||||
return this.createSubtleCryptoProvider();
|
||||
}
|
||||
}
|
||||
exports.WebPlatformFunctions = WebPlatformFunctions;
|
||||
//# sourceMappingURL=WebPlatformFunctions.js.map
|
||||
1
node_modules/stripe/cjs/platform/WebPlatformFunctions.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/platform/WebPlatformFunctions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WebPlatformFunctions.js","sourceRoot":"","sources":["../../src/platform/WebPlatformFunctions.ts"],"names":[],"mappings":";;;AAEA,iEAAyD;AACzD,0DAAkD;AAGlD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,wCAAiB;IACzD,gBAAgB;IAChB,aAAa;QACX,OAAO,IAAI,gCAAa,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB;IAChB,aAAa,CACX,IAA0B;QAE1B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,YAAY,cAAc,EAAE;YAC5C,MAAM,IAAI,KAAK,CACb,mLAAmL,CACpL,CAAC;SACH;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,gBAAgB;IAChB,oBAAoB;QAClB,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,uBAAuB;QACrB,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;IAED,gBAAgB;IAChB,wBAAwB;QACtB,MAAM,IAAI,KAAK,CACb,oIAAoI,CACrI,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,2BAA2B;QACzB,OAAO,IAAI,CAAC,0BAA0B,EAAE,CAAC;IAC3C,CAAC;CACF;AAzCD,oDAyCC"}
|
||||
76
node_modules/stripe/cjs/resources.d.ts
generated
vendored
Normal file
76
node_modules/stripe/cjs/resources.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
export { AccountResource as Account } from './resources/Accounts.js';
|
||||
export { AccountResource as Accounts } from './resources/Accounts.js';
|
||||
export { AccountLinkResource as AccountLinks } from './resources/AccountLinks.js';
|
||||
export { AccountSessionResource as AccountSessions } from './resources/AccountSessions.js';
|
||||
export { ApplePayDomainResource as ApplePayDomains } from './resources/ApplePayDomains.js';
|
||||
export { ApplicationFeeResource as ApplicationFees } from './resources/ApplicationFees.js';
|
||||
export { BalanceResource as Balance } from './resources/Balance.js';
|
||||
export { BalanceResource as Balances } from './resources/Balance.js';
|
||||
export { BalanceSettingResource as BalanceSettings } from './resources/BalanceSettings.js';
|
||||
export { BalanceTransactionResource as BalanceTransactions } from './resources/BalanceTransactions.js';
|
||||
export { ChargeResource as Charges } from './resources/Charges.js';
|
||||
export { ConfirmationTokenResource as ConfirmationTokens } from './resources/ConfirmationTokens.js';
|
||||
export { CountrySpecResource as CountrySpecs } from './resources/CountrySpecs.js';
|
||||
export { CouponResource as Coupons } from './resources/Coupons.js';
|
||||
export { CreditNoteResource as CreditNotes } from './resources/CreditNotes.js';
|
||||
export { CustomerResource as Customers } from './resources/Customers.js';
|
||||
export { CustomerSessionResource as CustomerSessions } from './resources/CustomerSessions.js';
|
||||
export { DisputeResource as Disputes } from './resources/Disputes.js';
|
||||
export { EphemeralKeyResource as EphemeralKeys } from './resources/EphemeralKeys.js';
|
||||
export { EventResource as Events } from './resources/Events.js';
|
||||
export { ExchangeRateResource as ExchangeRates } from './resources/ExchangeRates.js';
|
||||
export { FileResource as Files } from './resources/Files.js';
|
||||
export { FileLinkResource as FileLinks } from './resources/FileLinks.js';
|
||||
export { InvoiceResource as Invoices } from './resources/Invoices.js';
|
||||
export { InvoiceItemResource as InvoiceItems } from './resources/InvoiceItems.js';
|
||||
export { InvoicePaymentResource as InvoicePayments } from './resources/InvoicePayments.js';
|
||||
export { InvoiceRenderingTemplateResource as InvoiceRenderingTemplates } from './resources/InvoiceRenderingTemplates.js';
|
||||
export { MandateResource as Mandates } from './resources/Mandates.js';
|
||||
export { OAuthResource } from './resources/OAuth.js';
|
||||
export { PaymentAttemptRecordResource as PaymentAttemptRecords } from './resources/PaymentAttemptRecords.js';
|
||||
export { PaymentIntentResource as PaymentIntents } from './resources/PaymentIntents.js';
|
||||
export { PaymentLinkResource as PaymentLinks } from './resources/PaymentLinks.js';
|
||||
export { PaymentMethodResource as PaymentMethods } from './resources/PaymentMethods.js';
|
||||
export { PaymentMethodConfigurationResource as PaymentMethodConfigurations } from './resources/PaymentMethodConfigurations.js';
|
||||
export { PaymentMethodDomainResource as PaymentMethodDomains } from './resources/PaymentMethodDomains.js';
|
||||
export { PaymentRecordResource as PaymentRecords } from './resources/PaymentRecords.js';
|
||||
export { PayoutResource as Payouts } from './resources/Payouts.js';
|
||||
export { PlanResource as Plans } from './resources/Plans.js';
|
||||
export { PriceResource as Prices } from './resources/Prices.js';
|
||||
export { ProductResource as Products } from './resources/Products.js';
|
||||
export { PromotionCodeResource as PromotionCodes } from './resources/PromotionCodes.js';
|
||||
export { QuoteResource as Quotes } from './resources/Quotes.js';
|
||||
export { RefundResource as Refunds } from './resources/Refunds.js';
|
||||
export { ReviewResource as Reviews } from './resources/Reviews.js';
|
||||
export { SetupAttemptResource as SetupAttempts } from './resources/SetupAttempts.js';
|
||||
export { SetupIntentResource as SetupIntents } from './resources/SetupIntents.js';
|
||||
export { ShippingRateResource as ShippingRates } from './resources/ShippingRates.js';
|
||||
export { SourceResource as Sources } from './resources/Sources.js';
|
||||
export { SubscriptionResource as Subscriptions } from './resources/Subscriptions.js';
|
||||
export { SubscriptionItemResource as SubscriptionItems } from './resources/SubscriptionItems.js';
|
||||
export { SubscriptionScheduleResource as SubscriptionSchedules } from './resources/SubscriptionSchedules.js';
|
||||
export { TaxCodeResource as TaxCodes } from './resources/TaxCodes.js';
|
||||
export { TaxIdResource as TaxIds } from './resources/TaxIds.js';
|
||||
export { TaxRateResource as TaxRates } from './resources/TaxRates.js';
|
||||
export { TokenResource as Tokens } from './resources/Tokens.js';
|
||||
export { TopupResource as Topups } from './resources/Topups.js';
|
||||
export { TransferResource as Transfers } from './resources/Transfers.js';
|
||||
export { WebhookEndpointResource as WebhookEndpoints } from './resources/WebhookEndpoints.js';
|
||||
export declare const Apps: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Billing: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const BillingPortal: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Checkout: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Climate: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Entitlements: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const FinancialConnections: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Forwarding: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Identity: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Issuing: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Radar: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Reporting: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Sigma: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Tax: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Terminal: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const TestHelpers: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const Treasury: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
export declare const V2: new (stripe: import("./stripe.core.js").Stripe) => import("./ResourceNamespace.js").StripeResourceNamespaceObject;
|
||||
333
node_modules/stripe/cjs/resources.js
generated
vendored
Normal file
333
node_modules/stripe/cjs/resources.js
generated
vendored
Normal file
@@ -0,0 +1,333 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SubscriptionItems = exports.Subscriptions = exports.Sources = exports.ShippingRates = exports.SetupIntents = exports.SetupAttempts = exports.Reviews = exports.Refunds = exports.Quotes = exports.PromotionCodes = exports.Products = exports.Prices = exports.Plans = exports.Payouts = exports.PaymentRecords = exports.PaymentMethodDomains = exports.PaymentMethodConfigurations = exports.PaymentMethods = exports.PaymentLinks = exports.PaymentIntents = exports.PaymentAttemptRecords = exports.OAuthResource = exports.Mandates = exports.InvoiceRenderingTemplates = exports.InvoicePayments = exports.InvoiceItems = exports.Invoices = exports.FileLinks = exports.Files = exports.ExchangeRates = exports.Events = exports.EphemeralKeys = exports.Disputes = exports.CustomerSessions = exports.Customers = exports.CreditNotes = exports.Coupons = exports.CountrySpecs = exports.ConfirmationTokens = exports.Charges = exports.BalanceTransactions = exports.BalanceSettings = exports.Balances = exports.Balance = exports.ApplicationFees = exports.ApplePayDomains = exports.AccountSessions = exports.AccountLinks = exports.Accounts = exports.Account = void 0;
|
||||
exports.V2 = exports.Treasury = exports.TestHelpers = exports.Terminal = exports.Tax = exports.Sigma = exports.Reporting = exports.Radar = exports.Issuing = exports.Identity = exports.Forwarding = exports.FinancialConnections = exports.Entitlements = exports.Climate = exports.Checkout = exports.BillingPortal = exports.Billing = exports.Apps = exports.WebhookEndpoints = exports.Transfers = exports.Topups = exports.Tokens = exports.TaxRates = exports.TaxIds = exports.TaxCodes = exports.SubscriptionSchedules = void 0;
|
||||
const ResourceNamespace_js_1 = require("./ResourceNamespace.js");
|
||||
const AccountLinks_js_1 = require("./resources/V2/Core/AccountLinks.js");
|
||||
const AccountTokens_js_1 = require("./resources/V2/Core/AccountTokens.js");
|
||||
const Accounts_js_1 = require("./resources/FinancialConnections/Accounts.js");
|
||||
const Accounts_js_2 = require("./resources/V2/Core/Accounts.js");
|
||||
const ActiveEntitlements_js_1 = require("./resources/Entitlements/ActiveEntitlements.js");
|
||||
const Alerts_js_1 = require("./resources/Billing/Alerts.js");
|
||||
const Associations_js_1 = require("./resources/Tax/Associations.js");
|
||||
const Authorizations_js_1 = require("./resources/Issuing/Authorizations.js");
|
||||
const Authorizations_js_2 = require("./resources/TestHelpers/Issuing/Authorizations.js");
|
||||
const Calculations_js_1 = require("./resources/Tax/Calculations.js");
|
||||
const Cardholders_js_1 = require("./resources/Issuing/Cardholders.js");
|
||||
const Cards_js_1 = require("./resources/Issuing/Cards.js");
|
||||
const Cards_js_2 = require("./resources/TestHelpers/Issuing/Cards.js");
|
||||
const Configurations_js_1 = require("./resources/BillingPortal/Configurations.js");
|
||||
const Configurations_js_2 = require("./resources/Terminal/Configurations.js");
|
||||
const ConfirmationTokens_js_1 = require("./resources/TestHelpers/ConfirmationTokens.js");
|
||||
const ConnectionTokens_js_1 = require("./resources/Terminal/ConnectionTokens.js");
|
||||
const CreditBalanceSummary_js_1 = require("./resources/Billing/CreditBalanceSummary.js");
|
||||
const CreditBalanceTransactions_js_1 = require("./resources/Billing/CreditBalanceTransactions.js");
|
||||
const CreditGrants_js_1 = require("./resources/Billing/CreditGrants.js");
|
||||
const CreditReversals_js_1 = require("./resources/Treasury/CreditReversals.js");
|
||||
const Customers_js_1 = require("./resources/TestHelpers/Customers.js");
|
||||
const DebitReversals_js_1 = require("./resources/Treasury/DebitReversals.js");
|
||||
const Disputes_js_1 = require("./resources/Issuing/Disputes.js");
|
||||
const EarlyFraudWarnings_js_1 = require("./resources/Radar/EarlyFraudWarnings.js");
|
||||
const EventDestinations_js_1 = require("./resources/V2/Core/EventDestinations.js");
|
||||
const Events_js_1 = require("./resources/V2/Core/Events.js");
|
||||
const Features_js_1 = require("./resources/Entitlements/Features.js");
|
||||
const FinancialAccounts_js_1 = require("./resources/Treasury/FinancialAccounts.js");
|
||||
const Imports_js_1 = require("./resources/V2/Commerce/ProductCatalog/Imports.js");
|
||||
const InboundTransfers_js_1 = require("./resources/TestHelpers/Treasury/InboundTransfers.js");
|
||||
const InboundTransfers_js_2 = require("./resources/Treasury/InboundTransfers.js");
|
||||
const Locations_js_1 = require("./resources/Terminal/Locations.js");
|
||||
const MeterEventAdjustments_js_1 = require("./resources/Billing/MeterEventAdjustments.js");
|
||||
const MeterEventAdjustments_js_2 = require("./resources/V2/Billing/MeterEventAdjustments.js");
|
||||
const MeterEventSession_js_1 = require("./resources/V2/Billing/MeterEventSession.js");
|
||||
const MeterEventStream_js_1 = require("./resources/V2/Billing/MeterEventStream.js");
|
||||
const MeterEvents_js_1 = require("./resources/Billing/MeterEvents.js");
|
||||
const MeterEvents_js_2 = require("./resources/V2/Billing/MeterEvents.js");
|
||||
const Meters_js_1 = require("./resources/Billing/Meters.js");
|
||||
const OnboardingLinks_js_1 = require("./resources/Terminal/OnboardingLinks.js");
|
||||
const Orders_js_1 = require("./resources/Climate/Orders.js");
|
||||
const OutboundPayments_js_1 = require("./resources/TestHelpers/Treasury/OutboundPayments.js");
|
||||
const OutboundPayments_js_2 = require("./resources/Treasury/OutboundPayments.js");
|
||||
const OutboundTransfers_js_1 = require("./resources/TestHelpers/Treasury/OutboundTransfers.js");
|
||||
const OutboundTransfers_js_2 = require("./resources/Treasury/OutboundTransfers.js");
|
||||
const PaymentEvaluations_js_1 = require("./resources/Radar/PaymentEvaluations.js");
|
||||
const PersonalizationDesigns_js_1 = require("./resources/Issuing/PersonalizationDesigns.js");
|
||||
const PersonalizationDesigns_js_2 = require("./resources/TestHelpers/Issuing/PersonalizationDesigns.js");
|
||||
const PhysicalBundles_js_1 = require("./resources/Issuing/PhysicalBundles.js");
|
||||
const Products_js_1 = require("./resources/Climate/Products.js");
|
||||
const Readers_js_1 = require("./resources/Terminal/Readers.js");
|
||||
const Readers_js_2 = require("./resources/TestHelpers/Terminal/Readers.js");
|
||||
const ReceivedCredits_js_1 = require("./resources/TestHelpers/Treasury/ReceivedCredits.js");
|
||||
const ReceivedCredits_js_2 = require("./resources/Treasury/ReceivedCredits.js");
|
||||
const ReceivedDebits_js_1 = require("./resources/TestHelpers/Treasury/ReceivedDebits.js");
|
||||
const ReceivedDebits_js_2 = require("./resources/Treasury/ReceivedDebits.js");
|
||||
const Refunds_js_1 = require("./resources/TestHelpers/Refunds.js");
|
||||
const Registrations_js_1 = require("./resources/Tax/Registrations.js");
|
||||
const ReportRuns_js_1 = require("./resources/Reporting/ReportRuns.js");
|
||||
const ReportTypes_js_1 = require("./resources/Reporting/ReportTypes.js");
|
||||
const Requests_js_1 = require("./resources/Forwarding/Requests.js");
|
||||
const ScheduledQueryRuns_js_1 = require("./resources/Sigma/ScheduledQueryRuns.js");
|
||||
const Secrets_js_1 = require("./resources/Apps/Secrets.js");
|
||||
const Sessions_js_1 = require("./resources/BillingPortal/Sessions.js");
|
||||
const Sessions_js_2 = require("./resources/Checkout/Sessions.js");
|
||||
const Sessions_js_3 = require("./resources/FinancialConnections/Sessions.js");
|
||||
const Settings_js_1 = require("./resources/Tax/Settings.js");
|
||||
const Suppliers_js_1 = require("./resources/Climate/Suppliers.js");
|
||||
const TestClocks_js_1 = require("./resources/TestHelpers/TestClocks.js");
|
||||
const Tokens_js_1 = require("./resources/Issuing/Tokens.js");
|
||||
const TransactionEntries_js_1 = require("./resources/Treasury/TransactionEntries.js");
|
||||
const Transactions_js_1 = require("./resources/FinancialConnections/Transactions.js");
|
||||
const Transactions_js_2 = require("./resources/Issuing/Transactions.js");
|
||||
const Transactions_js_3 = require("./resources/Tax/Transactions.js");
|
||||
const Transactions_js_4 = require("./resources/TestHelpers/Issuing/Transactions.js");
|
||||
const Transactions_js_5 = require("./resources/Treasury/Transactions.js");
|
||||
const ValueListItems_js_1 = require("./resources/Radar/ValueListItems.js");
|
||||
const ValueLists_js_1 = require("./resources/Radar/ValueLists.js");
|
||||
const VerificationReports_js_1 = require("./resources/Identity/VerificationReports.js");
|
||||
const VerificationSessions_js_1 = require("./resources/Identity/VerificationSessions.js");
|
||||
var Accounts_js_3 = require("./resources/Accounts.js");
|
||||
Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Accounts_js_3.AccountResource; } });
|
||||
var Accounts_js_4 = require("./resources/Accounts.js");
|
||||
Object.defineProperty(exports, "Accounts", { enumerable: true, get: function () { return Accounts_js_4.AccountResource; } });
|
||||
var AccountLinks_js_2 = require("./resources/AccountLinks.js");
|
||||
Object.defineProperty(exports, "AccountLinks", { enumerable: true, get: function () { return AccountLinks_js_2.AccountLinkResource; } });
|
||||
var AccountSessions_js_1 = require("./resources/AccountSessions.js");
|
||||
Object.defineProperty(exports, "AccountSessions", { enumerable: true, get: function () { return AccountSessions_js_1.AccountSessionResource; } });
|
||||
var ApplePayDomains_js_1 = require("./resources/ApplePayDomains.js");
|
||||
Object.defineProperty(exports, "ApplePayDomains", { enumerable: true, get: function () { return ApplePayDomains_js_1.ApplePayDomainResource; } });
|
||||
var ApplicationFees_js_1 = require("./resources/ApplicationFees.js");
|
||||
Object.defineProperty(exports, "ApplicationFees", { enumerable: true, get: function () { return ApplicationFees_js_1.ApplicationFeeResource; } });
|
||||
var Balance_js_1 = require("./resources/Balance.js");
|
||||
Object.defineProperty(exports, "Balance", { enumerable: true, get: function () { return Balance_js_1.BalanceResource; } });
|
||||
var Balance_js_2 = require("./resources/Balance.js");
|
||||
Object.defineProperty(exports, "Balances", { enumerable: true, get: function () { return Balance_js_2.BalanceResource; } });
|
||||
var BalanceSettings_js_1 = require("./resources/BalanceSettings.js");
|
||||
Object.defineProperty(exports, "BalanceSettings", { enumerable: true, get: function () { return BalanceSettings_js_1.BalanceSettingResource; } });
|
||||
var BalanceTransactions_js_1 = require("./resources/BalanceTransactions.js");
|
||||
Object.defineProperty(exports, "BalanceTransactions", { enumerable: true, get: function () { return BalanceTransactions_js_1.BalanceTransactionResource; } });
|
||||
var Charges_js_1 = require("./resources/Charges.js");
|
||||
Object.defineProperty(exports, "Charges", { enumerable: true, get: function () { return Charges_js_1.ChargeResource; } });
|
||||
var ConfirmationTokens_js_2 = require("./resources/ConfirmationTokens.js");
|
||||
Object.defineProperty(exports, "ConfirmationTokens", { enumerable: true, get: function () { return ConfirmationTokens_js_2.ConfirmationTokenResource; } });
|
||||
var CountrySpecs_js_1 = require("./resources/CountrySpecs.js");
|
||||
Object.defineProperty(exports, "CountrySpecs", { enumerable: true, get: function () { return CountrySpecs_js_1.CountrySpecResource; } });
|
||||
var Coupons_js_1 = require("./resources/Coupons.js");
|
||||
Object.defineProperty(exports, "Coupons", { enumerable: true, get: function () { return Coupons_js_1.CouponResource; } });
|
||||
var CreditNotes_js_1 = require("./resources/CreditNotes.js");
|
||||
Object.defineProperty(exports, "CreditNotes", { enumerable: true, get: function () { return CreditNotes_js_1.CreditNoteResource; } });
|
||||
var Customers_js_2 = require("./resources/Customers.js");
|
||||
Object.defineProperty(exports, "Customers", { enumerable: true, get: function () { return Customers_js_2.CustomerResource; } });
|
||||
var CustomerSessions_js_1 = require("./resources/CustomerSessions.js");
|
||||
Object.defineProperty(exports, "CustomerSessions", { enumerable: true, get: function () { return CustomerSessions_js_1.CustomerSessionResource; } });
|
||||
var Disputes_js_2 = require("./resources/Disputes.js");
|
||||
Object.defineProperty(exports, "Disputes", { enumerable: true, get: function () { return Disputes_js_2.DisputeResource; } });
|
||||
var EphemeralKeys_js_1 = require("./resources/EphemeralKeys.js");
|
||||
Object.defineProperty(exports, "EphemeralKeys", { enumerable: true, get: function () { return EphemeralKeys_js_1.EphemeralKeyResource; } });
|
||||
var Events_js_2 = require("./resources/Events.js");
|
||||
Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return Events_js_2.EventResource; } });
|
||||
var ExchangeRates_js_1 = require("./resources/ExchangeRates.js");
|
||||
Object.defineProperty(exports, "ExchangeRates", { enumerable: true, get: function () { return ExchangeRates_js_1.ExchangeRateResource; } });
|
||||
var Files_js_1 = require("./resources/Files.js");
|
||||
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return Files_js_1.FileResource; } });
|
||||
var FileLinks_js_1 = require("./resources/FileLinks.js");
|
||||
Object.defineProperty(exports, "FileLinks", { enumerable: true, get: function () { return FileLinks_js_1.FileLinkResource; } });
|
||||
var Invoices_js_1 = require("./resources/Invoices.js");
|
||||
Object.defineProperty(exports, "Invoices", { enumerable: true, get: function () { return Invoices_js_1.InvoiceResource; } });
|
||||
var InvoiceItems_js_1 = require("./resources/InvoiceItems.js");
|
||||
Object.defineProperty(exports, "InvoiceItems", { enumerable: true, get: function () { return InvoiceItems_js_1.InvoiceItemResource; } });
|
||||
var InvoicePayments_js_1 = require("./resources/InvoicePayments.js");
|
||||
Object.defineProperty(exports, "InvoicePayments", { enumerable: true, get: function () { return InvoicePayments_js_1.InvoicePaymentResource; } });
|
||||
var InvoiceRenderingTemplates_js_1 = require("./resources/InvoiceRenderingTemplates.js");
|
||||
Object.defineProperty(exports, "InvoiceRenderingTemplates", { enumerable: true, get: function () { return InvoiceRenderingTemplates_js_1.InvoiceRenderingTemplateResource; } });
|
||||
var Mandates_js_1 = require("./resources/Mandates.js");
|
||||
Object.defineProperty(exports, "Mandates", { enumerable: true, get: function () { return Mandates_js_1.MandateResource; } });
|
||||
var OAuth_js_1 = require("./resources/OAuth.js");
|
||||
Object.defineProperty(exports, "OAuthResource", { enumerable: true, get: function () { return OAuth_js_1.OAuthResource; } });
|
||||
var PaymentAttemptRecords_js_1 = require("./resources/PaymentAttemptRecords.js");
|
||||
Object.defineProperty(exports, "PaymentAttemptRecords", { enumerable: true, get: function () { return PaymentAttemptRecords_js_1.PaymentAttemptRecordResource; } });
|
||||
var PaymentIntents_js_1 = require("./resources/PaymentIntents.js");
|
||||
Object.defineProperty(exports, "PaymentIntents", { enumerable: true, get: function () { return PaymentIntents_js_1.PaymentIntentResource; } });
|
||||
var PaymentLinks_js_1 = require("./resources/PaymentLinks.js");
|
||||
Object.defineProperty(exports, "PaymentLinks", { enumerable: true, get: function () { return PaymentLinks_js_1.PaymentLinkResource; } });
|
||||
var PaymentMethods_js_1 = require("./resources/PaymentMethods.js");
|
||||
Object.defineProperty(exports, "PaymentMethods", { enumerable: true, get: function () { return PaymentMethods_js_1.PaymentMethodResource; } });
|
||||
var PaymentMethodConfigurations_js_1 = require("./resources/PaymentMethodConfigurations.js");
|
||||
Object.defineProperty(exports, "PaymentMethodConfigurations", { enumerable: true, get: function () { return PaymentMethodConfigurations_js_1.PaymentMethodConfigurationResource; } });
|
||||
var PaymentMethodDomains_js_1 = require("./resources/PaymentMethodDomains.js");
|
||||
Object.defineProperty(exports, "PaymentMethodDomains", { enumerable: true, get: function () { return PaymentMethodDomains_js_1.PaymentMethodDomainResource; } });
|
||||
var PaymentRecords_js_1 = require("./resources/PaymentRecords.js");
|
||||
Object.defineProperty(exports, "PaymentRecords", { enumerable: true, get: function () { return PaymentRecords_js_1.PaymentRecordResource; } });
|
||||
var Payouts_js_1 = require("./resources/Payouts.js");
|
||||
Object.defineProperty(exports, "Payouts", { enumerable: true, get: function () { return Payouts_js_1.PayoutResource; } });
|
||||
var Plans_js_1 = require("./resources/Plans.js");
|
||||
Object.defineProperty(exports, "Plans", { enumerable: true, get: function () { return Plans_js_1.PlanResource; } });
|
||||
var Prices_js_1 = require("./resources/Prices.js");
|
||||
Object.defineProperty(exports, "Prices", { enumerable: true, get: function () { return Prices_js_1.PriceResource; } });
|
||||
var Products_js_2 = require("./resources/Products.js");
|
||||
Object.defineProperty(exports, "Products", { enumerable: true, get: function () { return Products_js_2.ProductResource; } });
|
||||
var PromotionCodes_js_1 = require("./resources/PromotionCodes.js");
|
||||
Object.defineProperty(exports, "PromotionCodes", { enumerable: true, get: function () { return PromotionCodes_js_1.PromotionCodeResource; } });
|
||||
var Quotes_js_1 = require("./resources/Quotes.js");
|
||||
Object.defineProperty(exports, "Quotes", { enumerable: true, get: function () { return Quotes_js_1.QuoteResource; } });
|
||||
var Refunds_js_2 = require("./resources/Refunds.js");
|
||||
Object.defineProperty(exports, "Refunds", { enumerable: true, get: function () { return Refunds_js_2.RefundResource; } });
|
||||
var Reviews_js_1 = require("./resources/Reviews.js");
|
||||
Object.defineProperty(exports, "Reviews", { enumerable: true, get: function () { return Reviews_js_1.ReviewResource; } });
|
||||
var SetupAttempts_js_1 = require("./resources/SetupAttempts.js");
|
||||
Object.defineProperty(exports, "SetupAttempts", { enumerable: true, get: function () { return SetupAttempts_js_1.SetupAttemptResource; } });
|
||||
var SetupIntents_js_1 = require("./resources/SetupIntents.js");
|
||||
Object.defineProperty(exports, "SetupIntents", { enumerable: true, get: function () { return SetupIntents_js_1.SetupIntentResource; } });
|
||||
var ShippingRates_js_1 = require("./resources/ShippingRates.js");
|
||||
Object.defineProperty(exports, "ShippingRates", { enumerable: true, get: function () { return ShippingRates_js_1.ShippingRateResource; } });
|
||||
var Sources_js_1 = require("./resources/Sources.js");
|
||||
Object.defineProperty(exports, "Sources", { enumerable: true, get: function () { return Sources_js_1.SourceResource; } });
|
||||
var Subscriptions_js_1 = require("./resources/Subscriptions.js");
|
||||
Object.defineProperty(exports, "Subscriptions", { enumerable: true, get: function () { return Subscriptions_js_1.SubscriptionResource; } });
|
||||
var SubscriptionItems_js_1 = require("./resources/SubscriptionItems.js");
|
||||
Object.defineProperty(exports, "SubscriptionItems", { enumerable: true, get: function () { return SubscriptionItems_js_1.SubscriptionItemResource; } });
|
||||
var SubscriptionSchedules_js_1 = require("./resources/SubscriptionSchedules.js");
|
||||
Object.defineProperty(exports, "SubscriptionSchedules", { enumerable: true, get: function () { return SubscriptionSchedules_js_1.SubscriptionScheduleResource; } });
|
||||
var TaxCodes_js_1 = require("./resources/TaxCodes.js");
|
||||
Object.defineProperty(exports, "TaxCodes", { enumerable: true, get: function () { return TaxCodes_js_1.TaxCodeResource; } });
|
||||
var TaxIds_js_1 = require("./resources/TaxIds.js");
|
||||
Object.defineProperty(exports, "TaxIds", { enumerable: true, get: function () { return TaxIds_js_1.TaxIdResource; } });
|
||||
var TaxRates_js_1 = require("./resources/TaxRates.js");
|
||||
Object.defineProperty(exports, "TaxRates", { enumerable: true, get: function () { return TaxRates_js_1.TaxRateResource; } });
|
||||
var Tokens_js_2 = require("./resources/Tokens.js");
|
||||
Object.defineProperty(exports, "Tokens", { enumerable: true, get: function () { return Tokens_js_2.TokenResource; } });
|
||||
var Topups_js_1 = require("./resources/Topups.js");
|
||||
Object.defineProperty(exports, "Topups", { enumerable: true, get: function () { return Topups_js_1.TopupResource; } });
|
||||
var Transfers_js_1 = require("./resources/Transfers.js");
|
||||
Object.defineProperty(exports, "Transfers", { enumerable: true, get: function () { return Transfers_js_1.TransferResource; } });
|
||||
var WebhookEndpoints_js_1 = require("./resources/WebhookEndpoints.js");
|
||||
Object.defineProperty(exports, "WebhookEndpoints", { enumerable: true, get: function () { return WebhookEndpoints_js_1.WebhookEndpointResource; } });
|
||||
exports.Apps = (0, ResourceNamespace_js_1.resourceNamespace)('apps', { Secrets: Secrets_js_1.SecretResource });
|
||||
exports.Billing = (0, ResourceNamespace_js_1.resourceNamespace)('billing', {
|
||||
Alerts: Alerts_js_1.AlertResource,
|
||||
CreditBalanceSummary: CreditBalanceSummary_js_1.CreditBalanceSummaryResource,
|
||||
CreditBalanceTransactions: CreditBalanceTransactions_js_1.CreditBalanceTransactionResource,
|
||||
CreditGrants: CreditGrants_js_1.CreditGrantResource,
|
||||
MeterEventAdjustments: MeterEventAdjustments_js_1.MeterEventAdjustmentResource,
|
||||
MeterEvents: MeterEvents_js_1.MeterEventResource,
|
||||
Meters: Meters_js_1.MeterResource,
|
||||
});
|
||||
exports.BillingPortal = (0, ResourceNamespace_js_1.resourceNamespace)('billingPortal', {
|
||||
Configurations: Configurations_js_1.ConfigurationResource,
|
||||
Sessions: Sessions_js_1.SessionResource,
|
||||
});
|
||||
exports.Checkout = (0, ResourceNamespace_js_1.resourceNamespace)('checkout', {
|
||||
Sessions: Sessions_js_2.SessionResource,
|
||||
});
|
||||
exports.Climate = (0, ResourceNamespace_js_1.resourceNamespace)('climate', {
|
||||
Orders: Orders_js_1.OrderResource,
|
||||
Products: Products_js_1.ProductResource,
|
||||
Suppliers: Suppliers_js_1.SupplierResource,
|
||||
});
|
||||
exports.Entitlements = (0, ResourceNamespace_js_1.resourceNamespace)('entitlements', {
|
||||
ActiveEntitlements: ActiveEntitlements_js_1.ActiveEntitlementResource,
|
||||
Features: Features_js_1.FeatureResource,
|
||||
});
|
||||
exports.FinancialConnections = (0, ResourceNamespace_js_1.resourceNamespace)('financialConnections', {
|
||||
Accounts: Accounts_js_1.AccountResource,
|
||||
Sessions: Sessions_js_3.SessionResource,
|
||||
Transactions: Transactions_js_1.TransactionResource,
|
||||
});
|
||||
exports.Forwarding = (0, ResourceNamespace_js_1.resourceNamespace)('forwarding', {
|
||||
Requests: Requests_js_1.RequestResource,
|
||||
});
|
||||
exports.Identity = (0, ResourceNamespace_js_1.resourceNamespace)('identity', {
|
||||
VerificationReports: VerificationReports_js_1.VerificationReportResource,
|
||||
VerificationSessions: VerificationSessions_js_1.VerificationSessionResource,
|
||||
});
|
||||
exports.Issuing = (0, ResourceNamespace_js_1.resourceNamespace)('issuing', {
|
||||
Authorizations: Authorizations_js_1.AuthorizationResource,
|
||||
Cardholders: Cardholders_js_1.CardholderResource,
|
||||
Cards: Cards_js_1.CardResource,
|
||||
Disputes: Disputes_js_1.DisputeResource,
|
||||
PersonalizationDesigns: PersonalizationDesigns_js_1.PersonalizationDesignResource,
|
||||
PhysicalBundles: PhysicalBundles_js_1.PhysicalBundleResource,
|
||||
Tokens: Tokens_js_1.TokenResource,
|
||||
Transactions: Transactions_js_2.TransactionResource,
|
||||
});
|
||||
exports.Radar = (0, ResourceNamespace_js_1.resourceNamespace)('radar', {
|
||||
EarlyFraudWarnings: EarlyFraudWarnings_js_1.EarlyFraudWarningResource,
|
||||
PaymentEvaluations: PaymentEvaluations_js_1.PaymentEvaluationResource,
|
||||
ValueListItems: ValueListItems_js_1.ValueListItemResource,
|
||||
ValueLists: ValueLists_js_1.ValueListResource,
|
||||
});
|
||||
exports.Reporting = (0, ResourceNamespace_js_1.resourceNamespace)('reporting', {
|
||||
ReportRuns: ReportRuns_js_1.ReportRunResource,
|
||||
ReportTypes: ReportTypes_js_1.ReportTypeResource,
|
||||
});
|
||||
exports.Sigma = (0, ResourceNamespace_js_1.resourceNamespace)('sigma', {
|
||||
ScheduledQueryRuns: ScheduledQueryRuns_js_1.ScheduledQueryRunResource,
|
||||
});
|
||||
exports.Tax = (0, ResourceNamespace_js_1.resourceNamespace)('tax', {
|
||||
Associations: Associations_js_1.AssociationResource,
|
||||
Calculations: Calculations_js_1.CalculationResource,
|
||||
Registrations: Registrations_js_1.RegistrationResource,
|
||||
Settings: Settings_js_1.SettingResource,
|
||||
Transactions: Transactions_js_3.TransactionResource,
|
||||
});
|
||||
exports.Terminal = (0, ResourceNamespace_js_1.resourceNamespace)('terminal', {
|
||||
Configurations: Configurations_js_2.ConfigurationResource,
|
||||
ConnectionTokens: ConnectionTokens_js_1.ConnectionTokenResource,
|
||||
Locations: Locations_js_1.LocationResource,
|
||||
OnboardingLinks: OnboardingLinks_js_1.OnboardingLinkResource,
|
||||
Readers: Readers_js_1.ReaderResource,
|
||||
});
|
||||
exports.TestHelpers = (0, ResourceNamespace_js_1.resourceNamespace)('testHelpers', {
|
||||
ConfirmationTokens: ConfirmationTokens_js_1.ConfirmationTokenResource,
|
||||
Customers: Customers_js_1.CustomerResource,
|
||||
Refunds: Refunds_js_1.RefundResource,
|
||||
TestClocks: TestClocks_js_1.TestClockResource,
|
||||
Issuing: (0, ResourceNamespace_js_1.resourceNamespace)('issuing', {
|
||||
Authorizations: Authorizations_js_2.AuthorizationResource,
|
||||
Cards: Cards_js_2.CardResource,
|
||||
PersonalizationDesigns: PersonalizationDesigns_js_2.PersonalizationDesignResource,
|
||||
Transactions: Transactions_js_4.TransactionResource,
|
||||
}),
|
||||
Terminal: (0, ResourceNamespace_js_1.resourceNamespace)('terminal', {
|
||||
Readers: Readers_js_2.ReaderResource,
|
||||
}),
|
||||
Treasury: (0, ResourceNamespace_js_1.resourceNamespace)('treasury', {
|
||||
InboundTransfers: InboundTransfers_js_1.InboundTransferResource,
|
||||
OutboundPayments: OutboundPayments_js_1.OutboundPaymentResource,
|
||||
OutboundTransfers: OutboundTransfers_js_1.OutboundTransferResource,
|
||||
ReceivedCredits: ReceivedCredits_js_1.ReceivedCreditResource,
|
||||
ReceivedDebits: ReceivedDebits_js_1.ReceivedDebitResource,
|
||||
}),
|
||||
});
|
||||
exports.Treasury = (0, ResourceNamespace_js_1.resourceNamespace)('treasury', {
|
||||
CreditReversals: CreditReversals_js_1.CreditReversalResource,
|
||||
DebitReversals: DebitReversals_js_1.DebitReversalResource,
|
||||
FinancialAccounts: FinancialAccounts_js_1.FinancialAccountResource,
|
||||
InboundTransfers: InboundTransfers_js_2.InboundTransferResource,
|
||||
OutboundPayments: OutboundPayments_js_2.OutboundPaymentResource,
|
||||
OutboundTransfers: OutboundTransfers_js_2.OutboundTransferResource,
|
||||
ReceivedCredits: ReceivedCredits_js_2.ReceivedCreditResource,
|
||||
ReceivedDebits: ReceivedDebits_js_2.ReceivedDebitResource,
|
||||
TransactionEntries: TransactionEntries_js_1.TransactionEntryResource,
|
||||
Transactions: Transactions_js_5.TransactionResource,
|
||||
});
|
||||
exports.V2 = (0, ResourceNamespace_js_1.resourceNamespace)('v2', {
|
||||
Billing: (0, ResourceNamespace_js_1.resourceNamespace)('billing', {
|
||||
MeterEventAdjustments: MeterEventAdjustments_js_2.MeterEventAdjustmentResource,
|
||||
MeterEventSession: MeterEventSession_js_1.MeterEventSessionResource,
|
||||
MeterEventStream: MeterEventStream_js_1.MeterEventStreamResource,
|
||||
MeterEvents: MeterEvents_js_2.MeterEventResource,
|
||||
}),
|
||||
Commerce: (0, ResourceNamespace_js_1.resourceNamespace)('commerce', {
|
||||
ProductCatalog: (0, ResourceNamespace_js_1.resourceNamespace)('productCatalog', {
|
||||
Imports: Imports_js_1.ImportResource,
|
||||
}),
|
||||
}),
|
||||
Core: (0, ResourceNamespace_js_1.resourceNamespace)('core', {
|
||||
AccountLinks: AccountLinks_js_1.AccountLinkResource,
|
||||
AccountTokens: AccountTokens_js_1.AccountTokenResource,
|
||||
Accounts: Accounts_js_2.AccountResource,
|
||||
EventDestinations: EventDestinations_js_1.EventDestinationResource,
|
||||
Events: Events_js_1.EventResource,
|
||||
}),
|
||||
});
|
||||
//# sourceMappingURL=resources.js.map
|
||||
1
node_modules/stripe/cjs/resources.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
76
node_modules/stripe/cjs/resources/AccountLinks.d.ts
generated
vendored
Normal file
76
node_modules/stripe/cjs/resources/AccountLinks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import { StripeResource } from '../StripeResource.js';
|
||||
import { RequestOptions, Response } from '../lib.js';
|
||||
export declare class AccountLinkResource extends StripeResource {
|
||||
/**
|
||||
* Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
|
||||
*/
|
||||
create(params: AccountLinkCreateParams, options?: RequestOptions): Promise<Response<AccountLink>>;
|
||||
}
|
||||
export interface AccountLink {
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'account_link';
|
||||
/**
|
||||
* Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
*/
|
||||
created: number;
|
||||
/**
|
||||
* The timestamp at which this account link will expire.
|
||||
*/
|
||||
expires_at: number;
|
||||
/**
|
||||
* The URL for the account link.
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
export interface AccountLinkCreateParams {
|
||||
/**
|
||||
* The identifier of the account to create an account link for.
|
||||
*/
|
||||
account: string;
|
||||
/**
|
||||
* The type of account link the user is requesting.
|
||||
*
|
||||
* You can create Account Links of type `account_update` only for connected accounts where your platform is responsible for collecting requirements, including Custom accounts. You can't create them for accounts that have access to a Stripe-hosted Dashboard. If you use [Connect embedded components](https://docs.stripe.com/connect/get-started-connect-embedded-components), you can include components that allow your connected accounts to update their own information. For an account without Stripe-hosted Dashboard access where Stripe is liable for negative balances, you must use embedded components.
|
||||
*/
|
||||
type: AccountLinkCreateParams.Type;
|
||||
/**
|
||||
* The collect parameter is deprecated. Use `collection_options` instead.
|
||||
*/
|
||||
collect?: AccountLinkCreateParams.Collect;
|
||||
/**
|
||||
* Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow.
|
||||
*/
|
||||
collection_options?: AccountLinkCreateParams.CollectionOptions;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
/**
|
||||
* The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.
|
||||
*/
|
||||
refresh_url?: string;
|
||||
/**
|
||||
* The URL that the user will be redirected to upon leaving or completing the linked flow.
|
||||
*/
|
||||
return_url?: string;
|
||||
}
|
||||
export declare namespace AccountLinkCreateParams {
|
||||
type Type = 'account_onboarding' | 'account_update';
|
||||
type Collect = 'currently_due' | 'eventually_due';
|
||||
interface CollectionOptions {
|
||||
/**
|
||||
* Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). If you don't specify `collection_options`, the default value is `currently_due`.
|
||||
*/
|
||||
fields?: CollectionOptions.Fields;
|
||||
/**
|
||||
* Specifies whether the platform collects future_requirements in addition to requirements in Connect Onboarding. The default value is `omit`.
|
||||
*/
|
||||
future_requirements?: CollectionOptions.FutureRequirements;
|
||||
}
|
||||
namespace CollectionOptions {
|
||||
type Fields = 'currently_due' | 'eventually_due';
|
||||
type FutureRequirements = 'include' | 'omit';
|
||||
}
|
||||
}
|
||||
15
node_modules/stripe/cjs/resources/AccountLinks.js
generated
vendored
Normal file
15
node_modules/stripe/cjs/resources/AccountLinks.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AccountLinkResource = void 0;
|
||||
const StripeResource_js_1 = require("../StripeResource.js");
|
||||
class AccountLinkResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
|
||||
*/
|
||||
create(params, options) {
|
||||
return this._makeRequest('POST', '/v1/account_links', params, options);
|
||||
}
|
||||
}
|
||||
exports.AccountLinkResource = AccountLinkResource;
|
||||
//# sourceMappingURL=AccountLinks.js.map
|
||||
1
node_modules/stripe/cjs/resources/AccountLinks.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/AccountLinks.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AccountLinks.js","sourceRoot":"","sources":["../../src/resources/AccountLinks.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAEvC,4DAAoD;AAGpD,MAAa,mBAAoB,SAAQ,kCAAc;IACrD;;OAEG;IACH,MAAM,CACJ,MAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;CACF;AAfD,kDAeC"}
|
||||
1075
node_modules/stripe/cjs/resources/AccountSessions.d.ts
generated
vendored
Normal file
1075
node_modules/stripe/cjs/resources/AccountSessions.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
node_modules/stripe/cjs/resources/AccountSessions.js
generated
vendored
Normal file
15
node_modules/stripe/cjs/resources/AccountSessions.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AccountSessionResource = void 0;
|
||||
const StripeResource_js_1 = require("../StripeResource.js");
|
||||
class AccountSessionResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
|
||||
*/
|
||||
create(params, options) {
|
||||
return this._makeRequest('POST', '/v1/account_sessions', params, options);
|
||||
}
|
||||
}
|
||||
exports.AccountSessionResource = AccountSessionResource;
|
||||
//# sourceMappingURL=AccountSessions.js.map
|
||||
1
node_modules/stripe/cjs/resources/AccountSessions.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/AccountSessions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AccountSessions.js","sourceRoot":"","sources":["../../src/resources/AccountSessions.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAEvC,4DAAoD;AAGpD,MAAa,sBAAuB,SAAQ,kCAAc;IACxD;;OAEG;IACH,MAAM,CACJ,MAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,sBAAsB,EACtB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;CACF;AAfD,wDAeC"}
|
||||
5296
node_modules/stripe/cjs/resources/Accounts.d.ts
generated
vendored
Normal file
5296
node_modules/stripe/cjs/resources/Accounts.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
182
node_modules/stripe/cjs/resources/Accounts.js
generated
vendored
Normal file
182
node_modules/stripe/cjs/resources/Accounts.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AccountResource = void 0;
|
||||
const StripeResource_js_1 = require("../StripeResource.js");
|
||||
class AccountResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* With [Connect](https://docs.stripe.com/connect), you can delete accounts you manage.
|
||||
*
|
||||
* Test-mode accounts can be deleted at any time.
|
||||
*
|
||||
* Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero.
|
||||
*
|
||||
* If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
|
||||
*/
|
||||
del(id, params, options) {
|
||||
return this._makeRequest('DELETE', `/v1/accounts/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Retrieves the details of an account. Pass `null` as the account id to retrieve details about your own account.
|
||||
*/
|
||||
retrieve(id, params, options) {
|
||||
if (typeof id === 'string') {
|
||||
return this._makeRequest('GET', `/v1/accounts/${id}`, params, options);
|
||||
}
|
||||
else {
|
||||
return this._makeRequest('GET', '/v1/account', params, options);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Updates a [connected account](https://docs.stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
|
||||
* left unchanged.
|
||||
*
|
||||
* For accounts where [controller.requirement_collection](https://docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
||||
* is application, which includes Custom accounts, you can update any information on the account.
|
||||
*
|
||||
* For accounts where [controller.requirement_collection](https://docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
||||
* is stripe, which includes Standard and Express accounts, you can update all information until you create
|
||||
* an [Account Link or <a href="/api/account_sessions">Account Session](https://docs.stripe.com/api/account_links) to start Connect onboarding,
|
||||
* after which some properties can no longer be updated.
|
||||
*
|
||||
* To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
|
||||
* [Connect](https://docs.stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
|
||||
*/
|
||||
update(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Retrieves the details of an account.
|
||||
*/
|
||||
retrieveCurrent(params, options) {
|
||||
return this._makeRequest('GET', '/v1/account', params, options);
|
||||
}
|
||||
/**
|
||||
* Returns a list of accounts connected to your platform via [Connect](https://docs.stripe.com/docs/connect). If you're not a platform, the list is empty.
|
||||
*/
|
||||
list(params, options) {
|
||||
return this._makeRequest('GET', '/v1/accounts', params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* With [Connect](https://docs.stripe.com/docs/connect), you can create Stripe accounts for your users.
|
||||
* To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
|
||||
*
|
||||
* If you've already collected information for your connected accounts, you [can prefill that information](https://docs.stripe.com/docs/connect/best-practices#onboarding) when
|
||||
* creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
|
||||
* You can prefill any information on the account.
|
||||
*/
|
||||
create(params, options) {
|
||||
return this._makeRequest('POST', '/v1/accounts', params, options);
|
||||
}
|
||||
/**
|
||||
* With [Connect](https://docs.stripe.com/connect), you can reject accounts that you have flagged as suspicious.
|
||||
*
|
||||
* Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
|
||||
*/
|
||||
reject(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(id)}/reject`, params, options);
|
||||
}
|
||||
/**
|
||||
* Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first.
|
||||
*/
|
||||
listCapabilities(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(id)}/capabilities`, params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves information about the specified Account Capability.
|
||||
*/
|
||||
retrieveCapability(accountId, id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(accountId)}/capabilities/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
|
||||
*/
|
||||
updateCapability(accountId, id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(accountId)}/capabilities/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Delete a specified external account for a given account.
|
||||
*/
|
||||
deleteExternalAccount(accountId, id, params, options) {
|
||||
return this._makeRequest('DELETE', `/v1/accounts/${encodeURIComponent(accountId)}/external_accounts/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Retrieve a specified external account for a given account.
|
||||
*/
|
||||
retrieveExternalAccount(accountId, id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(accountId)}/external_accounts/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Updates the metadata, account holder name, account holder type of a bank account belonging to
|
||||
* a connected account and optionally sets it as the default for its currency. Other bank account
|
||||
* details are not editable by design.
|
||||
*
|
||||
* You can only update bank accounts when [account.controller.requirement_collection is application, which includes <a href="/connect/custom-accounts">Custom accounts](https://docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection).
|
||||
*
|
||||
* You can re-enable a disabled bank account by performing an update call without providing any
|
||||
* arguments or changes.
|
||||
*/
|
||||
updateExternalAccount(accountId, id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(accountId)}/external_accounts/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* List external accounts for an account.
|
||||
*/
|
||||
listExternalAccounts(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(id)}/external_accounts`, params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create an external account for a given account.
|
||||
*/
|
||||
createExternalAccount(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(id)}/external_accounts`, params, options);
|
||||
}
|
||||
/**
|
||||
* Creates a login link for a connected account to access the Express Dashboard.
|
||||
*
|
||||
* You can only create login links for accounts that use the [Express Dashboard](https://docs.stripe.com/connect/express-dashboard) and are connected to your platform.
|
||||
*/
|
||||
createLoginLink(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(id)}/login_links`, params, options);
|
||||
}
|
||||
/**
|
||||
* Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
|
||||
*/
|
||||
deletePerson(accountId, id, params, options) {
|
||||
return this._makeRequest('DELETE', `/v1/accounts/${encodeURIComponent(accountId)}/persons/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Retrieves an existing person.
|
||||
*/
|
||||
retrievePerson(accountId, id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(accountId)}/persons/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Updates an existing person.
|
||||
*/
|
||||
updatePerson(accountId, id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(accountId)}/persons/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
|
||||
*/
|
||||
listPersons(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/accounts/${encodeURIComponent(id)}/persons`, params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Creates a new person.
|
||||
*/
|
||||
createPerson(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/accounts/${encodeURIComponent(id)}/persons`, params, options);
|
||||
}
|
||||
}
|
||||
exports.AccountResource = AccountResource;
|
||||
//# sourceMappingURL=Accounts.js.map
|
||||
1
node_modules/stripe/cjs/resources/Accounts.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/Accounts.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Accounts.js","sourceRoot":"","sources":["../../src/resources/Accounts.ts"],"names":[],"mappings":"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"}
|
||||
80
node_modules/stripe/cjs/resources/ApplePayDomains.d.ts
generated
vendored
Normal file
80
node_modules/stripe/cjs/resources/ApplePayDomains.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { StripeResource } from '../StripeResource.js';
|
||||
import { PaginationParams } from '../shared.js';
|
||||
import { RequestOptions, Response, ApiListPromise } from '../lib.js';
|
||||
export declare class ApplePayDomainResource extends StripeResource {
|
||||
/**
|
||||
* Delete an apple pay domain.
|
||||
*/
|
||||
del(id: string, params?: ApplePayDomainDeleteParams, options?: RequestOptions): Promise<Response<DeletedApplePayDomain>>;
|
||||
/**
|
||||
* Retrieve an apple pay domain.
|
||||
*/
|
||||
retrieve(id: string, params?: ApplePayDomainRetrieveParams, options?: RequestOptions): Promise<Response<ApplePayDomain>>;
|
||||
/**
|
||||
* List apple pay domains.
|
||||
*/
|
||||
list(params?: ApplePayDomainListParams, options?: RequestOptions): ApiListPromise<ApplePayDomain>;
|
||||
/**
|
||||
* Create an apple pay domain.
|
||||
*/
|
||||
create(params: ApplePayDomainCreateParams, options?: RequestOptions): Promise<Response<ApplePayDomain>>;
|
||||
}
|
||||
export interface ApplePayDomain {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'apple_pay_domain';
|
||||
/**
|
||||
* Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
*/
|
||||
created: number;
|
||||
/**
|
||||
* Always true for a deleted object
|
||||
*/
|
||||
deleted?: void;
|
||||
domain_name: string;
|
||||
/**
|
||||
* If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
|
||||
*/
|
||||
livemode: boolean;
|
||||
}
|
||||
export interface DeletedApplePayDomain {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'apple_pay_domain';
|
||||
/**
|
||||
* Always true for a deleted object
|
||||
*/
|
||||
deleted: true;
|
||||
}
|
||||
export interface ApplePayDomainCreateParams {
|
||||
domain_name: string;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplePayDomainRetrieveParams {
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplePayDomainListParams extends PaginationParams {
|
||||
domain_name?: string;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplePayDomainDeleteParams {
|
||||
}
|
||||
35
node_modules/stripe/cjs/resources/ApplePayDomains.js
generated
vendored
Normal file
35
node_modules/stripe/cjs/resources/ApplePayDomains.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApplePayDomainResource = void 0;
|
||||
const StripeResource_js_1 = require("../StripeResource.js");
|
||||
class ApplePayDomainResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* Delete an apple pay domain.
|
||||
*/
|
||||
del(id, params, options) {
|
||||
return this._makeRequest('DELETE', `/v1/apple_pay/domains/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Retrieve an apple pay domain.
|
||||
*/
|
||||
retrieve(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/apple_pay/domains/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* List apple pay domains.
|
||||
*/
|
||||
list(params, options) {
|
||||
return this._makeRequest('GET', '/v1/apple_pay/domains', params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create an apple pay domain.
|
||||
*/
|
||||
create(params, options) {
|
||||
return this._makeRequest('POST', '/v1/apple_pay/domains', params, options);
|
||||
}
|
||||
}
|
||||
exports.ApplePayDomainResource = ApplePayDomainResource;
|
||||
//# sourceMappingURL=ApplePayDomains.js.map
|
||||
1
node_modules/stripe/cjs/resources/ApplePayDomains.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/ApplePayDomains.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApplePayDomains.js","sourceRoot":"","sources":["../../src/resources/ApplePayDomains.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAEvC,4DAAoD;AAIpD,MAAa,sBAAuB,SAAQ,kCAAc;IACxD;;OAEG;IACH,GAAG,CACD,EAAU,EACV,MAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,QAAQ,EACR,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EACjD,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,QAAQ,CACN,EAAU,EACV,MAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,KAAK,EACL,yBAAyB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EACjD,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,IAAI,CACF,MAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE;YACxE,UAAU,EAAE,MAAM;SACnB,CAAQ,CAAC;IACZ,CAAC;IACD;;OAEG;IACH,MAAM,CACJ,MAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,uBAAuB,EACvB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;CACF;AAxDD,wDAwDC"}
|
||||
181
node_modules/stripe/cjs/resources/ApplicationFees.d.ts
generated
vendored
Normal file
181
node_modules/stripe/cjs/resources/ApplicationFees.d.ts
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
import { StripeResource } from '../StripeResource.js';
|
||||
import { FeeRefund } from './FeeRefunds.js';
|
||||
import { Account } from './Accounts.js';
|
||||
import { Application } from './Applications.js';
|
||||
import { BalanceTransaction } from './BalanceTransactions.js';
|
||||
import { Charge } from './Charges.js';
|
||||
import { PaginationParams, RangeQueryParam, MetadataParam, Emptyable } from '../shared.js';
|
||||
import { RequestOptions, ApiListPromise, Response, ApiList } from '../lib.js';
|
||||
export declare class ApplicationFeeResource extends StripeResource {
|
||||
/**
|
||||
* Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
|
||||
*/
|
||||
list(params?: ApplicationFeeListParams, options?: RequestOptions): ApiListPromise<ApplicationFee>;
|
||||
/**
|
||||
* Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee.
|
||||
*/
|
||||
retrieve(id: string, params?: ApplicationFeeRetrieveParams, options?: RequestOptions): Promise<Response<ApplicationFee>>;
|
||||
/**
|
||||
* By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
|
||||
*/
|
||||
retrieveRefund(feeId: string, id: string, params?: ApplicationFeeRetrieveRefundParams, options?: RequestOptions): Promise<Response<FeeRefund>>;
|
||||
/**
|
||||
* Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
||||
*
|
||||
* This request only accepts metadata as an argument.
|
||||
*/
|
||||
updateRefund(feeId: string, id: string, params?: ApplicationFeeUpdateRefundParams, options?: RequestOptions): Promise<Response<FeeRefund>>;
|
||||
/**
|
||||
* You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
|
||||
*/
|
||||
listRefunds(id: string, params?: ApplicationFeeListRefundsParams, options?: RequestOptions): ApiListPromise<FeeRefund>;
|
||||
/**
|
||||
* Refunds an application fee that has previously been collected but not yet refunded.
|
||||
* Funds will be refunded to the Stripe account from which the fee was originally collected.
|
||||
*
|
||||
* You can optionally refund only part of an application fee.
|
||||
* You can do so multiple times, until the entire fee has been refunded.
|
||||
*
|
||||
* Once entirely refunded, an application fee can't be refunded again.
|
||||
* This method will raise an error when called on an already-refunded application fee,
|
||||
* or when trying to refund more money than is left on an application fee.
|
||||
*/
|
||||
createRefund(id: string, params?: ApplicationFeeCreateRefundParams, options?: RequestOptions): Promise<Response<FeeRefund>>;
|
||||
}
|
||||
export interface ApplicationFee {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'application_fee';
|
||||
/**
|
||||
* ID of the Stripe account this fee was taken from.
|
||||
*/
|
||||
account: string | Account;
|
||||
/**
|
||||
* Amount earned, in cents (or local equivalent).
|
||||
*/
|
||||
amount: number;
|
||||
/**
|
||||
* Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued)
|
||||
*/
|
||||
amount_refunded: number;
|
||||
/**
|
||||
* ID of the Connect application that earned the fee.
|
||||
*/
|
||||
application: string | Application;
|
||||
/**
|
||||
* Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
|
||||
*/
|
||||
balance_transaction: string | BalanceTransaction | null;
|
||||
/**
|
||||
* ID of the charge that the application fee was taken from.
|
||||
*/
|
||||
charge: string | Charge;
|
||||
/**
|
||||
* Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
*/
|
||||
created: number;
|
||||
/**
|
||||
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
*/
|
||||
currency: string;
|
||||
/**
|
||||
* Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
|
||||
*/
|
||||
fee_source: ApplicationFee.FeeSource | null;
|
||||
/**
|
||||
* If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
|
||||
*/
|
||||
livemode: boolean;
|
||||
/**
|
||||
* ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter.
|
||||
*/
|
||||
originating_transaction: string | Charge | null;
|
||||
/**
|
||||
* Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
|
||||
*/
|
||||
refunded: boolean;
|
||||
/**
|
||||
* A list of refunds that have been applied to the fee.
|
||||
*/
|
||||
refunds: ApiList<FeeRefund>;
|
||||
}
|
||||
export declare namespace ApplicationFee {
|
||||
interface FeeSource {
|
||||
/**
|
||||
* Charge ID that created this application fee.
|
||||
*/
|
||||
charge?: string;
|
||||
/**
|
||||
* Payout ID that created this application fee.
|
||||
*/
|
||||
payout?: string;
|
||||
/**
|
||||
* Type of object that created the application fee.
|
||||
*/
|
||||
type: FeeSource.Type;
|
||||
}
|
||||
namespace FeeSource {
|
||||
type Type = 'charge' | 'payout';
|
||||
}
|
||||
}
|
||||
export interface ApplicationFeeRetrieveParams {
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplicationFeeListParams extends PaginationParams {
|
||||
/**
|
||||
* Only return application fees for the charge specified by this charge ID.
|
||||
*/
|
||||
charge?: string;
|
||||
/**
|
||||
* Only return applications fees that were created during the given date interval.
|
||||
*/
|
||||
created?: RangeQueryParam | number;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplicationFeeCreateRefundParams {
|
||||
/**
|
||||
* A positive integer, in _cents (or local equivalent)_, representing how much of this fee to refund. Can refund only up to the remaining unrefunded amount of the fee.
|
||||
*/
|
||||
amount?: number;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
/**
|
||||
* Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
*/
|
||||
metadata?: MetadataParam;
|
||||
}
|
||||
export interface ApplicationFeeListRefundsParams extends PaginationParams {
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplicationFeeRetrieveRefundParams {
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
export interface ApplicationFeeUpdateRefundParams {
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
/**
|
||||
* Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
*/
|
||||
metadata?: Emptyable<MetadataParam>;
|
||||
}
|
||||
59
node_modules/stripe/cjs/resources/ApplicationFees.js
generated
vendored
Normal file
59
node_modules/stripe/cjs/resources/ApplicationFees.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApplicationFeeResource = void 0;
|
||||
const StripeResource_js_1 = require("../StripeResource.js");
|
||||
class ApplicationFeeResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
|
||||
*/
|
||||
list(params, options) {
|
||||
return this._makeRequest('GET', '/v1/application_fees', params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee.
|
||||
*/
|
||||
retrieve(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/application_fees/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
|
||||
*/
|
||||
retrieveRefund(feeId, id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/application_fees/${encodeURIComponent(feeId)}/refunds/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
||||
*
|
||||
* This request only accepts metadata as an argument.
|
||||
*/
|
||||
updateRefund(feeId, id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/application_fees/${encodeURIComponent(feeId)}/refunds/${encodeURIComponent(id)}`, params, options);
|
||||
}
|
||||
/**
|
||||
* You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
|
||||
*/
|
||||
listRefunds(id, params, options) {
|
||||
return this._makeRequest('GET', `/v1/application_fees/${encodeURIComponent(id)}/refunds`, params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Refunds an application fee that has previously been collected but not yet refunded.
|
||||
* Funds will be refunded to the Stripe account from which the fee was originally collected.
|
||||
*
|
||||
* You can optionally refund only part of an application fee.
|
||||
* You can do so multiple times, until the entire fee has been refunded.
|
||||
*
|
||||
* Once entirely refunded, an application fee can't be refunded again.
|
||||
* This method will raise an error when called on an already-refunded application fee,
|
||||
* or when trying to refund more money than is left on an application fee.
|
||||
*/
|
||||
createRefund(id, params, options) {
|
||||
return this._makeRequest('POST', `/v1/application_fees/${encodeURIComponent(id)}/refunds`, params, options);
|
||||
}
|
||||
}
|
||||
exports.ApplicationFeeResource = ApplicationFeeResource;
|
||||
//# sourceMappingURL=ApplicationFees.js.map
|
||||
1
node_modules/stripe/cjs/resources/ApplicationFees.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/ApplicationFees.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApplicationFees.js","sourceRoot":"","sources":["../../src/resources/ApplicationFees.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAEvC,4DAAoD;AAcpD,MAAa,sBAAuB,SAAQ,kCAAc;IACxD;;OAEG;IACH,IAAI,CACF,MAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE;YACvE,UAAU,EAAE,MAAM;SACnB,CAAQ,CAAC;IACZ,CAAC;IACD;;OAEG;IACH,QAAQ,CACN,EAAU,EACV,MAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,KAAK,EACL,wBAAwB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAChD,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,cAAc,CACZ,KAAa,EACb,EAAU,EACV,MAA2C,EAC3C,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,KAAK,EACL,wBAAwB,kBAAkB,CACxC,KAAK,CACN,YAAY,kBAAkB,CAAC,EAAE,CAAC,EAAE,EACrC,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;;;OAIG;IACH,YAAY,CACV,KAAa,EACb,EAAU,EACV,MAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,wBAAwB,kBAAkB,CACxC,KAAK,CACN,YAAY,kBAAkB,CAAC,EAAE,CAAC,EAAE,EACrC,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,WAAW,CACT,EAAU,EACV,MAAwC,EACxC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,KAAK,EACL,wBAAwB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EACxD,MAAM,EACN,OAAO,EACP;YACE,UAAU,EAAE,MAAM;SACnB,CACK,CAAC;IACX,CAAC;IACD;;;;;;;;;;OAUG;IACH,YAAY,CACV,EAAU,EACV,MAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,wBAAwB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EACxD,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;CACF;AA1GD,wDA0GC"}
|
||||
36
node_modules/stripe/cjs/resources/Applications.d.ts
generated
vendored
Normal file
36
node_modules/stripe/cjs/resources/Applications.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
export interface Application {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'application';
|
||||
/**
|
||||
* Always true for a deleted object
|
||||
*/
|
||||
deleted?: void;
|
||||
/**
|
||||
* The name of the application.
|
||||
*/
|
||||
name: string | null;
|
||||
}
|
||||
export interface DeletedApplication {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'application';
|
||||
/**
|
||||
* Always true for a deleted object
|
||||
*/
|
||||
deleted: true;
|
||||
/**
|
||||
* The name of the application.
|
||||
*/
|
||||
name: string | null;
|
||||
}
|
||||
4
node_modules/stripe/cjs/resources/Applications.js
generated
vendored
Normal file
4
node_modules/stripe/cjs/resources/Applications.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Applications.js.map
|
||||
1
node_modules/stripe/cjs/resources/Applications.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/Applications.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Applications.js","sourceRoot":"","sources":["../../src/resources/Applications.ts"],"names":[],"mappings":";AAAA,uCAAuC"}
|
||||
201
node_modules/stripe/cjs/resources/Apps/Secrets.d.ts
generated
vendored
Normal file
201
node_modules/stripe/cjs/resources/Apps/Secrets.d.ts
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
import { StripeResource } from '../../StripeResource.js';
|
||||
import { PaginationParams } from '../../shared.js';
|
||||
import { RequestOptions, ApiListPromise, Response } from '../../lib.js';
|
||||
export declare class SecretResource extends StripeResource {
|
||||
/**
|
||||
* List all secrets stored on the given scope.
|
||||
*/
|
||||
list(params: Apps.SecretListParams, options?: RequestOptions): ApiListPromise<Secret>;
|
||||
/**
|
||||
* Create or replace a secret in the secret store.
|
||||
*/
|
||||
create(params: Apps.SecretCreateParams, options?: RequestOptions): Promise<Response<Secret>>;
|
||||
/**
|
||||
* Finds a secret in the secret store by name and scope.
|
||||
*/
|
||||
find(params: Apps.SecretFindParams, options?: RequestOptions): Promise<Response<Secret>>;
|
||||
/**
|
||||
* Deletes a secret from the secret store by name and scope.
|
||||
*/
|
||||
deleteWhere(params: Apps.SecretDeleteWhereParams, options?: RequestOptions): Promise<Response<Secret>>;
|
||||
}
|
||||
export interface Secret {
|
||||
/**
|
||||
* Unique identifier for the object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* String representing the object's type. Objects of the same type share the same value.
|
||||
*/
|
||||
object: 'apps.secret';
|
||||
/**
|
||||
* Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
*/
|
||||
created: number;
|
||||
/**
|
||||
* If true, indicates that this secret has been deleted
|
||||
*/
|
||||
deleted?: boolean;
|
||||
/**
|
||||
* The Unix timestamp for the expiry time of the secret, after which the secret deletes.
|
||||
*/
|
||||
expires_at: number | null;
|
||||
/**
|
||||
* If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
|
||||
*/
|
||||
livemode: boolean;
|
||||
/**
|
||||
* A name for the secret that's unique within the scope.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The plaintext secret value to be stored.
|
||||
*/
|
||||
payload?: string | null;
|
||||
scope: Apps.Secret.Scope;
|
||||
}
|
||||
export declare namespace Apps {
|
||||
namespace Secret {
|
||||
interface Scope {
|
||||
/**
|
||||
* The secret scope type.
|
||||
*/
|
||||
type: Scope.Type;
|
||||
/**
|
||||
* The user ID, if type is set to "user"
|
||||
*/
|
||||
user?: string;
|
||||
}
|
||||
namespace Scope {
|
||||
type Type = 'account' | 'user';
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare namespace Apps {
|
||||
interface SecretCreateParams {
|
||||
/**
|
||||
* A name for the secret that's unique within the scope.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The plaintext secret value to be stored.
|
||||
*/
|
||||
payload: string;
|
||||
/**
|
||||
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
*/
|
||||
scope: SecretCreateParams.Scope;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
/**
|
||||
* The Unix timestamp for the expiry time of the secret, after which the secret deletes.
|
||||
*/
|
||||
expires_at?: number;
|
||||
}
|
||||
namespace SecretCreateParams {
|
||||
interface Scope {
|
||||
/**
|
||||
* The secret scope type.
|
||||
*/
|
||||
type: Scope.Type;
|
||||
/**
|
||||
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
*/
|
||||
user?: string;
|
||||
}
|
||||
namespace Scope {
|
||||
type Type = 'account' | 'user';
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare namespace Apps {
|
||||
interface SecretListParams extends PaginationParams {
|
||||
/**
|
||||
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
*/
|
||||
scope: SecretListParams.Scope;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
namespace SecretListParams {
|
||||
interface Scope {
|
||||
/**
|
||||
* The secret scope type.
|
||||
*/
|
||||
type: Scope.Type;
|
||||
/**
|
||||
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
*/
|
||||
user?: string;
|
||||
}
|
||||
namespace Scope {
|
||||
type Type = 'account' | 'user';
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare namespace Apps {
|
||||
interface SecretDeleteWhereParams {
|
||||
/**
|
||||
* A name for the secret that's unique within the scope.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
*/
|
||||
scope: SecretDeleteWhereParams.Scope;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
namespace SecretDeleteWhereParams {
|
||||
interface Scope {
|
||||
/**
|
||||
* The secret scope type.
|
||||
*/
|
||||
type: Scope.Type;
|
||||
/**
|
||||
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
*/
|
||||
user?: string;
|
||||
}
|
||||
namespace Scope {
|
||||
type Type = 'account' | 'user';
|
||||
}
|
||||
}
|
||||
}
|
||||
export declare namespace Apps {
|
||||
interface SecretFindParams {
|
||||
/**
|
||||
* A name for the secret that's unique within the scope.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
*/
|
||||
scope: SecretFindParams.Scope;
|
||||
/**
|
||||
* Specifies which fields in the response should be expanded.
|
||||
*/
|
||||
expand?: Array<string>;
|
||||
}
|
||||
namespace SecretFindParams {
|
||||
interface Scope {
|
||||
/**
|
||||
* The secret scope type.
|
||||
*/
|
||||
type: Scope.Type;
|
||||
/**
|
||||
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
*/
|
||||
user?: string;
|
||||
}
|
||||
namespace Scope {
|
||||
type Type = 'account' | 'user';
|
||||
}
|
||||
}
|
||||
}
|
||||
35
node_modules/stripe/cjs/resources/Apps/Secrets.js
generated
vendored
Normal file
35
node_modules/stripe/cjs/resources/Apps/Secrets.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SecretResource = void 0;
|
||||
const StripeResource_js_1 = require("../../StripeResource.js");
|
||||
class SecretResource extends StripeResource_js_1.StripeResource {
|
||||
/**
|
||||
* List all secrets stored on the given scope.
|
||||
*/
|
||||
list(params, options) {
|
||||
return this._makeRequest('GET', '/v1/apps/secrets', params, options, {
|
||||
methodType: 'list',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create or replace a secret in the secret store.
|
||||
*/
|
||||
create(params, options) {
|
||||
return this._makeRequest('POST', '/v1/apps/secrets', params, options);
|
||||
}
|
||||
/**
|
||||
* Finds a secret in the secret store by name and scope.
|
||||
*/
|
||||
find(params, options) {
|
||||
return this._makeRequest('GET', '/v1/apps/secrets/find', params, options);
|
||||
}
|
||||
/**
|
||||
* Deletes a secret from the secret store by name and scope.
|
||||
*/
|
||||
deleteWhere(params, options) {
|
||||
return this._makeRequest('POST', '/v1/apps/secrets/delete', params, options);
|
||||
}
|
||||
}
|
||||
exports.SecretResource = SecretResource;
|
||||
//# sourceMappingURL=Secrets.js.map
|
||||
1
node_modules/stripe/cjs/resources/Apps/Secrets.js.map
generated
vendored
Normal file
1
node_modules/stripe/cjs/resources/Apps/Secrets.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Secrets.js","sourceRoot":"","sources":["../../../src/resources/Apps/Secrets.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;AAEvC,+DAAuD;AAIvD,MAAa,cAAe,SAAQ,kCAAc;IAChD;;OAEG;IACH,IAAI,CACF,MAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE;YACnE,UAAU,EAAE,MAAM;SACnB,CAAQ,CAAC;IACZ,CAAC;IACD;;OAEG;IACH,MAAM,CACJ,MAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,IAAI,CACF,MAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,KAAK,EACL,uBAAuB,EACvB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;IACD;;OAEG;IACH,WAAW,CACT,MAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,YAAY,CACtB,MAAM,EACN,yBAAyB,EACzB,MAAM,EACN,OAAO,CACD,CAAC;IACX,CAAC;CACF;AAtDD,wCAsDC"}
|
||||
15
node_modules/stripe/cjs/resources/Apps/index.d.ts
generated
vendored
Normal file
15
node_modules/stripe/cjs/resources/Apps/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Stripe } from '../../stripe.core.js';
|
||||
import { Apps as AppsNamespace0, Secret, SecretResource } from './Secrets.js';
|
||||
export { Secret } from './Secrets.js';
|
||||
export declare class Apps {
|
||||
private readonly stripe;
|
||||
secrets: SecretResource;
|
||||
constructor(stripe: Stripe);
|
||||
}
|
||||
export declare namespace Apps {
|
||||
export import SecretListParams = AppsNamespace0.SecretListParams;
|
||||
export import SecretCreateParams = AppsNamespace0.SecretCreateParams;
|
||||
export import SecretFindParams = AppsNamespace0.SecretFindParams;
|
||||
export import SecretDeleteWhereParams = AppsNamespace0.SecretDeleteWhereParams;
|
||||
export { Secret };
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user