@ngrx/data 12.5.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  2. package/esm2020/ngrx-data.mjs +5 -0
  3. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  4. package/esm2020/src/actions/entity-action-factory.mjs +50 -0
  5. package/{esm2015/src/actions/entity-action-guard.js → esm2020/src/actions/entity-action-guard.mjs} +0 -0
  6. package/{esm2015/src/actions/entity-action-operators.js → esm2020/src/actions/entity-action-operators.mjs} +0 -0
  7. package/{esm2015/src/actions/entity-action.js → esm2020/src/actions/entity-action.mjs} +0 -0
  8. package/esm2020/src/actions/entity-cache-action.mjs +116 -0
  9. package/esm2020/src/actions/entity-cache-change-set.mjs +50 -0
  10. package/{esm2015/src/actions/entity-op.js → esm2020/src/actions/entity-op.mjs} +0 -0
  11. package/{esm2015/src/actions/merge-strategy.js → esm2020/src/actions/merge-strategy.mjs} +0 -0
  12. package/{esm2015/src/actions/update-response-data.js → esm2020/src/actions/update-response-data.mjs} +0 -0
  13. package/{esm2015/src/dataservices/data-service-error.js → esm2020/src/dataservices/data-service-error.mjs} +0 -0
  14. package/{esm2015/src/dataservices/default-data-service-config.js → esm2020/src/dataservices/default-data-service-config.mjs} +0 -0
  15. package/{esm2015/src/dataservices/default-data.service.js → esm2020/src/dataservices/default-data.service.mjs} +13 -20
  16. package/esm2020/src/dataservices/entity-cache-data.service.mjs +146 -0
  17. package/esm2020/src/dataservices/entity-data.service.mjs +63 -0
  18. package/esm2020/src/dataservices/http-url-generator.mjs +86 -0
  19. package/{esm2015/src/dataservices/interfaces.js → esm2020/src/dataservices/interfaces.mjs} +0 -0
  20. package/esm2020/src/dataservices/persistence-result-handler.service.mjs +49 -0
  21. package/esm2020/src/dispatchers/entity-cache-dispatcher.mjs +163 -0
  22. package/{esm2015/src/dispatchers/entity-commands.js → esm2020/src/dispatchers/entity-commands.mjs} +0 -0
  23. package/esm2020/src/dispatchers/entity-dispatcher-base.mjs +405 -0
  24. package/esm2020/src/dispatchers/entity-dispatcher-default-options.mjs +30 -0
  25. package/esm2020/src/dispatchers/entity-dispatcher-factory.mjs +65 -0
  26. package/{esm2015/src/dispatchers/entity-dispatcher.js → esm2020/src/dispatchers/entity-dispatcher.mjs} +0 -0
  27. package/esm2020/src/effects/entity-cache-effects.mjs +115 -0
  28. package/{esm2015/src/effects/entity-effects-scheduler.js → esm2020/src/effects/entity-effects-scheduler.mjs} +0 -0
  29. package/esm2020/src/effects/entity-effects.mjs +148 -0
  30. package/esm2020/src/entity-data-without-effects.module.mjs +160 -0
  31. package/esm2020/src/entity-data.module.mjs +121 -0
  32. package/esm2020/src/entity-metadata/entity-definition.mjs +33 -0
  33. package/esm2020/src/entity-metadata/entity-definition.service.mjs +93 -0
  34. package/{esm2015/src/entity-metadata/entity-filters.js → esm2020/src/entity-metadata/entity-filters.mjs} +0 -0
  35. package/{esm2015/src/entity-metadata/entity-metadata.js → esm2020/src/entity-metadata/entity-metadata.mjs} +0 -0
  36. package/{esm2015/src/entity-services/entity-collection-service-base.js → esm2020/src/entity-services/entity-collection-service-base.mjs} +0 -0
  37. package/esm2020/src/entity-services/entity-collection-service-elements-factory.mjs +38 -0
  38. package/esm2020/src/entity-services/entity-collection-service-factory.mjs +28 -0
  39. package/{esm2015/src/entity-services/entity-collection-service.js → esm2020/src/entity-services/entity-collection-service.mjs} +0 -0
  40. package/esm2020/src/entity-services/entity-services-base.mjs +119 -0
  41. package/esm2020/src/entity-services/entity-services-elements.mjs +33 -0
  42. package/{esm2015/src/entity-services/entity-services.js → esm2020/src/entity-services/entity-services.mjs} +0 -0
  43. package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
  44. package/{esm2015/src/reducers/constants.js → esm2020/src/reducers/constants.mjs} +0 -0
  45. package/esm2020/src/reducers/entity-cache-reducer.mjs +271 -0
  46. package/{esm2015/src/reducers/entity-cache.js → esm2020/src/reducers/entity-cache.mjs} +0 -0
  47. package/esm2020/src/reducers/entity-change-tracker-base.mjs +587 -0
  48. package/{esm2015/src/reducers/entity-change-tracker.js → esm2020/src/reducers/entity-change-tracker.mjs} +0 -0
  49. package/esm2020/src/reducers/entity-collection-creator.mjs +37 -0
  50. package/esm2020/src/reducers/entity-collection-reducer-methods.mjs +807 -0
  51. package/esm2020/src/reducers/entity-collection-reducer-registry.mjs +68 -0
  52. package/esm2020/src/reducers/entity-collection-reducer.mjs +24 -0
  53. package/{esm2015/src/reducers/entity-collection.js → esm2020/src/reducers/entity-collection.mjs} +0 -0
  54. package/{esm2015/src/selectors/entity-cache-selector.js → esm2020/src/selectors/entity-cache-selector.mjs} +0 -0
  55. package/esm2020/src/selectors/entity-selectors$.mjs +52 -0
  56. package/esm2020/src/selectors/entity-selectors.mjs +96 -0
  57. package/esm2020/src/utils/correlation-id-generator.mjs +30 -0
  58. package/esm2020/src/utils/default-logger.mjs +25 -0
  59. package/esm2020/src/utils/default-pluralizer.mjs +71 -0
  60. package/{esm2015/src/utils/guid-fns.js → esm2020/src/utils/guid-fns.mjs} +0 -0
  61. package/{esm2015/src/utils/interfaces.js → esm2020/src/utils/interfaces.mjs} +0 -0
  62. package/{esm2015/src/utils/utilities.js → esm2020/src/utils/utilities.mjs} +0 -0
  63. package/fesm2015/{ngrx-data.js → ngrx-data.mjs} +341 -457
  64. package/fesm2015/ngrx-data.mjs.map +1 -0
  65. package/fesm2020/ngrx-data.mjs +4936 -0
  66. package/fesm2020/ngrx-data.mjs.map +1 -0
  67. package/ngrx-data.d.ts +1 -1
  68. package/package.json +25 -13
  69. package/schematics/ng-add/index.js +29 -25
  70. package/schematics/ng-add/index.js.map +1 -1
  71. package/schematics-core/index.js +1 -3
  72. package/schematics-core/index.js.map +1 -1
  73. package/schematics-core/utility/ast-utils.js +12 -8
  74. package/schematics-core/utility/ast-utils.js.map +1 -1
  75. package/schematics-core/utility/find-component.js +12 -12
  76. package/schematics-core/utility/find-component.js.map +1 -1
  77. package/schematics-core/utility/find-module.js +12 -12
  78. package/schematics-core/utility/find-module.js.map +1 -1
  79. package/schematics-core/utility/json-utilts.js.map +1 -1
  80. package/schematics-core/utility/libs-version.js +1 -1
  81. package/schematics-core/utility/libs-version.js.map +1 -1
  82. package/schematics-core/utility/ngrx-utils.js +16 -12
  83. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  84. package/schematics-core/utility/parse-name.js +3 -3
  85. package/schematics-core/utility/parse-name.js.map +1 -1
  86. package/schematics-core/utility/project.js +1 -1
  87. package/schematics-core/utility/project.js.map +1 -1
  88. package/schematics-core/utility/visitors.js +2 -2
  89. package/schematics-core/utility/visitors.js.map +1 -1
  90. package/src/actions/entity-action-factory.d.ts +3 -0
  91. package/src/dataservices/default-data.service.d.ts +3 -0
  92. package/src/dataservices/entity-cache-data.service.d.ts +3 -0
  93. package/src/dataservices/entity-data.service.d.ts +3 -0
  94. package/src/dataservices/http-url-generator.d.ts +3 -0
  95. package/src/dataservices/persistence-result-handler.service.d.ts +3 -0
  96. package/src/dispatchers/entity-cache-dispatcher.d.ts +3 -0
  97. package/src/dispatchers/entity-dispatcher-default-options.d.ts +3 -0
  98. package/src/dispatchers/entity-dispatcher-factory.d.ts +3 -0
  99. package/src/effects/entity-cache-effects.d.ts +3 -0
  100. package/src/effects/entity-effects.d.ts +3 -0
  101. package/src/entity-data-without-effects.module.d.ts +5 -0
  102. package/src/entity-data.module.d.ts +6 -0
  103. package/src/entity-metadata/entity-definition.service.d.ts +3 -0
  104. package/src/entity-services/entity-collection-service-base.d.ts +1 -1
  105. package/src/entity-services/entity-collection-service-elements-factory.d.ts +3 -0
  106. package/src/entity-services/entity-collection-service-factory.d.ts +3 -0
  107. package/src/entity-services/entity-services-base.d.ts +3 -0
  108. package/src/entity-services/entity-services-elements.d.ts +3 -0
  109. package/src/reducers/entity-cache-reducer.d.ts +3 -0
  110. package/src/reducers/entity-collection-creator.d.ts +3 -0
  111. package/src/reducers/entity-collection-reducer-methods.d.ts +3 -0
  112. package/src/reducers/entity-collection-reducer-registry.d.ts +3 -0
  113. package/src/reducers/entity-collection-reducer.d.ts +3 -0
  114. package/src/selectors/entity-selectors$.d.ts +3 -0
  115. package/src/selectors/entity-selectors.d.ts +3 -0
  116. package/src/utils/correlation-id-generator.d.ts +3 -0
  117. package/src/utils/default-logger.d.ts +3 -0
  118. package/src/utils/default-pluralizer.d.ts +3 -0
  119. package/bundles/ngrx-data.umd.js +0 -5579
  120. package/bundles/ngrx-data.umd.js.map +0 -1
  121. package/esm2015/ngrx-data.js +0 -6
  122. package/esm2015/src/actions/entity-action-factory.js +0 -44
  123. package/esm2015/src/actions/entity-cache-action.js +0 -116
  124. package/esm2015/src/actions/entity-cache-change-set.js +0 -50
  125. package/esm2015/src/dataservices/entity-cache-data.service.js +0 -148
  126. package/esm2015/src/dataservices/entity-data.service.js +0 -71
  127. package/esm2015/src/dataservices/http-url-generator.js +0 -91
  128. package/esm2015/src/dataservices/persistence-result-handler.service.js +0 -58
  129. package/esm2015/src/dispatchers/entity-cache-dispatcher.js +0 -169
  130. package/esm2015/src/dispatchers/entity-dispatcher-base.js +0 -401
  131. package/esm2015/src/dispatchers/entity-dispatcher-default-options.js +0 -28
  132. package/esm2015/src/dispatchers/entity-dispatcher-factory.js +0 -68
  133. package/esm2015/src/effects/entity-cache-effects.js +0 -121
  134. package/esm2015/src/effects/entity-effects.js +0 -154
  135. package/esm2015/src/entity-data-without-effects.module.js +0 -133
  136. package/esm2015/src/entity-data.module.js +0 -110
  137. package/esm2015/src/entity-metadata/entity-definition.js +0 -26
  138. package/esm2015/src/entity-metadata/entity-definition.service.js +0 -96
  139. package/esm2015/src/entity-services/entity-collection-service-elements-factory.js +0 -49
  140. package/esm2015/src/entity-services/entity-collection-service-factory.js +0 -36
  141. package/esm2015/src/entity-services/entity-services-base.js +0 -127
  142. package/esm2015/src/entity-services/entity-services-elements.js +0 -44
  143. package/esm2015/src/reducers/entity-cache-reducer.js +0 -281
  144. package/esm2015/src/reducers/entity-change-tracker-base.js +0 -575
  145. package/esm2015/src/reducers/entity-collection-creator.js +0 -43
  146. package/esm2015/src/reducers/entity-collection-reducer-methods.js +0 -792
  147. package/esm2015/src/reducers/entity-collection-reducer-registry.js +0 -72
  148. package/esm2015/src/reducers/entity-collection-reducer.js +0 -32
  149. package/esm2015/src/selectors/entity-selectors$.js +0 -59
  150. package/esm2015/src/selectors/entity-selectors.js +0 -90
  151. package/esm2015/src/utils/correlation-id-generator.js +0 -28
  152. package/esm2015/src/utils/default-logger.js +0 -23
  153. package/esm2015/src/utils/default-pluralizer.js +0 -74
  154. package/fesm2015/ngrx-data.js.map +0 -1
  155. package/ngrx-data.metadata.json +0 -1
  156. package/schematics-core/utility/angular-utils.js +0 -33
  157. package/schematics-core/utility/angular-utils.js.map +0 -1
