@ngrx/data 14.3.2 → 15.0.0-beta.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.
- package/esm2020/src/actions/entity-action-factory.mjs +3 -3
- package/esm2020/src/dataservices/default-data.service.mjs +3 -3
- package/esm2020/src/dataservices/entity-cache-data.service.mjs +3 -3
- package/esm2020/src/dataservices/entity-data.service.mjs +3 -3
- package/esm2020/src/dataservices/http-url-generator.mjs +3 -3
- package/esm2020/src/dataservices/persistence-result-handler.service.mjs +3 -3
- package/esm2020/src/dispatchers/entity-cache-dispatcher.mjs +3 -3
- package/esm2020/src/dispatchers/entity-dispatcher-default-options.mjs +3 -3
- package/esm2020/src/dispatchers/entity-dispatcher-factory.mjs +3 -3
- package/esm2020/src/effects/entity-cache-effects.mjs +3 -3
- package/esm2020/src/effects/entity-effects.mjs +3 -3
- package/esm2020/src/entity-data-config.mjs +2 -0
- package/esm2020/src/entity-data-without-effects.module.mjs +10 -141
- package/esm2020/src/entity-data.module.mjs +11 -102
- package/esm2020/src/entity-metadata/entity-definition.service.mjs +3 -3
- package/esm2020/src/entity-services/entity-collection-service-elements-factory.mjs +3 -3
- package/esm2020/src/entity-services/entity-collection-service-factory.mjs +3 -3
- package/esm2020/src/entity-services/entity-services-base.mjs +3 -3
- package/esm2020/src/entity-services/entity-services-elements.mjs +3 -3
- package/esm2020/src/index.mjs +4 -2
- package/esm2020/src/provide-entity-data.mjs +222 -0
- package/esm2020/src/reducers/entity-cache-reducer.mjs +3 -3
- package/esm2020/src/reducers/entity-collection-creator.mjs +3 -3
- package/esm2020/src/reducers/entity-collection-reducer-methods.mjs +3 -3
- package/esm2020/src/reducers/entity-collection-reducer-registry.mjs +3 -3
- package/esm2020/src/reducers/entity-collection-reducer.mjs +3 -3
- package/esm2020/src/selectors/entity-selectors$.mjs +3 -3
- package/esm2020/src/selectors/entity-selectors.mjs +3 -3
- package/esm2020/src/utils/correlation-id-generator.mjs +3 -3
- package/esm2020/src/utils/default-logger.mjs +3 -3
- package/esm2020/src/utils/default-pluralizer.mjs +3 -3
- package/fesm2015/ngrx-data.mjs +293 -291
- package/fesm2015/ngrx-data.mjs.map +1 -1
- package/fesm2020/ngrx-data.mjs +293 -289
- package/fesm2020/ngrx-data.mjs.map +1 -1
- package/package.json +6 -6
- package/schematics-core/index.js +1 -3
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/visitors.js +1 -2
- package/schematics-core/utility/visitors.js.map +1 -1
- package/src/entity-data-config.d.ts +15 -0
- package/src/entity-data-without-effects.module.d.ts +5 -28
- package/src/entity-data.module.d.ts +2 -14
- package/src/index.d.ts +3 -1
- package/src/provide-entity-data.d.ts +78 -0
- package/src/selectors/entity-selectors.d.ts +1 -1
- package/schematics-core/utility/decorators.js +0 -15
- package/schematics-core/utility/decorators.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrx/data",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0-beta.1",
|
|
4
4
|
"description": "API management for NgRx",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/ngrx/platform#readme",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@angular/common": "^
|
|
24
|
-
"@angular/core": "^
|
|
25
|
-
"@ngrx/store": "
|
|
26
|
-
"@ngrx/effects": "
|
|
27
|
-
"@ngrx/entity": "
|
|
23
|
+
"@angular/common": "^15.0.0",
|
|
24
|
+
"@angular/core": "^15.0.0",
|
|
25
|
+
"@ngrx/store": "15.0.0-beta.1",
|
|
26
|
+
"@ngrx/effects": "15.0.0-beta.1",
|
|
27
|
+
"@ngrx/entity": "15.0.0-beta.1",
|
|
28
28
|
"rxjs": "^6.5.3 || ^7.5.0"
|
|
29
29
|
},
|
|
30
30
|
"schematics": "./schematics/collection.json",
|
package/schematics-core/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
13
|
exports.__esModule = true;
|
|
14
|
-
exports.
|
|
14
|
+
exports.visitTemplates = exports.visitNgModules = exports.visitDecorator = exports.visitComponents = exports.visitNgModuleExports = exports.visitNgModuleImports = exports.visitTSSourceFiles = exports.platformVersion = exports.addPackageToPackageJson = exports.parseName = exports.updatePackage = exports.stringUtils = exports.isLib = exports.getProject = exports.getProjectPath = exports.getPrefix = exports.omit = exports.addReducerToActionReducerMap = exports.addReducerImportToNgModule = exports.addReducerToStateInterface = exports.addReducerToState = exports.findPropertyInAstObject = exports.buildRelativePath = exports.findModuleFromOptions = exports.findModule = exports.findComponentFromOptions = exports.getWorkspacePath = exports.getWorkspace = exports.commitChanges = exports.createChangeRecorder = exports.createReplaceChange = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = exports.containsProperty = exports.replaceImport = exports.addProviderToModule = exports.addProviderToComponent = exports.addImportToModule = exports.addExportToModule = exports.addDeclarationToModule = exports.addBootstrapToModule = exports.insertImport = exports.insertAfterLastOccurrence = exports.getContentOfKeyLiteral = exports.getDecoratorMetadata = exports.getSourceNodes = exports.findNodes = void 0;
|
|
15
15
|
var strings_1 = require("./utility/strings");
|
|
16
16
|
var ast_utils_1 = require("./utility/ast-utils");
|
|
17
17
|
__createBinding(exports, ast_utils_1, "findNodes");
|
|
@@ -85,6 +85,4 @@ __createBinding(exports, visitors_1, "visitComponents");
|
|
|
85
85
|
__createBinding(exports, visitors_1, "visitDecorator");
|
|
86
86
|
__createBinding(exports, visitors_1, "visitNgModules");
|
|
87
87
|
__createBinding(exports, visitors_1, "visitTemplates");
|
|
88
|
-
var decorators_1 = require("./utility/decorators");
|
|
89
|
-
__createBinding(exports, decorators_1, "getNodeDecorators");
|
|
90
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/data/schematics-core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAU2B;AAE3B,iDAe6B;AAd3B,mDAAS;AACT,wDAAc;AACd,8DAAoB;AACpB,gEAAsB;AACtB,mEAAyB;AACzB,sDAAY;AACZ,8DAAoB;AACpB,gEAAsB;AACtB,2DAAiB;AACjB,2DAAiB;AACjB,gEAAsB;AACtB,6DAAmB;AACnB,uDAAa;AACb,0DAAgB;AAGlB,2CAU0B;AAPxB,iDAAU;AACV,mDAAY;AACZ,mDAAY;AACZ,oDAAa;AACb,0DAAmB;AACnB,2DAAoB;AACpB,oDAAa;AAGf,2CAA6E;AAAzD,mDAAY;AAAE,uDAAgB;AAElD,2DAAoE;AAA3D,uEAAwB;AAEjC,qDAK+B;AAJ7B,sDAAU;AACV,iEAAqB;AACrB,6DAAiB;AAInB,qDAAgE;AAAvD,mEAAuB;AAEhC,mDAO8B;AAN5B,4DAAiB;AACjB,qEAA0B;AAC1B,qEAA0B;AAC1B,uEAA4B;AAC5B,+CAAI;AACJ,oDAAS;AAGX,6CAAsE;AAA7D,sDAAc;AAAE,kDAAU;AAAE,6CAAK;AAE7B,QAAA,WAAW,GAAG;IACzB,SAAS,qBAAA;IACT,UAAU,sBAAA;IACV,QAAQ,oBAAA;IACR,QAAQ,oBAAA;IACR,UAAU,sBAAA;IACV,KAAK,iBAAA;IACL,UAAU,sBAAA;IACV,WAAW,uBAAA;IACX,SAAS,qBAAA;CACV,CAAC;AAEF,2CAAiD;AAAxC,oDAAa;AAEtB,mDAAiD;AAAxC,oDAAS;AAElB,6CAA4D;AAAnD,+DAAuB;AAEhC,uDAAyD;AAAhD,4DAAe;AAExB,+CAQ4B;AAP1B,2DAAkB;AAClB,6DAAoB;AACpB,6DAAoB;AACpB,wDAAe;AACf,uDAAc;AACd,uDAAc;AACd,uDAAc
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/data/schematics-core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAU2B;AAE3B,iDAe6B;AAd3B,mDAAS;AACT,wDAAc;AACd,8DAAoB;AACpB,gEAAsB;AACtB,mEAAyB;AACzB,sDAAY;AACZ,8DAAoB;AACpB,gEAAsB;AACtB,2DAAiB;AACjB,2DAAiB;AACjB,gEAAsB;AACtB,6DAAmB;AACnB,uDAAa;AACb,0DAAgB;AAGlB,2CAU0B;AAPxB,iDAAU;AACV,mDAAY;AACZ,mDAAY;AACZ,oDAAa;AACb,0DAAmB;AACnB,2DAAoB;AACpB,oDAAa;AAGf,2CAA6E;AAAzD,mDAAY;AAAE,uDAAgB;AAElD,2DAAoE;AAA3D,uEAAwB;AAEjC,qDAK+B;AAJ7B,sDAAU;AACV,iEAAqB;AACrB,6DAAiB;AAInB,qDAAgE;AAAvD,mEAAuB;AAEhC,mDAO8B;AAN5B,4DAAiB;AACjB,qEAA0B;AAC1B,qEAA0B;AAC1B,uEAA4B;AAC5B,+CAAI;AACJ,oDAAS;AAGX,6CAAsE;AAA7D,sDAAc;AAAE,kDAAU;AAAE,6CAAK;AAE7B,QAAA,WAAW,GAAG;IACzB,SAAS,qBAAA;IACT,UAAU,sBAAA;IACV,QAAQ,oBAAA;IACR,QAAQ,oBAAA;IACR,UAAU,sBAAA;IACV,KAAK,iBAAA;IACL,UAAU,sBAAA;IACV,WAAW,uBAAA;IACX,SAAS,qBAAA;CACV,CAAC;AAEF,2CAAiD;AAAxC,oDAAa;AAEtB,mDAAiD;AAAxC,oDAAS;AAElB,6CAA4D;AAAnD,+DAAuB;AAEhC,uDAAyD;AAAhD,4DAAe;AAExB,+CAQ4B;AAP1B,2DAAkB;AAClB,6DAAoB;AACpB,6DAAoB;AACpB,wDAAe;AACf,uDAAc;AACd,uDAAc;AACd,uDAAc","sourcesContent":["import {\n dasherize,\n decamelize,\n camelize,\n classify,\n underscore,\n group,\n capitalize,\n featurePath,\n pluralize,\n} from './utility/strings';\n\nexport {\n findNodes,\n getSourceNodes,\n getDecoratorMetadata,\n getContentOfKeyLiteral,\n insertAfterLastOccurrence,\n insertImport,\n addBootstrapToModule,\n addDeclarationToModule,\n addExportToModule,\n addImportToModule,\n addProviderToComponent,\n addProviderToModule,\n replaceImport,\n containsProperty,\n} from './utility/ast-utils';\n\nexport {\n Host,\n Change,\n NoopChange,\n InsertChange,\n RemoveChange,\n ReplaceChange,\n createReplaceChange,\n createChangeRecorder,\n commitChanges,\n} from './utility/change';\n\nexport { AppConfig, getWorkspace, getWorkspacePath } from './utility/config';\n\nexport { findComponentFromOptions } from './utility/find-component';\n\nexport {\n findModule,\n findModuleFromOptions,\n buildRelativePath,\n ModuleOptions,\n} from './utility/find-module';\n\nexport { findPropertyInAstObject } from './utility/json-utilts';\n\nexport {\n addReducerToState,\n addReducerToStateInterface,\n addReducerImportToNgModule,\n addReducerToActionReducerMap,\n omit,\n getPrefix,\n} from './utility/ngrx-utils';\n\nexport { getProjectPath, getProject, isLib } from './utility/project';\n\nexport const stringUtils = {\n dasherize,\n decamelize,\n camelize,\n classify,\n underscore,\n group,\n capitalize,\n featurePath,\n pluralize,\n};\n\nexport { updatePackage } from './utility/update';\n\nexport { parseName } from './utility/parse-name';\n\nexport { addPackageToPackageJson } from './utility/package';\n\nexport { platformVersion } from './utility/libs-version';\n\nexport {\n visitTSSourceFiles,\n visitNgModuleImports,\n visitNgModuleExports,\n visitComponents,\n visitDecorator,\n visitNgModules,\n visitTemplates,\n} from './utility/visitors';\n"]}
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAC","sourcesContent":["export const platformVersion = '^15.0.0-beta.1';\n"]}
|
|
@@ -57,7 +57,6 @@ exports.__esModule = true;
|
|
|
57
57
|
exports.visitDecorator = exports.visitNgModules = exports.visitComponents = exports.visitNgModuleExports = exports.visitNgModuleImports = exports.visitTemplates = exports.visitTSSourceFiles = void 0;
|
|
58
58
|
var ts = require("typescript");
|
|
59
59
|
var core_1 = require("@angular-devkit/core");
|
|
60
|
-
var decorators_1 = require("./decorators");
|
|
61
60
|
function visitTSSourceFiles(tree, visitor) {
|
|
62
61
|
var e_1, _a;
|
|
63
62
|
var result = undefined;
|
|
@@ -157,7 +156,7 @@ function visitDecorator(sourceFile, decoratorName, callback) {
|
|
|
157
156
|
ts.forEachChild(node, findClassDeclaration);
|
|
158
157
|
}
|
|
159
158
|
var classDeclarationNode = node;
|
|
160
|
-
var decorators =
|
|
159
|
+
var decorators = ts.getDecorators(classDeclarationNode);
|
|
161
160
|
if (!decorators || !decorators.length) {
|
|
162
161
|
return;
|
|
163
162
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,6CAA0D;AAE1D,2CAAiD;AAEjD,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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BAAjC,SAAiC,CAAC;;;;;;;;;;;;;;;;;;;CAErC","sourcesContent":["import * as ts from 'typescript';\nimport { normalize, resolve } from '@angular-devkit/core';\nimport { Tree, DirEntry } from '@angular-devkit/schematics';\nimport { getNodeDecorators } from './decorators';\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 const decorators = getNodeDecorators(classDeclarationNode);\n\n if (!decorators || !decorators.length) {\n return;\n }\n\n const componentDecorator = 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,gDAcC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAQS;IAET,kBAAkB,CAAC,IAAI,EAAE,UAAC,MAAM;QAC9B,eAAe,CAAC,MAAM,EAAE,UAAC,CAAC,EAAE,uBAAuB;YACjD,EAAE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C,SAAS,IAAA,EAA3B,GAAG,QAAwB,CAAC;QACnC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAAE;YAC9C,OAAO;SACR;QAED,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,wCA4CC;AAED,SAAU,KAAK,CAAC,SAAmB;;;;;;;gBACd,KAAA,SAAA,SAAS,CAAC,QAAQ,CAAA;;;;gBAA1B,IAAI;qBACT,CAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,EAA/C,wBAA+C;gBAC3C,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC/B,KAAK,EAAL,wBAAK;gBACD,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBACxB,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,KAAK,CAAC,IAAI,EACV,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EACzC,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;gBACF,qBAAM,MAAM,EAAA;;gBAAZ,SAAY,CAAC;;;;;;;;;;;;;;;;;;gBAKA,KAAA,SAAA,SAAS,CAAC,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 const decorators = ts.getDecorators(classDeclarationNode);\n\n if (!decorators || !decorators.length) {\n return;\n }\n\n const componentDecorator = 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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { MetaReducer } from '@ngrx/store';
|
|
3
|
+
import { EntityCache } from './reducers/entity-cache';
|
|
4
|
+
import { EntityAction } from './actions/entity-action';
|
|
5
|
+
import { EntityMetadataMap } from './entity-metadata/entity-metadata';
|
|
6
|
+
import { EntityCollection } from './reducers/entity-collection';
|
|
7
|
+
export interface EntityDataModuleConfig {
|
|
8
|
+
entityMetadata?: EntityMetadataMap;
|
|
9
|
+
entityCacheMetaReducers?: (MetaReducer<EntityCache> | InjectionToken<MetaReducer<EntityCache>>)[];
|
|
10
|
+
entityCollectionMetaReducers?: MetaReducer<EntityCollection, EntityAction>[];
|
|
11
|
+
initialEntityCacheState?: EntityCache | (() => EntityCache);
|
|
12
|
+
pluralNames?: {
|
|
13
|
+
[name: string]: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
import { ModuleWithProviders
|
|
2
|
-
import {
|
|
3
|
-
import { EntityAction } from './actions/entity-action';
|
|
4
|
-
import { EntityCache } from './reducers/entity-cache';
|
|
5
|
-
import { EntityCollection } from './reducers/entity-collection';
|
|
6
|
-
import { EntityMetadataMap } from './entity-metadata/entity-metadata';
|
|
7
|
-
import { EntityCacheReducerFactory } from './reducers/entity-cache-reducer';
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { EntityDataModuleConfig } from './entity-data-config';
|
|
8
3
|
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "@ngrx/store";
|
|
10
|
-
export interface EntityDataModuleConfig {
|
|
11
|
-
entityMetadata?: EntityMetadataMap;
|
|
12
|
-
entityCacheMetaReducers?: (MetaReducer<EntityCache, Action> | InjectionToken<MetaReducer<EntityCache, Action>>)[];
|
|
13
|
-
entityCollectionMetaReducers?: MetaReducer<EntityCollection, EntityAction>[];
|
|
14
|
-
initialEntityCacheState?: EntityCache | (() => EntityCache);
|
|
15
|
-
pluralNames?: {
|
|
16
|
-
[name: string]: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
4
|
/**
|
|
20
5
|
* Module without effects or dataservices which means no HTTP calls
|
|
21
6
|
* This module helpful for internal testing.
|
|
22
7
|
* Also helpful for apps that handle server access on their own and
|
|
23
8
|
* therefore opt-out of @ngrx/effects for entities
|
|
24
9
|
*/
|
|
25
|
-
export declare class EntityDataModuleWithoutEffects
|
|
26
|
-
private reducerManager;
|
|
27
|
-
private injector;
|
|
28
|
-
private entityCacheName;
|
|
29
|
-
private initialState;
|
|
30
|
-
private metaReducers;
|
|
31
|
-
private entityCacheFeature;
|
|
10
|
+
export declare class EntityDataModuleWithoutEffects {
|
|
32
11
|
static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModuleWithoutEffects>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModuleWithoutEffects, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
|
36
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModuleWithoutEffects, never, [typeof i1.StoreModule], never>;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModuleWithoutEffects, never>;
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModuleWithoutEffects, never, never, never>;
|
|
37
14
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModuleWithoutEffects>;
|
|
38
15
|
}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { EntityCacheEffects } from './effects/entity-cache-effects';
|
|
4
|
-
import { EntityEffects } from './effects/entity-effects';
|
|
5
|
-
import { EntityDataModuleConfig } from './entity-data-without-effects.module';
|
|
2
|
+
import { EntityDataModuleConfig } from './entity-data-config';
|
|
6
3
|
import * as i0 from "@angular/core";
|
|
7
4
|
import * as i1 from "./entity-data-without-effects.module";
|
|
8
|
-
import * as i2 from "@ngrx/effects";
|
|
9
5
|
/**
|
|
10
6
|
* entity-data main module includes effects and HTTP data services
|
|
11
7
|
* Configure with `forRoot`.
|
|
12
8
|
* No `forFeature` yet.
|
|
13
9
|
*/
|
|
14
10
|
export declare class EntityDataModule {
|
|
15
|
-
private effectSources;
|
|
16
11
|
static forRoot(config: EntityDataModuleConfig): ModuleWithProviders<EntityDataModule>;
|
|
17
|
-
constructor(effectSources: EffectSources, entityCacheEffects: EntityCacheEffects, entityEffects: EntityEffects);
|
|
18
|
-
/**
|
|
19
|
-
* Add another class instance that contains effects.
|
|
20
|
-
* @param effectSourceInstance a class instance that implements effects.
|
|
21
|
-
* Warning: undocumented @ngrx/effects API
|
|
22
|
-
*/
|
|
23
|
-
addEffects(effectSourceInstance: any): void;
|
|
24
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataModule, never>;
|
|
25
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModule, never, [typeof i1.EntityDataModuleWithoutEffects
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityDataModule, never, [typeof i1.EntityDataModuleWithoutEffects], never>;
|
|
26
14
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntityDataModule>;
|
|
27
15
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -59,5 +59,7 @@ export { DefaultPluralizer } from './utils/default-pluralizer';
|
|
|
59
59
|
export { getGuid, getGuidComb, guidComparer } from './utils/guid-fns';
|
|
60
60
|
export { Logger, EntityPluralNames, PLURAL_NAMES_TOKEN, Pluralizer, } from './utils/interfaces';
|
|
61
61
|
export { defaultSelectId, flattenArgs, toUpdateFactory, } from './utils/utilities';
|
|
62
|
-
export { EntityDataModuleConfig
|
|
62
|
+
export { EntityDataModuleConfig } from './entity-data-config';
|
|
63
|
+
export { EntityDataModuleWithoutEffects } from './entity-data-without-effects.module';
|
|
63
64
|
export { EntityDataModule } from './entity-data.module';
|
|
65
|
+
export { provideEntityData, withEffects } from './provide-entity-data';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { EnvironmentProviders, Provider } from '@angular/core';
|
|
2
|
+
import { EntityDataModuleConfig } from './entity-data-config';
|
|
3
|
+
export declare const BASE_ENTITY_DATA_PROVIDERS: Provider[];
|
|
4
|
+
export declare const ENTITY_DATA_EFFECTS_PROVIDERS: Provider[];
|
|
5
|
+
export declare function provideEntityDataConfig(config: EntityDataModuleConfig): Provider[];
|
|
6
|
+
/**
|
|
7
|
+
* Sets up base entity data providers with entity config.
|
|
8
|
+
* This function should to be used at the root level.
|
|
9
|
+
*
|
|
10
|
+
* @usageNotes
|
|
11
|
+
*
|
|
12
|
+
* ### Providing entity data with effects
|
|
13
|
+
*
|
|
14
|
+
* When used with `withEffects` feature, the `provideEntityData` function is
|
|
15
|
+
* an alternative to `EntityDataModule.forRoot`
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { provideStore } from '@ngrx/store';
|
|
19
|
+
* import { provideEffects } from '@ngrx/effects';
|
|
20
|
+
* import {
|
|
21
|
+
* EntityMetadataMap,
|
|
22
|
+
* provideEntityData,
|
|
23
|
+
* withEffects,
|
|
24
|
+
* } from '@ngrx/data';
|
|
25
|
+
*
|
|
26
|
+
* const entityMetadata: EntityMetadataMap = {
|
|
27
|
+
* Hero: {},
|
|
28
|
+
* Villain: {},
|
|
29
|
+
* };
|
|
30
|
+
* const pluralNames = { Hero: 'Heroes' };
|
|
31
|
+
*
|
|
32
|
+
* bootstrapApplication(AppComponent, {
|
|
33
|
+
* providers: [
|
|
34
|
+
* provideStore(),
|
|
35
|
+
* provideEffects(),
|
|
36
|
+
* provideEntityData({ entityMetadata, pluralNames }, withEffects()),
|
|
37
|
+
* ],
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ### Providing entity data without effects
|
|
42
|
+
*
|
|
43
|
+
* When used without `withEffects` feature, the `provideEntityData` function is
|
|
44
|
+
* an alternative to `EntityDataModuleWithoutEffects.forRoot`.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { provideStore } from '@ngrx/store';
|
|
48
|
+
* import { EntityMetadataMap, provideEntityData } from '@ngrx/data';
|
|
49
|
+
*
|
|
50
|
+
* const entityMetadata: EntityMetadataMap = {
|
|
51
|
+
* Musician: {},
|
|
52
|
+
* Song: {},
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* bootstrapApplication(AppComponent, {
|
|
56
|
+
* providers: [
|
|
57
|
+
* provideStore(),
|
|
58
|
+
* provideEntityData({ entityMetadata }),
|
|
59
|
+
* ],
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
export declare function provideEntityData(config: EntityDataModuleConfig, ...features: EntityDataFeature[]): EnvironmentProviders;
|
|
65
|
+
declare enum EntityDataFeatureKind {
|
|
66
|
+
WithEffects = 0
|
|
67
|
+
}
|
|
68
|
+
interface EntityDataFeature {
|
|
69
|
+
ɵkind: EntityDataFeatureKind;
|
|
70
|
+
ɵproviders: Provider[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Registers entity data effects and provides HTTP data services.
|
|
74
|
+
*
|
|
75
|
+
* @see `provideEntityData`
|
|
76
|
+
*/
|
|
77
|
+
export declare function withEffects(): EntityDataFeature;
|
|
78
|
+
export {};
|
|
@@ -75,7 +75,7 @@ export declare class EntitySelectorsFactory {
|
|
|
75
75
|
* e.g. from Object to Heroes.
|
|
76
76
|
* @param entityName the name of the collection
|
|
77
77
|
*/
|
|
78
|
-
createCollectionSelector<T = any, C extends EntityCollection<T> = EntityCollection<T>>(entityName: string): MemoizedSelector<Object, C,
|
|
78
|
+
createCollectionSelector<T = any, C extends EntityCollection<T> = EntityCollection<T>>(entityName: string): MemoizedSelector<Object, C, (s1: EntityCache) => C>;
|
|
79
79
|
/**
|
|
80
80
|
* Creates entity collection selectors from metadata.
|
|
81
81
|
* @param metadata - EntityMetadata for the collection.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getNodeDecorators = void 0;
|
|
4
|
-
var ts = require("typescript");
|
|
5
|
-
/**
|
|
6
|
-
* In TS 4.8 the `decorators` are combined with the `modifiers` array.
|
|
7
|
-
* Once we drop support for older versions, we can remove this function
|
|
8
|
-
* and use `ts.getDecorators`.
|
|
9
|
-
*/
|
|
10
|
-
function getNodeDecorators(node) {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
return ((_b = (_a = ts).getDecorators) === null || _b === void 0 ? void 0 : _b.call(_a, node)) || node.decorators;
|
|
13
|
-
}
|
|
14
|
-
exports.getNodeDecorators = getNodeDecorators;
|
|
15
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/decorators.ts"],"names":[],"mappings":";;;AAAA,+BAAiC;AAEjC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAa;;IAC7C,OAAO,CAAA,MAAA,MAAC,EAAU,EAAC,aAAa,mDAAG,IAAI,CAAC,KAAI,IAAI,CAAC,UAAU,CAAC;AAC9D,CAAC;AAFD,8CAEC","sourcesContent":["import * as ts from 'typescript';\n\n/**\n * In TS 4.8 the `decorators` are combined with the `modifiers` array.\n * Once we drop support for older versions, we can remove this function\n * and use `ts.getDecorators`.\n */\nexport function getNodeDecorators(node: ts.Node): ts.Decorator[] | undefined {\n return (ts as any).getDecorators?.(node) || node.decorators;\n}\n"]}
|