@daffodil/geography 0.39.11 → 0.40.1

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 (244) hide show
  1. package/daffodil-geography.d.ts +1 -0
  2. package/driver/daffodil-geography-driver.d.ts +1 -0
  3. package/driver/in-memory/backend/geography.service.d.ts +3 -0
  4. package/driver/in-memory/daffodil-geography-driver-in-memory.d.ts +1 -0
  5. package/driver/in-memory/drivers/geography-driver.module.d.ts +5 -0
  6. package/driver/in-memory/drivers/geography.service.d.ts +3 -0
  7. package/driver/in-memory/package.json +5 -6
  8. package/driver/magento/daffodil-geography-driver-magento.d.ts +1 -0
  9. package/driver/magento/errors/transform.d.ts +1 -1
  10. package/driver/magento/geography-driver.module.d.ts +5 -0
  11. package/driver/magento/geography.service.d.ts +4 -1
  12. package/driver/magento/package.json +5 -6
  13. package/driver/magento/queries/fragments/country.d.ts +1 -1
  14. package/driver/magento/queries/fragments/region.d.ts +1 -1
  15. package/driver/magento/queries/get-countries.d.ts +1 -1
  16. package/driver/magento/queries/get-country.d.ts +1 -1
  17. package/driver/magento/transforms/responses/country.service.d.ts +3 -0
  18. package/driver/magento/transforms/responses/subdivision.service.d.ts +3 -0
  19. package/driver/package.json +5 -6
  20. package/driver/testing/daffodil-geography-driver-testing.d.ts +1 -0
  21. package/driver/testing/drivers/geography-driver.module.d.ts +5 -0
  22. package/driver/testing/drivers/geography.service.d.ts +3 -0
  23. package/driver/testing/package.json +5 -6
  24. package/{esm2015/comparators/address.js → esm2020/comparators/address.mjs} +0 -0
  25. package/{esm2015/comparators/personal-address.js → esm2020/comparators/personal-address.mjs} +0 -0
  26. package/{esm2015/comparators/public_api.js → esm2020/comparators/public_api.mjs} +0 -0
  27. package/{esm2015/daffodil-geography.js → esm2020/daffodil-geography.mjs} +0 -0
  28. package/{esm2015/driver/daffodil-geography-driver.js → esm2020/driver/daffodil-geography-driver.mjs} +0 -0
  29. package/{esm2015/driver/errors/country-not-found.js → esm2020/driver/errors/country-not-found.mjs} +0 -0
  30. package/{esm2015/driver/errors/invalid-api-response.js → esm2020/driver/errors/invalid-api-response.mjs} +0 -0
  31. package/{esm2015/driver/errors/public_api.js → esm2020/driver/errors/public_api.mjs} +0 -0
  32. package/esm2020/driver/in-memory/backend/geography.service.mjs +59 -0
  33. package/{esm2015/driver/in-memory/daffodil-geography-driver-in-memory.js → esm2020/driver/in-memory/daffodil-geography-driver-in-memory.mjs} +0 -0
  34. package/esm2020/driver/in-memory/drivers/geography-driver.module.mjs +32 -0
  35. package/esm2020/driver/in-memory/drivers/geography.service.mjs +31 -0
  36. package/{esm2015/driver/in-memory/drivers/public_api.js → esm2020/driver/in-memory/drivers/public_api.mjs} +0 -0
  37. package/{esm2015/driver/in-memory/index.js → esm2020/driver/in-memory/index.mjs} +0 -0
  38. package/{esm2015/driver/in-memory/public_api.js → esm2020/driver/in-memory/public_api.mjs} +0 -0
  39. package/{esm2015/driver/index.js → esm2020/driver/index.mjs} +0 -0
  40. package/{esm2015/driver/interfaces/geography-service.interface.js → esm2020/driver/interfaces/geography-service.interface.mjs} +0 -0
  41. package/{esm2015/driver/magento/daffodil-geography-driver-magento.js → esm2020/driver/magento/daffodil-geography-driver-magento.mjs} +0 -0
  42. package/{esm2015/driver/magento/errors/codes.js → esm2020/driver/magento/errors/codes.mjs} +0 -0
  43. package/{esm2015/driver/magento/errors/map.js → esm2020/driver/magento/errors/map.mjs} +0 -0
  44. package/{esm2015/driver/magento/errors/transform.js → esm2020/driver/magento/errors/transform.mjs} +0 -0
  45. package/esm2020/driver/magento/geography-driver.module.mjs +32 -0
  46. package/esm2020/driver/magento/geography.service.mjs +45 -0
  47. package/{esm2015/driver/magento/index.js → esm2020/driver/magento/index.mjs} +0 -0
  48. package/{esm2015/driver/magento/models/responses/country.js → esm2020/driver/magento/models/responses/country.mjs} +0 -0
  49. package/{esm2015/driver/magento/models/responses/public_api.js → esm2020/driver/magento/models/responses/public_api.mjs} +0 -0
  50. package/{esm2015/driver/magento/models/responses/region.js → esm2020/driver/magento/models/responses/region.mjs} +0 -0
  51. package/{esm2015/driver/magento/public_api.js → esm2020/driver/magento/public_api.mjs} +0 -0
  52. package/esm2020/driver/magento/queries/fragments/country.mjs +11 -0
  53. package/{esm2015/driver/magento/queries/fragments/public_api.js → esm2020/driver/magento/queries/fragments/public_api.mjs} +0 -0
  54. package/{esm2015/driver/magento/queries/fragments/region.js → esm2020/driver/magento/queries/fragments/region.mjs} +2 -2
  55. package/{esm2015/driver/magento/queries/get-countries.js → esm2020/driver/magento/queries/get-countries.mjs} +2 -2
  56. package/esm2020/driver/magento/queries/get-country.mjs +15 -0
  57. package/{esm2015/driver/magento/queries/public_api.js → esm2020/driver/magento/queries/public_api.mjs} +0 -0
  58. package/{esm2015/driver/magento/queries/responses/get-countries.js → esm2020/driver/magento/queries/responses/get-countries.mjs} +0 -0
  59. package/{esm2015/driver/magento/queries/responses/get-country.js → esm2020/driver/magento/queries/responses/get-country.mjs} +0 -0
  60. package/{esm2015/driver/magento/queries/responses/public_api.js → esm2020/driver/magento/queries/responses/public_api.mjs} +0 -0
  61. package/esm2020/driver/magento/transforms/responses/country.service.mjs +38 -0
  62. package/esm2020/driver/magento/transforms/responses/subdivision.service.mjs +27 -0
  63. package/{esm2015/driver/magento/validators/get-countries.js → esm2020/driver/magento/validators/get-countries.mjs} +0 -0
  64. package/{esm2015/driver/magento/validators/public_api.js → esm2020/driver/magento/validators/public_api.mjs} +0 -0
  65. package/{esm2015/driver/testing/daffodil-geography-driver-testing.js → esm2020/driver/testing/daffodil-geography-driver-testing.mjs} +0 -0
  66. package/esm2020/driver/testing/drivers/geography-driver.module.mjs +32 -0
  67. package/esm2020/driver/testing/drivers/geography.service.mjs +32 -0
  68. package/{esm2015/driver/testing/drivers/public_api.js → esm2020/driver/testing/drivers/public_api.mjs} +0 -0
  69. package/{esm2015/driver/testing/index.js → esm2020/driver/testing/index.mjs} +0 -0
  70. package/{esm2015/driver/testing/public_api.js → esm2020/driver/testing/public_api.mjs} +0 -0
  71. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  72. package/{esm2015/injection-tokens/error-matcher.token.js → esm2020/injection-tokens/error-matcher.token.mjs} +0 -0
  73. package/{esm2015/injection-tokens/public_api.js → esm2020/injection-tokens/public_api.mjs} +0 -0
  74. package/{esm2015/models/address.js → esm2020/models/address.mjs} +0 -0
  75. package/{esm2015/models/country.js → esm2020/models/country.mjs} +0 -0
  76. package/{esm2015/models/personal-address.js → esm2020/models/personal-address.mjs} +0 -0
  77. package/{esm2015/models/public_api.js → esm2020/models/public_api.mjs} +0 -0
  78. package/{esm2015/models/subdivision.js → esm2020/models/subdivision.mjs} +0 -0
  79. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  80. package/{esm2015/state/actions/geography.actions.js → esm2020/state/actions/geography.actions.mjs} +0 -0
  81. package/{esm2015/state/actions/public_api.js → esm2020/state/actions/public_api.mjs} +0 -0
  82. package/esm2020/state/daffodil-geography-state.mjs +5 -0
  83. package/esm2020/state/effects/geography.effects.mjs +30 -0
  84. package/{esm2015/state/facades/geography/geography-facade.interface.js → esm2020/state/facades/geography/geography-facade.interface.mjs} +0 -0
  85. package/esm2020/state/facades/geography/geography.facade.mjs +44 -0
  86. package/esm2020/state/geography-state.module.mjs +30 -0
  87. package/{esm2015/state/index.js → esm2020/state/index.mjs} +0 -0
  88. package/{esm2015/state/reducers/country-entities/country-entities-adapter.js → esm2020/state/reducers/country-entities/country-entities-adapter.mjs} +5 -7
  89. package/{esm2015/state/reducers/country-entities/country-entities-initial-state.js → esm2020/state/reducers/country-entities/country-entities-initial-state.mjs} +0 -0
  90. package/{esm2015/state/reducers/country-entities/country-entities-state.interface.js → esm2020/state/reducers/country-entities/country-entities-state.interface.mjs} +0 -0
  91. package/esm2020/state/reducers/country-entities/country-entities.reducer.mjs +29 -0
  92. package/{esm2015/state/reducers/country-entities/public_api.js → esm2020/state/reducers/country-entities/public_api.mjs} +0 -0
  93. package/{esm2015/state/reducers/geography/geography-initial-state.js → esm2020/state/reducers/geography/geography-initial-state.mjs} +0 -0
  94. package/{esm2015/state/reducers/geography/geography-state.interface.js → esm2020/state/reducers/geography/geography-state.interface.mjs} +0 -0
  95. package/{esm2015/state/reducers/geography/geography.reducer.js → esm2020/state/reducers/geography/geography.reducer.mjs} +13 -5
  96. package/{esm2015/state/reducers/geography/public_api.js → esm2020/state/reducers/geography/public_api.mjs} +0 -0
  97. package/{esm2015/state/reducers/geography-reducers-state.interface.js → esm2020/state/reducers/geography-reducers-state.interface.mjs} +0 -0
  98. package/{esm2015/state/reducers/geography-reducers.js → esm2020/state/reducers/geography-reducers.mjs} +0 -0
  99. package/{esm2015/state/reducers/geography-store-feature-key.js → esm2020/state/reducers/geography-store-feature-key.mjs} +0 -0
  100. package/{esm2015/state/reducers/public_api.js → esm2020/state/reducers/public_api.mjs} +0 -0
  101. package/esm2020/state/selectors/country-entities.selector.mjs +48 -0
  102. package/esm2020/state/selectors/geography-all.selector.mjs +12 -0
  103. package/esm2020/state/selectors/geography-feature.selector.mjs +9 -0
  104. package/esm2020/state/selectors/geography.selector.mjs +18 -0
  105. package/{esm2015/state/selectors/public_api.js → esm2020/state/selectors/public_api.mjs} +0 -0
  106. package/{esm2015/state/testing/daffodil-geography-state-testing.js → esm2020/state/testing/daffodil-geography-state-testing.mjs} +0 -0
  107. package/esm2020/state/testing/geography-testing.module.mjs +20 -0
  108. package/{esm2015/state/testing/index.js → esm2020/state/testing/index.mjs} +0 -0
  109. package/esm2020/state/testing/mock-geography-facade.mjs +34 -0
  110. package/{esm2015/state/testing/public_api.js → esm2020/state/testing/public_api.mjs} +0 -0
  111. package/{esm2015/testing/daffodil-geography-testing.js → esm2020/testing/daffodil-geography-testing.mjs} +0 -0
  112. package/esm2020/testing/factories/address.factory.mjs +28 -0
  113. package/esm2020/testing/factories/country.factory.mjs +28 -0
  114. package/esm2020/testing/factories/personal-address.factory.mjs +31 -0
  115. package/{esm2015/testing/factories/public_api.js → esm2020/testing/factories/public_api.mjs} +0 -0
  116. package/esm2020/testing/factories/subdivision.factory.mjs +25 -0
  117. package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
  118. package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
  119. package/fesm2015/daffodil-geography-driver-in-memory.mjs +121 -0
  120. package/fesm2015/daffodil-geography-driver-in-memory.mjs.map +1 -0
  121. package/fesm2015/{daffodil-geography-driver-magento.js → daffodil-geography-driver-magento.mjs} +42 -37
  122. package/fesm2015/daffodil-geography-driver-magento.mjs.map +1 -0
  123. package/fesm2015/daffodil-geography-driver-testing.mjs +67 -0
  124. package/fesm2015/daffodil-geography-driver-testing.mjs.map +1 -0
  125. package/fesm2015/{daffodil-geography-driver.js → daffodil-geography-driver.mjs} +1 -1
  126. package/fesm2015/daffodil-geography-driver.mjs.map +1 -0
  127. package/fesm2015/daffodil-geography-state-testing.mjs +58 -0
  128. package/fesm2015/daffodil-geography-state-testing.mjs.map +1 -0
  129. package/fesm2015/{daffodil-geography-state.js → daffodil-geography-state.mjs} +62 -72
  130. package/fesm2015/daffodil-geography-state.mjs.map +1 -0
  131. package/fesm2015/daffodil-geography-testing.mjs +106 -0
  132. package/fesm2015/daffodil-geography-testing.mjs.map +1 -0
  133. package/fesm2015/{daffodil-geography.js → daffodil-geography.mjs} +1 -1
  134. package/fesm2015/daffodil-geography.mjs.map +1 -0
  135. package/fesm2020/daffodil-geography-driver-in-memory.mjs +121 -0
  136. package/fesm2020/daffodil-geography-driver-in-memory.mjs.map +1 -0
  137. package/fesm2020/daffodil-geography-driver-magento.mjs +197 -0
  138. package/fesm2020/daffodil-geography-driver-magento.mjs.map +1 -0
  139. package/fesm2020/daffodil-geography-driver-testing.mjs +67 -0
  140. package/fesm2020/daffodil-geography-driver-testing.mjs.map +1 -0
  141. package/fesm2020/daffodil-geography-driver.mjs +27 -0
  142. package/fesm2020/daffodil-geography-driver.mjs.map +1 -0
  143. package/fesm2020/daffodil-geography-state-testing.mjs +58 -0
  144. package/fesm2020/daffodil-geography-state-testing.mjs.map +1 -0
  145. package/fesm2020/daffodil-geography-state.mjs +300 -0
  146. package/fesm2020/daffodil-geography-state.mjs.map +1 -0
  147. package/fesm2020/daffodil-geography-testing.mjs +106 -0
  148. package/fesm2020/daffodil-geography-testing.mjs.map +1 -0
  149. package/fesm2020/daffodil-geography.mjs +54 -0
  150. package/fesm2020/daffodil-geography.mjs.map +1 -0
  151. package/package.json +79 -11
  152. package/state/daffodil-geography-state.d.ts +1 -1
  153. package/state/effects/geography.effects.d.ts +5 -2
  154. package/state/facades/geography/geography.facade.d.ts +3 -0
  155. package/state/geography-state.module.d.ts +6 -0
  156. package/state/package.json +5 -6
  157. package/state/testing/daffodil-geography-state-testing.d.ts +1 -0
  158. package/state/testing/geography-testing.module.d.ts +4 -0
  159. package/state/testing/mock-geography-facade.d.ts +3 -0
  160. package/state/testing/package.json +5 -6
  161. package/testing/daffodil-geography-testing.d.ts +1 -0
  162. package/testing/factories/address.factory.d.ts +3 -0
  163. package/testing/factories/country.factory.d.ts +3 -0
  164. package/testing/factories/personal-address.factory.d.ts +3 -0
  165. package/testing/factories/subdivision.factory.d.ts +3 -0
  166. package/testing/package.json +5 -6
  167. package/bundles/daffodil-geography-driver-in-memory.umd.js +0 -129
  168. package/bundles/daffodil-geography-driver-in-memory.umd.js.map +0 -1
  169. package/bundles/daffodil-geography-driver-in-memory.umd.min.js +0 -2
  170. package/bundles/daffodil-geography-driver-in-memory.umd.min.js.map +0 -1
  171. package/bundles/daffodil-geography-driver-magento.umd.js +0 -490
  172. package/bundles/daffodil-geography-driver-magento.umd.js.map +0 -1
  173. package/bundles/daffodil-geography-driver-magento.umd.min.js +0 -2
  174. package/bundles/daffodil-geography-driver-magento.umd.min.js.map +0 -1
  175. package/bundles/daffodil-geography-driver-testing.umd.js +0 -72
  176. package/bundles/daffodil-geography-driver-testing.umd.js.map +0 -1
  177. package/bundles/daffodil-geography-driver-testing.umd.min.js +0 -2
  178. package/bundles/daffodil-geography-driver-testing.umd.min.js.map +0 -1
  179. package/bundles/daffodil-geography-driver.umd.js +0 -360
  180. package/bundles/daffodil-geography-driver.umd.js.map +0 -1
  181. package/bundles/daffodil-geography-driver.umd.min.js +0 -16
  182. package/bundles/daffodil-geography-driver.umd.min.js.map +0 -1
  183. package/bundles/daffodil-geography-state-testing.umd.js +0 -60
  184. package/bundles/daffodil-geography-state-testing.umd.js.map +0 -1
  185. package/bundles/daffodil-geography-state-testing.umd.min.js +0 -2
  186. package/bundles/daffodil-geography-state-testing.umd.min.js.map +0 -1
  187. package/bundles/daffodil-geography-state.umd.js +0 -649
  188. package/bundles/daffodil-geography-state.umd.js.map +0 -1
  189. package/bundles/daffodil-geography-state.umd.min.js +0 -16
  190. package/bundles/daffodil-geography-state.umd.min.js.map +0 -1
  191. package/bundles/daffodil-geography-testing.umd.js +0 -450
  192. package/bundles/daffodil-geography-testing.umd.js.map +0 -1
  193. package/bundles/daffodil-geography-testing.umd.min.js +0 -16
  194. package/bundles/daffodil-geography-testing.umd.min.js.map +0 -1
  195. package/bundles/daffodil-geography.umd.js +0 -63
  196. package/bundles/daffodil-geography.umd.js.map +0 -1
  197. package/bundles/daffodil-geography.umd.min.js +0 -2
  198. package/bundles/daffodil-geography.umd.min.js.map +0 -1
  199. package/daffodil-geography.metadata.json +0 -1
  200. package/driver/daffodil-geography-driver.metadata.json +0 -1
  201. package/driver/in-memory/daffodil-geography-driver-in-memory.metadata.json +0 -1
  202. package/driver/magento/daffodil-geography-driver-magento.metadata.json +0 -1
  203. package/driver/testing/daffodil-geography-driver-testing.metadata.json +0 -1
  204. package/esm2015/driver/in-memory/backend/geography.service.js +0 -62
  205. package/esm2015/driver/in-memory/drivers/geography-driver.module.js +0 -25
  206. package/esm2015/driver/in-memory/drivers/geography.service.js +0 -33
  207. package/esm2015/driver/magento/geography-driver.module.js +0 -25
  208. package/esm2015/driver/magento/geography.service.js +0 -48
  209. package/esm2015/driver/magento/queries/fragments/country.js +0 -11
  210. package/esm2015/driver/magento/queries/get-country.js +0 -15
  211. package/esm2015/driver/magento/transforms/responses/country.service.js +0 -32
  212. package/esm2015/driver/magento/transforms/responses/subdivision.service.js +0 -20
  213. package/esm2015/driver/testing/drivers/geography-driver.module.js +0 -25
  214. package/esm2015/driver/testing/drivers/geography.service.js +0 -35
  215. package/esm2015/state/daffodil-geography-state.js +0 -6
  216. package/esm2015/state/effects/geography.effects.js +0 -43
  217. package/esm2015/state/facades/geography/geography.facade.js +0 -46
  218. package/esm2015/state/geography-state.module.js +0 -18
  219. package/esm2015/state/reducers/country-entities/country-entities.reducer.js +0 -24
  220. package/esm2015/state/selectors/country-entities.selector.js +0 -51
  221. package/esm2015/state/selectors/geography-all.selector.js +0 -10
  222. package/esm2015/state/selectors/geography-feature.selector.js +0 -11
  223. package/esm2015/state/selectors/geography.selector.js +0 -21
  224. package/esm2015/state/testing/geography-testing.module.js +0 -13
  225. package/esm2015/state/testing/mock-geography-facade.js +0 -32
  226. package/esm2015/testing/factories/address.factory.js +0 -28
  227. package/esm2015/testing/factories/country.factory.js +0 -28
  228. package/esm2015/testing/factories/personal-address.factory.js +0 -31
  229. package/esm2015/testing/factories/subdivision.factory.js +0 -25
  230. package/fesm2015/daffodil-geography-driver-in-memory.js +0 -119
  231. package/fesm2015/daffodil-geography-driver-in-memory.js.map +0 -1
  232. package/fesm2015/daffodil-geography-driver-magento.js.map +0 -1
  233. package/fesm2015/daffodil-geography-driver-testing.js +0 -63
  234. package/fesm2015/daffodil-geography-driver-testing.js.map +0 -1
  235. package/fesm2015/daffodil-geography-driver.js.map +0 -1
  236. package/fesm2015/daffodil-geography-state-testing.js +0 -49
  237. package/fesm2015/daffodil-geography-state-testing.js.map +0 -1
  238. package/fesm2015/daffodil-geography-state.js.map +0 -1
  239. package/fesm2015/daffodil-geography-testing.js +0 -105
  240. package/fesm2015/daffodil-geography-testing.js.map +0 -1
  241. package/fesm2015/daffodil-geography.js.map +0 -1
  242. package/state/daffodil-geography-state.metadata.json +0 -1
  243. package/state/testing/daffodil-geography-state-testing.metadata.json +0 -1
  244. package/testing/daffodil-geography-testing.metadata.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-geography-driver-in-memory.mjs","sources":["../../../libs/geography/driver/in-memory/src/drivers/geography.service.ts","../../../libs/geography/driver/in-memory/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/in-memory/src/backend/geography.service.ts","../../../libs/geography/driver/in-memory/src/daffodil-geography-driver-in-memory.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffGeographyServiceInterface,\n DaffCountryNotFoundError,\n} from '@daffodil/geography/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n url = '/api/countries';\n\n constructor(private http: HttpClient) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return this.http.get<DaffCountry>(`${this.url}/${countryId}`).pipe(\n catchError((error: Error) => throwError(DaffCountryNotFoundError)),\n map(result => result),\n );\n }\n\n list(): Observable<DaffCountry[]> {\n return this.http.get<DaffCountry[]>(`${this.url}/`);\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 { DaffInMemoryGeographyService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyInMemoryDriverModule> {\n return {\n ngModule: DaffGeographyInMemoryDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffInMemoryGeographyService,\n },\n ],\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\nimport { DaffCountry } from '@daffodil/geography';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\n/**\n * An in-memory service that stubs out the backend services for getting countries.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendGeographyService implements InMemoryDbService, DaffInMemoryDataServiceInterface {\n countries: DaffCountry[];\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {\n this.countries = this.countryFactory.createMany(5);\n this.countries.forEach(country => country.subdivisions = this.subdivisionFactory.createMany(5));\n }\n\n /**\n * Creates a fake database of countries for the geography inmemory backend service.\n *\n * @docs-private\n * @returns A fake database of an array of countries\n */\n createDb(reqInfo: RequestInfo): any {\n if (reqInfo) {\n const seedData = reqInfo.utils.getJsonBody(reqInfo.req).countries;\n if (seedData) {\n this.countries = seedData;\n }\n }\n\n return {\n countries: this.countries,\n };\n }\n\n /**\n * Responds to GET requests.\n */\n get(reqInfo: RequestInfo): any {\n return reqInfo.utils.createResponse$(() => ({\n body: reqInfo.id ? this.getCountry(reqInfo) : this.listCountries(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCountry(reqInfo: RequestInfo) {\n return reqInfo.collection.find(country => country.id === reqInfo.id);\n }\n\n private listCountries(reqInfo: RequestInfo) {\n return reqInfo.collection;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;AAiBA;;AAEG;MAIU,4BAA4B,CAAA;AAGvC,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAFpC,IAAG,CAAA,GAAA,GAAG,gBAAgB,CAAC;KAEiB;AAExC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ACrBD;;AAEG;;;;"}
