@daffodil/geography 0.48.2 → 0.49.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.
@@ -1 +1,2 @@
1
+ export declare const MAGENTO_GET_COUNTRIES_QUERY_NAME = "MagentoGetCountries";
1
2
  export declare const getCountries: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
@@ -1 +1,2 @@
1
+ export declare const MAGENTO_GET_COUNTRY_QUERY_NAME = "MagentoGetCountry";
1
2
  export declare const getCountry: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
@@ -1,4 +1,4 @@
1
1
  export * from './fragments/public_api';
2
2
  export * from './responses/public_api';
3
- export { getCountries } from './get-countries';
4
- export { getCountry } from './get-country';
3
+ export * from './get-countries';
4
+ export * from './get-country';
@@ -1,7 +1,9 @@
1
1
  import { CommonModule } from '@angular/common';
2
2
  import { NgModule, } from '@angular/core';
3
+ import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
3
4
  import { DaffGeographyDriver } from '@daffodil/geography/driver';
4
5
  import { DaffGeographyMagentoService } from './geography.service';
6
+ import { MAGENTO_GET_COUNTRIES_QUERY_NAME, MAGENTO_GET_COUNTRY_QUERY_NAME, } from './queries/public_api';
5
7
  import * as i0 from "@angular/core";
6
8
  export class DaffGeographyMagentoDriverModule {
7
9
  static forRoot() {
@@ -12,6 +14,16 @@ export class DaffGeographyMagentoDriverModule {
12
14
  provide: DaffGeographyDriver,
13
15
  useExisting: DaffGeographyMagentoService,
14
16
  },
17
+ {
18
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
19
+ useValue: MAGENTO_GET_COUNTRY_QUERY_NAME,
20
+ multi: true,
21
+ },
22
+ {
23
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
24
+ useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME,
25
+ multi: true,
26
+ },
15
27
  ],
16
28
  };
17
29
  }
@@ -29,4 +41,4 @@ i0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hZmZHZW9ncmFwaHlEcml2ZXIsXG4gICAgICAgICAgdXNlRXhpc3Rpbmc6IERhZmZHZW9ncmFwaHlNYWdlbnRvU2VydmljZSxcbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIHByb3ZpZGU6IERBRkZfTUFHRU5UT19DQUNIRUFCTEVfT1BFUkFUSU9OUyxcbiAgICAgICAgICB1c2VWYWx1ZTogTUFHRU5UT19HRVRfQ09VTlRSWV9RVUVSWV9OQU1FLFxuICAgICAgICAgIG11bHRpOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgcHJvdmlkZTogREFGRl9NQUdFTlRPX0NBQ0hFQUJMRV9PUEVSQVRJT05TLFxuICAgICAgICAgIHVzZVZhbHVlOiBNQUdFTlRPX0dFVF9DT1VOVFJJRVNfUVVFUllfTkFNRSxcbiAgICAgICAgICBtdWx0aTogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfTtcbiAgfVxufVxuIl19
@@ -1,11 +1,12 @@
1
1
  import { gql } from 'apollo-angular';
2
2
  import { countryFragment } from './fragments/public_api';
3
+ export const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';
3
4
  export const getCountries = gql `
4
- query MagentoGetCountries {
5
+ query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {
5
6
  countries {
6
7
  ...country
7
8
  }
8
9
  }
9
10
  ${countryFragment}
10
11
  `;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWNvdW50cmllcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZ2VvZ3JhcGh5L2RyaXZlci9tYWdlbnRvL3NyYy9xdWVyaWVzL2dldC1jb3VudHJpZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEdBQUcsRU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UFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZ3FsIH0gZnJvbSAnYXBvbGxvLWFuZ3VsYXInO1xuXG5pbXBvcnQgeyBjb3VudHJ5RnJhZ21lbnQgfSBmcm9tICcuL2ZyYWdtZW50cy9wdWJsaWNfYXBpJztcblxuZXhwb3J0IGNvbnN0IE1BR0VOVE9fR0VUX0NPVU5UUklFU19RVUVSWV9OQU1FID0gJ01hZ2VudG9HZXRDb3VudHJpZXMnO1xuXG5leHBvcnQgY29uc3QgZ2V0Q291bnRyaWVzID0gZ3FsYFxuICBxdWVyeSAke01BR0VOVE9fR0VUX0NPVU5UUklFU19RVUVSWV9OQU1FfSB7XG4gICAgY291bnRyaWVzIHtcbiAgICAgIC4uLmNvdW50cnlcbiAgICB9XG4gIH1cbiAgJHtjb3VudHJ5RnJhZ21lbnR9XG5gO1xuIl19
