@daffodil/customer 0.94.1 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/fesm2022/daffodil-customer-driver-in-memory.mjs +344 -324
  2. package/fesm2022/daffodil-customer-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-customer-driver-magento-2.4.7-testing.mjs +116 -0
  4. package/fesm2022/daffodil-customer-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-customer-driver-magento-2.4.7.mjs +399 -0
  6. package/fesm2022/daffodil-customer-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-customer-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-customer-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-customer-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-customer-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-customer-driver-testing.mjs +152 -105
  12. package/fesm2022/daffodil-customer-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-customer-driver.mjs +45 -88
  14. package/fesm2022/daffodil-customer-driver.mjs.map +1 -1
  15. package/fesm2022/daffodil-customer-routing.mjs +86 -52
  16. package/fesm2022/daffodil-customer-routing.mjs.map +1 -1
  17. package/fesm2022/daffodil-customer-state-testing.mjs +176 -108
  18. package/fesm2022/daffodil-customer-state-testing.mjs.map +1 -1
  19. package/fesm2022/daffodil-customer-state.mjs +581 -718
  20. package/fesm2022/daffodil-customer-state.mjs.map +1 -1
  21. package/fesm2022/daffodil-customer-testing.mjs +102 -75
  22. package/fesm2022/daffodil-customer-testing.mjs.map +1 -1
  23. package/fesm2022/daffodil-customer.mjs +0 -4
  24. package/package.json +1 -1
  25. package/types/daffodil-customer-driver-in-memory.d.ts +102 -104
  26. package/types/daffodil-customer-driver-magento-2.4.7-testing.d.ts +33 -0
  27. package/types/daffodil-customer-driver-magento-2.4.7.d.ts +193 -0
  28. package/types/daffodil-customer-driver-magento-auto-testing.d.ts +1 -0
  29. package/types/daffodil-customer-driver-magento-auto.d.ts +1 -0
  30. package/types/daffodil-customer-driver-testing.d.ts +38 -37
  31. package/types/daffodil-customer-driver.d.ts +76 -90
  32. package/types/daffodil-customer-routing.d.ts +18 -22
  33. package/types/daffodil-customer-state-testing.d.ts +43 -43
  34. package/types/daffodil-customer-state.d.ts +240 -264
  35. package/types/daffodil-customer-testing.d.ts +27 -31
  36. package/types/daffodil-customer.d.ts +33 -37
  37. package/fesm2022/daffodil-customer-driver-magento-testing.mjs +0 -75
  38. package/fesm2022/daffodil-customer-driver-magento-testing.mjs.map +0 -1
  39. package/fesm2022/daffodil-customer-driver-magento.mjs +0 -448
  40. package/fesm2022/daffodil-customer-driver-magento.mjs.map +0 -1
  41. package/fesm2022/daffodil-customer.mjs.map +0 -1
  42. package/types/daffodil-customer-driver-magento-testing.d.ts +0 -37
  43. package/types/daffodil-customer-driver-magento.d.ts +0 -205
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-customer-driver-magento-2.4.7.mjs","names":[],"sources":["../../../libs/customer/driver/magento/2.4.7/src/transforms/requests/customer-input.ts","../../../libs/customer/driver/magento/2.4.7/src/transforms/requests/address-input.ts","../../../libs/customer/driver/magento/2.4.7/src/transforms/responses/customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/transforms/responses/customer.ts","../../../libs/customer/driver/magento/2.4.7/src/models/gender.enum.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/fragments/customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/fragments/customer.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/get-customer.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/get-customer-addresses.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/create-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/update-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/delete-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/update-customer.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/update-email.ts","../../../libs/customer/driver/magento/2.4.7/src/queries/change-password.ts","../../../libs/customer/driver/magento/2.4.7/src/errors/map.ts","../../../libs/customer/driver/magento/2.4.7/src/errors/transform.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/get-customer.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/change-email.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/change-password.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/get-customer-addresses.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/create-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/update-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/delete-customer-address.ts","../../../libs/customer/driver/magento/2.4.7/src/validators/update-customer.ts","../../../libs/customer/driver/magento/2.4.7/src/customer.service.ts","../../../libs/customer/driver/magento/2.4.7/src/address.service.ts","../../../libs/customer/driver/magento/2.4.7/src/provider.ts","../../../libs/customer/driver/magento/2.4.7/src/customer-driver.module.ts"],"sourcesContent":["import { DaffCustomer } from '@daffodil/customer';\n\nimport { MagentoCustomerInput } from '../../models/public_api';\n\nexport const magentoCustomerInputTransform = (customer: Partial<DaffCustomer>): MagentoCustomerInput => ({\n firstname: customer.firstName,\n lastname: customer.lastName,\n is_subscribed: customer.isSubscribed,\n});\n","import { DaffCustomerAddress } from '@daffodil/customer';\n\nimport { MagentoCustomerAddressInput } from '../../models/public_api';\n\nexport const magentoCustomerAddressInputTransform = (address: Partial<DaffCustomerAddress>): MagentoCustomerAddressInput => ({\n city: address.city,\n country_code: address.country,\n country_id: address.country,\n default_billing: address.defaultBilling,\n default_shipping: address.defaultShipping,\n firstname: address.firstname,\n lastname: address.lastname,\n middlename: address.middlename,\n postcode: address.postcode,\n prefix: address.prefix,\n region: {\n region_id: Number(address.region),\n },\n street: [\n address.street,\n ...(address.street2 ? [address.street2] : []),\n ],\n suffix: address.suffix,\n telephone: address.telephone,\n});\n","import { DaffCustomerAddress } from '@daffodil/customer';\n\nimport { MagentoCustomerAddress } from '../../models/public_api';\n\nexport const magentoCustomerAddressTransform = (address: MagentoCustomerAddress): DaffCustomerAddress => ({\n id: address.id ? String(address.id) : null,\n street: address.street[0],\n street2: address.street[1],\n city: address.city,\n region: String(address.region.region_id),\n region_code: address.region.region_code,\n country: address.country_code,\n country_id: address.country_code,\n postcode: address.postcode,\n firstname: address.firstname,\n lastname: address.lastname,\n telephone: address.telephone,\n email: address.email,\n defaultBilling: address.default_billing,\n defaultShipping: address.default_shipping,\n});\n","import { DaffCustomer } from '@daffodil/customer';\n\nimport { magentoCustomerAddressTransform } from './customer-address';\nimport { MagentoCustomer } from '../../models/public_api';\n\nexport const magentoCustomerTransform = (customer: MagentoCustomer): DaffCustomer => ({\n id: customer.email,\n email: customer.email,\n firstName: customer.firstname,\n lastName: customer.lastname,\n isSubscribed: customer.is_subscribed,\n addresses: customer.addresses.map(magentoCustomerAddressTransform),\n});\n","export enum MagentoCustomerGender {\n MALE = 1,\n FEMALE = 2\n}\n","import { gql } from 'apollo-angular';\n\nexport const magentoCustomerAddressFragment = gql`\n fragment magentoCustomerAddress on CustomerAddress {\n id\n city\n country_code\n firstname\n lastname\n postcode\n region {\n region_code\n region_id\n }\n street\n telephone\n company\n default_billing\n default_shipping\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './customer-address';\n\nexport const magentoCustomerFragment = gql`\n fragment magentoCustomer on Customer {\n email\n firstname\n lastname\n is_subscribed\n addresses {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_QUERY_NAME = 'MagentoGetCustomer';\n\nexport const getCustomer = gql`\n query ${MAGENTO_GET_CUSTOMER_QUERY_NAME} {\n customer {\n ...magentoCustomer\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME = 'MagentoGetCustomerAddresses';\n\nexport const getCustomerAddresses = gql`\n query ${MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME} {\n customer {\n addresses {\n ...magentoCustomerAddress\n }\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const createCustomerAddress = gql`\n mutation MagentoCreateCustomerAddress($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const updateCustomerAddress = gql`\n mutation MagentoUpdateCustomerAddress($id: Int!, $input: CustomerAddressInput!) {\n updateCustomerAddress(id: $id, input: $input) {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nexport const deleteCustomerAddress = gql`\n mutation MagentoDeleteCustomerAddress($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_UPDATE_CUSTOMER_QUERY_NAME = 'MagentoUpdateCustomer';\n\nexport const updateCustomer = gql`\n mutation ${MAGENTO_UPDATE_CUSTOMER_QUERY_NAME}($customer: CustomerUpdateInput!) {\n updateCustomerV2(input: $customer) {\n customer {\n ...magentoCustomer\n }\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_UPDATE_EMAIL_QUERY_NAME = 'MagentoUpdateEmail';\n\nexport const updateEmail = gql`\n mutation ${MAGENTO_UPDATE_EMAIL_QUERY_NAME}($email: String!, $password: String!) {\n updateCustomerEmail(email: $email, password: $password) {\n customer {\n ...magentoCustomer\n }\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nexport const MAGENTO_CHANGE_PASSWORD_QUERY_NAME = 'MagentoChangePassword';\n\nexport const changePassword = gql`\n mutation ${MAGENTO_CHANGE_PASSWORD_QUERY_NAME}($old: String!, $new: String!) {\n changeCustomerPassword(\n currentPassword: $old\n newPassword: $new\n ) {\n email\n }\n }\n`;\n","import { DaffCustomerDriverErrorCodes } from '@daffodil/customer/driver';\n\nexport const DaffCustomerMagentoErrorMessageRegexMap = {\n [DaffCustomerDriverErrorCodes.DEFAULT_SHIPPING_ADDRESS_DELETION]: /is set as default shipping address and can not be deleted/,\n [DaffCustomerDriverErrorCodes.DEFAULT_BILLING_ADDRESS_DELETION]: /is set as default billing address and can not be deleted/,\n};\n","import { CombinedGraphQLErrors } from '@apollo/client';\nimport { GraphQLFormattedError } from 'graphql';\n\nimport { DaffError } from '@daffodil/core';\nimport {\n DaffCustomerDriverErrorMap,\n DaffCustomerInvalidAPIResponseError,\n} from '@daffodil/customer/driver';\nimport { daffTransformMagentoError } from '@daffodil/driver/magento/2.4.7';\n\nimport { DaffCustomerMagentoErrorMessageRegexMap } from './map';\n\n/**\n * Transforms a single GraphQL error.\n * Optionally accepts a request payload which can be used in certain cases\n * to add supplemental info to the error.\n */\nexport function transformMagentoCartGraphQlError(error: GraphQLFormattedError, requestPayload?: unknown): DaffError {\n // TODO: readdress this when we move to eslint\n // eslint-disable-next-line\n for (const code in DaffCustomerMagentoErrorMessageRegexMap) {\n const matchIndex = error.message.search(DaffCustomerMagentoErrorMessageRegexMap[code]);\n\n if (matchIndex > -1 && DaffCustomerDriverErrorMap[code]) {\n const errObj = new DaffCustomerDriverErrorMap[code](error.message);\n\n return errObj;\n }\n }\n\n return daffTransformMagentoError(error, {});\n}\n\nexport function transformMagentoReviewsError(error: any, requestPayload?: unknown) {\n if (CombinedGraphQLErrors.is(error)) {\n return transformMagentoCartGraphQlError(error.errors[0], requestPayload);\n } else {\n return daffTransformMagentoError(error, {}) || new DaffCustomerInvalidAPIResponseError(error.message);\n }\n}\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoGetCustomerResponse } from '../models/public_api';\n\nexport const validateGetCustomerResponse = (response: Apollo.QueryResult<MagentoGetCustomerResponse>) => {\n if (response.data.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoChangeEmailResponse } from '../models/public_api';\n\nexport const validateChangeEmailResponse = (response: Apollo.QueryResult<MagentoChangeEmailResponse>) => {\n if (response.data.updateCustomerEmail.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update email response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoChangePasswordResponse } from '../models/public_api';\n\nexport const validateChangePasswordResponse = (response: Apollo.QueryResult<MagentoChangePasswordResponse>) => {\n if (response.data.changeCustomerPassword?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Change password response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoGetCustomerAddressesResponse } from '../models/public_api';\n\nexport const validateGetCustomerAddressesResponse = (response: Apollo.QueryResult<MagentoGetCustomerAddressesResponse>) => {\n if (response.data.customer?.addresses) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer address response does not contain addresses.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoCreateCustomerAddressResponse } from '../models/public_api';\n\nexport const validateCreateCustomerAddressResponse = (response: Apollo.QueryResult<MagentoCreateCustomerAddressResponse>) => {\n if (response.data.createCustomerAddress?.id) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Create customer address response does not contain an address.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoUpdateCustomerAddressResponse } from '../models/public_api';\n\nexport const validateUpdateCustomerAddressResponse = (response: Apollo.QueryResult<MagentoUpdateCustomerAddressResponse>) => {\n if (response.data.updateCustomerAddress?.id) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update customer address response does not contain an address.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoDeleteCustomerAddressResponse } from '../models/public_api';\n\nexport const validateDeleteCustomerAddressResponse = (response: Apollo.QueryResult<MagentoDeleteCustomerAddressResponse>) => {\n if (response.data.deleteCustomerAddress) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Delete customer address did not complete successfully.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoUpdateCustomerResponse } from '../models/public_api';\n\nexport const validateUpdateCustomerResponse = (response: Apollo.QueryResult<MagentoUpdateCustomerResponse>) => {\n if (response.data.updateCustomerV2.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update customer response does not contain a valid customer.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCustomer } from '@daffodil/customer';\nimport { DaffCustomerDriverInterface } from '@daffodil/customer/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport {\n MagentoChangeEmailResponse,\n MagentoChangePasswordResponse,\n MagentoGetCustomerResponse,\n MagentoUpdateCustomerResponse,\n} from './models/public_api';\nimport {\n changePassword,\n getCustomer,\n updateCustomer,\n updateEmail,\n} from './queries/public_api';\nimport {\n magentoCustomerInputTransform,\n magentoCustomerTransform,\n} from './transforms/public_api';\nimport { validateChangeEmailResponse } from './validators/change-email';\nimport { validateChangePasswordResponse } from './validators/change-password';\nimport { validateGetCustomerResponse } from './validators/public_api';\nimport { validateUpdateCustomerResponse } from './validators/update-customer';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerMagentoService implements DaffCustomerDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n changeEmail(email: string, password: string): Observable<DaffCustomer> {\n return this.apollo.mutate<MagentoChangeEmailResponse>({\n mutation: updateEmail,\n variables: {\n email,\n password,\n },\n }).pipe(\n map(validateChangeEmailResponse),\n map(result => magentoCustomerTransform(result.data.updateCustomerEmail.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n changePassword(oldPassword: string, newPassword: string): Observable<void> {\n return this.apollo.mutate<MagentoChangePasswordResponse>({\n mutation: changePassword,\n variables: {\n old: oldPassword,\n new: newPassword,\n },\n }).pipe(\n map(validateChangePasswordResponse),\n map(() => undefined),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n get(): Observable<DaffCustomer> {\n return this.apollo.query<MagentoGetCustomerResponse>({\n query: getCustomer,\n }).pipe(\n map(validateGetCustomerResponse),\n map(result => magentoCustomerTransform(result.data.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n update(customer: Partial<DaffCustomer>): Observable<DaffCustomer> {\n return this.apollo.mutate<MagentoUpdateCustomerResponse>({\n mutation: updateCustomer,\n variables: {\n customer: magentoCustomerInputTransform(customer),\n },\n }).pipe(\n map(validateUpdateCustomerResponse),\n map(result => magentoCustomerTransform(result.data.updateCustomerV2.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n}\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffIdentifiable } from '@daffodil/core';\nimport { DaffQueuedApollo } from '@daffodil/core/graphql';\nimport { DaffCustomerAddress } from '@daffodil/customer';\nimport {\n DaffCustomerAddressDriverInterface,\n DaffCustomerAddressNotFoundError,\n} from '@daffodil/customer/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport {\n MagentoCreateCustomerAddressResponse,\n MagentoDeleteCustomerAddressResponse,\n MagentoGetCustomerAddressesResponse,\n MagentoUpdateCustomerAddressResponse,\n} from './models/public_api';\nimport {\n createCustomerAddress,\n deleteCustomerAddress,\n getCustomerAddresses,\n updateCustomerAddress,\n} from './queries/public_api';\nimport {\n magentoCustomerAddressInputTransform,\n magentoCustomerAddressTransform,\n} from './transforms/public_api';\nimport {\n validateCreateCustomerAddressResponse,\n validateDeleteCustomerAddressResponse,\n validateGetCustomerAddressesResponse,\n validateUpdateCustomerAddressResponse,\n} from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerMagentoAddressService implements DaffCustomerAddressDriverInterface {\n constructor(\n private apollo: Apollo,\n private mutationQueue: DaffQueuedApollo,\n ) {}\n\n add(address: DaffCustomerAddress): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoCreateCustomerAddressResponse>({\n mutation: createCustomerAddress,\n variables: {\n input: magentoCustomerAddressInputTransform(address),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: () => true,\n }).pipe(\n map(validateCreateCustomerAddressResponse),\n // magento doesn't return address collection so make an additional request >:(\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n delete(addressId: DaffCustomerAddress['id']): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoDeleteCustomerAddressResponse>({\n mutation: deleteCustomerAddress,\n variables: {\n id: Number(addressId),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: (query) => true,\n }).pipe(\n map(validateDeleteCustomerAddressResponse),\n // magento doesn't return address collection so make an additional request >:(\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n list(): Observable<DaffCustomerAddress[]> {\n return this.listAddresses().pipe(\n map((response) => response.data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n get(addressId: DaffCustomerAddress['id']): Observable<DaffCustomerAddress> {\n return this.listAddresses().pipe(\n map(({ data }) => {\n const address = data.customer.addresses.find(({ id }) => String(id) === addressId);\n if (!address) {\n throw new DaffCustomerAddressNotFoundError(`Could not find an address with ID: ${addressId}`);\n }\n return address;\n }),\n map(address => magentoCustomerAddressTransform(address)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n update(address: Partial<DaffCustomerAddress> & DaffIdentifiable): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoUpdateCustomerAddressResponse>({\n mutation: updateCustomerAddress,\n variables: {\n id: Number(address.id),\n input: magentoCustomerAddressInputTransform(address),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: (query) => true,\n }).pipe(\n map(validateUpdateCustomerAddressResponse),\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n protected listAddresses(): Observable<Apollo.QueryResult<MagentoGetCustomerAddressesResponse>> {\n return this.apollo.query<MagentoGetCustomerAddressesResponse>({\n query: getCustomerAddresses,\n }).pipe(\n map(validateGetCustomerAddressesResponse),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerAddressDriver,\n provideDaffCustomerDriver,\n} from '@daffodil/customer/driver';\n\nimport { DaffCustomerMagentoAddressService } from './address.service';\nimport { DaffCustomerMagentoService } from './customer.service';\n\n/**\n * Provides the Magento implementations of the `@daffodil/customer/driver` interfaces.\n */\nexport const provideDaffCustomerMagentoDriver = (): EnvironmentProviders => makeEnvironmentProviders([\n provideDaffCustomerDriver(DaffCustomerMagentoService),\n provideDaffCustomerAddressDriver(DaffCustomerMagentoAddressService),\n]);\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffCustomerMagentoDriver } from './provider';\n\n/**\n * @deprecated in favor of {@link provideDaffCustomerMagentoDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerMagentoDriverModule> {\n return {\n ngModule: DaffCustomerMagentoDriverModule,\n providers: [\n provideDaffCustomerMagentoDriver(),\n ],\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAIA,MAAa,iCAAiC,cAA2D;CACvG,WAAW,SAAS;CACpB,UAAU,SAAS;CACnB,eAAe,SAAS;AACzB;ACJD,MAAa,wCAAwC,aAAwE;CAC3H,MAAM,QAAQ;CACd,cAAc,QAAQ;CACtB,YAAY,QAAQ;CACpB,iBAAiB,QAAQ;CACzB,kBAAkB,QAAQ;CAC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AA,MAAA;GAA+B,SAAA,CAHxC,YAAY;EAAA,CAAA;CAAA;CAGH;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA+B,SAAA,CAHxC,YAAY;EAAA,CAAA;CAAA;;AAGH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA+B,YAAA,CAAA;EAL3C,MAAA;EAAS,MAAA,CAAA,EACR,SAAS,CACP,YACD,EACF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { isDevMode } from "@angular/core";
2
+ import { daffAutoDriverErrorMessage } from "@daffodil/driver";
3
+ const MESSAGE = daffAutoDriverErrorMessage("customer");
4
+ if (isDevMode()) throw new Error(MESSAGE);
5
+ else console.error(MESSAGE);
6
+
7
+ //# sourceMappingURL=daffodil-customer-driver-magento-auto-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-customer-driver-magento-auto-testing.mjs","names":[],"sources":["../../../libs/customer/driver/magento/auto/testing/src/index.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nimport { daffAutoDriverErrorMessage } from '@daffodil/driver';\n\nconst MESSAGE = daffAutoDriverErrorMessage('customer');\n\nif (isDevMode()) {\n throw new Error(MESSAGE);\n} else {\n console.error(MESSAGE);\n}\n\nexport {};\n"],"mappings":";;AAIA,MAAM,UAAU,2BAA2B,UAAU;AAErD,IAAI,UAAS,GACX,MAAM,IAAI,MAAM,OAAO;KAEvB,QAAQ,MAAM,OAAO"}
@@ -0,0 +1,7 @@
1
+ import { isDevMode } from "@angular/core";
2
+ import { daffAutoDriverErrorMessage } from "@daffodil/driver";
3
+ const MESSAGE = daffAutoDriverErrorMessage("customer");
4
+ if (isDevMode()) throw new Error(MESSAGE);
5
+ else console.error(MESSAGE);
6
+
7
+ //# sourceMappingURL=daffodil-customer-driver-magento-auto.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-customer-driver-magento-auto.mjs","names":[],"sources":["../../../libs/customer/driver/magento/auto/src/index.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nimport { daffAutoDriverErrorMessage } from '@daffodil/driver';\n\nconst MESSAGE = daffAutoDriverErrorMessage('customer');\n\nif (isDevMode()) {\n throw new Error(MESSAGE);\n} else {\n console.error(MESSAGE);\n}\n\nexport {};\n"],"mappings":";;AAIA,MAAM,UAAU,2BAA2B,UAAU;AAErD,IAAI,UAAS,GACX,MAAM,IAAI,MAAM,OAAO;KAEvB,QAAQ,MAAM,OAAO"}
@@ -1,106 +1,153 @@
1
- import { CommonModule } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { Injectable, NgModule } from '@angular/core';
4
- import { provideDaffCustomerDriver, provideDaffCustomerAddressDriver } from '@daffodil/customer/driver';
5
- import { of } from 'rxjs';
6
- import * as i1 from '@daffodil/customer/testing';
1
+ import { CommonModule } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
4
+ import { provideDaffCustomerAddressDriver, provideDaffCustomerDriver } from "@daffodil/customer/driver";
5
+ import { of } from "rxjs";
6
+ import * as i1 from "@daffodil/customer/testing";
7
+ var DaffCustomerAddressTestingDriver = class DaffCustomerAddressTestingDriver {
8
+ constructor(factory) {
9
+ this.factory = factory;
10
+ }
11
+ list() {
12
+ return of(this.factory.createMany(3));
13
+ }
14
+ get(addressId) {
15
+ return of(this.factory.create({ id: addressId }));
16
+ }
17
+ update(address) {
18
+ return of(this.factory.createMany(3));
19
+ }
20
+ add(address) {
21
+ return of(this.factory.createMany(3));
22
+ }
23
+ delete(addressId) {
24
+ return of(this.factory.createMany(3));
25
+ }
26
+ static {
27
+ this.ɵfac = i0.ɵɵngDeclareFactory({
28
+ minVersion: "12.0.0",
29
+ version: "22.2.4",
30
+ ngImport: i0,
31
+ type: DaffCustomerAddressTestingDriver,
32
+ deps: [{ token: i1.DaffCustomerAddressFactory }],
33
+ target: i0.ɵɵFactoryTarget.Injectable
34
+ });
35
+ }
36
+ static {
37
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
38
+ minVersion: "12.0.0",
39
+ version: "22.2.4",
40
+ ngImport: i0,
41
+ type: DaffCustomerAddressTestingDriver,
42
+ providedIn: "root"
43
+ });
44
+ }
45
+ };
46
+ i0.ɵɵngDeclareClassMetadata({
47
+ minVersion: "12.0.0",
48
+ version: "22.2.4",
49
+ ngImport: i0,
50
+ type: DaffCustomerAddressTestingDriver,
51
+ decorators: [{
52
+ type: Injectable,
53
+ args: [{ providedIn: "root" }]
54
+ }],
55
+ ctorParameters: () => [{ type: i1.DaffCustomerAddressFactory }]
56
+ });
57
+ var DaffCustomerTestingDriver = class DaffCustomerTestingDriver {
58
+ constructor(customerFactory) {
59
+ this.customerFactory = customerFactory;
60
+ }
61
+ changeEmail(email, password) {
62
+ return of(this.customerFactory.create({ email }));
63
+ }
64
+ changePassword(oldPassword, newPassword) {
65
+ return of(void 0);
66
+ }
67
+ get() {
68
+ return of(this.customerFactory.create());
69
+ }
70
+ update(customer) {
71
+ return of(this.customerFactory.create(customer));
72
+ }
73
+ static {
74
+ this.ɵfac = i0.ɵɵngDeclareFactory({
75
+ minVersion: "12.0.0",
76
+ version: "22.2.4",
77
+ ngImport: i0,
78
+ type: DaffCustomerTestingDriver,
79
+ deps: [{ token: i1.DaffCustomerFactory }],
80
+ target: i0.ɵɵFactoryTarget.Injectable
81
+ });
82
+ }
83
+ static {
84
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
85
+ minVersion: "12.0.0",
86
+ version: "22.2.4",
87
+ ngImport: i0,
88
+ type: DaffCustomerTestingDriver,
89
+ providedIn: "root"
90
+ });
91
+ }
92
+ };
93
+ i0.ɵɵngDeclareClassMetadata({
94
+ minVersion: "12.0.0",
95
+ version: "22.2.4",
96
+ ngImport: i0,
97
+ type: DaffCustomerTestingDriver,
98
+ decorators: [{
99
+ type: Injectable,
100
+ args: [{ providedIn: "root" }]
101
+ }],
102
+ ctorParameters: () => [{ type: i1.DaffCustomerFactory }]
103
+ });
104
+ const provideDaffCustomerTestingDriver = () => makeEnvironmentProviders([provideDaffCustomerDriver(DaffCustomerTestingDriver), provideDaffCustomerAddressDriver(DaffCustomerAddressTestingDriver)]);
105
+ var DaffCustomerTestingDriverModule = class DaffCustomerTestingDriverModule {
106
+ static forRoot() {
107
+ return {
108
+ ngModule: DaffCustomerTestingDriverModule,
109
+ providers: [provideDaffCustomerTestingDriver()]
110
+ };
111
+ }
112
+ static {
113
+ this.ɵfac = i0.ɵɵngDeclareFactory({
114
+ minVersion: "12.0.0",
115
+ version: "22.2.4",
116
+ ngImport: i0,
117
+ type: DaffCustomerTestingDriverModule,
118
+ deps: [],
119
+ target: i0.ɵɵFactoryTarget.NgModule
120
+ });
121
+ }
122
+ static {
123
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
124
+ minVersion: "14.0.0",
125
+ version: "22.2.4",
126
+ ngImport: i0,
127
+ type: DaffCustomerTestingDriverModule,
128
+ imports: [CommonModule]
129
+ });
130
+ }
131
+ static {
132
+ this.ɵinj = i0.ɵɵngDeclareInjector({
133
+ minVersion: "12.0.0",
134
+ version: "22.2.4",
135
+ ngImport: i0,
136
+ type: DaffCustomerTestingDriverModule,
137
+ imports: [CommonModule]
138
+ });
139
+ }
140
+ };
141
+ i0.ɵɵngDeclareClassMetadata({
142
+ minVersion: "12.0.0",
143
+ version: "22.2.4",
144
+ ngImport: i0,
145
+ type: DaffCustomerTestingDriverModule,
146
+ decorators: [{
147
+ type: NgModule,
148
+ args: [{ imports: [CommonModule] }]
149
+ }]
150
+ });
151
+ export { DaffCustomerAddressTestingDriver, DaffCustomerTestingDriver, DaffCustomerTestingDriverModule, provideDaffCustomerTestingDriver };
7
152
 
8
- /**
9
- * A basic customer driver that creates mock customer results of different kinds.
10
- * For testing purposes.
11
- *
12
- * @inheritdoc
13
- */
14
- class DaffCustomerAddressTestingDriver {
15
- constructor(factory) {
16
- this.factory = factory;
17
- }
18
- list() {
19
- return of(this.factory.createMany(3));
20
- }
21
- get(addressId) {
22
- return of(this.factory.create({ id: addressId }));
23
- }
24
- update(address) {
25
- return of(this.factory.createMany(3));
26
- }
27
- add(address) {
28
- return of(this.factory.createMany(3));
29
- }
30
- delete(addressId) {
31
- return of(this.factory.createMany(3));
32
- }
33
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerAddressTestingDriver, deps: [{ token: i1.DaffCustomerAddressFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
34
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerAddressTestingDriver, providedIn: 'root' }); }
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerAddressTestingDriver, decorators: [{
37
- type: Injectable,
38
- args: [{
39
- providedIn: 'root',
40
- }]
41
- }], ctorParameters: () => [{ type: i1.DaffCustomerAddressFactory }] });
42
-
43
- /**
44
- * A basic customer driver that creates mock customer results of different kinds.
45
- * For testing purposes.
46
- *
47
- * @inheritdoc
48
- */
49
- class DaffCustomerTestingDriver {
50
- constructor(customerFactory) {
51
- this.customerFactory = customerFactory;
52
- }
53
- changeEmail(email, password) {
54
- return of(this.customerFactory.create({ email }));
55
- }
56
- changePassword(oldPassword, newPassword) {
57
- return of(undefined);
58
- }
59
- get() {
60
- return of(this.customerFactory.create());
61
- }
62
- update(customer) {
63
- return of(this.customerFactory.create(customer));
64
- }
65
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriver, deps: [{ token: i1.DaffCustomerFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
66
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriver, providedIn: 'root' }); }
67
- }
68
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriver, decorators: [{
69
- type: Injectable,
70
- args: [{
71
- providedIn: 'root',
72
- }]
73
- }], ctorParameters: () => [{ type: i1.DaffCustomerFactory }] });
74
-
75
- /**
76
- * Provides the {@link DaffCustomerTestingDriver} as the {@link DaffCustomerDriver}.
77
- */
78
- class DaffCustomerTestingDriverModule {
79
- static forRoot() {
80
- return {
81
- ngModule: DaffCustomerTestingDriverModule,
82
- providers: [
83
- provideDaffCustomerDriver(DaffCustomerTestingDriver),
84
- provideDaffCustomerAddressDriver(DaffCustomerAddressTestingDriver),
85
- ],
86
- };
87
- }
88
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
89
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriverModule, imports: [CommonModule] }); }
90
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriverModule, imports: [CommonModule] }); }
91
- }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerTestingDriverModule, decorators: [{
93
- type: NgModule,
94
- args: [{
95
- imports: [
96
- CommonModule,
97
- ],
98
- }]
99
- }] });
100
-
101
- /**
102
- * Generated bundle index. Do not edit.
103
- */
104
-
105
- export { DaffCustomerAddressTestingDriver, DaffCustomerTestingDriver, DaffCustomerTestingDriverModule };
106
- //# sourceMappingURL=daffodil-customer-driver-testing.mjs.map
153
+ //# sourceMappingURL=daffodil-customer-driver-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-customer-driver-testing.mjs","sources":["../../../libs/customer/driver/testing/src/drivers/address.service.ts","../../../libs/customer/driver/testing/src/drivers/customer.service.ts","../../../libs/customer/driver/testing/src/drivers/customer-driver.module.ts","../../../libs/customer/driver/testing/src/daffodil-customer-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffIdentifiable } from '@daffodil/core';\nimport { DaffCustomerAddress } from '@daffodil/customer';\nimport { DaffCustomerAddressDriverInterface } from '@daffodil/customer/driver';\nimport { DaffCustomerAddressFactory } from '@daffodil/customer/testing';\n\n/**\n * A basic customer driver that creates mock customer results of different kinds.\n * For testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerAddressTestingDriver implements DaffCustomerAddressDriverInterface {\n constructor(\n private factory: DaffCustomerAddressFactory,\n ) {}\n\n list(): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n get(addressId: string): Observable<DaffCustomerAddress> {\n return of(this.factory.create({ id: addressId }));\n }\n\n update(address: Partial<DaffCustomerAddress> & DaffIdentifiable): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n add(address: DaffCustomerAddress): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n delete(addressId: string): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCustomer } from '@daffodil/customer';\nimport { DaffCustomerDriverInterface } from '@daffodil/customer/driver';\nimport { DaffCustomerFactory } from '@daffodil/customer/testing';\n\n/**\n * A basic customer driver that creates mock customer results of different kinds.\n * For testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerTestingDriver implements DaffCustomerDriverInterface {\n constructor(\n private customerFactory: DaffCustomerFactory,\n ) {}\n\n changeEmail(email: string, password: string): Observable<DaffCustomer> {\n return of(this.customerFactory.create({ email }));\n }\n\n changePassword(oldPassword: string, newPassword: string): Observable<void> {\n return of(undefined);\n }\n\n get(): Observable<DaffCustomer> {\n return of(this.customerFactory.create());\n }\n\n update(customer: Partial<DaffCustomer>): Observable<DaffCustomer> {\n return of(this.customerFactory.create(customer));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerAddressDriver,\n provideDaffCustomerDriver,\n} from '@daffodil/customer/driver';\n\nimport { DaffCustomerAddressTestingDriver } from './address.service';\nimport { DaffCustomerTestingDriver } from './customer.service';\n\n/**\n * Provides the {@link DaffCustomerTestingDriver} as the {@link DaffCustomerDriver}.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerTestingDriverModule> {\n return {\n ngModule: DaffCustomerTestingDriverModule,\n providers: [\n provideDaffCustomerDriver(DaffCustomerTestingDriver),\n provideDaffCustomerAddressDriver(DaffCustomerAddressTestingDriver),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAWA;;;;;AAKG;MAIU,gCAAgC,CAAA;AAC3C,IAAA,WAAA,CACU,OAAmC,EAAA;QAAnC,IAAA,CAAA,OAAO,GAAP,OAAO;IACd;IAEH,IAAI,GAAA;QACF,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACvC;AAEA,IAAA,GAAG,CAAC,SAAiB,EAAA;AACnB,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;I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AAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,YAHxC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAL3C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACrBD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-customer-driver-testing.mjs","names":[],"sources":["../../../libs/customer/driver/testing/src/drivers/address.service.ts","../../../libs/customer/driver/testing/src/drivers/customer.service.ts","../../../libs/customer/driver/testing/src/provider.ts","../../../libs/customer/driver/testing/src/drivers/customer-driver.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffIdentifiable } from '@daffodil/core';\nimport { DaffCustomerAddress } from '@daffodil/customer';\nimport { DaffCustomerAddressDriverInterface } from '@daffodil/customer/driver';\nimport { DaffCustomerAddressFactory } from '@daffodil/customer/testing';\n\n/**\n * A basic customer driver that creates mock customer results of different kinds.\n * For testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerAddressTestingDriver implements DaffCustomerAddressDriverInterface {\n constructor(\n private factory: DaffCustomerAddressFactory,\n ) {}\n\n list(): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n get(addressId: string): Observable<DaffCustomerAddress> {\n return of(this.factory.create({ id: addressId }));\n }\n\n update(address: Partial<DaffCustomerAddress> & DaffIdentifiable): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n add(address: DaffCustomerAddress): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n\n delete(addressId: string): Observable<DaffCustomerAddress[]> {\n return of(this.factory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCustomer } from '@daffodil/customer';\nimport { DaffCustomerDriverInterface } from '@daffodil/customer/driver';\nimport { DaffCustomerFactory } from '@daffodil/customer/testing';\n\n/**\n * A basic customer driver that creates mock customer results of different kinds.\n * For testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerTestingDriver implements DaffCustomerDriverInterface {\n constructor(\n private customerFactory: DaffCustomerFactory,\n ) {}\n\n changeEmail(email: string, password: string): Observable<DaffCustomer> {\n return of(this.customerFactory.create({ email }));\n }\n\n changePassword(oldPassword: string, newPassword: string): Observable<void> {\n return of(undefined);\n }\n\n get(): Observable<DaffCustomer> {\n return of(this.customerFactory.create());\n }\n\n update(customer: Partial<DaffCustomer>): Observable<DaffCustomer> {\n return of(this.customerFactory.create(customer));\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerAddressDriver,\n provideDaffCustomerDriver,\n} from '@daffodil/customer/driver';\n\nimport { DaffCustomerAddressTestingDriver } from './drivers/address.service';\nimport { DaffCustomerTestingDriver } from './drivers/customer.service';\n\n/**\n * Provides the {@link DaffCustomerTestingDriver} as the {@link DaffCustomerDriver}.\n */\nexport const provideDaffCustomerTestingDriver = (): EnvironmentProviders => makeEnvironmentProviders([\n provideDaffCustomerDriver(DaffCustomerTestingDriver),\n provideDaffCustomerAddressDriver(DaffCustomerAddressTestingDriver),\n]);\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffCustomerTestingDriver } from '../provider';\n\n/**\n * Provides the {@link DaffCustomerTestingDriver} as the {@link DaffCustomerDriver}.\n *\n * @deprecated in favor of {@link provideDaffCustomerTestingDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerTestingDriverModule> {\n return {\n ngModule: DaffCustomerTestingDriverModule,\n providers: [\n provideDaffCustomerTestingDriver(),\n ],\n };\n }\n}\n"],"mappings":";;;;;;AAoBA,IAAa,mCAAb,MAAa,iCAAgC;CAC3C,YACU,SAAmC;EAAnC,KAAA,UAAA;CACP;CAEH,OAAI;EACF,OAAO,GAAG,KAAK,QAAQ,WAAW,CAAC,CAAC;CACtC;CAEA,IAAI,WAAiB;EACnB,OAAO,GAAG,KAAK,QAAQ,OAAO,EAAE,IAAI,UAAS,CAAE,CAAC;CAClD;CAEA,OAAO,SAAwD;EAC7D,OAAO,GAAG,KAAK,QAAQ,WAAW,CAAC,CAAC;CACtC;CAEA,IAAI,SAA4B;EAC9B,OAAO,GAAG,KAAK,QAAQ,WAAW,CAAC,CAAC;CACtC;CAEA,OAAO,WAAiB;EACtB,OAAO,GAAG,KAAK,QAAQ,WAAW,CAAC,CAAC;CACtC;CAvBW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgC,MAAA,CAAA,EAAA,OAAA,GAAA,2BAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhC;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgC,YAF/B;EAAM,CAAA;CAAA;;AAEP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgC,YAAA,CAAA;EAH5C,MAAA;EAAW,MAAA,CAAA,EACV,YAAY,OACb,CAAA;;;;ACAD,IAAa,4BAAb,MAAa,0BAAyB;CACpC,YACU,iBAAoC;EAApC,KAAA,kBAAA;CACP;CAEH,YAAY,OAAe,UAAgB;EACzC,OAAO,GAAG,KAAK,gBAA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GAAA,MAAA;GAA+B,SAAA,CAHxC,YAAY;EAAA,CAAA;CAAA;;AAGH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA+B,YAAA,CAAA;EAL3C,MAAA;EAAS,MAAA,CAAA,EACR,SAAS,CACP,YACD,EACF,CAAA"}
@@ -1,93 +1,50 @@
1
- import { createSingletonInjectionToken, DaffInheritableError } from '@daffodil/core';
2
-
3
- const {
4
- /**
5
- * An injection token for the customer driver.
6
- */
7
- token: DaffCustomerDriver,
8
- /**
9
- * Provider function for {@link DaffCustomerDriver}.
10
- */
11
- provider: provideDaffCustomerDriver, } = createSingletonInjectionToken('DaffCustomerDriver');
12
-
13
- const {
14
- /**
15
- * An injection token for the customer driver.
16
- */
17
- token: DaffCustomerAddressDriver,
18
- /**
19
- * Provider function for {@link DaffCustomerAddressDriver}.
20
- */
21
- provider: provideDaffCustomerAddressDriver, } = createSingletonInjectionToken('DaffCustomerAddressDriver');
22
-
23
- const DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE = 'DAFF_CUSTOMER_INVALID_API_RESPONSE';
24
- /**
25
- * A general error indicating that the platform returned a response which cannot be processed.
26
- */
27
- class DaffCustomerInvalidAPIResponseError extends DaffInheritableError {
28
- constructor(message) {
29
- super(message);
30
- this.message = message;
31
- this.code = DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE;
32
- }
33
- }
34
-
35
- const DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE = 'DAFF_CUSTOMER_ADDRESS_NOT_FOUND';
36
- /**
37
- * An error indicating that the requested address cannot be found.
38
- */
39
- class DaffCustomerAddressNotFoundError extends DaffInheritableError {
40
- constructor(message) {
41
- super(message);
42
- this.message = message;
43
- this.code = DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE;
44
- }
45
- }
46
-
47
- const DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION';
48
- /**
49
- * An error indicating that a deletion of the customer's default billing address was attempted and failed.
50
- */
51
- class DaffCustomerDefaultBillingAddressDeletionError extends DaffInheritableError {
52
- constructor(message) {
53
- super(message);
54
- this.message = message;
55
- this.code = DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE;
56
- }
57
- }
58
-
59
- const DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION';
60
- /**
61
- * An error indicating that a deletion of the customer's default shipping address was attempted and failed.
62
- */
63
- class DaffCustomerDefaultShippingAddressDeletionError extends DaffInheritableError {
64
- constructor(message) {
65
- super(message);
66
- this.message = message;
67
- this.code = DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE;
68
- }
69
- }
70
-
71
- /**
72
- * A mapping from error codes to error class constructors.
73
- */
1
+ import { DaffInheritableError, createSingletonInjectionToken } from "@daffodil/core";
2
+ const { token: DaffCustomerDriver, provider: provideDaffCustomerDriver } = createSingletonInjectionToken("DaffCustomerDriver");
3
+ const { token: DaffCustomerAddressDriver, provider: provideDaffCustomerAddressDriver } = createSingletonInjectionToken("DaffCustomerAddressDriver");
4
+ const DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE = "DAFF_CUSTOMER_INVALID_API_RESPONSE";
5
+ var DaffCustomerInvalidAPIResponseError = class extends DaffInheritableError {
6
+ constructor(message) {
7
+ super(message);
8
+ this.message = message;
9
+ this.code = DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE;
10
+ }
11
+ };
12
+ const DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE = "DAFF_CUSTOMER_ADDRESS_NOT_FOUND";
13
+ var DaffCustomerAddressNotFoundError = class extends DaffInheritableError {
14
+ constructor(message) {
15
+ super(message);
16
+ this.message = message;
17
+ this.code = DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE;
18
+ }
19
+ };
20
+ const DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE = "DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION";
21
+ var DaffCustomerDefaultBillingAddressDeletionError = class extends DaffInheritableError {
22
+ constructor(message) {
23
+ super(message);
24
+ this.message = message;
25
+ this.code = DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE;
26
+ }
27
+ };
28
+ const DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE = "DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION";
29
+ var DaffCustomerDefaultShippingAddressDeletionError = class extends DaffInheritableError {
30
+ constructor(message) {
31
+ super(message);
32
+ this.message = message;
33
+ this.code = DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE;
34
+ }
35
+ };
74
36
  const DaffCustomerDriverErrorMap = {
75
- [DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE]: DaffCustomerInvalidAPIResponseError,
76
- [DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE]: DaffCustomerAddressNotFoundError,
77
- [DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultBillingAddressDeletionError,
78
- [DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultShippingAddressDeletionError,
37
+ [DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE]: DaffCustomerInvalidAPIResponseError,
38
+ [DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE]: DaffCustomerAddressNotFoundError,
39
+ [DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultBillingAddressDeletionError,
40
+ [DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultShippingAddressDeletionError
79
41
  };
80
-
81
42
  const DaffCustomerDriverErrorCodes = {
82
- ADDRESS_NOT_FOUND: DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,
83
- DEFAULT_BILLING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,
84
- DEFAULT_SHIPPING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,
85
- INVALID_API_RESPONSE: DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE,
43
+ ADDRESS_NOT_FOUND: DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,
44
+ DEFAULT_BILLING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,
45
+ DEFAULT_SHIPPING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,
46
+ INVALID_API_RESPONSE: DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE
86
47
  };
87
-
88
- /**
89
- * Generated bundle index. Do not edit.
90
- */
91
-
92
48
  export { DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE, DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE, DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE, DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE, DaffCustomerAddressDriver, DaffCustomerAddressNotFoundError, DaffCustomerDefaultBillingAddressDeletionError, DaffCustomerDefaultShippingAddressDeletionError, DaffCustomerDriver, DaffCustomerDriverErrorCodes, DaffCustomerDriverErrorMap, DaffCustomerInvalidAPIResponseError, provideDaffCustomerAddressDriver, provideDaffCustomerDriver };
93
- //# sourceMappingURL=daffodil-customer-driver.mjs.map
49
+
50
+ //# sourceMappingURL=daffodil-customer-driver.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-customer-driver.mjs","sources":["../../../libs/customer/driver/src/interfaces/customer-service.interface.ts","../../../libs/customer/driver/src/interfaces/address-service.interface.ts","../../../libs/customer/driver/src/errors/invalid-api-response.ts","../../../libs/customer/driver/src/errors/address-not-found.ts","../../../libs/customer/driver/src/errors/default-billing-address-deletion.ts","../../../libs/customer/driver/src/errors/default-shipping-address-deletion.ts","../../../libs/customer/driver/src/errors/map.ts","../../../libs/customer/driver/src/errors/codes.ts","../../../libs/customer/driver/src/daffodil-customer-driver.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffCustomer } from '@daffodil/customer';\n\nexport const {\n /**\n * An injection token for the customer driver.\n */\n token: DaffCustomerDriver,\n /**\n * Provider function for {@link DaffCustomerDriver}.\n */\n provider: provideDaffCustomerDriver,\n} = createSingletonInjectionToken<DaffCustomerDriverInterface>('DaffCustomerDriver');\n\n/**\n * The customer driver is responsible for loading customers.\n */\nexport interface DaffCustomerDriverInterface<\n T extends DaffCustomer = DaffCustomer,\n> {\n /**\n * Get the currently logged-in customer.\n */\n get(): Observable<T>;\n\n /**\n * Update the currently logged-in customer.\n *\n * @param customer The customer info to update.\n */\n update(customer: Partial<T>): Observable<T>;\n\n /**\n * Change the currently logged-in customer's email.\n */\n changeEmail(email: string, password: string): Observable<T>;\n\n /**\n * Change the currently logged-in customer's password.\n */\n changePassword(oldPassword: string, newPassword: string): Observable<void>;\n}\n","import { Observable } from 'rxjs';\n\nimport {\n DaffIdentifiable,\n createSingletonInjectionToken,\n} from '@daffodil/core';\nimport { DaffCustomerAddress } from '@daffodil/customer';\n\nexport const {\n /**\n * An injection token for the customer driver.\n */\n token: DaffCustomerAddressDriver,\n /**\n * Provider function for {@link DaffCustomerAddressDriver}.\n */\n provider: provideDaffCustomerAddressDriver,\n} = createSingletonInjectionToken<DaffCustomerAddressDriverInterface>('DaffCustomerAddressDriver');\n\n/**\n * The customer driver is responsible for loading customers.\n */\nexport interface DaffCustomerAddressDriverInterface<\n T extends DaffCustomerAddress = DaffCustomerAddress,\n> {\n /**\n * Lists the customer's addresses.\n */\n list(): Observable<T[]>;\n\n /**\n * Get the specified address.\n */\n get(addressId: DaffCustomerAddress['id']): Observable<T>;\n\n /**\n * Update the passed address.\n */\n update(address: Partial<T> & DaffIdentifiable): Observable<T[]>;\n\n /**\n * Adds the passed address.\n */\n add(address: T): Observable<T[]>;\n\n /**\n * Deletes the specified address.\n */\n delete(addressId: DaffCustomerAddress['id']): Observable<T[]>;\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE = 'DAFF_CUSTOMER_INVALID_API_RESPONSE';\n\n/**\n * A general error indicating that the platform returned a response which cannot be processed.\n */\nexport class DaffCustomerInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE = 'DAFF_CUSTOMER_ADDRESS_NOT_FOUND';\n\n/**\n * An error indicating that the requested address cannot be found.\n */\nexport class DaffCustomerAddressNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION';\n\n/**\n * An error indicating that a deletion of the customer's default billing address was attempted and failed.\n */\nexport class DaffCustomerDefaultBillingAddressDeletionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION';\n\n/**\n * An error indicating that a deletion of the customer's default shipping address was attempted and failed.\n */\nexport class DaffCustomerDefaultShippingAddressDeletionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,\n DaffCustomerAddressNotFoundError,\n} from './address-not-found';\nimport {\n DaffCustomerDefaultBillingAddressDeletionError,\n DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,\n} from './default-billing-address-deletion';\nimport {\n DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,\n DaffCustomerDefaultShippingAddressDeletionError,\n} from './default-shipping-address-deletion';\nimport {\n DaffCustomerInvalidAPIResponseError,\n DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE,\n} from './invalid-api-response';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffCustomerDriverErrorMap = {\n [DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE]: DaffCustomerInvalidAPIResponseError,\n [DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE]: DaffCustomerAddressNotFoundError,\n [DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultBillingAddressDeletionError,\n [DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultShippingAddressDeletionError,\n};\n","import { DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE } from './address-not-found';\nimport { DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE } from './default-billing-address-deletion';\nimport { DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE } from './default-shipping-address-deletion';\nimport { DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE } from './invalid-api-response';\n\nexport const DaffCustomerDriverErrorCodes = {\n ADDRESS_NOT_FOUND: DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,\n DEFAULT_BILLING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,\n DEFAULT_SHIPPING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,\n INVALID_API_RESPONSE: DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE,\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKO,MAAM;AACX;;AAEG;AACH,KAAK,EAAE,kBAAkB;AACzB;;AAEG;AACH,QAAQ,EAAE,yBAAyB,GACpC,GAAG,6BAA6B,CAA8B,oBAAoB;;ACN5E,MAAM;AACX;;AAEG;AACH,KAAK,EAAE,yBAAyB;AAChC;;AAEG;AACH,QAAQ,EAAE,gCAAgC,GAC3C,GAAG,6BAA6B,CAAqC,2BAA2B;;ACZ1F,MAAM,6CAA6C,GAAG;AAE7D;;AAEG;AACG,MAAO,mCAAoC,SAAQ,oBAAoB,CAAA;AAG3E,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,6CAA6C;IAI5E;AACD;;ACXM,MAAM,0CAA0C,GAAG;AAE1D;;AAEG;AACG,MAAO,gCAAiC,SAAQ,oBAAoB,CAAA;AAGxE,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,0CAA0C;IAIzE;AACD;;ACXM,MAAM,yDAAyD,GAAG;AAEzE;;AAEG;AACG,MAAO,8CAA+C,SAAQ,oBAAoB,CAAA;AAGtF,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,yDAAyD;IAIxF;AACD;;ACXM,MAAM,0DAA0D,GAAG;AAE1E;;AAEG;AACG,MAAO,+CAAgD,SAAQ,oBAAoB,CAAA;AAGvF,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC;QADG,IAAA,CAAA,OAAO,GAAP,OAAO;QAFV,IAAA,CAAA,IAAI,GAAW,0DAA0D;IAIzF;AACD;;ACCD;;AAEG;AACI,MAAM,0BAA0B,GAAG;IACxC,CAAC,6CAA6C,GAAG,mCAAmC;IACpF,CAAC,0CAA0C,GAAG,gCAAgC;IAC9E,CAAC,yDAAyD,GAAG,8CAA8C;IAC3G,CAAC,0DAA0D,GAAG,+CAA+C;;;ACnBxG,MAAM,4BAA4B,GAAG;AAC1C,IAAA,iBAAiB,EAAE,0CAA0C;AAC7D,IAAA,gCAAgC,EAAE,yDAAyD;AAC3F,IAAA,iCAAiC,EAAE,0DAA0D;AAC7F,IAAA,oBAAoB,EAAE,6CAA6C;;;ACTrE;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-customer-driver.mjs","names":[],"sources":["../../../libs/customer/driver/src/interfaces/customer-service.interface.ts","../../../libs/customer/driver/src/interfaces/address-service.interface.ts","../../../libs/customer/driver/src/errors/invalid-api-response.ts","../../../libs/customer/driver/src/errors/address-not-found.ts","../../../libs/customer/driver/src/errors/default-billing-address-deletion.ts","../../../libs/customer/driver/src/errors/default-shipping-address-deletion.ts","../../../libs/customer/driver/src/errors/map.ts","../../../libs/customer/driver/src/errors/codes.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffCustomer } from '@daffodil/customer';\n\nexport const {\n /**\n * An injection token for the customer driver.\n */\n token: DaffCustomerDriver,\n /**\n * Provider function for {@link DaffCustomerDriver}.\n */\n provider: provideDaffCustomerDriver,\n} = createSingletonInjectionToken<DaffCustomerDriverInterface>('DaffCustomerDriver');\n\n/**\n * The customer driver is responsible for loading customers.\n */\nexport interface DaffCustomerDriverInterface<\n T extends DaffCustomer = DaffCustomer,\n> {\n /**\n * Get the currently logged-in customer.\n */\n get(): Observable<T>;\n\n /**\n * Update the currently logged-in customer.\n *\n * @param customer The customer info to update.\n */\n update(customer: Partial<T>): Observable<T>;\n\n /**\n * Change the currently logged-in customer's email.\n */\n changeEmail(email: string, password: string): Observable<T>;\n\n /**\n * Change the currently logged-in customer's password.\n */\n changePassword(oldPassword: string, newPassword: string): Observable<void>;\n}\n","import { Observable } from 'rxjs';\n\nimport {\n DaffIdentifiable,\n createSingletonInjectionToken,\n} from '@daffodil/core';\nimport { DaffCustomerAddress } from '@daffodil/customer';\n\nexport const {\n /**\n * An injection token for the customer driver.\n */\n token: DaffCustomerAddressDriver,\n /**\n * Provider function for {@link DaffCustomerAddressDriver}.\n */\n provider: provideDaffCustomerAddressDriver,\n} = createSingletonInjectionToken<DaffCustomerAddressDriverInterface>('DaffCustomerAddressDriver');\n\n/**\n * The customer driver is responsible for loading customers.\n */\nexport interface DaffCustomerAddressDriverInterface<\n T extends DaffCustomerAddress = DaffCustomerAddress,\n> {\n /**\n * Lists the customer's addresses.\n */\n list(): Observable<T[]>;\n\n /**\n * Get the specified address.\n */\n get(addressId: DaffCustomerAddress['id']): Observable<T>;\n\n /**\n * Update the passed address.\n */\n update(address: Partial<T> & DaffIdentifiable): Observable<T[]>;\n\n /**\n * Adds the passed address.\n */\n add(address: T): Observable<T[]>;\n\n /**\n * Deletes the specified address.\n */\n delete(addressId: DaffCustomerAddress['id']): Observable<T[]>;\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE = 'DAFF_CUSTOMER_INVALID_API_RESPONSE';\n\n/**\n * A general error indicating that the platform returned a response which cannot be processed.\n */\nexport class DaffCustomerInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE = 'DAFF_CUSTOMER_ADDRESS_NOT_FOUND';\n\n/**\n * An error indicating that the requested address cannot be found.\n */\nexport class DaffCustomerAddressNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION';\n\n/**\n * An error indicating that a deletion of the customer's default billing address was attempted and failed.\n */\nexport class DaffCustomerDefaultBillingAddressDeletionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE = 'DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION';\n\n/**\n * An error indicating that a deletion of the customer's default shipping address was attempted and failed.\n */\nexport class DaffCustomerDefaultShippingAddressDeletionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,\n DaffCustomerAddressNotFoundError,\n} from './address-not-found';\nimport {\n DaffCustomerDefaultBillingAddressDeletionError,\n DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,\n} from './default-billing-address-deletion';\nimport {\n DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,\n DaffCustomerDefaultShippingAddressDeletionError,\n} from './default-shipping-address-deletion';\nimport {\n DaffCustomerInvalidAPIResponseError,\n DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE,\n} from './invalid-api-response';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffCustomerDriverErrorMap = {\n [DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE]: DaffCustomerInvalidAPIResponseError,\n [DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE]: DaffCustomerAddressNotFoundError,\n [DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultBillingAddressDeletionError,\n [DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE]: DaffCustomerDefaultShippingAddressDeletionError,\n};\n","import { DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE } from './address-not-found';\nimport { DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE } from './default-billing-address-deletion';\nimport { DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE } from './default-shipping-address-deletion';\nimport { DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE } from './invalid-api-response';\n\nexport const DaffCustomerDriverErrorCodes = {\n ADDRESS_NOT_FOUND: DAFF_CUSTOMER_ADDRESS_NOT_FOUND_ERROR_CODE,\n DEFAULT_BILLING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_BILLING_ADDRESS_DELETION_ERROR_CODE,\n DEFAULT_SHIPPING_ADDRESS_DELETION: DAFF_CUSTOMER_DEFAULT_SHIPPING_ADDRESS_DELETION_ERROR_CODE,\n INVALID_API_RESPONSE: DAFF_CUSTOMER_INVALID_API_RESPONSE_ERROR_CODE,\n};\n"],"mappings":";AAKA,MAAa,EAIX,OAAO,oBAIP,UAAU,8BACR,8BAA2D,oBAAoB;ACNnF,MAAa,EAIX,OAAO,2BAIP,UAAU,qCACR,8BAAkE,2BAA2B;ACZjG,MAAa,gDAAgD;AAK7D,IAAa,sCAAb,cAAyD,qBAAoB;CAG3E,YAAmB,SAAe;EAChC,MAAM,OAAO;EADI,KAAA,UAAA;EAFH,KAAA,OAAe;CAI/B;AACD;ACXD,MAAa,6CAA6C;AAK1D,IAAa,mCAAb,cAAsD,qBAAoB;CAGxE,YAAmB,SAAe;EAChC,MAAM,OAAO;EADI,KAAA,UAAA;EAFH,KAAA,OAAe;CAI/B;AACD;ACXD,MAAa,4DAA4D;AAKzE,IAAa,iDAAb,cAAoE,qBAAoB;CAGtF,YAAmB,SAAe;EAChC,MAAM,OAAO;EADI,KAAA,UAAA;EAFH,KAAA,OAAe;CAI/B;AACD;ACXD,MAAa,6DAA6D;AAK1E,IAAa,kDAAb,cAAqE,qBAAoB;CAGvF,YAAmB,SAAe;EAChC,MAAM,OAAO;EADI,KAAA,UAAA;EAFH,KAAA,OAAe;CAI/B;AACD;ACID,MAAa,6BAA6B;EACvC,gDAAgD;EAChD,6CAA6C;EAC7C,4DAA4D;EAC5D,6DAA6D;AAC/D;ACpBD,MAAa,+BAA+B;CAC1C,mBAAmB;CACnB,kCAAkC;CAClC,mCAAmC;CACnC,sBAAsB;AACvB"}