@@ -19,22 +19,22 @@ function findComponentFromOptions(host, options) {
19
19
  if (!options.component) {
20
20
  var pathToCheck = (options.path || '') +
21
21
  (options.flat ? '' : '/' + core_1.strings.dasherize(options.name));
22
- return core_1.normalize(findComponent(host, pathToCheck));
22
+ return (0, core_1.normalize)(findComponent(host, pathToCheck));
23
23
  }
24
24
  else {
25
- var componentPath = core_1.normalize('/' + options.path + '/' + options.component);
26
- var componentBaseName = core_1.normalize(componentPath).split('/').pop();
25
+ var componentPath = (0, core_1.normalize)('/' + options.path + '/' + options.component);
26
+ var componentBaseName = (0, core_1.normalize)(componentPath).split('/').pop();
27
27
  if (host.exists(componentPath)) {
28
- return core_1.normalize(componentPath);
28
+ return (0, core_1.normalize)(componentPath);
29
29
  }
30
30
  else if (host.exists(componentPath + '.ts')) {
31
- return core_1.normalize(componentPath + '.ts');
31
+ return (0, core_1.normalize)(componentPath + '.ts');
32
32
  }
33
33
  else if (host.exists(componentPath + '.component.ts')) {
34
- return core_1.normalize(componentPath + '.component.ts');
34
+ return (0, core_1.normalize)(componentPath + '.component.ts');
35
35
  }
36
36
  else if (host.exists(componentPath + '/' + componentBaseName + '.component.ts')) {
37
- return core_1.normalize(componentPath + '/' + componentBaseName + '.component.ts');
37
+ return (0, core_1.normalize)(componentPath + '/' + componentBaseName + '.component.ts');
38
38
  }
39
39
  else {
40
40
  throw new Error("Specified component path " + componentPath + " does not exist");
@@ -51,7 +51,7 @@ function findComponent(host, generateDir) {
51
51
  while (dir) {
52
52
  var matches = dir.subfiles.filter(function (p) { return componentRe.test(p); });
53
53
  if (matches.length == 1) {
54
- return core_1.join(dir.path, matches[0]);
54
+ return (0, core_1.join)(dir.path, matches[0]);
55
55
  }
56
56
  else if (matches.length > 1) {
57
57
  throw new Error('More than one component matches. Use skip-import option to skip importing ' +
@@ -69,7 +69,7 @@ exports.findComponent = findComponent;
69
69
  function buildRelativePath(from, to) {
70
70
  var _a = parsePath(from), fromPath = _a.path, fromFileName = _a.filename, fromDirectory = _a.directory;
71
71
  var _b = parsePath(to), toPath = _b.path, toFileName = _b.filename, toDirectory = _b.directory;
72
- var relativePath = core_1.relative(fromDirectory, toDirectory);
72
+ var relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
73
73
  var fixedRelativePath = relativePath.startsWith('.')
74
74
  ? relativePath
75
75
  : "./" + relativePath;
@@ -81,9 +81,9 @@ function buildRelativePath(from, to) {
81
81
  }
82
82
  exports.buildRelativePath = buildRelativePath;
83
83
  function parsePath(path) {
84
- var pathNormalized = core_1.normalize(path);
85
- var filename = core_1.extname(pathNormalized) ? core_1.basename(pathNormalized) : '';
86
- var directory = filename ? core_1.dirname(pathNormalized) : pathNormalized;
84
+ var pathNormalized = (0, core_1.normalize)(path);
85
+ var filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : '';
86
+ var directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized;
87
87
  return {
88
88
  path: pathNormalized,
89
89
  filename: filename,
@@ -1 +1 @@
1
- {"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;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AC,CAAC;IAC1D,IAAM,iBAAiB,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,OAAK,YAAc,CAAC;IAExB,OAAO,CAAC,UAAU,IAAI,UAAU,KAAK,UAAU;QAC7C,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,MACE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,iBAAiB,GAAG,GAAG,IAC1B,2BAA2B,CAAC,UAAU,CAAG,CAAC;AACnD,CAAC;AAvBD,8CAuBC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAM,cAAc,GAAG,gBAAS,CAAC,IAAI,CAAS,CAAC;IAC/C,IAAM,QAAQ,GAAG,cAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,eAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ComponentOptions {\n component?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the component referred by a set of options passed to the schematics.\n */\nexport function findComponentFromOptions(\n host: Tree,\n options: ComponentOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.component) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findComponent(host, pathToCheck));\n } else {\n const componentPath = normalize(\n '/' + options.path + '/' + options.component\n );\n const componentBaseName = normalize(componentPath).split('/').pop();\n\n if (host.exists(componentPath)) {\n return normalize(componentPath);\n } else if (host.exists(componentPath + '.ts')) {\n return normalize(componentPath + '.ts');\n } else if (host.exists(componentPath + '.component.ts')) {\n return normalize(componentPath + '.component.ts');\n } else if (\n host.exists(componentPath + '/' + componentBaseName + '.component.ts')\n ) {\n return normalize(\n componentPath + '/' + componentBaseName + '.component.ts'\n );\n } else {\n throw new Error(\n `Specified component path ${componentPath} does not exist`\n );\n }\n }\n}\n\n/**\n * Function to find the \"closest\" component to a generated file's path.\n */\nexport function findComponent(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const componentRe = /\\.component\\.ts$/;\n\n while (dir) {\n const matches = dir.subfiles.filter((p) => componentRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one component matches. Use skip-import option to skip importing ' +\n 'the component store into the closest component.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an Component. Use the skip-import ' +\n 'option to skip importing in Component.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
1
+ {"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,wBAAwB,CACtC,IAAU,EACV,OAAyB;IAEzB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACtB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9D,OAAO,IAAA,gBAAS,EAAC,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KACpD;SAAM;QACL,IAAM,aAAa,GAAG,IAAA,gBAAS,EAC7B,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,SAAS,CAC7C,CA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AC,CAAC,EAAE,CAAC;IACzE,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ComponentOptions {\n component?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the component referred by a set of options passed to the schematics.\n */\nexport function findComponentFromOptions(\n host: Tree,\n options: ComponentOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.component) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findComponent(host, pathToCheck));\n } else {\n const componentPath = normalize(\n '/' + options.path + '/' + options.component\n );\n const componentBaseName = normalize(componentPath).split('/').pop();\n\n if (host.exists(componentPath)) {\n return normalize(componentPath);\n } else if (host.exists(componentPath + '.ts')) {\n return normalize(componentPath + '.ts');\n } else if (host.exists(componentPath + '.component.ts')) {\n return normalize(componentPath + '.component.ts');\n } else if (\n host.exists(componentPath + '/' + componentBaseName + '.component.ts')\n ) {\n return normalize(\n componentPath + '/' + componentBaseName + '.component.ts'\n );\n } else {\n throw new Error(\n `Specified component path ${componentPath} does not exist`\n );\n }\n }\n}\n\n/**\n * Function to find the \"closest\" component to a generated file's path.\n */\nexport function findComponent(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const componentRe = /\\.component\\.ts$/;\n\n while (dir) {\n const matches = dir.subfiles.filter((p) => componentRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one component matches. Use skip-import option to skip importing ' +\n 'the component store into the closest component.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an Component. Use the skip-import ' +\n 'option to skip importing in Component.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
@@ -19,22 +19,22 @@ function findModuleFromOptions(host, options) {
19
19
  if (!options.module) {
20
20
  var pathToCheck = (options.path || '') +
21
21
  (options.flat ? '' : '/' + core_1.strings.dasherize(options.name));
22
- return core_1.normalize(findModule(host, pathToCheck));
22
+ return (0, core_1.normalize)(findModule(host, pathToCheck));
23
23
  }
24
24
  else {
25
- var modulePath = core_1.normalize('/' + options.path + '/' + options.module);
26
- var moduleBaseName = core_1.normalize(modulePath).split('/').pop();
25
+ var modulePath = (0, core_1.normalize)('/' + options.path + '/' + options.module);
26
+ var moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();
27
27
  if (host.exists(modulePath)) {
28
- return core_1.normalize(modulePath);
28
+ return (0, core_1.normalize)(modulePath);
29
29
  }
30
30
  else if (host.exists(modulePath + '.ts')) {
31
- return core_1.normalize(modulePath + '.ts');
31
+ return (0, core_1.normalize)(modulePath + '.ts');
32
32
  }
33
33
  else if (host.exists(modulePath + '.module.ts')) {
34
- return core_1.normalize(modulePath + '.module.ts');
34
+ return (0, core_1.normalize)(modulePath + '.module.ts');
35
35
  }
36
36
  else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {
37
- return core_1.normalize(modulePath + '/' + moduleBaseName + '.module.ts');
37
+ return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '.module.ts');
38
38
  }
39
39
  else {
40
40
  throw new Error("Specified module path " + modulePath + " does not exist");
@@ -52,7 +52,7 @@ function findModule(host, generateDir) {
52
52
  while (dir) {
53
53
  var matches = dir.subfiles.filter(function (p) { return moduleRe.test(p) && !routingModuleRe.test(p); });
54
54
  if (matches.length == 1) {
55
- return core_1.join(dir.path, matches[0]);
55
+ return (0, core_1.join)(dir.path, matches[0]);
56
56
  }
57
57
  else if (matches.length > 1) {
58
58
  throw new Error('More than one module matches. Use skip-import option to skip importing ' +
@@ -70,7 +70,7 @@ exports.findModule = findModule;
70
70
  function buildRelativePath(from, to) {
71
71
  var _a = parsePath(from), fromPath = _a.path, fromFileName = _a.filename, fromDirectory = _a.directory;
72
72
  var _b = parsePath(to), toPath = _b.path, toFileName = _b.filename, toDirectory = _b.directory;
73
- var relativePath = core_1.relative(fromDirectory, toDirectory);
73
+ var relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
74
74
  var fixedRelativePath = relativePath.startsWith('.')
75
75
  ? relativePath
76
76
  : "./" + relativePath;
@@ -82,9 +82,9 @@ function buildRelativePath(from, to) {
82
82
  }
83
83
  exports.buildRelativePath = buildRelativePath;
84
84
  function parsePath(path) {
85
- var pathNormalized = core_1.normalize(path);
86
- var filename = core_1.extname(pathNormalized) ? core_1.basename(pathNormalized) : '';
87
- var directory = filename ? core_1.dirname(pathNormalized) : pathNormalized;
85
+ var pathNormalized = (0, core_1.normalize)(path);
86
+ var filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : '';
87
+ var directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized;
88
88
  return {
89
89
  path: pathNormalized,
90
90
  filename: filename,
@@ -1 +1 @@
1
- {"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAsB;IAEtB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9D,OAAO,gBAAS,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KACjD;SAAM;QACL,IAAM,UAAU,GAAG,gBAAS,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GA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Ac,CAAC,CAAC,CAAC,CAAC,eAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(\n host: Tree,\n options: ModuleOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize('/' + options.path + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(\n (p) => moduleRe.test(p) && !routingModuleRe.test(p)\n );\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one module matches. Use skip-import option to skip importing ' +\n 'the component into the closest module.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an NgModule. Use the skip-import ' +\n 'option to skip importing in NgModule.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
1
+ {"version":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esContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(\n host: Tree,\n options: ModuleOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize('/' + options.path + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(\n (p) => moduleRe.test(p) && !routingModuleRe.test(p)\n );\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one module matches. Use skip-import option to skip importing ' +\n 'the component into the closest module.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an NgModule. Use the skip-import ' +\n 'option to skip importing in NgModule.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/json-utilts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,uGAAuG;AACvG,SAAgB,uBAAuB,CACrC,IAAmB,EACnB,YAAoB;;IAEpB,IAAI,SAAS,GAAuB,IAAI,CAAC;;QACzC,KAAuB,IAAA,KAAA,SAAA,IAAI,CAAC,UAAU,CAAA,gBAAA,4BAAE;YAAnC,IAAM,QAAQ,WAAA;YACjB,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,YAAY,EAAE;gBACtC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;aAC5B;SACF;;;;;;;;;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,0DAYC","sourcesContent":["import { JsonAstNode, JsonAstObject } from '@angular-devkit/core';\n\n// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts\nexport function findPropertyInAstObject(\n node: JsonAstObject,\n propertyName: string\n): JsonAstNode | null {\n let maybeNode: JsonAstNode | null = null;\n for (const property of node.properties) {\n if (property.key.value == propertyName) {\n maybeNode = property.value;\n }\n }\n\n return maybeNode;\n}\n"]}
1
+ {"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/json-utilts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uGAAuG;AACvG,SAAgB,uBAAuB,CACrC,IAAS,EACT,YAAoB;;IAEpB,IAAI,SAAS,GAAe,IAAI,CAAC;;QACjC,KAAuB,IAAA,KAAA,SAAA,IAAI,CAAC,UAAU,CAAA,gBAAA,4BAAE;YAAnC,IAAM,QAAQ,WAAA;YACjB,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,YAAY,EAAE;gBACtC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;aAC5B;SACF;;;;;;;;;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,0DAYC","sourcesContent":["// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts\nexport function findPropertyInAstObject(\n node: any,\n propertyName: string\n): any | null {\n let maybeNode: any | null = null;\n for (const property of node.properties) {\n if (property.key.value == propertyName) {\n maybeNode = property.value;\n }\n }\n\n return maybeNode;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  exports.platformVersion = void 0;
4
- exports.platformVersion = '^12.5.0';
4
+ exports.platformVersion = '^13.0.0';
5
5
  //# sourceMappingURL=libs-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^12.5.0';\n"]}
1
+ {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^13.0.0';\n"]}
@@ -26,10 +26,14 @@ var __read = (this && this.__read) || function (o, n) {
26
26
  }
27
27
  return ar;
28
28
  };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
30
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
31
- to[j] = from[i];
32
- return to;
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
33
37
  };
34
38
  exports.__esModule = true;
35
39
  exports.getPrefix = exports.omit = exports.addReducerImportToNgModule = exports.addReducerToActionReducerMap = exports.addReducerToStateInterface = exports.addReducerToState = void 0;
@@ -46,7 +50,7 @@ function addReducerToState(options) {
46
50
  if (!options.reducers) {
47
51
  return host;
48
52
  }
49
- var reducersPath = core_1.normalize("/" + options.path + "/" + options.reducers);
53
+ var reducersPath = (0, core_1.normalize)("/" + options.path + "/" + options.reducers);
50
54
  if (!host.exists(reducersPath)) {
51
55
  throw new Error("Specified reducers path " + reducersPath + " does not exist");
52
56
  }
@@ -61,8 +65,8 @@ function addReducerToState(options) {
61
65
  (options.group ? 'reducers/' : '') +
62
66
  stringUtils.dasherize(options.name) +
63
67
  '.reducer';
64
- var relativePath = find_module_1.buildRelativePath(reducersPath, reducerPath);
65
- var reducerImport = ast_utils_1.insertImport(source, reducersPath, "* as from" + stringUtils.classify(options.name), relativePath, true);
68
+ var relativePath = (0, find_module_1.buildRelativePath)(reducersPath, reducerPath);
69
+ var reducerImport = (0, ast_utils_1.insertImport)(source, reducersPath, "* as from" + stringUtils.classify(options.name), relativePath, true);
66
70
  var stateInterfaceInsert = addReducerToStateInterface(source, reducersPath, options);
67
71
  var reducerMapInsert = addReducerToActionReducerMap(source, reducersPath, options);
68
72
  var changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];
@@ -193,20 +197,20 @@ function addReducerImportToNgModule(options) {
193
197
  var sourceText = text.toString('utf-8');
194
198
  var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
195
199
  var commonImports = [
196
- ast_utils_1.insertImport(source, modulePath, 'StoreModule', '@ngrx/store'),
200
+ (0, ast_utils_1.insertImport)(source, modulePath, 'StoreModule', '@ngrx/store'),
197
201
  ];
198
202
  var reducerPath = "/" + options.path + "/" +
199
203
  (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +
200
204
  (options.group ? 'reducers/' : '') +
201
205
  stringUtils.dasherize(options.name) +
202
206
  '.reducer';
203
- var relativePath = find_module_1.buildRelativePath(modulePath, reducerPath);
204
- var reducerImport = ast_utils_1.insertImport(source, modulePath, "* as from" + stringUtils.classify(options.name), relativePath, true);
207
+ var relativePath = (0, find_module_1.buildRelativePath)(modulePath, reducerPath);
208
+ var reducerImport = (0, ast_utils_1.insertImport)(source, modulePath, "* as from" + stringUtils.classify(options.name), relativePath, true);
205
209
  var state = options.plural
206
210
  ? stringUtils.pluralize(options.name)
207
211
  : stringUtils.camelize(options.name);
208
- var _b = __read(ast_utils_1.addImportToModule(source, modulePath, "StoreModule.forFeature(from" + stringUtils.classify(options.name) + "." + state + "FeatureKey, from" + stringUtils.classify(options.name) + ".reducer)", relativePath), 1), storeNgModuleImport = _b[0];
209
- var changes = __spreadArray(__spreadArray([], __read(commonImports)), [reducerImport, storeNgModuleImport]);
212
+ var _b = __read((0, ast_utils_1.addImportToModule)(source, modulePath, "StoreModule.forFeature(from" + stringUtils.classify(options.name) + "." + state + "FeatureKey, from" + stringUtils.classify(options.name) + ".reducer)", relativePath), 1), storeNgModuleImport = _b[0];
213
+ var changes = __spreadArray(__spreadArray([], __read(commonImports), false), [reducerImport, storeNgModuleImport], false);
210
214
  var recorder = host.beginUpdate(modulePath);
211
215
  try {
212
216
  for (var changes_2 = __values(changes), changes_2_1 = changes_2.next(); !changes_2_1.done; changes_2_1 = changes_2.next()) {
@@ -1 +1 @@
1
- {"version":3,"file":"ngrx-utils.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/ngrx-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,uCAAyC;AACzC,mCAA4D;AAC5D,yDAA6E;AAC7E,6CAAiD;AACjD,6CAAkD;AAClD,yCAA8D;AAE9D,SAAgB,iBAAiB,CAAC,OAAY;IAC5C,OAAO,UAAC,IAAU;;QAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;QAED,IAAM,YAAY,GAAG,gBAAS,CAAC,MAAI,OAAO,CAAC,IAAI,SAAI,OAAO,CAAC,QAAU,CAAC,CAAC;QAEvE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,6BAA2B,YAAY,oBAAiB,CAAC,CAAC;SAC3E;QAED,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrC,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,MAAM,IAAI,gCAAmB,CAAC,UAAQ,YAAY,qBAAkB,CAAC,CAAC;SACvE;QAED,IAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE1C,IAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,YAAY,EACZ,UAAU,EACV,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;QAE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;;;;;;;QACD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAlED,gEAkEC;AAED,SAAgB,IAAI,CAClB,MAAS,EACT,WAAoB;IAEpB,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACvB,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,KAAK,WAAW,EAAnB,CAAmB,CAAC;SACpC,MAAM,CAAC,UAAC,MAAM,EAAE,GAAG;;QAAK,OAAA,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG;IAA7C,CAA6C,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC;AAPD,oBAOC;AAED,SAAgB,SAAS,CAAC,OAAgD;IACxE,OAAO,OAAO,CAAC,QAAQ;QACrB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC;QAChD,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;AACvD,CAAC;AAJD,8BAIC","sourcesContent":["import * as ts from 'typescript';\nimport * as stringUtils from './strings';\nimport { InsertChange, Change, NoopChange } from './change';\nimport { Tree, SchematicsException, Rule } from '@angular-devkit/schematics';\nimport { normalize } from '@angular-devkit/core';\nimport { buildRelativePath } from './find-module';\nimport { addImportToModule, insertImport } from './ast-utils';\n\nexport function addReducerToState(options: any): Rule {\n return (host: Tree) => {\n if (!options.reducers) {\n return host;\n }\n\n const reducersPath = normalize(`/${options.path}/${options.reducers}`);\n\n if (!host.exists(reducersPath)) {\n throw new Error(`Specified reducers path ${reducersPath} does not exist`);\n }\n\n const text = host.read(reducersPath);\n if (text === null) {\n throw new SchematicsException(`File ${reducersPath} does not exist.`);\n }\n\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n reducersPath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n\n const relativePath = buildRelativePath(reducersPath, reducerPath);\n const reducerImport = insertImport(\n source,\n reducersPath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n\n const stateInterfaceInsert = addReducerToStateInterface(\n source,\n reducersPath,\n options\n );\n const reducerMapInsert = addReducerToActionReducerMap(\n source,\n reducersPath,\n options\n );\n\n const changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];\n const recorder = host.beginUpdate(reducersPath);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\n/**\n * Insert the reducer into the first defined top level interface\n */\nexport function addReducerToStateInterface(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n const stateInterface = source.statements.find(\n (stm) => stm.kind === ts.SyntaxKind.InterfaceDeclaration\n );\n let node = stateInterface as ts.Statement;\n\n if (!node) {\n return new NoopChange();\n }\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.State;`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.members.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.members[expr.members.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `${matches[1]}${keyInsert}\\n`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Insert the reducer into the ActionReducerMap\n */\nexport function addReducerToActionReducerMap(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n let initializer: any;\n const actionReducerMap: any = source.statements\n .filter((stm) => stm.kind === ts.SyntaxKind.VariableStatement)\n .filter((stm: any) => !!stm.declarationList)\n .map((stm: any) => {\n const {\n declarations,\n }: {\n declarations: ts.SyntaxKind.VariableDeclarationList[];\n } = stm.declarationList;\n const variable: any = declarations.find(\n (decl: any) => decl.kind === ts.SyntaxKind.VariableDeclaration\n );\n const type = variable ? variable.type : {};\n\n return { initializer: variable.initializer, type };\n })\n .filter((initWithType) => initWithType.type !== undefined)\n .find(({ type }) => type.typeName.text === 'ActionReducerMap');\n\n if (!actionReducerMap || !actionReducerMap.initializer) {\n return new NoopChange();\n }\n\n let node = actionReducerMap.initializer;\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.reducer,`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.properties.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `\\n${matches[1]}${keyInsert}`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Add reducer feature to NgModule\n */\nexport function addReducerImportToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (!options.module) {\n return host;\n }\n\n const modulePath = options.module;\n if (!host.exists(options.module)) {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n modulePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const commonImports = [\n insertImport(source, modulePath, 'StoreModule', '@ngrx/store'),\n ];\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n const relativePath = buildRelativePath(modulePath, reducerPath);\n const reducerImport = insertImport(\n source,\n modulePath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n const [storeNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreModule.forFeature(from${stringUtils.classify(\n options.name\n )}.${state}FeatureKey, from${stringUtils.classify(\n options.name\n )}.reducer)`,\n relativePath\n );\n const changes = [...commonImports, reducerImport, storeNgModuleImport];\n const recorder = host.beginUpdate(modulePath);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\nexport function omit<T extends { [key: string]: any }>(\n object: T,\n keyToRemove: keyof T\n): Partial<T> {\n return Object.keys(object)\n .filter((key) => key !== keyToRemove)\n .reduce((result, key) => Object.assign(result, { [key]: object[key] }), {});\n}\n\nexport function getPrefix(options: { prefix?: string; creators?: boolean }) {\n return options.creators\n ? stringUtils.camelize(options.prefix || 'load')\n : stringUtils.capitalize(options.prefix || 'load');\n}\n"]}
1
+ {"version":3,"file":"ngrx-utils.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/ngrx-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,uCAAyC;AACzC,mCAA4D;AAC5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,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG;IAA7C,CAA6C,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC;AAPD,oBAOC;AAED,SAAgB,SAAS,CAAC,OAAgD;IACxE,OAAO,OAAO,CAAC,QAAQ;QACrB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC;QAChD,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;AACvD,CAAC;AAJD,8BAIC","sourcesContent":["import * as ts from 'typescript';\nimport * as stringUtils from './strings';\nimport { InsertChange, Change, NoopChange } from './change';\nimport { Tree, SchematicsException, Rule } from '@angular-devkit/schematics';\nimport { normalize } from '@angular-devkit/core';\nimport { buildRelativePath } from './find-module';\nimport { addImportToModule, insertImport } from './ast-utils';\n\nexport function addReducerToState(options: any): Rule {\n return (host: Tree) => {\n if (!options.reducers) {\n return host;\n }\n\n const reducersPath = normalize(`/${options.path}/${options.reducers}`);\n\n if (!host.exists(reducersPath)) {\n throw new Error(`Specified reducers path ${reducersPath} does not exist`);\n }\n\n const text = host.read(reducersPath);\n if (text === null) {\n throw new SchematicsException(`File ${reducersPath} does not exist.`);\n }\n\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n reducersPath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n\n const relativePath = buildRelativePath(reducersPath, reducerPath);\n const reducerImport = insertImport(\n source,\n reducersPath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n\n const stateInterfaceInsert = addReducerToStateInterface(\n source,\n reducersPath,\n options\n );\n const reducerMapInsert = addReducerToActionReducerMap(\n source,\n reducersPath,\n options\n );\n\n const changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];\n const recorder = host.beginUpdate(reducersPath);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\n/**\n * Insert the reducer into the first defined top level interface\n */\nexport function addReducerToStateInterface(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n const stateInterface = source.statements.find(\n (stm) => stm.kind === ts.SyntaxKind.InterfaceDeclaration\n );\n let node = stateInterface as ts.Statement;\n\n if (!node) {\n return new NoopChange();\n }\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.State;`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.members.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.members[expr.members.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `${matches[1]}${keyInsert}\\n`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Insert the reducer into the ActionReducerMap\n */\nexport function addReducerToActionReducerMap(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n let initializer: any;\n const actionReducerMap: any = source.statements\n .filter((stm) => stm.kind === ts.SyntaxKind.VariableStatement)\n .filter((stm: any) => !!stm.declarationList)\n .map((stm: any) => {\n const {\n declarations,\n }: {\n declarations: ts.SyntaxKind.VariableDeclarationList[];\n } = stm.declarationList;\n const variable: any = declarations.find(\n (decl: any) => decl.kind === ts.SyntaxKind.VariableDeclaration\n );\n const type = variable ? variable.type : {};\n\n return { initializer: variable.initializer, type };\n })\n .filter((initWithType) => initWithType.type !== undefined)\n .find(({ type }) => type.typeName.text === 'ActionReducerMap');\n\n if (!actionReducerMap || !actionReducerMap.initializer) {\n return new NoopChange();\n }\n\n let node = actionReducerMap.initializer;\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.reducer,`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.properties.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `\\n${matches[1]}${keyInsert}`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Add reducer feature to NgModule\n */\nexport function addReducerImportToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (!options.module) {\n return host;\n }\n\n const modulePath = options.module;\n if (!host.exists(options.module)) {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n modulePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const commonImports = [\n insertImport(source, modulePath, 'StoreModule', '@ngrx/store'),\n ];\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n const relativePath = buildRelativePath(modulePath, reducerPath);\n const reducerImport = insertImport(\n source,\n modulePath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n const [storeNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreModule.forFeature(from${stringUtils.classify(\n options.name\n )}.${state}FeatureKey, from${stringUtils.classify(\n options.name\n )}.reducer)`,\n relativePath\n );\n const changes = [...commonImports, reducerImport, storeNgModuleImport];\n const recorder = host.beginUpdate(modulePath);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\nexport function omit<T extends { [key: string]: any }>(\n object: T,\n keyToRemove: keyof T\n): Partial<T> {\n return Object.keys(object)\n .filter((key) => key !== keyToRemove)\n .reduce((result, key) => Object.assign(result, { [key]: object[key] }), {});\n}\n\nexport function getPrefix(options: { prefix?: string; creators?: boolean }) {\n return options.creators\n ? stringUtils.camelize(options.prefix || 'load')\n : stringUtils.capitalize(options.prefix || 'load');\n}\n"]}
@@ -3,11 +3,11 @@ exports.__esModule = true;
3
3
  exports.parseName = void 0;
4
4
  var core_1 = require("@angular-devkit/core");
5
5
  function parseName(path, name) {
6
- var nameWithoutPath = core_1.basename(name);
7
- var namePath = core_1.dirname((path + '/' + name));
6
+ var nameWithoutPath = (0, core_1.basename)(name);
7
+ var namePath = (0, core_1.dirname)((path + '/' + name));
8
8
  return {
9
9
  name: nameWithoutPath,
10
- path: core_1.normalize('/' + namePath)
10
+ path: (0, core_1.normalize)('/' + namePath)
11
11
  };
12
12
  }
13
13
  exports.parseName = parseName;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-name.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/parse-name.ts"],"names":[],"mappings":";;;AAAA,6CAA0E;AAO1E,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,IAAM,eAAe,GAAG,eAAQ,CAAC,IAAY,CAAC,CAAC;IAC/C,IAAM,QAAQ,GAAG,cAAO,CAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAS,CAAC,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,gBAAS,CAAC,GAAG,GAAG,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC;AARD,8BAQC","sourcesContent":["import { Path, basename, dirname, normalize } from '@angular-devkit/core';\n\nexport interface Location {\n name: string;\n path: Path;\n}\n\nexport function parseName(path: string, name: string): Location {\n const nameWithoutPath = basename(name as Path);\n const namePath = dirname((path + '/' + name) as Path);\n\n return {\n name: nameWithoutPath,\n path: normalize('/' + namePath),\n };\n}\n"]}
1
+ {"version":3,"file":"parse-name.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/parse-name.ts"],"names":[],"mappings":";;;AAAA,6CAA0E;AAO1E,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,IAAM,eAAe,GAAG,IAAA,eAAQ,EAAC,IAAY,CAAC,CAAC;IAC/C,IAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAS,CAAC,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,IAAA,gBAAS,EAAC,GAAG,GAAG,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC;AARD,8BAQC","sourcesContent":["import { Path, basename, dirname, normalize } from '@angular-devkit/core';\n\nexport interface Location {\n name: string;\n path: Path;\n}\n\nexport function parseName(path: string, name: string): Location {\n const nameWithoutPath = basename(name as Path);\n const namePath = dirname((path + '/' + name) as Path);\n\n return {\n name: nameWithoutPath,\n path: normalize('/' + namePath),\n };\n}\n"]}
@@ -3,7 +3,7 @@ exports.__esModule = true;
3
3
  exports.isLib = exports.getProjectPath = exports.getProject = void 0;
4
4
  var config_1 = require("./config");
5
5
  function getProject(host, options) {
6
- var workspace = config_1.getWorkspace(host);
6
+ var workspace = (0, config_1.getWorkspace)(host);
7
7
  if (!options.project) {
8
8
  var defaultProject = workspace
9
9
  .defaultProject;
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/project.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAQxC,SAAgB,UAAU,CACxB,IAAU,EACV,OAAoE;IAEpE,IAAM,SAAS,GAAG,qBAAY,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,IAAM,cAAc,GAAI,SAAyC;aAC9D,cAAc,CAAC;QAClB,OAAO,CAAC,OAAO;YACb,cAAc,KAAK,SAAS;gBAC1B,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAhBD,gCAgBC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAChE;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QAC9B,IAAM,cAAc,GAClB,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,OAAO,CAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAI,OAAO,CAAC,IAAM,CAAC,CAAC,CAAC,EAAE,cAAQ,cAAgB,CAAC;KAC1E;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAlBD,wCAkBC;AAED,SAAgB,KAAK,CACnB,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;AAC3C,CAAC;AAPD,sBAOC","sourcesContent":["import { getWorkspace } from './config';\nimport { Tree } from '@angular-devkit/schematics';\n\nexport interface WorkspaceProject {\n root: string;\n projectType: string;\n}\n\nexport function getProject(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n): WorkspaceProject {\n const workspace = getWorkspace(host);\n\n if (!options.project) {\n const defaultProject = (workspace as { defaultProject?: string })\n .defaultProject;\n options.project =\n defaultProject !== undefined\n ? defaultProject\n : Object.keys(workspace.projects)[0];\n }\n\n return workspace.projects[options.project];\n}\n\nexport function getProjectPath(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n if (project.root.substr(-1) === '/') {\n project.root = project.root.substr(0, project.root.length - 1);\n }\n\n if (options.path === undefined) {\n const projectDirName =\n project.projectType === 'application' ? 'app' : 'lib';\n\n return `${project.root ? `/${project.root}` : ''}/src/${projectDirName}`;\n }\n\n return options.path;\n}\n\nexport function isLib(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n return project.projectType === 'library';\n}\n"]}
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/project.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAQxC,SAAgB,UAAU,CACxB,IAAU,EACV,OAAoE;IAEpE,IAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,IAAM,cAAc,GAAI,SAAyC;aAC9D,cAAc,CAAC;QAClB,OAAO,CAAC,OAAO;YACb,cAAc,KAAK,SAAS;gBAC1B,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAhBD,gCAgBC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAChE;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QAC9B,IAAM,cAAc,GAClB,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,OAAO,CAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAI,OAAO,CAAC,IAAM,CAAC,CAAC,CAAC,EAAE,cAAQ,cAAgB,CAAC;KAC1E;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAlBD,wCAkBC;AAED,SAAgB,KAAK,CACnB,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;AAC3C,CAAC;AAPD,sBAOC","sourcesContent":["import { getWorkspace } from './config';\nimport { Tree } from '@angular-devkit/schematics';\n\nexport interface WorkspaceProject {\n root: string;\n projectType: string;\n}\n\nexport function getProject(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n): WorkspaceProject {\n const workspace = getWorkspace(host);\n\n if (!options.project) {\n const defaultProject = (workspace as { defaultProject?: string })\n .defaultProject;\n options.project =\n defaultProject !== undefined\n ? defaultProject\n : Object.keys(workspace.projects)[0];\n }\n\n return workspace.projects[options.project];\n}\n\nexport function getProjectPath(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n if (project.root.substr(-1) === '/') {\n project.root = project.root.substr(0, project.root.length - 1);\n }\n\n if (options.path === undefined) {\n const projectDirName =\n project.projectType === 'application' ? 'app' : 'lib';\n\n return `${project.root ? `/${project.root}` : ''}/src/${projectDirName}`;\n }\n\n return options.path;\n}\n\nexport function isLib(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n return project.projectType === 'library';\n}\n"]}
@@ -96,8 +96,8 @@ function visitTemplates(tree, visitor) {
96
96
  }
97
97
  else if (n.name.text === 'templateUrl' &&
98
98
  ts.isStringLiteralLike(n.initializer)) {
99
- var parts = core_1.normalize(source.fileName).split('/').slice(0, -1);
100
- var templatePath = core_1.resolve(core_1.normalize(parts.join('/')), core_1.normalize(n.initializer.text));
99
+ var parts = (0, core_1.normalize)(source.fileName).split('/').slice(0, -1);
100
+ var templatePath = (0, core_1.resolve)((0, core_1.normalize)(parts.join('/')), (0, core_1.normalize)(n.initializer.text));
101
101
  if (!tree.exists(templatePath)) {
102
102
  return;
103
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,6CAA0D;AAG1D,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAIuB;;IAEvB,IAAI,MAAM,GAAuB,SAAS,CAAC;;QAC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C,OAAO,CAAA;;;;gBAAzB,IAAI;gBACb,IAAI,IAAI,KAAK,cAAc,EAAE;oBAC3B,yBAAS;iBACV;gBAED,sBAAA,SAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA,EAAA;;gBAAjC,SAAiC,CAAC;;;;;;;;;;;;;;;;;;;CAErC","sourcesContent":["import * as ts from 'typescript';\nimport { normalize, resolve } from '@angular-devkit/core';\nimport { Tree, DirEntry } from '@angular-devkit/schematics';\n\nexport function visitTSSourceFiles<Result = void>(\n tree: Tree,\n visitor: (\n sourceFile: ts.SourceFile,\n tree: Tree,\n result?: Result\n ) => Result | undefined\n): Result | undefined {\n let result: Result | undefined = undefined;\n for (const sourceFile of visit(tree.root)) {\n result = visitor(sourceFile, tree, result);\n }\n\n return result;\n}\n\nexport function visitTemplates(\n tree: Tree,\n visitor: (\n template: {\n fileName: string;\n content: string;\n inline: boolean;\n start: number;\n },\n tree: Tree\n ) => void\n): void {\n visitTSSourceFiles(tree, (source) => {\n visitComponents(source, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (ts.isPropertyAssignment(n) && ts.isIdentifier(n.name)) {\n if (\n n.name.text === 'template' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n // Need to add an offset of one to the start because the template quotes are\n // not part of the template content.\n const templateStartIdx = n.initializer.getStart() + 1;\n visitor(\n {\n fileName: source.fileName,\n content: n.initializer.text,\n inline: true,\n start: templateStartIdx,\n },\n tree\n );\n return;\n } else if (\n n.name.text === 'templateUrl' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n const parts = normalize(source.fileName).split('/').slice(0, -1);\n const templatePath = resolve(\n normalize(parts.join('/')),\n normalize(n.initializer.text)\n );\n if (!tree.exists(templatePath)) {\n return;\n }\n\n const fileContent = tree.read(templatePath);\n if (!fileContent) {\n return;\n }\n\n visitor(\n {\n fileName: templatePath,\n content: fileContent.toString(),\n inline: false,\n start: 0,\n },\n tree\n );\n return;\n }\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n });\n}\n\nexport function visitNgModuleImports(\n sourceFile: ts.SourceFile,\n callback: (\n importNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'imports');\n}\n\nexport function visitNgModuleExports(\n sourceFile: ts.SourceFile,\n callback: (\n exportNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'exports');\n}\n\nfunction visitNgModuleProperty(\n sourceFile: ts.SourceFile,\n callback: (\n nodes: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void,\n property: string\n) {\n visitNgModules(sourceFile, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (\n ts.isPropertyAssignment(n) &&\n ts.isIdentifier(n.name) &&\n n.name.text === property &&\n ts.isArrayLiteralExpression(n.initializer)\n ) {\n callback(n, n.initializer.elements);\n return;\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n}\nexport function visitComponents(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'Component', callback);\n}\n\nexport function visitNgModules(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'NgModule', callback);\n}\n\nexport function visitDecorator(\n sourceFile: ts.SourceFile,\n decoratorName: string,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n ts.forEachChild(sourceFile, function findClassDeclaration(node) {\n if (!ts.isClassDeclaration(node)) {\n ts.forEachChild(node, findClassDeclaration);\n }\n\n const classDeclarationNode = node as ts.ClassDeclaration;\n\n if (\n !classDeclarationNode.decorators ||\n !classDeclarationNode.decorators.length\n ) {\n return;\n }\n\n const componentDecorator = classDeclarationNode.decorators.find((d) => {\n return (\n ts.isCallExpression(d.expression) &&\n ts.isIdentifier(d.expression.expression) &&\n d.expression.expression.text === decoratorName\n );\n });\n\n if (!componentDecorator) {\n return;\n }\n\n const { expression } = componentDecorator;\n if (!ts.isCallExpression(expression)) {\n return;\n }\n\n const [arg] = expression.arguments;\n if (!arg || !ts.isObjectLiteralExpression(arg)) {\n return;\n }\n\n callback(classDeclarationNode, arg);\n });\n}\n\nfunction* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {\n for (const path of directory.subfiles) {\n if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n const entry = directory.file(path);\n if (entry) {\n const content = entry.content;\n const source = ts.createSourceFile(\n entry.path,\n content.toString().replace(/^\\uFEFF/, ''),\n ts.ScriptTarget.Latest,\n true\n );\n yield source;\n }\n }\n }\n\n for (const path of directory.subdirs) {\n if (path === 'node_modules') {\n continue;\n }\n\n yield* visit(directory.dir(path));\n }\n}\n"]}
1
+ {"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,6CAA0D;AAG1D,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAIuB;;IAEvB,IAAI,MAAM,GAAuB,SAAS,CAAC;;QAC3C,KAAyB,IAAA,KAAA,SAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,gBAAA,4BAAE;YAAtC,IAAM,UAAU,WAAA;YACnB,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SAC5C;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,gD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;CAErC","sourcesContent":["import * as ts from 'typescript';\nimport { normalize, resolve } from '@angular-devkit/core';\nimport { Tree, DirEntry } from '@angular-devkit/schematics';\n\nexport function visitTSSourceFiles<Result = void>(\n tree: Tree,\n visitor: (\n sourceFile: ts.SourceFile,\n tree: Tree,\n result?: Result\n ) => Result | undefined\n): Result | undefined {\n let result: Result | undefined = undefined;\n for (const sourceFile of visit(tree.root)) {\n result = visitor(sourceFile, tree, result);\n }\n\n return result;\n}\n\nexport function visitTemplates(\n tree: Tree,\n visitor: (\n template: {\n fileName: string;\n content: string;\n inline: boolean;\n start: number;\n },\n tree: Tree\n ) => void\n): void {\n visitTSSourceFiles(tree, (source) => {\n visitComponents(source, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (ts.isPropertyAssignment(n) && ts.isIdentifier(n.name)) {\n if (\n n.name.text === 'template' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n // Need to add an offset of one to the start because the template quotes are\n // not part of the template content.\n const templateStartIdx = n.initializer.getStart() + 1;\n visitor(\n {\n fileName: source.fileName,\n content: n.initializer.text,\n inline: true,\n start: templateStartIdx,\n },\n tree\n );\n return;\n } else if (\n n.name.text === 'templateUrl' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n const parts = normalize(source.fileName).split('/').slice(0, -1);\n const templatePath = resolve(\n normalize(parts.join('/')),\n normalize(n.initializer.text)\n );\n if (!tree.exists(templatePath)) {\n return;\n }\n\n const fileContent = tree.read(templatePath);\n if (!fileContent) {\n return;\n }\n\n visitor(\n {\n fileName: templatePath,\n content: fileContent.toString(),\n inline: false,\n start: 0,\n },\n tree\n );\n return;\n }\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n });\n}\n\nexport function visitNgModuleImports(\n sourceFile: ts.SourceFile,\n callback: (\n importNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'imports');\n}\n\nexport function visitNgModuleExports(\n sourceFile: ts.SourceFile,\n callback: (\n exportNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'exports');\n}\n\nfunction visitNgModuleProperty(\n sourceFile: ts.SourceFile,\n callback: (\n nodes: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void,\n property: string\n) {\n visitNgModules(sourceFile, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (\n ts.isPropertyAssignment(n) &&\n ts.isIdentifier(n.name) &&\n n.name.text === property &&\n ts.isArrayLiteralExpression(n.initializer)\n ) {\n callback(n, n.initializer.elements);\n return;\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n}\nexport function visitComponents(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'Component', callback);\n}\n\nexport function visitNgModules(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'NgModule', callback);\n}\n\nexport function visitDecorator(\n sourceFile: ts.SourceFile,\n decoratorName: string,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n ts.forEachChild(sourceFile, function findClassDeclaration(node) {\n if (!ts.isClassDeclaration(node)) {\n ts.forEachChild(node, findClassDeclaration);\n }\n\n const classDeclarationNode = node as ts.ClassDeclaration;\n\n if (\n !classDeclarationNode.decorators ||\n !classDeclarationNode.decorators.length\n ) {\n return;\n }\n\n const componentDecorator = classDeclarationNode.decorators.find((d) => {\n return (\n ts.isCallExpression(d.expression) &&\n ts.isIdentifier(d.expression.expression) &&\n d.expression.expression.text === decoratorName\n );\n });\n\n if (!componentDecorator) {\n return;\n }\n\n const { expression } = componentDecorator;\n if (!ts.isCallExpression(expression)) {\n return;\n }\n\n const [arg] = expression.arguments;\n if (!arg || !ts.isObjectLiteralExpression(arg)) {\n return;\n }\n\n callback(classDeclarationNode, arg);\n });\n}\n\nfunction* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {\n for (const path of directory.subfiles) {\n if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n const entry = directory.file(path);\n if (entry) {\n const content = entry.content;\n const source = ts.createSourceFile(\n entry.path,\n content.toString().replace(/^\\uFEFF/, ''),\n ts.ScriptTarget.Latest,\n true\n );\n yield source;\n }\n }\n }\n\n for (const path of directory.subdirs) {\n if (path === 'node_modules') {\n continue;\n }\n\n yield* visit(directory.dir(path));\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { EntityOp } from './entity-op';
2
2
  import { EntityAction, EntityActionOptions, EntityActionPayload } from './entity-action';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class EntityActionFactory {
4
5
  /**
5
6
  * Create an EntityAction to perform an operation (op) for a particular entity type
@@ -32,4 +33,6 @@ export declare class EntityActionFactory {
32
33
  */
33
34
  createFromAction<P = any>(from: EntityAction, newProperties: Partial<EntityActionPayload<P>>): EntityAction<P>;
34
35
  formatActionType(op: string, tag: string): string;
36
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityActionFactory, never>;
37
+ static ɵprov: i0.ɵɵInjectableDeclaration<EntityActionFactory>;
35
38
  }
@@ -4,6 +4,7 @@ import { Update } from '@ngrx/entity';
4
4
  import { DefaultDataServiceConfig } from './default-data-service-config';
5
5
  import { EntityCollectionDataService, HttpMethods, QueryParams } from './interfaces';
6
6
  import { HttpUrlGenerator } from './http-url-generator';
7
+ import * as i0 from "@angular/core";
7
8
  /**
8
9
  * A basic, generic entity data service
9
10
  * suitable for persistence of most entities.
@@ -49,4 +50,6 @@ export declare class DefaultDataServiceFactory {
49
50
  * @param entityName {string} Name of the entity type for this data service
50
51
  */
51
52
  create<T>(entityName: string): EntityCollectionDataService<T>;
53
+ static ɵfac: i0.ɵɵFactoryDeclaration<DefaultDataServiceFactory, [null, null, { optional: true; }]>;
54
+ static ɵprov: i0.ɵɵInjectableDeclaration<DefaultDataServiceFactory>;
52
55
  }
@@ -5,6 +5,7 @@ import { ChangeSet } from '../actions/entity-cache-change-set';
5
5
  import { DefaultDataServiceConfig } from './default-data-service-config';
6
6
  import { EntityDefinitionService } from '../entity-metadata/entity-definition.service';
7
7
  import { RequestData } from './interfaces';
8
+ import * as i0 from "@angular/core";
8
9
  /**
9
10
  * Default data service for making remote service calls targeting the entire EntityCache.
10
11
  * See EntityDataService for services that target a single EntityCollection
@@ -52,4 +53,6 @@ export declare class EntityCacheDataService {
52
53
  * @param entityName name of the entity type
53
54
  */
54
55
  protected getIdSelector(entityName: string): IdSelector<any>;
56
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityCacheDataService, [null, null, { optional: true; }]>;
57
+ static ɵprov: i0.ɵɵInjectableDeclaration<EntityCacheDataService>;
55
58
  }
@@ -1,5 +1,6 @@
1
1
  import { EntityCollectionDataService } from './interfaces';
2
2
  import { DefaultDataServiceFactory } from './default-data.service';
3
+ import * as i0 from "@angular/core";
3
4
  /**
4
5
  * Registry of EntityCollection data services that make REST-like CRUD calls
5
6
  * to entity collection endpoints.
@@ -42,4 +43,6 @@ export declare class EntityDataService {
42
43
  registerServices(services: {
43
44
  [name: string]: EntityCollectionDataService<any>;
44
45
  }): void;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataService, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<EntityDataService>;
45
48
  }
@@ -1,4 +1,5 @@
1
1
  import { Pluralizer } from '../utils/interfaces';
2
+ import * as i0 from "@angular/core";
2
3
  /**
3
4
  * Known resource URLS for specific entity types.
4
5
  * Each entity's resource URLS are endpoints that
@@ -86,6 +87,8 @@ export declare class DefaultHttpUrlGenerator implements HttpUrlGenerator {
86
87
  * Note: this method does not ensure that resource urls are well-formed.
87
88
  */
88
89
  registerHttpResourceUrls(entityHttpResourceUrls: EntityHttpResourceUrls): void;
90
+ static ɵfac: i0.ɵɵFactoryDeclaration<DefaultHttpUrlGenerator, never>;
91
+ static ɵprov: i0.ɵɵInjectableDeclaration<DefaultHttpUrlGenerator>;
89
92
  }
90
93
  /** Remove leading & trailing spaces or slashes */
91
94
  export declare function normalizeRoot(root: string): string;
@@ -3,6 +3,7 @@ import { DataServiceError, EntityActionDataServiceError } from './data-service-e
3
3
  import { EntityAction } from '../actions/entity-action';
4
4
  import { EntityActionFactory } from '../actions/entity-action-factory';
5
5
  import { Logger } from '../utils/interfaces';
6
+ import * as i0 from "@angular/core";
6
7
  /**
7
8
  * Handling of responses from persistence operation
8
9
  */
@@ -24,4 +25,6 @@ export declare class DefaultPersistenceResultHandler implements PersistenceResul
24
25
  handleSuccess(originalAction: EntityAction): (data: any) => Action;
25
26
  /** Handle error result of persistence operation on an EntityAction */
26
27
  handleError(originalAction: EntityAction): (error: DataServiceError | Error) => EntityAction<EntityActionDataServiceError>;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<DefaultPersistenceResultHandler, never>;
29
+ static ɵprov: i0.ɵɵInjectableDeclaration<DefaultPersistenceResultHandler>;
27
30
  }
@@ -7,6 +7,7 @@ import { EntityDispatcherDefaultOptions } from './entity-dispatcher-default-opti
7
7
  import { MergeStrategy } from '../actions/merge-strategy';
8
8
  import { ChangeSet, ChangeSetItem } from '../actions/entity-cache-change-set';
9
9
  import { EntityCacheQuerySet } from '../actions/entity-cache-action';
10
+ import * as i0 from "@angular/core";
10
11
  /**
11
12
  * Dispatches Entity Cache actions to the EntityCache reducer
12
13
  */
@@ -108,4 +109,6 @@ export declare class EntityCacheDispatcher {
108
109
  * @param crid The correlationId for both the save and response actions.
109
110
  */
110
111
  private getSaveEntitiesResponseData$;
112
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityCacheDispatcher, never>;
113
+ static ɵprov: i0.ɵɵInjectableDeclaration<EntityCacheDispatcher>;
111
114
  }