@@ -1,7 +1,8 @@
1
1
  import { gql } from 'apollo-angular';
2
2
  import { countryFragment, regionFragment, } from './fragments/public_api';
3
+ export const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';
3
4
  export const getCountry = gql `
4
- query MagentoGetCountry($countryId: String!) {
5
+ query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {
5
6
  country(id: $countryId) {
6
7
  ...country
7
8
  available_regions {
@@ -12,4 +13,4 @@ export const getCountry = gql `
12
13
  ${countryFragment}
13
14
  ${regionFragment}
14
15
  `;
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWNvdW50cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2dlb2dyYXBoeS9kcml2ZXIvbWFnZW50by9zcmMvcXVlcmllcy9nZXQtY291bnRyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0sZ0JBQW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FBQztBQUVoQyxNQUFNLENBQUMsTUFBTSw4QkFBOEIsR0FBRyxtQkFBbUIsQ0FBQztBQUVsRSxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUcsR0FBRyxDQUFBO1VBQ25CLDhCQUE4Qjs7Ozs7Ozs7SUFRcEMsZUFBZTtJQUNmLGNBQWM7Q0FDakIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGdxbCB9IGZyb20gJ2Fwb2xsby1hbmd1bGFyJztcblxuaW1wb3J0IHtcbiAgY291bnRyeUZyYWdtZW50LFxuICByZWdpb25GcmFnbWVudCxcbn0gZnJvbSAnLi9mcmFnbWVudHMvcHVibGljX2FwaSc7XG5cbmV4cG9ydCBjb25zdCBNQUdFTlRPX0dFVF9DT1VOVFJZX1FVRVJZX05BTUUgPSAnTWFnZW50b0dldENvdW50cnknO1xuXG5leHBvcnQgY29uc3QgZ2V0Q291bnRyeSA9IGdxbGBcbiAgcXVlcnkgJHtNQUdFTlRPX0dFVF9DT1VOVFJZX1FVRVJZX05BTUV9KCRjb3VudHJ5SWQ6IFN0cmluZyEpIHtcbiAgICBjb3VudHJ5KGlkOiAkY291bnRyeUlkKSB7XG4gICAgICAuLi5jb3VudHJ5XG4gICAgICBhdmFpbGFibGVfcmVnaW9ucyB7XG4gICAgICAgIC4uLnJlZ2lvblxuICAgICAgfVxuICAgIH1cbiAgfVxuICAke2NvdW50cnlGcmFnbWVudH1cbiAgJHtyZWdpb25GcmFnbWVudH1cbmA7XG4iXX0=
@@ -1,5 +1,5 @@
1
1
  export * from './fragments/public_api';
2
2
  export * from './responses/public_api';
3
- export { getCountries } from './get-countries';
4
- export { getCountry } from './get-country';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZ2VvZ3JhcGh5L2RyaXZlci9tYWdlbnRvL3NyYy9xdWVyaWVzL3B1YmxpY19hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLHdCQUF3QixDQUFDO0FBRXZDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMvQyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9mcmFnbWVudHMvcHVibGljX2FwaSc7XG5leHBvcnQgKiBmcm9tICcuL3Jlc3BvbnNlcy9wdWJsaWNfYXBpJztcblxuZXhwb3J0IHsgZ2V0Q291bnRyaWVzIH0gZnJvbSAnLi9nZXQtY291bnRyaWVzJztcbmV4cG9ydCB7IGdldENvdW50cnkgfSBmcm9tICcuL2dldC1jb3VudHJ5JztcbiJdfQ==
3
+ export * from './get-countries';
4
+ export * from './get-country';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZ2VvZ3JhcGh5L2RyaXZlci9tYWdlbnRvL3NyYy9xdWVyaWVzL3B1YmxpY19hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLHdCQUF3QixDQUFDO0FBRXZDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxlQUFlLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2ZyYWdtZW50cy9wdWJsaWNfYXBpJztcbmV4cG9ydCAqIGZyb20gJy4vcmVzcG9uc2VzL3B1YmxpY19hcGknO1xuXG5leHBvcnQgKiBmcm9tICcuL2dldC1jb3VudHJpZXMnO1xuZXhwb3J0ICogZnJvbSAnLi9nZXQtY291bnRyeSc7XG4iXX0=
@@ -4,7 +4,7 @@ import * as i1 from 'apollo-angular';
4
4
  import { gql } from 'apollo-angular';
5
5
  import { throwError } from 'rxjs';
6
6
  import { map, catchError } from 'rxjs/operators';
7
- import { daffTransformMagentoError } from '@daffodil/driver/magento';
7
+ import { daffTransformMagentoError, DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
8
8
  import { DaffCountryNotFoundError, DaffGeographyInvalidAPIResponseError, DaffGeographyDriver } from '@daffodil/geography/driver';
9
9
  import { CommonModule } from '@angular/common';
10
10
 
@@ -72,8 +72,9 @@ const regionFragment = gql `
72
72
  }
