diff --git a/package.json b/package.json index 8950cc9c6..495dff0e1 100644 --- a/package.json +++ b/package.json @@ -28,12 +28,14 @@ }, "devDependencies": { "@microsoft/api-extractor": "^7.3.9", + "@types/faker": "^4.1.6", "@types/jest": "^24.0.18", "axios": "^0.19.0", "brotli": "^1.3.2", "chalk": "^2.4.2", "coveralls": "^3.0.6", "execa": "^3.0.0", + "faker": "^4.1.0", "fs-extra": "^8.1.0", "jest": "^24.9.0", "lerna": "^3.16.4", @@ -50,11 +52,7 @@ "ts-jest": "^24.0.2", "typedoc": "^0.15.0", "typescript": "^3.5.3", - "yorkie": "^2.0.0", - "faker": "^4.1.0", - "jest-when": "^2.7.0", - "@types/faker": "^4.1.6", - "@types/jest-when": "^2.7.0" + "yorkie": "^2.0.0" }, "peerDependencies": { "axios": "^0.19.0" diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/createCustomerAddress.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/createCustomerAddress.spec.ts index 20122f95c..5fb6443e2 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/createCustomerAddress.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/createCustomerAddress.spec.ts @@ -1,6 +1,9 @@ -import { when } from "jest-when"; import { address, name, random } from "faker"; -import { createCustomerAddress } from "../../../src/index"; +import { + createCustomerAddress, + update, + config +} from "@shopware-pwa/shopware-6-client"; import { getCustomerAddressEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; @@ -17,23 +20,26 @@ describe("CustomerService - createCustomerAddress", () => { city: address.city(), street: address.streetName() }; + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("should return created address id", async () => { - when(mockedAxios.post) - .expectCalledWith(getCustomerAddressEndpoint(), newAddressData) - .mockReturnValueOnce({ data: "2bbb89dfa4664bc581e80b37eaa80fb7" }); + mockedAxios.post.mockResolvedValueOnce({ + data: "2bbb89dfa4664bc581e80b37eaa80fb7" + }); const result = await createCustomerAddress(newAddressData); expect(result).toEqual("2bbb89dfa4664bc581e80b37eaa80fb7"); expect(mockedAxios.post).toBeCalledTimes(1); expect(mockedAxios.post).toBeCalledWith( getCustomerAddressEndpoint(), - newAddressData, - { - headers: { "sw-context-token": undefined } - } + newAddressData ); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerPassword.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerAddress.spec.ts similarity index 74% rename from packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerPassword.spec.ts rename to packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerAddress.spec.ts index ae6964b5c..19b168519 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerPassword.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/deleteCustomerAddress.spec.ts @@ -1,13 +1,25 @@ import { getCustomerAddressEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; -import { deleteCustomerAddress } from "../../../src"; +import { + deleteCustomerAddress, + update, + config +} from "@shopware-pwa/shopware-6-client"; +import { random } from "faker"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - deleteCustomerAddress", () => { + let contextToken: string; + beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("rejects the promise if the address does not exist", async () => { @@ -19,20 +31,17 @@ describe("CustomerService - deleteCustomerAddress", () => { ).rejects.toThrow("400 - customer's address not found"); expect(mockedAxios.delete).toBeCalledTimes(1); expect(mockedAxios.delete).toBeCalledWith( - getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7") ); }); it("returns no data if successfully deleted", async () => { mockedAxios.delete.mockResolvedValue(null); - expect( - await deleteCustomerAddress("2bbb89dfa4664bc681e80b37eaa80fb7") - ).toBeNull(); + + await deleteCustomerAddress("2bbb89dfa4664bc681e80b37eaa80fb7"); expect(mockedAxios.delete).toBeCalledTimes(1); expect(mockedAxios.delete).toBeCalledWith( - getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7") ); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomer.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomer.spec.ts index be21134d8..62cd91dcc 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomer.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomer.spec.ts @@ -1,38 +1,37 @@ -import { when } from "jest-when"; -import { getCustomer } from "@shopware-pwa/shopware-6-client"; +import { getCustomer, update, config } from "@shopware-pwa/shopware-6-client"; import { apiService } from "../../../src/apiService"; import { getCustomerEndpoint } from "../../../src/endpoints"; +import { random } from "faker"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - getCustomer", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); + }); }); it("should an current customer's data - using correct token", async () => { - when(mockedAxios.get) - .expectCalledWith(getCustomerEndpoint(), { - headers: { "sw-context-token": "c370eb5cd1df4d4dbcc78f055b693e79" } - }) - .mockReturnValueOnce({ - data: { data: { id: "c370eb5cd1df4d4dbcc78f055b693e79" } } - }); - const result = await getCustomer("c370eb5cd1df4d4dbcc78f055b693e79"); - expect(mockedAxios.get).toBeCalledTimes(1); - expect(mockedAxios.get).toBeCalledWith("/customer", { - headers: { "sw-context-token": "c370eb5cd1df4d4dbcc78f055b693e79" } + mockedAxios.get.mockResolvedValueOnce({ + data: { data: { id: "c370eb5cd1df4d4dbcc78f055b693e79" } } }); - expect(result).toHaveProperty("id"); + const result = await getCustomer(); + expect(mockedAxios.get).toBeCalledTimes(1); + expect(mockedAxios.get).toBeCalledWith(getCustomerEndpoint()); expect(result.id).toEqual("c370eb5cd1df4d4dbcc78f055b693e79"); }); it("should an current customer's data - using incorrect token", async () => { mockedAxios.get.mockRejectedValue(new Error()); - expect(getCustomer("b370eb5cd1df4d4dbcc78f055b693e79")).rejects.toThrow(); + expect(getCustomer()).rejects.toThrow(); expect(mockedAxios.get).toBeCalledTimes(1); - expect(mockedAxios.get).toBeCalledWith("/customer", { - headers: { "sw-context-token": "b370eb5cd1df4d4dbcc78f055b693e79" } - }); + expect(mockedAxios.get).toBeCalledWith(getCustomerEndpoint()); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddress.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddress.spec.ts index 5c3da70c9..0b38240f8 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddress.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddress.spec.ts @@ -1,31 +1,40 @@ -import { when } from "jest-when"; -import { getCustomerAddress } from "../../../src/index"; +import { + getCustomerAddress, + update, + config +} from "@shopware-pwa/shopware-6-client"; import { getCustomerAddressEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; +import { random } from "faker"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - getCustomerAddress", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + + contextToken = random.uuid(); + + update({ contextToken }); }); + afterEach(() => { + // expect( + // mockedAxios.defaults.headers.common["sw-context-token"] + // ).toEqual(contextToken); + expect(config.contextToken).toEqual(contextToken); + }); + it("should return address object", async () => { - when(mockedAxios.get) - .expectCalledWith( - getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7") - ) - .mockReturnValueOnce({ - data: { data: { id: "2bbb89dfa4664bc681e80b37eaa80fb7" } } - }); + mockedAxios.get.mockResolvedValueOnce({ + data: { data: { id: "2bbb89dfa4664bc681e80b37eaa80fb7" } } + }); const result = await getCustomerAddress("2bbb89dfa4664bc681e80b37eaa80fb7"); expect(result.id).toEqual("2bbb89dfa4664bc681e80b37eaa80fb7"); expect(mockedAxios.get).toBeCalledTimes(1); expect(mockedAxios.get).toBeCalledWith( - getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7"), - { - headers: { "sw-context-token": undefined } - } + getCustomerAddressEndpoint("2bbb89dfa4664bc681e80b37eaa80fb7") ); }); @@ -38,8 +47,7 @@ describe("CustomerService - getCustomerAddress", () => { ); expect(mockedAxios.get).toBeCalledTimes(1); expect(mockedAxios.get).toBeCalledWith( - getCustomerAddressEndpoint("wrong-id"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressEndpoint("wrong-id") ); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddresses.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddresses.spec.ts index 51cfcc6ea..324f392c8 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddresses.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/getCustomerAddresses.spec.ts @@ -1,6 +1,9 @@ import { random } from "faker"; -import { when } from "jest-when"; -import { getCustomerAddresses } from "../../../src/index"; +import { + getCustomerAddresses, + update, + config +} from "@shopware-pwa/shopware-6-client"; import { getCustomerEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; @@ -8,19 +11,23 @@ jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - register", () => { - const customerToken = random.uuid(); + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); }); + afterEach(() => { + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); + }); + }); + it("should return object of addresses", async () => { - when(mockedAxios.get) - .expectCalledWith(`${getCustomerEndpoint()}/address`) - .mockReturnValueOnce({ data: { data: {} } }); - const result = await getCustomerAddresses(customerToken); + mockedAxios.get.mockResolvedValueOnce({ data: { data: {} } }); + const result = await getCustomerAddresses(); expect(mockedAxios.get).toBeCalledTimes(1); - expect(mockedAxios.get).toBeCalledWith(`${getCustomerEndpoint()}/address`, { - headers: { "sw-context-token": customerToken } - }); + expect(mockedAxios.get).toBeCalledWith(`${getCustomerEndpoint()}/address`); expect(result).toMatchObject({}); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/login.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/login.spec.ts index 35ed43b35..9c3bb933f 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/login.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/login.spec.ts @@ -1,5 +1,4 @@ -import { login } from "../../../src/index"; -import { when } from "jest-when"; +import { login, config } from "@shopware-pwa/shopware-6-client"; import { getCustomerLoginEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; import { internet } from "faker"; @@ -17,14 +16,10 @@ describe("CustomerService - login", () => { jest.resetAllMocks(); }); it("should return context token", async () => { - when(mockedAxios.post) - .expectCalledWith(getCustomerLoginEndpoint(), { - username: credentials.username, - password: credentials.password - }) - .mockReturnValueOnce({ - data: { "sw-context-token": "RmzTExFStSBW5GhPmQNicSK6bhUQhqXi" } - }); + mockedAxios.post.mockResolvedValueOnce({ + data: { "sw-context-token": "RmzTExFStSBW5GhPmQNicSK6bhUQhqXi" } + }); + const result = await login({ username: credentials.username, password: credentials.password @@ -34,16 +29,12 @@ describe("CustomerService - login", () => { username: credentials.username, password: credentials.password }); - expect(result).toHaveProperty("sw-context-token"); + + expect(result.contextToken).toEqual("RmzTExFStSBW5GhPmQNicSK6bhUQhqXi"); + expect(config.contextToken).toEqual("RmzTExFStSBW5GhPmQNicSK6bhUQhqXi"); }); it("should throws unhandled rejection - 401", async () => { - when(mockedAxios.post.mockRejectedValue(new Error())).expectCalledWith( - getCustomerLoginEndpoint(), - { - username: credentials.username, - password: "wrong-password-123456" - } - ); + mockedAxios.post.mockRejectedValue(new Error()); expect( login({ diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/logout.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/logout.spec.ts index 6a9bc9c75..5d0fc8a4a 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/logout.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/logout.spec.ts @@ -1,5 +1,4 @@ -import { logout } from "../../../src/index"; -import { when } from "jest-when"; +import { logout } from "@shopware-pwa/shopware-6-client"; import { getCustomerLogoutEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; @@ -12,14 +11,9 @@ describe("CustomerService - logout", () => { }); it("should log out the customer", async () => { - when(mockedAxios.post) - .expectCalledWith(getCustomerLogoutEndpoint()) - .mockReturnValueOnce(""); - const result = await logout(); + mockedAxios.get.mockResolvedValueOnce({ data: null }); + await logout(); expect(mockedAxios.post).toBeCalledTimes(1); - expect(mockedAxios.post).toBeCalledWith(getCustomerLogoutEndpoint(), null, { - headers: { "sw-context-token": undefined } - }); - expect(result).toBeUndefined(); + expect(mockedAxios.post).toBeCalledWith(getCustomerLogoutEndpoint()); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/register.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/register.spec.ts index 9e3c501f1..4c1d2ab9f 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/register.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/register.spec.ts @@ -1,36 +1,36 @@ import { name, address, random, phone, internet } from "faker"; -import { when } from "jest-when"; -import { register } from "../../../src/index"; +import { register } from "@shopware-pwa/shopware-6-client"; import { getCustomerEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; +import { CustomerRegistrationParams } from "../../../src/interfaces/request/CustomerRegistrationParams"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; -const customerData = { - salutationId: random.uuid(), - firstName: name.firstName(), - lastName: name.lastName(), - password: internet.password(8), - email: internet.email(), - billingAddress: { - countryId: random.uuid(), - street: address.streetName(), - zipcode: address.zipCode(), - city: address.city(), - phoneNumber: phone.phoneNumber() - } -}; +let customerData: CustomerRegistrationParams; describe("CustomerService - register", () => { - const customerId = random.uuid(); beforeEach(() => { jest.resetAllMocks(); + customerData = { + salutationId: random.uuid(), + firstName: name.firstName(), + lastName: name.lastName(), + password: internet.password(8), + email: internet.email(), + billingAddress: { + countryId: random.uuid(), + street: address.streetName(), + zipcode: address.zipCode(), + city: address.city(), + phoneNumber: phone.phoneNumber() + } + }; }); + it("should register the new customer with basic data provided", async () => { - when(mockedAxios.post) - .expectCalledWith(getCustomerEndpoint(), customerData) - .mockReturnValueOnce({ data: customerId }); + const customerId = random.uuid(); + mockedAxios.post.mockResolvedValueOnce({ data: customerId }); const result = await register(customerData); expect(mockedAxios.post).toBeCalledTimes(1); expect(mockedAxios.post).toBeCalledWith( @@ -43,10 +43,7 @@ describe("CustomerService - register", () => { it("should never register a customer without billing address", async () => { delete customerData.billingAddress; - when(mockedAxios.post.mockRejectedValue(new Error("400"))).expectCalledWith( - getCustomerEndpoint(), - customerData - ); + mockedAxios.post.mockRejectedValueOnce(new Error("400")); expect(register(customerData)).rejects.toThrowError("400"); expect(mockedAxios.post).toBeCalledTimes(1); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerBillingAddress.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerBillingAddress.spec.ts index 28be06e03..cbc2623dd 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerBillingAddress.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerBillingAddress.spec.ts @@ -1,13 +1,24 @@ +import { random } from "faker"; import { getCustomerAddressSetDefaultBillingEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; -import { setDefaultCustomerBillingAddress } from "../../../src"; +import { + update, + config, + setDefaultCustomerBillingAddress +} from "@shopware-pwa/shopware-6-client"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - updateDefaultCustomerBillingAddress", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("rejects the promise if provided addressId does not exist", async () => { @@ -19,8 +30,7 @@ describe("CustomerService - updateDefaultCustomerBillingAddress", () => { ); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith( - getCustomerAddressSetDefaultBillingEndpoint("1234"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressSetDefaultBillingEndpoint("1234") ); }); @@ -30,8 +40,7 @@ describe("CustomerService - updateDefaultCustomerBillingAddress", () => { expect(result).toBe("12345"); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith( - getCustomerAddressSetDefaultBillingEndpoint("12345"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressSetDefaultBillingEndpoint("12345") ); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerShippingAddress.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerShippingAddress.spec.ts index b4780b58c..9ac5df71e 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerShippingAddress.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/setDefaultCustomerShippingAddress.spec.ts @@ -1,13 +1,24 @@ +import { random } from "faker"; import { getCustomerAddressSetDefaultShippingEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; -import { setDefaultCustomerShippingAddress } from "../../../src"; +import { + setDefaultCustomerShippingAddress, + update, + config +} from "@shopware-pwa/shopware-6-client"; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; -describe("CustomerService - updateDefaultCustomerShippingAddress", () => { +describe("CustomerService - setDefaultCustomerShippingAddress", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("rejects the promise if provided addressId does not exist", async () => { @@ -19,8 +30,7 @@ describe("CustomerService - updateDefaultCustomerShippingAddress", () => { ); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith( - getCustomerAddressSetDefaultShippingEndpoint("1234"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressSetDefaultShippingEndpoint("1234") ); }); @@ -30,8 +40,7 @@ describe("CustomerService - updateDefaultCustomerShippingAddress", () => { expect(result).toBe("12345"); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith( - getCustomerAddressSetDefaultShippingEndpoint("12345"), - { headers: { "sw-context-token": undefined } } + getCustomerAddressSetDefaultShippingEndpoint("12345") ); }); }); diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/updateEmail.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/updateEmail.spec.ts index ceaa1d307..6ad5dd133 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/updateEmail.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/updateEmail.spec.ts @@ -1,7 +1,7 @@ import { getCustomerUpdateEmailEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; -import { internet } from "faker"; -import { updateEmail } from "../../../src"; +import { internet, random } from "faker"; +import { updateEmail, update, config } from "@shopware-pwa/shopware-6-client"; const credentials = { email: internet.email(), @@ -12,8 +12,14 @@ jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - updateEmail", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("rejects the promise if the email confirmation is wrong", async () => { @@ -38,12 +44,11 @@ describe("CustomerService - updateEmail", () => { it("returns no data if successfully updated", async () => { mockedAxios.patch.mockResolvedValueOnce(null); - const result = await updateEmail({ + await updateEmail({ email: credentials.email, emailConfirmation: credentials.email, password: credentials.password }); - expect(result).toBeFalsy(); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith(getCustomerUpdateEmailEndpoint(), { email: credentials.email, diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/updatePassword.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/updatePassword.spec.ts index 2dfbb52a1..4cc8e7bf1 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/updatePassword.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/updatePassword.spec.ts @@ -1,7 +1,11 @@ import { getCustomerUpdatePasswordEndpoint } from "../../../src/endpoints"; import { apiService } from "../../../src/apiService"; -import { internet } from "faker"; -import { updatePassword } from "../../../src"; +import { internet, random } from "faker"; +import { + updatePassword, + update, + config +} from "@shopware-pwa/shopware-6-client"; const newPassword = internet.password(8); const credentials = { @@ -14,13 +18,19 @@ jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - updatePassword", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("rejects the promise if the password is to short", async () => { mockedAxios.patch.mockRejectedValueOnce( - new Error("400 - password to short") + new Error("400 - password too short") ); expect( updatePassword({ @@ -28,7 +38,7 @@ describe("CustomerService - updatePassword", () => { newPassword: "!23", newPasswordConfirm: "!23" }) - ).rejects.toThrow("400 - password to short"); + ).rejects.toThrow("400 - password too short"); expect(mockedAxios.patch).toBeCalledTimes(1); expect(mockedAxios.patch).toBeCalledWith( getCustomerUpdatePasswordEndpoint(), diff --git a/packages/shopware-6-client/__tests__/services/CustomerService/updateProfile.spec.ts b/packages/shopware-6-client/__tests__/services/CustomerService/updateProfile.spec.ts index 522bcbef8..dbaeb4af2 100644 --- a/packages/shopware-6-client/__tests__/services/CustomerService/updateProfile.spec.ts +++ b/packages/shopware-6-client/__tests__/services/CustomerService/updateProfile.spec.ts @@ -1,21 +1,27 @@ import { name, random } from "faker"; import { apiService } from "../../../src/apiService"; -import { updateProfile } from "../../../src"; +import { updateProfile, update, config } from "@shopware-pwa/shopware-6-client"; import { getCustomerEndpoint } from "../../../src/endpoints"; const customerData = { salutationId: random.uuid(), firstName: name.firstName(), lastName: name.lastName(), - title: "Mr." + title: "d" }; jest.mock("../../../src/apiService"); const mockedAxios = apiService as jest.Mocked; describe("CustomerService - updateProfile", () => { + let contextToken: string; beforeEach(() => { jest.resetAllMocks(); + contextToken = random.uuid(); + update({ contextToken }); + }); + afterEach(() => { + expect(config.contextToken).toEqual(contextToken); }); it("returns no data if successfully updated", async () => { diff --git a/packages/shopware-6-client/src/interfaces/request/CustomerRegistrationParams.ts b/packages/shopware-6-client/src/interfaces/request/CustomerRegistrationParams.ts new file mode 100644 index 000000000..60a6a0873 --- /dev/null +++ b/packages/shopware-6-client/src/interfaces/request/CustomerRegistrationParams.ts @@ -0,0 +1,18 @@ +import { ShippingAddress } from "../models/checkout/customer/ShippingAddress"; +import { BillingAddress } from "../models/checkout/customer/BillingAddress"; + +export interface CustomerRegistrationParams { + salutationId: string; + firstName: string; + lastName: string; + password: string; + email: string; + title?: string; + birthdayYear?: number; + birthdayMonth?: number; + birthdayDay?: number; + billingAddress: Partial< + BillingAddress + > /** TODO: replace Partial with correct optional fields in BillingAddress */; + shippingAddress?: ShippingAddress; +} diff --git a/packages/shopware-6-client/src/services/customerService.ts b/packages/shopware-6-client/src/services/customerService.ts index 0a56a4d2c..2ecbf1c37 100644 --- a/packages/shopware-6-client/src/services/customerService.ts +++ b/packages/shopware-6-client/src/services/customerService.ts @@ -6,280 +6,163 @@ import { getCustomerDefaultBillingAddressEndpoint, getCustomerDefaultShippingAddressEndpoint } from "../endpoints"; -import { BillingAddress } from "../interfaces/models/checkout/customer/BillingAddress"; -import { ShippingAddress } from "../interfaces/models/checkout/customer/ShippingAddress"; import { Customer } from "../interfaces/models/checkout/customer/Customer"; import { apiService } from "../apiService"; import { CustomerAddress } from "../interfaces/models/checkout/customer/CustomerAddress"; - -interface CustomerLoginParam { - username: string; - password: string; -} - -interface CustomerRegisterParam { - salutationId: string; - firstName: string; - lastName: string; - password: string; - email: string; - title?: string; - birthdayYear?: number; - birthdayMonth?: number; - birthdayDay?: number; - billingAddress: Partial< - BillingAddress - > /** TODO: replace Partial with correct optional fields in BillingAddress */; - shippingAddress?: ShippingAddress; -} - -interface CustomerUpdateEmailParam { - email: string; - emailConfirmation: string; - password: string; -} - -interface CustomerUpdatePasswordParam { - password: string; - newPassword: string; - newPasswordConfirm: string; -} - -interface CustomerUpdateProfileParam { - firstName: string; - lastName: string; - salutationId: string; - title: string; -} - -interface CustomerAddressParam extends Partial {} - -interface CustomerLoginResponse { - "sw-context-token": string; -} +import { CustomerRegistrationParams } from "../interfaces/request/CustomerRegistrationParams"; +import { update } from ".."; +import { UpdateContextResponse } from "../interfaces/response/UpdateContextResponse"; interface CustomerRegisterResponse { data: string; } /** - * Usage example: - * ```ts - * import { CustomerService } from '@shopware-pwa/shopware-6-client' - * ``` - */ -export interface CustomerService { - login: (params: CustomerLoginParam) => Promise; - logout: (contextToken: string) => Promise; - register: ( - params: CustomerRegisterParam - ) => Promise; - getCustomer: (contextToken: string) => Promise | Promise; - getCustomerAddresses: (contextToken?: string) => Promise; - getCustomerAddress: ( - addressId: string, - contextToken?: string - ) => Promise; - createCustomerAddress: ( - params: CustomerAddressParam, - contextToken?: string - ) => Promise; - updateEmail: (params: CustomerUpdateEmailParam) => Promise; - updatePassword: (params: CustomerUpdatePasswordParam) => Promise; - updateProfile: (params: CustomerUpdateProfileParam) => Promise; -} - -/** - * @description Register a customer + * Register a customer */ -export const register = async function( - params: CustomerRegisterParam +export async function register( + params: CustomerRegistrationParams ): Promise { const resp = await apiService.post(getCustomerEndpoint(), params); return resp.data; -}; +} + +interface CustomerLoginParam { + username: string; + password: string; +} /** - * @description Get the context token for current user + * Get the context token for current user */ -export const login = async function( +export async function login( params: CustomerLoginParam -): Promise { +): Promise { const resp = await apiService.post(`${getCustomerEndpoint()}/login`, params); - return resp.data; -}; + const contextToken = resp.data["sw-context-token"]; + update({ contextToken }); + return { contextToken }; +} /** - * @description End up the session + * End up the session */ -export const logout = async function(contextToken?: string): Promise { - const resp = await apiService.post(`${getCustomerEndpoint()}/logout`, null, { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); - return resp.data; -}; +export async function logout(): Promise { + await apiService.post(`${getCustomerEndpoint()}/logout`); + update({ contextToken: "" }); +} /** - * @description End up the session + * End up the session */ -export const getCustomer = async function( - contextToken: string -): Promise { - const resp = await apiService.get(getCustomerEndpoint(), { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); +export async function getCustomer(): Promise { + const resp = await apiService.get(getCustomerEndpoint()); return resp.data.data; -}; +} /** - * @description Get all customer's addresses + * Get all customer's addresses */ -export const getCustomerAddresses = async function( - contextToken: string -): Promise { - const resp = await apiService.get(getCustomerAddressEndpoint(), { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); +export async function getCustomerAddresses(): Promise { + const resp = await apiService.get(getCustomerAddressEndpoint()); return resp.data.data; -}; +} /** - * @description Get the customer's address by id + * Get the customer's address by id */ -export const getCustomerAddress = async function( - addressId: string, - contextToken?: string +export async function getCustomerAddress( + addressId: string ): Promise { - const resp = await apiService.get(getCustomerAddressEndpoint(addressId), { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); + const resp = await apiService.get(getCustomerAddressEndpoint(addressId)); return resp.data.data; -}; +} + +interface CustomerAddressParam extends Partial {} /** - * @description Get the customer's address by id + * Create an address and respond the new address's id */ -export const createCustomerAddress = async function( - params: CustomerAddressParam, - contextToken?: string +export async function createCustomerAddress( + params: CustomerAddressParam ): Promise { - const resp = await apiService.post(getCustomerAddressEndpoint(), params, { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); + const resp = await apiService.post(getCustomerAddressEndpoint(), params); return resp.data; -}; +} /** - * @description Delete's the customer's address by id + * Delete's the customer's address by id */ -export const deleteCustomerAddress = async function( - addressId: string, - contextToken?: string -): Promise { - await apiService.delete(getCustomerAddressEndpoint(addressId), { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - }); - return null; -}; +export async function deleteCustomerAddress(addressId: string): Promise { + await apiService.delete(getCustomerAddressEndpoint(addressId)); +} /** - * @description Set address as default + * Set address as default */ -export const setDefaultCustomerBillingAddress = async function( - addressId: string, - contextToken?: string +export async function setDefaultCustomerBillingAddress( + addressId: string ): Promise { const response = await apiService.patch( - getCustomerDefaultBillingAddressEndpoint(addressId), - { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - } + getCustomerDefaultBillingAddressEndpoint(addressId) ); return response.data; -}; +} /** - * @description Set address as default + * Set address as default */ -export const setDefaultCustomerShippingAddress = async function( - addressId: string, - contextToken?: string +export async function setDefaultCustomerShippingAddress( + addressId: string ): Promise { const response = await apiService.patch( - getCustomerDefaultShippingAddressEndpoint(addressId), - { - headers: { - /** TODO: move into different layer if created */ - "sw-context-token": contextToken - } - } + getCustomerDefaultShippingAddressEndpoint(addressId) ); return response.data; -}; +} + +interface CustomerUpdateEmailParam { + email: string; + emailConfirmation: string; + password: string; +} /** - * @description Update a customer's email + * Update a customer's email */ -export const updateEmail = async function( +export async function updateEmail( params: CustomerUpdateEmailParam -): Promise { +): Promise { await apiService.patch(getCustomerUpdateEmailEndpoint(), params); - return null; -}; +} + +interface CustomerUpdatePasswordParam { + password: string; + newPassword: string; + newPasswordConfirm: string; +} /** - * @description Update a customer's password + * Update a customer's password */ -export const updatePassword = async function( +export async function updatePassword( params: CustomerUpdatePasswordParam -): Promise { +): Promise { await apiService.patch(getCustomerUpdatePasswordEndpoint(), params); - return null; -}; +} + +interface CustomerUpdateProfileParam { + firstName: string; + lastName: string; + salutationId: string; + title: string; +} /** - * @description Update a customer's profile data + * Update a customer's profile data */ -export const updateProfile = async function( +export async function updateProfile( params: CustomerUpdateProfileParam -): Promise { +): Promise { await apiService.patch(getCustomerEndpoint(), params); - return null; -}; - -/** - * @description Expose public methods of the service - */ -export const CustomerService: CustomerService = { - register, - login, - logout, - getCustomer, - getCustomerAddresses, - getCustomerAddress, - createCustomerAddress, - updateEmail, - updatePassword, - updateProfile -}; +} diff --git a/yarn.lock b/yarn.lock index 80703f677..48c861002 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1249,20 +1249,6 @@ resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== -"@types/jest-when@^2.7.0": - version "2.7.0" - resolved "https://registry.yarnpkg.com/@types/jest-when/-/jest-when-2.7.0.tgz#538d5a3d069aedb496ce42aed76404fc8673bf27" - integrity sha512-oahwfICJSaEmmtyN7JeOg6P7ey+GKigzk26zdKLxYLewmr2F3WeDPo/U+kVpIxPuZG3EiVFdRy97q9N9DoEkSg== - dependencies: - "@types/jest" "*" - -"@types/jest@*": - version "24.0.19" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.19.tgz#f7036058d2a5844fe922609187c0ad8be430aff5" - integrity sha512-YYiqfSjocv7lk5H/T+v5MjATYjaTMsUkbDnjGqSMoO88jWdtJXJV4ST/7DKZcoMHMBvB2SeSfyOzZfkxXHR5xg== - dependencies: - "@types/jest-diff" "*" - "@types/jest@^24.0.18": version "24.0.18" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" @@ -1762,16 +1748,6 @@ builtins@^1.0.3: resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= -bunyan@^1.8.12: - version "1.8.12" - resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.12.tgz#f150f0f6748abdd72aeae84f04403be2ef113797" - integrity sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c= - optionalDependencies: - dtrace-provider "~0.8" - moment "^2.10.6" - mv "~2" - safe-json-stringify "~1" - byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" @@ -2519,13 +2495,6 @@ dot-prop@^4.2.0: dependencies: is-obj "^1.0.0" -dtrace-provider@~0.8: - version "0.8.8" - resolved "https://registry.yarnpkg.com/dtrace-provider/-/dtrace-provider-0.8.8.tgz#2996d5490c37e1347be263b423ed7b297fb0d97e" - integrity sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg== - dependencies: - nan "^2.14.0" - duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" @@ -2753,7 +2722,7 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.8.0, expect@^24.9.0: +expect@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== @@ -3208,17 +3177,6 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@^6.0.1: - version "6.0.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" - integrity sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI= - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -4243,14 +4201,6 @@ jest-watcher@^24.9.0: jest-util "^24.9.0" string-length "^2.0.0" -jest-when@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/jest-when/-/jest-when-2.7.0.tgz#9549185ae8847b47d5d40262f1c59a5143e89a0c" - integrity sha512-psU0pXdomBORY9TGuSut/k8vViVki9l92WggL0m5/Lk8zTrDYtcCpPIFdZQDKqXvmW5Jzoh7SCsLKITvBJ0jyQ== - dependencies: - bunyan "^1.8.12" - expect "^24.8.0" - jest-worker@^24.6.0, jest-worker@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" @@ -4906,7 +4856,7 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -4982,7 +4932,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -4994,11 +4944,6 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -moment@^2.10.6: - version "2.24.0" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" - integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== - move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -5041,15 +4986,6 @@ mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mv@~2: - version "2.1.1" - resolved "https://registry.yarnpkg.com/mv/-/mv-2.1.1.tgz#ae6ce0d6f6d5e0a4f7d893798d03c1ea9559b6a2" - integrity sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI= - dependencies: - mkdirp "~0.5.1" - ncp "~2.0.0" - rimraf "~2.4.0" - mz@^2.5.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -5059,7 +4995,7 @@ mz@^2.5.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.12.1, nan@^2.14.0: +nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== @@ -5086,11 +5022,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -ncp@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" - integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= - needle@^2.2.1: version "2.4.0" resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" @@ -6208,13 +6139,6 @@ rimraf@^3.0.0: dependencies: glob "^7.1.3" -rimraf@~2.4.0: - version "2.4.5" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da" - integrity sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto= - dependencies: - glob "^6.0.1" - rollup-plugin-alias@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-2.0.1.tgz#2f11b0a09e0bab1bbd1f130536fe99ef8f35c0dd" @@ -6328,11 +6252,6 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-json-stringify@~1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" - integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg== - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e"