Skip to content

Commit

Permalink
Update node-fetch to 2.6.7 (#1570)
Browse files Browse the repository at this point in the history
* Update node-fetch to 2.6.7

* Yarn.lock

* Formatting

* Lint
  • Loading branch information
kamil-stripe authored Oct 4, 2022
1 parent 234923e commit 30b4679
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ app.post(
}
);

app.listen(
3000,
(): void => {
console.log('Example app listening on port 3000!');
}
);
app.listen(3000, (): void => {
console.log('Example app listening on port 3000!');
});
4 changes: 1 addition & 3 deletions lib/StripeMethod.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"chai": "^4.3.6",
"chai-as-promised": "~7.1.1",
"coveralls": "^3.1.1",
"eslint": "7.32.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-chai-friendly": "^0.7.2",
"eslint-plugin-prettier": "3.4.1",
"eslint-plugin-prettier": "^3.4.1",
"mocha": "^8.4.0",
"mocha-junit-reporter": "^2.1.0",
"nock": "^13.2.9",
"node-fetch": "2.6.6",
"node-fetch": "^2.6.7",
"nyc": "^15.1.0",
"prettier": "1.16.4",
"prettier": "^1.16.4",
"typescript": "^4.8.4"
},
"resolutions": {
Expand Down
4 changes: 1 addition & 3 deletions src/StripeMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ const makeAutoPaginationMethods = autoPagination.makeAutoPaginationMethods;
function stripeMethod(spec) {
if (spec.path !== undefined && spec.fullPath !== undefined) {
throw new Error(
`Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${
spec.fullPath
}).`
`Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).`
);
}
return function(...args) {
Expand Down
9 changes: 5 additions & 4 deletions test/StripeResource.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ describe('StripeResource', () => {
}
)
.get(
`${
options.path
}?customer=cus_123&subscription_items[0][plan]=foo&subscription_items[0][quantity]=2&subscription_items[1][id]=si_123&subscription_items[1][deleted]=true`,
`${options.path}?customer=cus_123&subscription_items[0][plan]=foo&subscription_items[0][quantity]=2&subscription_items[1][id]=si_123&subscription_items[1][deleted]=true`,
''
)
.reply(200, '{}');
Expand Down Expand Up @@ -257,7 +255,10 @@ describe('StripeResource', () => {
path: '/v1/subscriptions/sub_123',
data: {
customer: 'cus_123',
items: [{plan: 'foo', quantity: 2}, {id: 'si_123', deleted: true}],
items: [
{plan: 'foo', quantity: 2},
{id: 'si_123', deleted: true},
],
},
body:
'customer=cus_123&items[0][plan]=foo&items[0][quantity]=2&items[1][id]=si_123&items[1][deleted]=true',
Expand Down
49 changes: 41 additions & 8 deletions test/autoPagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,10 @@ describe('auto pagination', function() {
describe('foward pagination', () => {
it('paginates forwards through a page', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4]],
pages: [
[1, 2],
[3, 4],
],
limit: 10,
expectedIds: [1, 2, 3, 4],
expectedParamsLog: ['?starting_after=2'],
Expand All @@ -515,7 +518,11 @@ describe('auto pagination', function() {

it('respects limit even when paginating', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4], [5, 6]],
pages: [
[1, 2],
[3, 4],
[5, 6],
],
limit: 5,
expectedIds: [1, 2, 3, 4, 5],
expectedParamsLog: ['?starting_after=2', '?starting_after=4'],
Expand All @@ -524,7 +531,13 @@ describe('auto pagination', function() {

it('paginates through multiple full pages', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],
pages: [
[1, 2],
[3, 4],
[5, 6],
[7, 8],
[9, 10],
],
limit: 10,
expectedIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
expectedParamsLog: [
Expand All @@ -540,7 +553,10 @@ describe('auto pagination', function() {
describe('backwards pagination', () => {
it('paginates forwards through a page', () => {
return testCase(mockPagination, {
pages: [[-2, -1], [-4, -3]],
pages: [
[-2, -1],
[-4, -3],
],
limit: 5,
expectedIds: [-1, -2, -3, -4],
expectedParamsLog: ['?ending_before=-2'],
Expand All @@ -560,7 +576,11 @@ describe('auto pagination', function() {

it('respects limit', () => {
return testCase(mockPagination, {
pages: [[-2, -1], [-4, -3], [-6, -5]],
pages: [
[-2, -1],
[-4, -3],
[-6, -5],
],
limit: 5,
expectedIds: [-1, -2, -3, -4, -5],
expectedParamsLog: ['?ending_before=-2', '?ending_before=-4'],
Expand Down Expand Up @@ -621,7 +641,10 @@ describe('auto pagination', function() {

it('paginates forwards through a page', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4]],
pages: [
[1, 2],
[3, 4],
],
limit: 10,
expectedIds: [1, 2, 3, 4],
expectedParamsLog: ['?page=2-encoded'],
Expand All @@ -639,7 +662,11 @@ describe('auto pagination', function() {

it('respects limit even when paginating', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4], [5, 6]],
pages: [
[1, 2],
[3, 4],
[5, 6],
],
limit: 5,
expectedIds: [1, 2, 3, 4, 5],
expectedParamsLog: ['?page=2-encoded', '?page=4-encoded'],
Expand All @@ -648,7 +675,13 @@ describe('auto pagination', function() {

it('paginates through multiple full pages', () => {
return testCase(mockPagination, {
pages: [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]],
pages: [
[1, 2],
[3, 4],
[5, 6],
[7, 8],
[9, 10],
],
limit: 10,
expectedIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
expectedParamsLog: [
Expand Down
4 changes: 1 addition & 3 deletions test/crypto/SubtleCryptoProvider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const expect = require('chai').expect;
// webcrypto is only available on Node 15+.
if (!webcrypto || !webcrypto.subtle) {
console.log(
`Skipping SubtleCryptoProvider tests. No 'webcrypto.subtle' available for ${
process.version
}.`
`Skipping SubtleCryptoProvider tests. No 'webcrypto.subtle' available for ${process.version}.`
);
return;
}
Expand Down
10 changes: 8 additions & 2 deletions test/resources/Plans.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ describe('Plans Resource', () => {
stripe.plans.create({
currency: 'usd',
billing_scheme: 'tiered',
tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}],
tiers: [
{up_to: 123, amount: 100},
{up_to: 'inf', amount: 200},
],
tiers_mode: 'volume',
});
expect(stripe.LAST_REQUEST).to.deep.equal({
Expand All @@ -61,7 +64,10 @@ describe('Plans Resource', () => {
data: {
currency: 'usd',
billing_scheme: 'tiered',
tiers: [{up_to: 123, amount: 100}, {up_to: 'inf', amount: 200}],
tiers: [
{up_to: 123, amount: 100},
{up_to: 'inf', amount: 200},
],
tiers_mode: 'volume',
},
settings: {},
Expand Down
2 changes: 1 addition & 1 deletion types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare module 'stripe' {

export class StripeResource {
static extend<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
T extends {[prop: string]: any} & {
includeBasic?: Array<
'create' | 'retrieve' | 'update' | 'list' | 'del'
Expand Down
10 changes: 4 additions & 6 deletions types/test/typescriptTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ stripe.setHost('host', 'port', 'protocol');
}
}

const cusList: Stripe.ApiList<
Stripe.Customer
> = await stripe.customers.list();
const cusList: Stripe.ApiList<Stripe.Customer> = await stripe.customers.list();

const aThousandCustomers: Array<
Stripe.Customer
> = await stripe.customers.list().autoPagingToArray({limit: 1000});
const aThousandCustomers: Array<Stripe.Customer> = await stripe.customers
.list()
.autoPagingToArray({limit: 1000});

const nothing: void = await stripe.customers
.list()
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ eslint-plugin-chai-friendly@^0.7.2:
resolved "https://registry.yarnpkg.com/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.7.2.tgz#0ebfbb2c1244f5de2997f3963d155758234f2b0f"
integrity sha512-LOIfGx5sZZ5FwM1shr2GlYAWV9Omdi+1/3byuVagvQNoGUuU0iHhp7AfjA1uR+4dJ4Isfb4+FwBJgQajIw9iAg==

[email protected]:
eslint-plugin-prettier@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5"
integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==
Expand Down Expand Up @@ -952,7 +952,7 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==

[email protected]:
eslint@^7.32.0:
version "7.32.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d"
integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==
Expand Down Expand Up @@ -1814,10 +1814,10 @@ nock@^13.2.9:
lodash "^4.17.21"
propagate "^2.0.0"

[email protected].6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

Expand Down Expand Up @@ -2016,10 +2016,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

[email protected]:
version "1.16.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
prettier@^1.16.4:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

process-on-spawn@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit 30b4679

Please sign in to comment.