73
73
  `;
74
74
 
75
+ const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';
75
76
  const getCountries = gql `
76
- query MagentoGetCountries {
77
+ query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {
77
78
  countries {
78
79
  ...country
79
80
  }
@@ -81,8 +82,9 @@ const getCountries = gql `
81
82
  ${countryFragment}
82
83
  `;
83
84
 
85
+ const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';
84
86
  const getCountry = gql `
85
- query MagentoGetCountry($countryId: String!) {
87
+ query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {
86
88
  country(id: $countryId) {
87
89
  ...country
88
90
  available_regions {
@@ -158,6 +160,16 @@ class DaffGeographyMagentoDriverModule {
158
160
  provide: DaffGeographyDriver,
159
161
  useExisting: DaffGeographyMagentoService,
160
162
  },
163
+ {
164
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
165
+ useValue: MAGENTO_GET_COUNTRY_QUERY_NAME,
166
+ multi: true,
167
+ },
168
+ {
169
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
170
+ useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME,
171
+ multi: true,
172
+ },
161
173
  ],
162
174
  };
163
175
  }
@@ -180,5 +192,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
180
192
  * Generated bundle index. Do not edit.
181
193
  */
182
194
 
183
- export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, countryFragment, getCountries, getCountry, regionFragment };
195
+ export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, MAGENTO_GET_COUNTRIES_QUERY_NAME, MAGENTO_GET_COUNTRY_QUERY_NAME, countryFragment, getCountries, getCountry, regionFragment };
184
196
  //# sourceMappingURL=daffodil-geography-driver-magento.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const getCountries = gql`\n query MagentoGetCountries {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const getCountry = gql`\n query MagentoGetCountry($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\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 { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionTransformer","i2.DaffMagentoCountryTransformer"],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,iCAAiC,CAAA;AAC5C;;AAEG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;AAC7B,QAAA,OAAO,MAAM,GAAE,MAAA,CAAA,MAAA,CACV,EAAE,cAAc,EAAE,MAAM,EAAE,IAE7B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EACrB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAA,CAAA,GACrB,IAAI,CAAC;KACV;;iJAZU,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAA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"}
1
+ {"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';\n\nexport const getCountries = gql`\n query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';\n\nexport const getCountry = gql`\n query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\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 { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\nimport {\n MAGENTO_GET_COUNTRIES_QUERY_NAME,\n MAGENTO_GET_COUNTRY_QUERY_NAME,\n} from './queries/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: MAGENTO_GET_COUNTRY_QUERY_NAME,\n multi: true,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionTransformer","i2.DaffMagentoCountryTransformer"],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,iCAAiC,CAAA;AAC5C;;AAEG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;AAC7B,QAAA,OAAO,MAAM,GAAE,MAAA,CAAA,MAAA,CACV,EAAE,cAAc,EAAE,MAAM,EAAE,IAE7B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EACrB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAA,CAAA,GACrB,IAAI,CAAC;KACV;;iJAZU,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA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A,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,EAJlC,OAAA,EAAA,CAAA;YACP,YAAY;SACb,CAAA,EAAA,CAAA,CAAA;2FAEU,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;;ACnBD;;AAEG;;;;"}
@@ -4,7 +4,7 @@ import * as i1 from 'apollo-angular';
4
4
  import { gql } from 'apollo-angular';
5
5
  import { throwError } from 'rxjs';
6
6
  import { map, catchError } from 'rxjs/operators';
7
- import { daffTransformMagentoError } from '@daffodil/driver/magento';
7
+ import { daffTransformMagentoError, DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
8
8
  import { DaffCountryNotFoundError, DaffGeographyInvalidAPIResponseError, DaffGeographyDriver } from '@daffodil/geography/driver';
9
9
  import { CommonModule } from '@angular/common';
10
10
 
@@ -85,8 +85,9 @@ const regionFragment = gql `
85
85
  }
86
86
  `;
87
87
 
88
+ const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';
88
89
  const getCountries = gql `
89
- query MagentoGetCountries {
90
+ query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {
90
91
  countries {
91
92
  ...country
92
93
  }
@@ -94,8 +95,9 @@ const getCountries = gql `
94
95
  ${countryFragment}
95
96
  `;
96
97
 
98
+ const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';
97
99
  const getCountry = gql `
98
- query MagentoGetCountry($countryId: String!) {
100
+ query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {
99
101
  country(id: $countryId) {
100
102
  ...country
101
103
  available_regions {
@@ -171,6 +173,16 @@ class DaffGeographyMagentoDriverModule {
171
173
  provide: DaffGeographyDriver,
172
174
  useExisting: DaffGeographyMagentoService,
173
175
  },
176
+ {
177
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
178
+ useValue: MAGENTO_GET_COUNTRY_QUERY_NAME,
179
+ multi: true,
180
+ },
181
+ {
182
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
183
+ useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME,
184
+ multi: true,
185
+ },
174
186
  ],
175
187
  };
176
188
  }
@@ -193,5 +205,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
193
205
  * Generated bundle index. Do not edit.
194
206
  */
195
207
 
196
- export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, countryFragment, getCountries, getCountry, regionFragment };
208
+ export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, MAGENTO_GET_COUNTRIES_QUERY_NAME, MAGENTO_GET_COUNTRY_QUERY_NAME, countryFragment, getCountries, getCountry, regionFragment };
197
209
  //# sourceMappingURL=daffodil-geography-driver-magento.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const getCountries = gql`\n query MagentoGetCountries {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const getCountry = gql`\n query MagentoGetCountry($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\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 { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionTransformer","i2.DaffMagentoCountryTransformer"],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,iCAAiC,CAAA;AAC5C;;AAEG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;QAC7B,OAAO,MAAM,GAAG;AACd,YAAA,GAAG,EAAE,cAAc,EAAE,MAAM,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EAAA,gCAAgC,EAJlC,OAAA,EAAA,CAAA;YACP,YAAY;AACb,SAAA,CAAA,EAAA,CAAA,CAAA;2FAEU,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA,CAAA;;;ACdD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-geography-driver-magento.mjs","sources":["../../../libs/geography/driver/magento/src/transforms/responses/subdivision.service.ts","../../../libs/geography/driver/magento/src/transforms/responses/country.service.ts","../../../libs/geography/driver/magento/src/queries/fragments/country.ts","../../../libs/geography/driver/magento/src/queries/fragments/region.ts","../../../libs/geography/driver/magento/src/queries/get-countries.ts","../../../libs/geography/driver/magento/src/queries/get-country.ts","../../../libs/geography/driver/magento/src/errors/codes.ts","../../../libs/geography/driver/magento/src/errors/map.ts","../../../libs/geography/driver/magento/src/errors/transform.ts","../../../libs/geography/driver/magento/src/validators/get-countries.ts","../../../libs/geography/driver/magento/src/geography.service.ts","../../../libs/geography/driver/magento/src/geography-driver.module.ts","../../../libs/geography/driver/magento/src/daffodil-geography-driver-magento.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffSubdivision } from '@daffodil/geography';\n\nimport { MagentoRegion } from '../../models/responses/region';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoSubdivisionTransformer {\n /**\n * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.\n */\n transform(region: MagentoRegion): DaffSubdivision {\n return region ? {\n ...{ magento_region: region },\n\n id: String(region.id),\n name: region.name,\n iso_3166_2: region.code,\n } : null;\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nimport { MagentoCountry } from '../../models/responses/country';\nimport { DaffMagentoSubdivisionTransformer } from './subdivision.service';\n\n/**\n * Transforms magento carts into an object usable by daffodil.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCountryTransformer {\n constructor(public subdivisionTransformer: DaffMagentoSubdivisionTransformer) {}\n\n private transformSubdivisions(regions: MagentoCountry['available_regions']): DaffCountry['subdivisions'] {\n return regions.map(region => this.subdivisionTransformer.transform(region));\n }\n\n /**\n * Transforms the MagentoCountry from the magento country query into a DaffCountry.\n */\n transform(country: MagentoCountry): DaffCountry {\n return country ? {\n ...{ magento_country: country },\n\n subdivisions: this.transformSubdivisions(country.available_regions || []),\n\n id: country.id,\n name: country.full_name_locale,\n name_en: country.full_name_english,\n alpha2: country.two_letter_abbreviation,\n alpha3: country.three_letter_abbreviation,\n } : null;\n }\n}\n","import { gql } from 'apollo-angular';\n\n\nexport const countryFragment = gql`\n fragment country on Country {\n id\n full_name_english\n full_name_locale\n three_letter_abbreviation\n two_letter_abbreviation\n }\n`;\n","import { gql } from 'apollo-angular';\n\n\nexport const regionFragment = gql`\n fragment region on Region {\n code\n id\n name\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { countryFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRIES_QUERY_NAME = 'MagentoGetCountries';\n\nexport const getCountries = gql`\n query ${MAGENTO_GET_COUNTRIES_QUERY_NAME} {\n countries {\n ...country\n }\n }\n ${countryFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport {\n countryFragment,\n regionFragment,\n} from './fragments/public_api';\n\nexport const MAGENTO_GET_COUNTRY_QUERY_NAME = 'MagentoGetCountry';\n\nexport const getCountry = gql`\n query ${MAGENTO_GET_COUNTRY_QUERY_NAME}($countryId: String!) {\n country(id: $countryId) {\n ...country\n available_regions {\n ...region\n }\n }\n }\n ${countryFragment}\n ${regionFragment}\n`;\n","export enum MagentoGeographyGraphQlErrorCode {\n COUNTRY_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffErrorCodeMap } from '@daffodil/core';\nimport { DaffCountryNotFoundError } from '@daffodil/geography/driver';\n\nimport { MagentoGeographyGraphQlErrorCode } from './codes';\n\nexport const DaffGeographyMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffGeographyMagentoErrorMap } from './map';\n\nexport function transformMagentoGeographyError(error: any) {\n return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffGeographyInvalidAPIResponseError } from '@daffodil/geography/driver';\n\nimport { MagentoGetCountriesResponse } from '../queries/public_api';\n\nexport const validateGetCountriesResponse = (response: ApolloQueryResult<MagentoGetCountriesResponse>) => {\n if (response.data.countries) {\n return response;\n } else {\n throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');\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 { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\n\nimport { transformMagentoGeographyError } from './errors/transform';\nimport { getCountry } from './queries/get-country';\nimport {\n getCountries,\n MagentoGetCountriesResponse,\n} from './queries/public_api';\nimport { MagentoGetCountryResponse } from './queries/responses/get-country';\nimport { DaffMagentoCountryTransformer } from './transforms/responses/country.service';\nimport { validateGetCountriesResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for carts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffGeographyMagentoService implements DaffGeographyServiceInterface<DaffCountry> {\n constructor(\n private apollo: Apollo,\n public countryTransformer: DaffMagentoCountryTransformer,\n ) {}\n\n list(): Observable<DaffCountry[]> {\n return this.apollo.query<MagentoGetCountriesResponse>({\n query: getCountries,\n }).pipe(\n map(validateGetCountriesResponse),\n map(result => result.data.countries.map(country => this.countryTransformer.transform(country))),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.apollo.query<MagentoGetCountryResponse>({\n query: getCountry,\n variables: {\n countryId,\n },\n }).pipe(\n map(result => this.countryTransformer.transform(result.data.country)),\n catchError(err => throwError(() => transformMagentoGeographyError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffGeographyDriver } from '@daffodil/geography/driver';\n\nimport { DaffGeographyMagentoService } from './geography.service';\nimport {\n MAGENTO_GET_COUNTRIES_QUERY_NAME,\n MAGENTO_GET_COUNTRY_QUERY_NAME,\n} from './queries/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyMagentoDriverModule> {\n return {\n ngModule: DaffGeographyMagentoDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffGeographyMagentoService,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: MAGENTO_GET_COUNTRY_QUERY_NAME,\n multi: true,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.DaffMagentoSubdivisionTransformer","i2.DaffMagentoCountryTransformer"],"mappings":";;;;;;;;;;AAMA;;AAEG;MAIU,iCAAiC,CAAA;AAC5C;;AAEG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;QAC7B,OAAO,MAAM,GAAG;AACd,YAAA,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE;AAE7B,YAAA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hC,mBAAA,gCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,YAHzC,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,mBAAA,gCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,EAJlC,OAAA,EAAA,CAAA;YACP,YAAY;AACb,SAAA,CAAA,EAAA,CAAA,CAAA;2FAEU,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAL5C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daffodil/geography",
3
- "version": "0.48.2",
3
+ "version": "0.49.0",
4
4
  "description": "A package for interacting with platforms that provide geographic data information like States and Countries",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,10 @@
14
14
  "homepage": "https://github.com/graycoreio/daffodil",
15
15
  "peerDependencies": {
16
16
  "@angular/core": "^13.0.0",
17
- "@daffodil/core": "0.48.2"
17
+ "@daffodil/core": "0.49.0"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@daffodil/driver": "0.48.2"
20
+ "@daffodil/driver": "0.49.0"
21
21
  },
22
22
  "module": "fesm2015/daffodil-geography.mjs",
23
23
  "es2020": "fesm2020/daffodil-geography.mjs",