Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump @babel/traverse from 7.19.0 to 7.24.6 #1894

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion integration-tests/cli/discount-codes.it.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ describe('DiscountCode tests', () => {
])

cartDiscount = data[0].body

}, 15000)

afterAll(async () => {
Expand Down
18 changes: 6 additions & 12 deletions integration-tests/cli/product-json-to-csv.it.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ describe('CSV and CLI Tests', () => {

it('contains `description`', () => {
const description = {
en:
'The light jackets of Save the Duck keep us cozy warm. The slight',
de:
'Die leichten Freizeitjacken von Save the Duck halten uns wohlig',
en: 'The light jackets of Save the Duck keep us cozy warm. The slight',
de: 'Die leichten Freizeitjacken von Save the Duck halten uns wohlig',
}
expect(product[0]).toEqual(expect.objectContaining({ description }))
expect(product[1]).toEqual(expect.objectContaining({ description }))
Expand Down Expand Up @@ -305,8 +303,7 @@ describe('CSV and CLI Tests', () => {

it('contains `description`', () => {
const description = {
en:
'Golom Jacop Caesar Icarve the Duck keep us cozy warm. The slight',
en: 'Golom Jacop Caesar Icarve the Duck keep us cozy warm. The slight',
de: 'Lorem Ipsum Text von Save the Duck halten uns wohlig',
}
expect(product[0]).toEqual(expect.objectContaining({ description }))
Expand Down Expand Up @@ -571,10 +568,8 @@ describe('CSV and CLI Tests', () => {

it('contains `description`', () => {
const description = {
en:
'The light jackets of Save the Duck keep us cozy warm. The slight',
de:
'Die leichten Freizeitjacken von Save the Duck halten uns wohlig',
en: 'The light jackets of Save the Duck keep us cozy warm. The slight',
de: 'Die leichten Freizeitjacken von Save the Duck halten uns wohlig',
}
expect(product[0]).toEqual(expect.objectContaining({ description }))
expect(product[1]).toEqual(expect.objectContaining({ description }))
Expand Down Expand Up @@ -697,8 +692,7 @@ describe('CSV and CLI Tests', () => {

it('contains `description`', () => {
const description = {
en:
'Golom Jacop Caesar Icarve the Duck keep us cozy warm. The slight',
en: 'Golom Jacop Caesar Icarve the Duck keep us cozy warm. The slight',
de: 'Lorem Ipsum Text von Save the Duck halten uns wohlig',
}
expect(product[0]).toEqual(expect.objectContaining({ description }))
Expand Down
7 changes: 3 additions & 4 deletions integration-tests/sdk/channels.it.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Channels', () => {
'createdBy',
'lastModifiedAt',
'lastModifiedBy',
'versionModifiedAt'
'versionModifiedAt',
]
const service = createRequestBuilder({ projectKey }).channels
const httpMiddleware = createHttpMiddleware({
Expand Down Expand Up @@ -62,9 +62,8 @@ describe('Channels', () => {
},
fetch,
}
const authMiddleware = createAuthMiddlewareForClientCredentialsFlow(
apiConfig
)
const authMiddleware =
createAuthMiddlewareForClientCredentialsFlow(apiConfig)
client = createClient({
middlewares: [
authMiddleware,
Expand Down
3 changes: 2 additions & 1 deletion packages/csv-parser-orders/test/deliveries.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('DeliveriesParser', () => {
test('should return an error with missing headers', () => {
return new Promise((done) => {
// eslint-disable-next-line max-len
const expectedError = /Required headers missing: 'orderNumber,item\.quantity'/
const expectedError =
/Required headers missing: 'orderNumber,item\.quantity'/
const deliveriesParser = new DeliveriesParser()
const spy = sinon.stub(deliveriesParser.logger, 'error')
const readStream = streamTestFile('delivery-error-missing-headers.csv')
Expand Down
6 changes: 2 additions & 4 deletions packages/csv-parser-price/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,8 @@ export default class CsvParserPrice {
const previousPrice = data.prices[data.prices.length - 1]

// remove variant-sku property from price object
const {
[CONSTANTS.header.sku]: currentSku,
...restOfCurrentPrice
} = currentPrice
const { [CONSTANTS.header.sku]: currentSku, ...restOfCurrentPrice } =
currentPrice

if (previousPrice?.sku === currentSku)
previousPrice.prices.push(restOfCurrentPrice)
Expand Down
40 changes: 19 additions & 21 deletions packages/discount-code-importer/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,20 @@ export default class DiscountCodeImport {
// Batch to `batchSize` to reduce necessary fetch API calls
const batchedList = _.chunk(codes, this.batchSize)
const functionsList = batchedList.map(
(codeObjects: CodeDataArray): Function => (): Promise<void> => {
// Build predicate and fetch existing code
const predicate = DiscountCodeImport._buildPredicate(codeObjects)
const service = this._createService()
const uri = service.where(predicate).perPage(this.batchSize).build()
const req = this._buildRequest(uri, 'GET')
return this.client
.execute(req)
.then(({ body: { results: existingCodes } }: Object): Promise<void> =>
this._createOrUpdate(codeObjects, existingCodes)
)
}
(codeObjects: CodeDataArray): Function =>
(): Promise<void> => {
// Build predicate and fetch existing code
const predicate = DiscountCodeImport._buildPredicate(codeObjects)
const service = this._createService()
const uri = service.where(predicate).perPage(this.batchSize).build()
const req = this._buildRequest(uri, 'GET')
return this.client
.execute(req)
.then(
({ body: { results: existingCodes } }: Object): Promise<void> =>
this._createOrUpdate(codeObjects, existingCodes)
)
}
)
return DiscountCodeImport.promiseMapSerially(functionsList)
.then((): Promise<void> => Promise.resolve())
Expand All @@ -152,8 +154,9 @@ export default class DiscountCodeImport {
'Processing batches failed',
caughtError.message || caughtError,
this._summary
);
})
)
}
)
}

_createOrUpdate(
Expand Down Expand Up @@ -273,13 +276,8 @@ export default class DiscountCodeImport {
}

summaryReport(): Object {
const {
created,
updated,
unchanged,
createErrorCount,
updateErrorCount,
} = this._summary
const { created, updated, unchanged, createErrorCount, updateErrorCount } =
this._summary
let message = ''
if (created + updated + createErrorCount + updateErrorCount === 0)
message = 'Summary: nothing to do, everything is fine'
Expand Down
7 changes: 3 additions & 4 deletions packages/inventories-exporter/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ export default class InventoryExporter {

_fetchInventories(outputStream: stream$Writable): Promise<any> {
if (this.exportConfig.channelKey)
return this._resolveChannelKey(
this.exportConfig.channelKey
).then((channelId: string): Promise<any> =>
this._makeRequest(outputStream, channelId)
return this._resolveChannelKey(this.exportConfig.channelKey).then(
(channelId: string): Promise<any> =>
this._makeRequest(outputStream, channelId)
)
return this._makeRequest(outputStream)
}
Expand Down
3 changes: 1 addition & 2 deletions packages/inventories-exporter/test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ describe('InventoryExporter', () => {
expect(processMock).toHaveBeenCalledTimes(1)
expect(processMock.mock.calls[0][0]).toEqual({
// eslint-disable-next-line max-len
uri:
'/foo/inventory?expand=custom.type&expand=supplyChannel&where=descript%3D%22lovely%22%20and%20supplyChannel(id%3D%221234567qwertyuxcv%22)',
uri: '/foo/inventory?expand=custom.type&expand=supplyChannel&where=descript%3D%22lovely%22%20and%20supplyChannel(id%3D%221234567qwertyuxcv%22)',
method: 'GET',
headers: {
Authorization: 'Bearer 12345',
Expand Down
40 changes: 20 additions & 20 deletions packages/personal-data-erasure/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,32 @@ export default class PersonalDataErasure {
{ accumulate: true }
)
})
).then(async (responses: Array<Array<AllData>>): Promise<
Array<AllData>
> => {
const flattenedResponses = flatten(responses)
).then(
async (responses: Array<Array<AllData>>): Promise<Array<AllData>> => {
const flattenedResponses = flatten(responses)

let results = flatten(
flattenedResponses.map(
(response: ClientResponse): Array<ClientResult> | void =>
response.body?.results
let results = flatten(
flattenedResponses.map(
(response: ClientResponse): Array<ClientResult> | void =>
response.body?.results
)
)
)
const ids = results.map((result: AllData): string => result.id)
const ids = results.map((result: AllData): string => result.id)

if (ids.length > 0) {
const reference = PersonalDataErasure.buildReference(ids)
const messagesUri = requestBuilder.messages.where(reference).build()
const request = PersonalDataErasure.buildRequest(messagesUri, 'GET')
if (ids.length > 0) {
const reference = PersonalDataErasure.buildReference(ids)
const messagesUri = requestBuilder.messages.where(reference).build()
const request = PersonalDataErasure.buildRequest(messagesUri, 'GET')

const messages = await this._getAllMessages(request)
const messages = await this._getAllMessages(request)

results = [...messages, ...results]
}
this.logger.info('Export operation completed successfully')
results = [...messages, ...results]
}
this.logger.info('Export operation completed successfully')

return Promise.resolve(results)
})
return Promise.resolve(results)
}
)
}

async _getAllMessages(request: ClientRequest): Promise<Messages> {
Expand Down
14 changes: 7 additions & 7 deletions packages/product-exporter/test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ describe('ProductExporter', () => {
let productExporter
beforeEach(() => {
const logger = {
error: () => { },
warn: () => { },
info: () => { },
verbose: () => { },
error: () => {},
warn: () => {},
info: () => {},
verbose: () => {},
}
const exportConfig = {
staged: true,
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('ProductExporter', () => {
describe('::run', () => {
test('prepare the output stream and pass to `_getProducts`', async () => {
productExporter._getProducts = jest.fn(() => Promise.resolve())
const outputStream = streamtest.v2.toText(() => { })
const outputStream = streamtest.v2.toText(() => {})
await productExporter.run(outputStream)
expect(productExporter._getProducts).toHaveBeenCalled()
expect(productExporter._getProducts).not.toHaveBeenCalledWith(
Expand All @@ -69,9 +69,9 @@ describe('ProductExporter', () => {
describe('::_getProducts', () => {
let processMock
const outputStream = {
emit: () => { },
emit: () => {},
end: jest.fn(),
write: jest.fn()
write: jest.fn(),
}
beforeEach(() => {
const sampleResult = {
Expand Down
6 changes: 4 additions & 2 deletions packages/product-json-to-csv/test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,13 @@ describe('ProductJsonToCsv', () => {
const payload = {
body: {
count: 5,
results: [{}]
results: [{}],
},
}
beforeEach(() => {
productJsonToCsv.client.execute = jest.fn().mockImplementation(() => Promise.resolve(payload));
productJsonToCsv.client.execute = jest
.fn()
.mockImplementation(() => Promise.resolve(payload))
})
test('should fetch reference from API from url', async () => {
const uri = 'dummy-uri'
Expand Down
14 changes: 10 additions & 4 deletions packages/product-json-to-xlsx/test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,13 @@ describe('ProductJsonToXlsx', () => {
const payload = {
body: {
count: 5,
results: [{}]
results: [{}],
},
}
beforeEach(() => {
productJsonToXlsx.client.execute = jest.fn().mockImplementation(() => Promise.resolve(payload));
productJsonToXlsx.client.execute = jest
.fn()
.mockImplementation(() => Promise.resolve(payload))
})
test('should fetch reference from API from url', async () => {
const uri = 'dummy-uri'
Expand Down Expand Up @@ -907,8 +909,12 @@ describe('ProductJsonToXlsx', () => {

productJsonToXlsx.fetchReferences(uri)
productJsonToXlsx._getChannelsById = jest.fn((channel) =>
Promise.resolve({ ...sampleResult, 'channel-id': { ...sampleResult['channel-id'], id: channel } }))
const res = await productJsonToXlsx._getChannelsById(_channel);
Promise.resolve({
...sampleResult,
'channel-id': { ...sampleResult['channel-id'], id: channel },
})
)
const res = await productJsonToXlsx._getChannelsById(_channel)

expect(res).toEqual({
'channel-id': {
Expand Down
4 changes: 2 additions & 2 deletions packages/resource-deleter/src/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "core-js/stable";
import "regenerator-runtime/runtime";
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import fs from 'fs'
import { getCredentials } from '@commercetools/get-credentials'
Expand Down
15 changes: 5 additions & 10 deletions packages/sdk-auth/src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export default class SdkAuth {
clientSecret,
}: ClientAuthOptions): string {
const targetStr = `${clientId}:${clientSecret}`
return typeof Buffer === 'undefined' ? btoa(targetStr) : Buffer.from(targetStr).toString('base64')
return typeof Buffer === 'undefined'
? btoa(targetStr)
: Buffer.from(targetStr).toString('base64')
}

static _getScopes(scopes: ?Array<string>, projectKey: ?string): string {
Expand Down Expand Up @@ -337,15 +339,8 @@ export default class SdkAuth {
}

customFlow(requestConfig: Object): Promise<Object> {
const {
credentials,
host,
uri,
body,
token,
authType,
headers,
} = requestConfig
const { credentials, host, uri, body, token, authType, headers } =
requestConfig
const _config = this._getRequestConfig({
host,
token,
Expand Down
6 changes: 4 additions & 2 deletions packages/sdk-auth/test/token-provider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,14 @@ describe('Token Provider', () => {
test('should include scope in the merged config', () => {
expect(config.scopes).toBeFalsy()

const mergedConfig = auth._getRequestConfig({ scopes: ['new-scope:demo-projectKey'] })
const mergedConfig = auth._getRequestConfig({
scopes: ['new-scope:demo-projectKey'],
})

expect(mergedConfig).toBeTruthy()
expect(mergedConfig).toMatchObject(
expect.objectContaining({
scopes: ['new-scope:demo-projectKey']
scopes: ['new-scope:demo-projectKey'],
})
)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk-client/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function compose(...funcs: Array<Function>): Function {
if (funcs.length === 1) return funcs[0]

return funcs.reduce(
(a: Function, b: Function): Function => (
...args: Array<Function>
): Array<Function> => a(b(...args))
(a: Function, b: Function): Function =>
(...args: Array<Function>): Array<Function> =>
a(b(...args))
)
}

Expand Down
Loading
Loading