@@ -0,0 +1,197 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import * as i1 from '@damienwebdev/apollo-angular';
4
+ import { gql } from '@damienwebdev/apollo-angular';
5
+ import { throwError } from 'rxjs';
6
+ import { map, catchError } from 'rxjs/operators';
7
+ import { daffTransformMagentoError } from '@daffodil/driver/magento';
8
+ import { DaffCountryNotFoundError, DaffGeographyInvalidAPIResponseError, DaffGeographyDriver } from '@daffodil/geography/driver';
9
+ import { CommonModule } from '@angular/common';
10
+
11
+ /**
12
+ * Transforms magento carts into an object usable by daffodil.
13
+ */
14
+ class DaffMagentoSubdivisionTransformer {
15
+ /**
16
+ * Transforms the MagentoRegion from the magento region query into a DaffSubdivision.
17
+ */
18
+ transform(region) {
19
+ return region ? {
20
+ ...{ magento_region: region },
21
+ id: String(region.id),
22
+ name: region.name,
23
+ iso_3166_2: region.code,
24
+ } : null;
25
+ }
26
+ }
27
+ /** @nocollapse */ /** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoSubdivisionTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
28
+ /** @nocollapse */ /** @nocollapse */ DaffMagentoSubdivisionTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoSubdivisionTransformer, providedIn: 'root' });
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoSubdivisionTransformer, decorators: [{
30
+ type: Injectable,
31
+ args: [{
32
+ providedIn: 'root',
33
+ }]
34
+ }] });
35
+
36
+ /**
37
+ * Transforms magento carts into an object usable by daffodil.
38
+ */
39
+ class DaffMagentoCountryTransformer {
40
+ constructor(subdivisionTransformer) {
41
+ this.subdivisionTransformer = subdivisionTransformer;
42
+ }
43
+ transformSubdivisions(regions) {
44
+ return regions.map(region => this.subdivisionTransformer.transform(region));
45
+ }
46
+ /**
47
+ * Transforms the MagentoCountry from the magento country query into a DaffCountry.
48
+ */
49
+ transform(country) {
50
+ return country ? {
51
+ ...{ magento_country: country },
52
+ subdivisions: this.transformSubdivisions(country.available_regions || []),
53
+ id: country.id,
54
+ name: country.full_name_locale,
55
+ name_en: country.full_name_english,
56
+ alpha2: country.two_letter_abbreviation,
57
+ alpha3: country.three_letter_abbreviation,
58
+ } : null;
59
+ }
60
+ }
61
+ /** @nocollapse */ /** @nocollapse */ DaffMagentoCountryTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCountryTransformer, deps: [{ token: DaffMagentoSubdivisionTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
62
+ /** @nocollapse */ /** @nocollapse */ DaffMagentoCountryTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCountryTransformer, providedIn: 'root' });
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCountryTransformer, decorators: [{
64
+ type: Injectable,
65
+ args: [{
66
+ providedIn: 'root',
67
+ }]
68
+ }], ctorParameters: function () { return [{ type: DaffMagentoSubdivisionTransformer }]; } });
69
+
70
+ const countryFragment = gql `
71
+ fragment country on Country {
72
+ id
73
+ full_name_english
74
+ full_name_locale
75
+ three_letter_abbreviation
76
+ two_letter_abbreviation
77
+ }
78
+ `;
79
+
80
+ const regionFragment = gql `
81
+ fragment region on Region {
82
+ code
83
+ id
84
+ name
85
+ }
86
+ `;
87
+
88
+ const getCountries = gql `
89
+ query MagentoGetCountries {
90
+ countries {
91
+ ...country
92
+ }
93
+ }
94
+ ${countryFragment}
95
+ `;
96
+
97
+ const getCountry = gql `
98
+ query MagentoGetCountry($countryId: String!) {
99
+ country(id: $countryId) {
100
+ ...country
101
+ available_regions {
102
+ ...region
103
+ }
104
+ }
105
+ }
106
+ ${countryFragment}
107
+ ${regionFragment}
108
+ `;
109
+
110
+ var MagentoGeographyGraphQlErrorCode;
111
+ (function (MagentoGeographyGraphQlErrorCode) {
112
+ MagentoGeographyGraphQlErrorCode["COUNTRY_NOT_FOUND"] = "graphql-no-such-entity";
113
+ })(MagentoGeographyGraphQlErrorCode || (MagentoGeographyGraphQlErrorCode = {}));
114
+
115
+ const DaffGeographyMagentoErrorMap = {
116
+ [MagentoGeographyGraphQlErrorCode.COUNTRY_NOT_FOUND]: DaffCountryNotFoundError,
117
+ };
118
+
119
+ function transformMagentoGeographyError(error) {
120
+ return daffTransformMagentoError(error, DaffGeographyMagentoErrorMap);
121
+ }
122
+
123
+ const validateGetCountriesResponse = (response) => {
124
+ if (response.data.countries) {
125
+ return response;
126
+ }
127
+ else {
128
+ throw new DaffGeographyInvalidAPIResponseError('Get countries response does not contain a valid list of countries.');
129
+ }
130
+ };
131
+
132
+ /**
133
+ * A service for making Magento GraphQL queries for carts.
134
+ *
135
+ * @inheritdoc
136
+ */
137
+ class DaffGeographyMagentoService {
138
+ constructor(apollo, countryTransformer) {
139
+ this.apollo = apollo;
140
+ this.countryTransformer = countryTransformer;
141
+ }
142
+ list() {
143
+ return this.apollo.query({
144
+ query: getCountries,
145
+ }).pipe(map(validateGetCountriesResponse), map(result => result.data.countries.map(country => this.countryTransformer.transform(country))), catchError(err => throwError(transformMagentoGeographyError(err))));
146
+ }
147
+ get(countryId) {
148
+ return this.apollo.query({
149
+ query: getCountry,
150
+ variables: {
151
+ countryId,
152
+ },
153
+ }).pipe(map(result => this.countryTransformer.transform(result.data.country)), catchError(err => throwError(transformMagentoGeographyError(err))));
154
+ }
155
+ }
156
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyMagentoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoService, deps: [{ token: i1.Apollo }, { token: DaffMagentoCountryTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
157
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyMagentoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoService, providedIn: 'root' });
158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoService, decorators: [{
159
+ type: Injectable,
160
+ args: [{
161
+ providedIn: 'root',
162
+ }]
163
+ }], ctorParameters: function () { return [{ type: i1.Apollo }, { type: DaffMagentoCountryTransformer }]; } });
164
+
165
+ class DaffGeographyMagentoDriverModule {
166
+ static forRoot() {
167
+ return {
168
+ ngModule: DaffGeographyMagentoDriverModule,
169
+ providers: [
170
+ {
171
+ provide: DaffGeographyDriver,
172
+ useExisting: DaffGeographyMagentoService,
173
+ },
174
+ ],
175
+ };
176
+ }
177
+ }
178
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyMagentoDriverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
179
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyMagentoDriverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoDriverModule, imports: [CommonModule] });
180
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyMagentoDriverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoDriverModule, imports: [[
181
+ CommonModule,
182
+ ]] });
183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyMagentoDriverModule, decorators: [{
184
+ type: NgModule,
185
+ args: [{
186
+ imports: [
187
+ CommonModule,
188
+ ],
189
+ }]
190
+ }] });
191
+
192
+ /**
193
+ * Generated bundle index. Do not edit.
194
+ */
195
+
196
+ export { DaffGeographyMagentoDriverModule, DaffGeographyMagentoService, DaffMagentoCountryTransformer, DaffMagentoSubdivisionTransformer, countryFragment, getCountries, getCountry, regionFragment };
197
+ //# sourceMappingURL=daffodil-geography-driver-magento.mjs.map
@@ -0,0 +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 '@damienwebdev/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 '@damienwebdev/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 '@damienwebdev/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 '@damienwebdev/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\tCOUNTRY_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 '@damienwebdev/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,EAAE;AAE7B,YAAA,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,IAAI;SACxB,GAAG,IAAI,CAAC;KACV;;oKAZU,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,sCAAA,iCAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cAFhC,MAAM,EAAA,CAAA,CAAA;2F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ACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;MChBY,gCAAgC,CAAA;AAC3C,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO;AACL,YAAA,QAAQ,EAAE,gCAAgC;AAC1C,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,mBAAmB;AAC5B,oBAAA,WAAW,EAAE,2BAA2B;AACzC,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;mKAXU,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAhC,sCAAA,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,sCAAA,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;;;ACdD;;AAEG;;;;"}
@@ -0,0 +1,67 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, NgModule } from '@angular/core';
4
+ import { DaffGeographyDriver } from '@daffodil/geography/driver';
5
+ import { of } from 'rxjs';
6
+ import * as i1 from '@daffodil/geography/testing';
7
+
8
+ /**
9
+ * @inheritdoc
10
+ */
11
+ class DaffTestingGeographyService {
12
+ constructor(countryFactory, subdivisionFactory) {
13
+ this.countryFactory = countryFactory;
14
+ this.subdivisionFactory = subdivisionFactory;
15
+ }
16
+ get(countryId) {
17
+ return of(this.countryFactory.create({
18
+ id: countryId,
19
+ subdivisions: this.subdivisionFactory.createMany(3),
20
+ }));
21
+ }
22
+ list() {
23
+ return of(this.countryFactory.createMany(5));
24
+ }
25
+ }
26
+ /** @nocollapse */ /** @nocollapse */ DaffTestingGeographyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffTestingGeographyService, deps: [{ token: i1.DaffCountryFactory }, { token: i1.DaffSubdivisionFactory }], target: i0.ɵɵFactoryTarget.Injectable });
27
+ /** @nocollapse */ /** @nocollapse */ DaffTestingGeographyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffTestingGeographyService, providedIn: 'root' });
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffTestingGeographyService, decorators: [{
29
+ type: Injectable,
30
+ args: [{
31
+ providedIn: 'root',
32
+ }]
33
+ }], ctorParameters: function () { return [{ type: i1.DaffCountryFactory }, { type: i1.DaffSubdivisionFactory }]; } });
34
+
35
+ class DaffGeographyTestingDriverModule {
36
+ static forRoot() {
37
+ return {
38
+ ngModule: DaffGeographyTestingDriverModule,
39
+ providers: [
40
+ {
41
+ provide: DaffGeographyDriver,
42
+ useExisting: DaffTestingGeographyService,
43
+ },
44
+ ],
45
+ };
46
+ }
47
+ }
48
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingDriverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
49
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingDriverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingDriverModule, imports: [CommonModule] });
50
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingDriverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingDriverModule, imports: [[
51
+ CommonModule,
52
+ ]] });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingDriverModule, decorators: [{
54
+ type: NgModule,
55
+ args: [{
56
+ imports: [
57
+ CommonModule,
58
+ ],
59
+ }]
60
+ }] });
61
+
62
+ /**
63
+ * Generated bundle index. Do not edit.
64
+ */
65
+
66
+ export { DaffGeographyTestingDriverModule, DaffTestingGeographyService };
67
+ //# sourceMappingURL=daffodil-geography-driver-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-geography-driver-testing.mjs","sources":["../../../libs/geography/driver/testing/src/drivers/geography.service.ts","../../../libs/geography/driver/testing/src/drivers/geography-driver.module.ts","../../../libs/geography/driver/testing/src/daffodil-geography-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyServiceInterface } from '@daffodil/geography/driver';\nimport {\n DaffCountryFactory,\n DaffSubdivisionFactory,\n} from '@daffodil/geography/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingGeographyService implements DaffGeographyServiceInterface<DaffCountry> {\n\n constructor(\n private countryFactory: DaffCountryFactory,\n private subdivisionFactory: DaffSubdivisionFactory,\n ) {}\n\n get(countryId: DaffCountry['id']): Observable<DaffCountry> {\n return of(this.countryFactory.create({\n id: countryId,\n subdivisions: this.subdivisionFactory.createMany(3),\n }));\n }\n\n list(): Observable<DaffCountry[]> {\n return of(this.countryFactory.createMany(5));\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 { DaffTestingGeographyService } from './geography.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffGeographyTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffGeographyTestingDriverModule> {\n return {\n ngModule: DaffGeographyTestingDriverModule,\n providers: [\n {\n provide: DaffGeographyDriver,\n useExisting: DaffTestingGeographyService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAaA;;AAEG;MAIU,2BAA2B,CAAA;IAEtC,WACU,CAAA,cAAkC,EAClC,kBAA0C,EAAA;QAD1C,IAAc,CAAA,cAAA,GAAd,cAAc,CAAoB;QAClC,IAAkB,CAAA,kBAAA,GAAlB,kBAAkB,CAAwB;KAChD;AAEJ,IAAA,GAAG,CAAC,SAA4B,EAAA;AAC9B,QAAA,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;AACnC,YAAA,EAAE,EAAE,SAAS;YACb,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;AACpD,SAAA,CAAC,CAAC,CAAC;KACL;IAED,IAAI,GAAA;QACF,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9C;;8JAhBU,2BAA2B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,sBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,sCAAA,2BAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAA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27 @@
1
+ import { DaffInheritableError } from '@daffodil/core';
2
+ import { InjectionToken } from '@angular/core';
3
+
4
+ class DaffCountryNotFoundError extends DaffInheritableError {
5
+ constructor(message) {
6
+ super(message);
7
+ this.message = message;
8
+ this.code = 'DAFF_GEOGRAPHY_COUNTRY_NOT_FOUND';
9
+ }
10
+ }
11
+
12
+ class DaffGeographyInvalidAPIResponseError extends DaffInheritableError {
13
+ constructor(message) {
14
+ super(message);
15
+ this.message = message;
16
+ this.code = 'DAFF_GEOGRAPHY_INVALID_API_RESPONSE';
17
+ }
18
+ }
19
+
20
+ const DaffGeographyDriver = new InjectionToken('DaffGeographyDriver');
21
+
22
+ /**
23
+ * Generated bundle index. Do not edit.
24
+ */
25
+
26
+ export { DaffCountryNotFoundError, DaffGeographyDriver, DaffGeographyInvalidAPIResponseError };
27
+ //# sourceMappingURL=daffodil-geography-driver.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-geography-driver.mjs","sources":["../../../libs/geography/driver/src/errors/country-not-found.ts","../../../libs/geography/driver/src/errors/invalid-api-response.ts","../../../libs/geography/driver/src/interfaces/geography-service.interface.ts","../../../libs/geography/driver/src/daffodil-geography-driver.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffCountryNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_COUNTRY_NOT_FOUND';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffGeographyInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_GEOGRAPHY_INVALID_API_RESPONSE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffCountry } from '@daffodil/geography';\n\nexport const DaffGeographyDriver = new InjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');\n\nexport interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {\n\t/**\n\t * Retrieves the list of countries available to the given store.\n\t */\n\tlist(): Observable<T[]>;\n\n\t/**\n\t * Retrieve precise information about a specific country.\n\t */\n\tget(id: T['id']): Observable<T>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAKM,MAAO,wBAAyB,SAAQ,oBAAoB,CAAA;AAGhE,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;QAFlB,IAAI,CAAA,IAAA,GAAW,kCAAkC,CAAC;KAIjE;AACF;;ACNK,MAAO,oCAAqC,SAAQ,oBAAoB,CAAA;AAG5E,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;QAFlB,IAAI,CAAA,IAAA,GAAW,qCAAqC,CAAC;KAIpE;AACF;;MCNY,mBAAmB,GAAG,IAAI,cAAc,CAAgC,qBAAqB;;ACL1G;;AAEG;;;;"}
@@ -0,0 +1,58 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import { DaffGeographyFacade } from '@daffodil/geography/state';
4
+ import { BehaviorSubject } from 'rxjs';
5
+
6
+ /**
7
+ * @inheritdoc
8
+ */
9
+ class MockDaffGeographyFacade {
10
+ constructor() {
11
+ this.loading$ = new BehaviorSubject(null);
12
+ this.errors$ = new BehaviorSubject([]);
13
+ this.countries$ = new BehaviorSubject([]);
14
+ this.countryIds$ = new BehaviorSubject([]);
15
+ this.countryCount$ = new BehaviorSubject(null);
16
+ this.countryEntities$ = new BehaviorSubject(null);
17
+ }
18
+ getCountry(id) {
19
+ return new BehaviorSubject(null);
20
+ }
21
+ getCountrySubdivisions(id) {
22
+ return new BehaviorSubject([]);
23
+ }
24
+ isCountryFullyLoaded(id) {
25
+ return new BehaviorSubject(false);
26
+ }
27
+ dispatch(action) { }
28
+ ;
29
+ }
30
+ /** @nocollapse */ /** @nocollapse */ MockDaffGeographyFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MockDaffGeographyFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
31
+ /** @nocollapse */ /** @nocollapse */ MockDaffGeographyFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MockDaffGeographyFacade, providedIn: 'root' });
32
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MockDaffGeographyFacade, decorators: [{
33
+ type: Injectable,
34
+ args: [{ providedIn: 'root' }]
35
+ }] });
36
+
37
+ class DaffGeographyTestingModule {
38
+ }
39
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
40
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingModule });
41
+ /** @nocollapse */ /** @nocollapse */ DaffGeographyTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingModule, providers: [
42
+ { provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },
43
+ ] });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffGeographyTestingModule, decorators: [{
45
+ type: NgModule,
46
+ args: [{
47
+ providers: [
48
+ { provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },
49
+ ],
50
+ }]
51
+ }] });
52
+
53
+ /**
54
+ * Generated bundle index. Do not edit.
55
+ */
56
+
57
+ export { DaffGeographyTestingModule, MockDaffGeographyFacade };
58
+ //# sourceMappingURL=daffodil-geography-state-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-geography-state-testing.mjs","sources":["../../../libs/geography/state/testing/src/mock-geography-facade.ts","../../../libs/geography/state/testing/src/geography-testing.module.ts","../../../libs/geography/state/testing/src/daffodil-geography-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport { Action } from '@ngrx/store';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffCountry } from '@daffodil/geography';\nimport { DaffGeographyFacadeInterface } from '@daffodil/geography/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffGeographyFacade implements DaffGeographyFacadeInterface {\n loading$: BehaviorSubject<boolean> = new BehaviorSubject(null);\n errors$: BehaviorSubject<DaffStateError[]> = new BehaviorSubject([]);\n countries$: BehaviorSubject<DaffCountry[]> = new BehaviorSubject([]);\n countryIds$: BehaviorSubject<DaffCountry['id'][]> = new BehaviorSubject([]);\n countryCount$: BehaviorSubject<number> = new BehaviorSubject(null);\n countryEntities$: BehaviorSubject<Dictionary<DaffCountry>> = new BehaviorSubject(null);\n\n getCountry(id) {\n return new BehaviorSubject(null);\n }\n\n getCountrySubdivisions(id) {\n return new BehaviorSubject([]);\n }\n\n isCountryFullyLoaded(id) {\n return new BehaviorSubject(false);\n }\n\n dispatch(action: Action) {};\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffGeographyFacade } from '@daffodil/geography/state';\n\nimport { MockDaffGeographyFacade } from './mock-geography-facade';\n\n@NgModule({\n providers: [\n { provide: DaffGeographyFacade, useExisting: MockDaffGeographyFacade },\n ],\n})\nexport class DaffGeographyTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\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