@processpuzzle/base-entity 1.2.2 → 1.3.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.
- package/README.md +113 -13
- package/assets/i18n/base_entity/de.json +42 -0
- package/assets/i18n/base_entity/en.json +42 -0
- package/assets/i18n/base_entity/es.json +42 -0
- package/assets/i18n/base_entity/fr.json +42 -0
- package/assets/i18n/base_entity/hu.json +42 -0
- package/fesm2022/processpuzzle-base-entity.mjs +9949 -4089
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/package.json +2 -2
- package/types/processpuzzle-base-entity.d.ts +2732 -757
- package/types/processpuzzle-base-entity.d.ts.map +1 -1
|
@@ -1,484 +1,1123 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { SelectionModel } from
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { AfterViewInit, EnvironmentProviders, InjectionToken, Injector, InputSignal, OnDestroy, OnInit, PipeTransform, Provider, ProviderToken, Signal, TemplateRef, Type, ViewContainerRef, WritableSignal } from "@angular/core";
|
|
4
|
+
import { MatSnackBar } from "@angular/material/snack-bar";
|
|
5
|
+
import { ActivatedRouteSnapshot, CanActivateFn, Route, Routes } from "@angular/router";
|
|
6
|
+
import { DocumentData, DocumentSnapshot, Firestore, WhereFilterOp, collection, deleteDoc, doc, getDoc, getDocs, limit, orderBy, query, setDoc, updateDoc, where } from "@angular/fire/firestore";
|
|
7
|
+
import { WritableStateSource } from "@ngrx/signals";
|
|
8
|
+
import { MatTableDataSource } from "@angular/material/table";
|
|
9
|
+
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
|
10
|
+
import { FormGroup } from "@angular/forms";
|
|
11
|
+
import { NGXLogger } from "ngx-logging-kit";
|
|
12
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
13
|
+
import { MatSort } from "@angular/material/sort";
|
|
14
|
+
import { MatPaginator } from "@angular/material/paginator";
|
|
15
|
+
import { SelectionModel } from "@angular/cdk/collections";
|
|
16
|
+
import "reflect-metadata";
|
|
17
|
+
import { TranslationSource } from "@processpuzzle/util";
|
|
18
|
+
export declare enum FormControlType {
|
|
19
|
+
ADDITIONAL_PROPERTIES = "ADDITIONAL_PROPERTIES",
|
|
20
|
+
ARTIFACT = "ARTIFACT",
|
|
21
|
+
CHECKBOX = "CHECKBOX",
|
|
22
|
+
COMPONENTS = "COMPONENTS",
|
|
23
|
+
/** Rendered by the descriptor's own `component` — the extension point for controls base-entity cannot know. */
|
|
24
|
+
CUSTOM = "CUSTOM",
|
|
25
|
+
DATE = "DATE",
|
|
26
|
+
DROPDOWN = "DROPDOWN",
|
|
27
|
+
EMBEDDED_COMPONENTS = "EMBEDDED_COMPONENTS",
|
|
28
|
+
FLEX_BOX = "FLEX_BOX",
|
|
29
|
+
FOREIGN_KEY = "FOREIGN_KEY",
|
|
30
|
+
LABEL = "LABEL",
|
|
31
|
+
LOOKUP = "LOOKUP",
|
|
32
|
+
RADIO = "RADIO",
|
|
33
|
+
RELATED_ENTITIES = "RELATED_ENTITIES",
|
|
34
|
+
TAGS = "TAGS",
|
|
35
|
+
TITLE = "TITLE",
|
|
36
|
+
TEXT_BOX = "TEXT_BOX",
|
|
37
|
+
TEXTAREA = "TEXTAREA"
|
|
38
|
+
}
|
|
39
|
+
export declare abstract class AbstractAttrDescriptor {
|
|
40
|
+
attrName: string;
|
|
41
|
+
formControlType: FormControlType;
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
style: {
|
|
44
|
+
[p: string]: unknown;
|
|
45
|
+
} | null | undefined;
|
|
46
|
+
/** Optional override for the transloco key segment of this attribute. Defaults to {@link attrName}. */
|
|
47
|
+
labelKey?: string;
|
|
48
|
+
private _scopeRoot?;
|
|
49
|
+
protected constructor(attrName: string, formControlType: FormControlType);
|
|
50
|
+
/**
|
|
51
|
+
* Called by the owning {@link BaseEntityDescriptor} to stamp the entity's transloco key root
|
|
52
|
+
* (`i18nScope` override, or the value derived from the entity name) onto this attribute.
|
|
53
|
+
*/
|
|
54
|
+
setI18nContext(scopeRoot: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Full transloco key for this attribute's label: `<scopeRoot>.<labelKey|attrName>`. The root
|
|
57
|
+
* identifies the entity (see {@link BaseEntityDescriptor.i18nKey}). Returns `undefined` until the
|
|
58
|
+
* owning descriptor has stamped the context — a bare `attrName` would be a root-level key and could
|
|
59
|
+
* collide with an unrelated translation in the consuming app.
|
|
60
|
+
*/
|
|
61
|
+
i18nKey(): string | undefined;
|
|
62
|
+
}
|
|
61
63
|
interface ArtifactAttr {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
readonly bucket: string;
|
|
65
|
+
readonly objectId: string;
|
|
66
|
+
readonly name: string;
|
|
67
|
+
readonly mimeType: string;
|
|
68
|
+
}
|
|
69
|
+
interface UploadObjectResponse {
|
|
70
|
+
objectID: string;
|
|
71
|
+
fileName: string;
|
|
72
|
+
mimeType: string;
|
|
73
|
+
bucketName?: string;
|
|
74
|
+
}
|
|
75
|
+
interface ObjectDownloadResponse {
|
|
76
|
+
data: Blob;
|
|
77
|
+
fileName?: string;
|
|
78
|
+
bucketName?: string;
|
|
79
|
+
}
|
|
80
|
+
interface ObjectUriResponse {
|
|
81
|
+
uri: string;
|
|
82
|
+
}
|
|
83
|
+
export declare class ObjectStoreService {
|
|
84
|
+
private readonly runtimeConfiguration;
|
|
85
|
+
private readonly httpClient;
|
|
86
|
+
private readonly baseUrl;
|
|
87
|
+
uploadObject(file: Blob, name: string, mimeType: string): Observable<UploadObjectResponse>;
|
|
88
|
+
getObjectByID(bucketName: string, objectID: string): Observable<ObjectDownloadResponse>;
|
|
89
|
+
deleteObjectByID(bucketName: string, objectID: string): Observable<void>;
|
|
90
|
+
getObjectUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse>;
|
|
91
|
+
getThumbnailUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse | null>;
|
|
92
|
+
private buildFullUrl;
|
|
93
|
+
private resolveBaseUrl;
|
|
94
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ObjectStoreService, never>;
|
|
95
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
96
|
+
}
|
|
97
|
+
type Selectable = {
|
|
98
|
+
key: string;
|
|
99
|
+
value: unknown;
|
|
100
|
+
};
|
|
101
|
+
type SelectablesInput = Array<Selectable> | (() => Array<Selectable>);
|
|
102
|
+
export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
103
|
+
description?: string;
|
|
104
|
+
styleClass?: string | undefined;
|
|
105
|
+
labelClass?: string;
|
|
106
|
+
format?: string;
|
|
107
|
+
isLinkToDetails?: boolean;
|
|
108
|
+
selectables?: SelectablesInput;
|
|
109
|
+
visible: boolean;
|
|
110
|
+
showThumbnail?: boolean;
|
|
111
|
+
hideInTable?: boolean;
|
|
112
|
+
isHeading?: boolean;
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
lines?: number;
|
|
115
|
+
options: {
|
|
116
|
+
inputType: 'text';
|
|
117
|
+
};
|
|
118
|
+
required: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Regular-expression source the value has to match, applied as `Validators.pattern` and anchored by
|
|
121
|
+
* Angular at both ends.
|
|
122
|
+
*
|
|
123
|
+
* For a field the backend constrains beyond "not empty" — a URL slug, a locale tag, an identifier — so the
|
|
124
|
+
* form rejects it where the user typed it rather than letting the save come back a 400 with a message from
|
|
125
|
+
* the server's validation locale. Write the source without delimiters, exactly as the contract's `pattern`
|
|
126
|
+
* gives it: `'^[a-z0-9]+(-[a-z0-9]+)*$'`.
|
|
127
|
+
*/
|
|
128
|
+
pattern?: string;
|
|
129
|
+
referenceIdField?: string;
|
|
130
|
+
/**
|
|
131
|
+
* The control of a {@link FormControlType.CUSTOM} attribute: a `BaseFormControlComponent` subclass the form
|
|
132
|
+
* builder creates like any built-in control. Typed loosely because the base class is generic over the entity
|
|
133
|
+
* and lives in the form layer, which this descriptor must not import.
|
|
134
|
+
*/
|
|
135
|
+
component?: Type<unknown>;
|
|
136
|
+
private _label?;
|
|
137
|
+
private _linkedEntityType?;
|
|
138
|
+
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: SelectablesInput, isLinkToDetails?: boolean, options?: object);
|
|
139
|
+
getSelectables(): Array<Selectable> | undefined;
|
|
140
|
+
get label(): string;
|
|
141
|
+
set label(label: string);
|
|
142
|
+
get linkedEntityType(): string | undefined;
|
|
143
|
+
set linkedEntityType(linkedEntityType: string | undefined);
|
|
66
144
|
}
|
|
67
|
-
|
|
68
145
|
type EntityTitle = string | (() => string);
|
|
69
146
|
type ExtraFormActionsTemplate = () => TemplateRef<unknown> | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* A screen of this entity beyond the generic List and Details, contributed by the feature that owns the
|
|
149
|
+
* entity: `Document` adds a content editor, and a workflow definition is expected to add its diagram.
|
|
150
|
+
*
|
|
151
|
+
* Declared on the descriptor rather than wired into `BaseEntityTabsComponent` so the framework stays
|
|
152
|
+
* ignorant of what any one feature needs a third screen *for* — the same reason
|
|
153
|
+
* {@link ExtraFormActionsTemplate} lives here. One and the same value has to be handed to
|
|
154
|
+
* `baseEntityRoutes` (which mounts `:entityId/<segment>`) and to the descriptor (which renders the link),
|
|
155
|
+
* so that the URL a tab navigates to and the URL that resolves a component cannot drift apart.
|
|
156
|
+
*/
|
|
157
|
+
interface EntityTabDescriptor {
|
|
158
|
+
/** Last URL segment of the tab's route, appended to `<entity>/<id>/`. Lower-case, no slashes. */
|
|
159
|
+
segment: string;
|
|
160
|
+
/** Transloco key of the tab's label. Resolved with `{ entity }`, as the generic tab labels are. */
|
|
161
|
+
i18nKey: string;
|
|
162
|
+
/** Component the route mounts. */
|
|
163
|
+
component: Type<unknown>;
|
|
164
|
+
/** Suffix for the link's `data-testid`; defaults to `show-<segment>`. */
|
|
165
|
+
testIdSuffix?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Routes to nest **below** the tab's own route, so the tab's component can host a `<router-outlet>` and
|
|
168
|
+
* the screens inside it get URLs of their own. Only a tab that is itself a container needs this; a leaf
|
|
169
|
+
* tab leaves it undefined and gets exactly the route it always did.
|
|
170
|
+
*
|
|
171
|
+
* Pass `[]` when the children are not known until navigation — they are read fresh from the route on
|
|
172
|
+
* every recognition, so a {@link canMatch} guard may fill them in. See `appShellRoutesGuard` in
|
|
173
|
+
* base-app, which builds an application's routes out of its `AppDefinition` that way.
|
|
174
|
+
*/
|
|
175
|
+
children?: Routes;
|
|
176
|
+
/**
|
|
177
|
+
* Guards deciding whether the tab's route matches. Runs during recognition, before the router reads
|
|
178
|
+
* {@link children}, and may be asynchronous — which is what makes the deferred-children pattern above
|
|
179
|
+
* work on a deep link rather than only after a click.
|
|
180
|
+
*/
|
|
181
|
+
canMatch?: Route['canMatch'];
|
|
182
|
+
}
|
|
70
183
|
interface BaseEntityDescriptorOptions {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
184
|
+
store?: unknown;
|
|
185
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
186
|
+
entityName: string;
|
|
187
|
+
entityTitle?: EntityTitle;
|
|
188
|
+
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
189
|
+
/** Screens beyond List and Details. See {@link EntityTabDescriptor}. */
|
|
190
|
+
extraTabs?: EntityTabDescriptor[];
|
|
191
|
+
/**
|
|
192
|
+
* Optional override for the transloco key root of this entity and its attributes. Defaults to the
|
|
193
|
+
* value derived from {@link entityName} (`"Base Entity"` → `base_entity`); set it only when the
|
|
194
|
+
* registered transloco scope differs from that convention.
|
|
195
|
+
*/
|
|
196
|
+
i18nScope?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Name of the attribute whose value identifies the selected entity in the
|
|
199
|
+
* {@link BaseEntityStatusbarComponent}. Defaults to the `isLinkToDetails` attribute
|
|
200
|
+
* (see {@link componentIdentification}).
|
|
201
|
+
*/
|
|
202
|
+
titleKey?: string;
|
|
203
|
+
isAbstract?: boolean;
|
|
204
|
+
/** Name of the entity this one inherits from. Unrelated to {@link componentParent}. */
|
|
205
|
+
parentEntity?: string;
|
|
206
|
+
route?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Entity name(s) that may aggregate this one as a component. A component *instance* belongs to exactly
|
|
209
|
+
* one parent (1:N containment) — it is created from the parent's form, edited in its own form and
|
|
210
|
+
* deleted outright when removed there. A list is allowed because one component *type* can be hosted by
|
|
211
|
+
* several parent types (an `App Widget` sits under `App Region`, `App Page` and `App Widget`).
|
|
212
|
+
* Leave undefined for a stand-alone entity. Not to be confused with {@link parentEntity}, which is the
|
|
213
|
+
* inheritance supertype.
|
|
214
|
+
*/
|
|
215
|
+
componentParent?: string | string[];
|
|
216
|
+
/**
|
|
217
|
+
* True when the component's payload is carried inside its parent's payload — it has no endpoint and no
|
|
218
|
+
* store of its own, and the parent's save persists it. False (the default) when the component is
|
|
219
|
+
* persisted on its own and points back at its parent through a foreign-key attribute. Meaningless
|
|
220
|
+
* without {@link componentParent}, and rejected without it.
|
|
221
|
+
*/
|
|
222
|
+
isEmbedded?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export declare class BaseEntityDescriptor {
|
|
225
|
+
store: unknown;
|
|
226
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
227
|
+
entityName: string;
|
|
228
|
+
entityTitle: EntityTitle;
|
|
229
|
+
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
230
|
+
extraTabs: EntityTabDescriptor[];
|
|
231
|
+
i18nScope?: string;
|
|
232
|
+
titleKey?: string;
|
|
233
|
+
parentEntity: string | undefined;
|
|
234
|
+
readonly isAbstract: boolean;
|
|
235
|
+
route: string | undefined;
|
|
236
|
+
/** Normalized {@link BaseEntityDescriptorOptions.componentParent}; empty when this is not a component. */
|
|
237
|
+
readonly componentParents: readonly string[];
|
|
238
|
+
readonly isEmbedded: boolean;
|
|
239
|
+
constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, extraTabs, i18nScope, titleKey, isAbstract, parentEntity, route, componentParent, isEmbedded }: BaseEntityDescriptorOptions);
|
|
240
|
+
createTestId(suffix: string): string;
|
|
241
|
+
/** Transloco key root for this entity, derived from {@link entityName} unless {@link i18nScope} overrides it. */
|
|
242
|
+
scopeRoot(): string;
|
|
243
|
+
/**
|
|
244
|
+
* Full transloco key for the entity name: `<scopeRoot>._self`. The reserved `_self` segment keeps the
|
|
245
|
+
* entity name in the same object as its attribute labels without the two colliding.
|
|
246
|
+
*/
|
|
247
|
+
i18nKey(): string;
|
|
248
|
+
/** True when this entity is a part of another one rather than a stand-alone aggregate root. */
|
|
249
|
+
isComponent(): boolean;
|
|
250
|
+
isComponentOf(entityName: string): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Attribute holding this component's reference back to its parent — the `FOREIGN_KEY` attribute whose
|
|
253
|
+
* `linkedEntityType` names one of {@link componentParents}. Returns `undefined` for a stand-alone entity
|
|
254
|
+
* and for an embedded component, neither of which carries such a reference: an embedded component is
|
|
255
|
+
* located by its position in the parent's payload, not by a foreign key.
|
|
256
|
+
*/
|
|
257
|
+
parentReferenceAttrName(): string | undefined;
|
|
258
|
+
componentIdentification(): string;
|
|
259
|
+
/** The attributes that carry embedded children — one route branch, and one row list, per entry. */
|
|
260
|
+
embeddedAttrDescriptors(): BaseEntityAttrDescriptor[];
|
|
261
|
+
/**
|
|
262
|
+
* The attribute carrying `entityName`'s rows. An embedded child is addressed in the URL by its entity
|
|
263
|
+
* name, so two attributes offering the same child type would make that segment ambiguous — hence the
|
|
264
|
+
* error rather than a silent first-match.
|
|
265
|
+
*/
|
|
266
|
+
embeddedAttrFor(entityName: string): BaseEntityAttrDescriptor | undefined;
|
|
267
|
+
/** Name of the attribute whose value labels the selected entity in the status bar. */
|
|
268
|
+
titleAttrName(): string;
|
|
269
|
+
overwriteLinkedEntityAttr(attrName: string, linkedEntityName: string): void;
|
|
270
|
+
}
|
|
118
271
|
interface BaseEntity {
|
|
119
|
-
|
|
272
|
+
readonly id?: string;
|
|
120
273
|
}
|
|
121
274
|
interface PersistedBaseEntity extends BaseEntity {
|
|
122
|
-
|
|
275
|
+
readonly id: string;
|
|
123
276
|
}
|
|
124
277
|
type PersistedEntity<Entity extends BaseEntity> = Entity & PersistedBaseEntity;
|
|
125
|
-
|
|
278
|
+
declare function assertPersistedEntity<Entity extends BaseEntity>(entity: Entity): asserts entity is PersistedEntity<Entity>;
|
|
279
|
+
declare const BASE_ENTITY_MAPPER: InjectionToken<BaseEntityMapper<BaseEntity>>;
|
|
126
280
|
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
127
|
-
|
|
128
|
-
|
|
281
|
+
fromDto(dto: unknown, index?: number): Entity;
|
|
282
|
+
toDto(entity: Entity): unknown;
|
|
129
283
|
}
|
|
130
|
-
declare class SimpleEntityMapper<Entity extends BaseEntity> implements BaseEntityMapper<Entity> {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
284
|
+
export declare class SimpleEntityMapper<Entity extends BaseEntity> implements BaseEntityMapper<Entity> {
|
|
285
|
+
private readonly entityType;
|
|
286
|
+
constructor(entityType: new (...args: unknown[]) => Entity);
|
|
287
|
+
fromDto(dto: unknown): Entity;
|
|
288
|
+
toDto(entity: Entity): unknown;
|
|
135
289
|
}
|
|
136
|
-
declare function getEnumKeyByValue<E>(myEnum: {
|
|
137
|
-
|
|
290
|
+
export declare function getEnumKeyByValue<E>(myEnum: {
|
|
291
|
+
[key: number]: string;
|
|
138
292
|
}, enumValue: number): E | undefined;
|
|
139
|
-
declare function getEnumValueByKey<E>(myEnum: {
|
|
140
|
-
|
|
293
|
+
export declare function getEnumValueByKey<E>(myEnum: {
|
|
294
|
+
[key: string]: E | string;
|
|
141
295
|
}, enumKey: string): E | undefined;
|
|
142
|
-
|
|
296
|
+
interface WhereCondition<Entity extends BaseEntity> {
|
|
297
|
+
field: keyof Entity;
|
|
298
|
+
operator: WhereFilterOp;
|
|
299
|
+
value: Entity[keyof Entity];
|
|
300
|
+
}
|
|
143
301
|
interface OrderByCondition<Entity extends BaseEntity> {
|
|
144
|
-
|
|
145
|
-
|
|
302
|
+
field: keyof Entity;
|
|
303
|
+
order?: OrderByDirection;
|
|
146
304
|
}
|
|
147
305
|
interface FilterCondition {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
306
|
+
property: string;
|
|
307
|
+
operator: WhereFilterOp;
|
|
308
|
+
value: string;
|
|
151
309
|
}
|
|
152
310
|
type LogicalOperator = 'AND' | 'OR';
|
|
153
311
|
interface FilterGroup {
|
|
154
|
-
|
|
155
|
-
|
|
312
|
+
operator: LogicalOperator;
|
|
313
|
+
conditions: Array<FilterCondition | FilterGroup>;
|
|
156
314
|
}
|
|
157
|
-
declare
|
|
158
|
-
|
|
159
|
-
|
|
315
|
+
declare function isFilterGroup(node: FilterCondition | FilterGroup): node is FilterGroup;
|
|
316
|
+
export declare enum OrderByDirection {
|
|
317
|
+
ASC = "asc",
|
|
318
|
+
DESC = "desc"
|
|
160
319
|
}
|
|
161
320
|
interface OrderBy {
|
|
162
|
-
|
|
163
|
-
|
|
321
|
+
property: string;
|
|
322
|
+
direction: string;
|
|
164
323
|
}
|
|
165
324
|
interface BaseEntityQueryCondition {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
325
|
+
path?: string;
|
|
326
|
+
hash?: string;
|
|
327
|
+
page?: number;
|
|
328
|
+
pageSize?: number;
|
|
329
|
+
pathParams?: Map<string, string>;
|
|
330
|
+
filters?: FilterCondition[];
|
|
331
|
+
filterGroup?: FilterGroup;
|
|
332
|
+
orderBys?: OrderBy[];
|
|
333
|
+
query?: string;
|
|
334
|
+
}
|
|
335
|
+
interface FirestoreQuery<Entity extends BaseEntity> {
|
|
336
|
+
limit?: number;
|
|
337
|
+
startAt?: number | string | DocumentSnapshot<Entity>;
|
|
338
|
+
startAfter?: number | string | DocumentSnapshot<Entity> | null;
|
|
339
|
+
endAt?: number | DocumentSnapshot<Entity>;
|
|
340
|
+
endBefore?: number | DocumentSnapshot<Entity>;
|
|
341
|
+
orderBy?: OrderByCondition<Entity>[];
|
|
342
|
+
where?: WhereCondition<Entity>[];
|
|
175
343
|
}
|
|
176
344
|
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<BaseEntity>>;
|
|
345
|
+
number: number | undefined;
|
|
346
|
+
size: number | undefined;
|
|
347
|
+
totalElements: number | undefined;
|
|
348
|
+
totalPages: number | undefined;
|
|
349
|
+
content: Entity[];
|
|
350
|
+
}
|
|
351
|
+
export declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<BaseEntity>>;
|
|
185
352
|
interface BaseEntityService<Entity extends BaseEntity> {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
353
|
+
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
354
|
+
delete(id: string): Observable<unknown>;
|
|
355
|
+
deleteAll(): Observable<unknown>;
|
|
356
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
357
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
358
|
+
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
359
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
360
|
+
}
|
|
195
361
|
type EntityServiceKind = 'rest' | 'firestore';
|
|
196
|
-
declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
362
|
+
export declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
|
|
363
|
+
abstract readonly entityType: Type<Entity>;
|
|
364
|
+
protected readonly serviceKind: EntityServiceKind;
|
|
365
|
+
protected readonly endpoint?: string;
|
|
366
|
+
protected readonly backendRoot?: string;
|
|
367
|
+
protected readonly injector: Injector;
|
|
368
|
+
private _mapper?;
|
|
369
|
+
private _service?;
|
|
370
|
+
private _storeClass?;
|
|
371
|
+
private _storeInstance?;
|
|
372
|
+
private _descriptor?;
|
|
373
|
+
get mapper(): BaseEntityMapper<Entity>;
|
|
374
|
+
get service(): BaseEntityService<Entity>;
|
|
375
|
+
get storeClass(): Type<unknown>;
|
|
376
|
+
get store(): unknown;
|
|
377
|
+
get descriptor(): BaseEntityDescriptor;
|
|
378
|
+
/**
|
|
379
|
+
* Deliberately does not go through {@link descriptor}: the store is created with a repository, and a
|
|
380
|
+
* repository may need to know which entity it serves — as an embedded one does. Binding the store into the
|
|
381
|
+
* descriptor only when the descriptor itself is asked for keeps that from re-entering the store getter and
|
|
382
|
+
* building a second store.
|
|
383
|
+
*/
|
|
384
|
+
get entityName(): string;
|
|
385
|
+
get attrDescriptors(): AbstractAttrDescriptor[];
|
|
386
|
+
get entityTitle(): string;
|
|
387
|
+
protected createMapper(): BaseEntityMapper<Entity>;
|
|
388
|
+
protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
|
|
389
|
+
/** The descriptor as declared, before the store is bound into it. See {@link entityName}. */
|
|
390
|
+
private declaredDescriptor;
|
|
391
|
+
protected createStoreClass(): Type<unknown>;
|
|
392
|
+
protected abstract createDescriptor(): BaseEntityDescriptor;
|
|
393
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
|
|
394
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
395
|
+
}
|
|
396
|
+
export declare const BASE_ENTITY_STORE: InjectionToken<unknown>;
|
|
397
|
+
interface EntityStoreState<Entity extends BaseEntity> {
|
|
398
|
+
entities: Entity[];
|
|
399
|
+
number: number;
|
|
400
|
+
size: number;
|
|
401
|
+
totalElements: number;
|
|
402
|
+
totalPages: number;
|
|
403
|
+
currentId: string | undefined;
|
|
404
|
+
currentEntity: Entity | undefined;
|
|
405
|
+
isLoading: boolean;
|
|
406
|
+
error: string | undefined;
|
|
407
|
+
selectedEntities: Array<Entity>;
|
|
408
|
+
}
|
|
409
|
+
type EntityStoreHandle<Entity extends BaseEntity> = WritableStateSource<EntityStoreState<Entity>> & {
|
|
410
|
+
entities: Signal<Entity[]>;
|
|
411
|
+
selectedEntities: Signal<Entity[]>;
|
|
412
|
+
};
|
|
224
413
|
interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
414
|
+
entities: Signal<Entity[]>;
|
|
415
|
+
selectedEntities: Signal<Entity[]>;
|
|
416
|
+
currentEntity: Signal<Entity | undefined>;
|
|
417
|
+
currentId: Signal<string | undefined>;
|
|
418
|
+
isLoading: Signal<boolean>;
|
|
419
|
+
error: Signal<string | undefined>;
|
|
420
|
+
number: Signal<number>;
|
|
421
|
+
size: Signal<number>;
|
|
422
|
+
totalElements: Signal<number>;
|
|
423
|
+
totalPages: Signal<number>;
|
|
424
|
+
filterKey: Signal<string | undefined>;
|
|
425
|
+
activeTabs: Signal<string[]>;
|
|
426
|
+
currentTab: Signal<string | undefined>;
|
|
427
|
+
countOfEntities: Signal<number>;
|
|
428
|
+
matTableDataSource: Signal<MatTableDataSource<Entity>>;
|
|
429
|
+
add(entity: Entity): Promise<PersistedEntity<Entity> | undefined>;
|
|
430
|
+
delete(id: string): Promise<void>;
|
|
431
|
+
deleteAll(input?: void): void;
|
|
432
|
+
deselectAll(): void;
|
|
433
|
+
deselectEntity(id: string): void;
|
|
434
|
+
load(query: BaseEntityQueryCondition): void;
|
|
435
|
+
loadById(id: string): Entity | undefined;
|
|
436
|
+
resetErrorState(): void;
|
|
437
|
+
selectEntity(id: string): void;
|
|
438
|
+
setCurrentEntity(id: string | undefined): void;
|
|
439
|
+
update(entity: PersistedEntity<Entity>): Promise<PersistedEntity<Entity> | undefined>;
|
|
440
|
+
clearCurrentEntity(): void;
|
|
441
|
+
createEntity(): Entity;
|
|
442
|
+
doFilter(filterKey: string): void;
|
|
443
|
+
reset(): void;
|
|
444
|
+
tabIsActive(tabName: string): void;
|
|
445
|
+
tabIsInactive(tabName: string): void;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* What identifies a row of this store, as it appears in a URL segment.
|
|
449
|
+
*
|
|
450
|
+
* Defaults to {@link entityKeyById}, and every entity persisted through an endpoint of its own keeps
|
|
451
|
+
* that default. An **embedded** entity may be keyed by something else — `App Region` has no `id` at all
|
|
452
|
+
* and is identified by `type` — and its store is built with a resolver reading the `referenceIdField`
|
|
453
|
+
* its owner's attribute declares. See `EmbeddedEntityFacade`.
|
|
454
|
+
*/
|
|
455
|
+
type EntityKeyResolver<Entity extends BaseEntity> = (entity: Entity) => string | undefined;
|
|
456
|
+
declare const entityKeyById: <Entity extends BaseEntity>(entity: Entity) => string | undefined;
|
|
457
|
+
export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, getRepository: () => BaseEntityService<Entity>, keyOf?: EntityKeyResolver<Entity>): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
458
|
+
state: {
|
|
459
|
+
entities: Entity[];
|
|
460
|
+
number: number;
|
|
461
|
+
size: number;
|
|
462
|
+
totalElements: number;
|
|
463
|
+
totalPages: number;
|
|
464
|
+
currentId: string | undefined;
|
|
465
|
+
currentEntity: Entity | undefined;
|
|
466
|
+
isLoading: boolean;
|
|
467
|
+
error: string | undefined;
|
|
468
|
+
selectedEntities: Entity[];
|
|
469
|
+
};
|
|
470
|
+
props: {
|
|
238
471
|
countOfEntities: Signal<number>;
|
|
239
|
-
matTableDataSource: Signal<MatTableDataSource<Entity>>;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
tabIsInactive(tabName: string): void;
|
|
257
|
-
}
|
|
258
|
-
declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, getRepository: () => BaseEntityService<Entity>): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
259
|
-
state: {
|
|
260
|
-
entities: Entity[];
|
|
261
|
-
number: number;
|
|
262
|
-
size: number;
|
|
263
|
-
totalElements: number;
|
|
264
|
-
totalPages: number;
|
|
265
|
-
currentId: string | undefined;
|
|
266
|
-
currentEntity: Entity | undefined;
|
|
267
|
-
isLoading: boolean;
|
|
268
|
-
error: string | undefined;
|
|
269
|
-
selectedEntities: Entity[];
|
|
270
|
-
};
|
|
271
|
-
props: {
|
|
272
|
-
countOfEntities: Signal<number>;
|
|
273
|
-
matTableDataSource: Signal<MatTableDataSource<Entity, _angular_material_paginator.MatPaginator>>;
|
|
274
|
-
};
|
|
275
|
-
methods: {
|
|
276
|
-
clearCurrentEntity: () => void;
|
|
277
|
-
createEntity: () => Entity;
|
|
278
|
-
add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
|
|
279
|
-
delete: (id: string) => Promise<void>;
|
|
280
|
-
deleteAll: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
281
|
-
deselectAll: () => void;
|
|
282
|
-
deselectEntity: (id: string) => void;
|
|
283
|
-
load: _ngrx_signals_rxjs_interop.RxMethod<BaseEntityQueryCondition>;
|
|
284
|
-
loadById: (id: string) => Entity | undefined;
|
|
285
|
-
resetErrorState: () => void;
|
|
286
|
-
selectEntity: (id: string) => void;
|
|
287
|
-
setCurrentEntity: (id: string | undefined) => void;
|
|
288
|
-
update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
|
|
289
|
-
};
|
|
472
|
+
matTableDataSource: Signal<MatTableDataSource<Entity, import("@angular/material/paginator").MatPaginator>>;
|
|
473
|
+
};
|
|
474
|
+
methods: {
|
|
475
|
+
clearCurrentEntity: () => void;
|
|
476
|
+
createEntity: () => Entity;
|
|
477
|
+
add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
|
|
478
|
+
delete: (id: string) => Promise<void>;
|
|
479
|
+
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
480
|
+
deselectAll: () => void;
|
|
481
|
+
deselectEntity: (id: string) => void;
|
|
482
|
+
load: import("@ngrx/signals/rxjs-interop").RxMethod<BaseEntityQueryCondition>;
|
|
483
|
+
loadById: (id: string) => Entity | undefined;
|
|
484
|
+
resetErrorState: () => void;
|
|
485
|
+
selectEntity: (id: string) => void;
|
|
486
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
487
|
+
update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
|
|
488
|
+
};
|
|
290
489
|
}>;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
state: {
|
|
311
|
-
filterKey: string | undefined;
|
|
490
|
+
export declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
491
|
+
entityDescriptor: import("@angular/core").InputSignal<BaseEntityDescriptor | undefined>;
|
|
492
|
+
facade: import("@angular/core").InputSignal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
493
|
+
private readonly injectedFacade;
|
|
494
|
+
protected snackBar: MatSnackBar;
|
|
495
|
+
store: BaseEntityStoreApi<BaseEntity>;
|
|
496
|
+
protected activeFacade: import("@angular/core").Signal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
497
|
+
protected resolvedDescriptor: import("@angular/core").Signal<BaseEntityDescriptor>;
|
|
498
|
+
constructor();
|
|
499
|
+
ngOnDestroy(): void;
|
|
500
|
+
ngOnInit(): void;
|
|
501
|
+
private registerEffects;
|
|
502
|
+
private registerFacadeDescriptorMerge;
|
|
503
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
504
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, {
|
|
505
|
+
"entityDescriptor": {
|
|
506
|
+
"alias": "entityDescriptor";
|
|
507
|
+
"required": false;
|
|
508
|
+
"isSignal": true;
|
|
312
509
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
510
|
+
"facade": {
|
|
511
|
+
"alias": "facade";
|
|
512
|
+
"required": false;
|
|
513
|
+
"isSignal": true;
|
|
316
514
|
};
|
|
515
|
+
}, {}, never, ["*"], true, never>;
|
|
516
|
+
}
|
|
517
|
+
interface EntityContainerState {
|
|
518
|
+
filterKey: string | undefined;
|
|
519
|
+
}
|
|
520
|
+
export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
521
|
+
state: {
|
|
522
|
+
filterKey: string | undefined;
|
|
523
|
+
};
|
|
524
|
+
props: {};
|
|
525
|
+
methods: {
|
|
526
|
+
doFilter: (filterKey: string) => void;
|
|
527
|
+
};
|
|
317
528
|
}>;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: SelectablesInput, isLinkToDetails?: boolean, options?: object);
|
|
371
|
-
getSelectables(): Array<Selectable> | undefined;
|
|
372
|
-
get label(): string;
|
|
373
|
-
set label(label: string);
|
|
374
|
-
get linkedEntityType(): string | undefined;
|
|
375
|
-
set linkedEntityType(linkedEntityType: string | undefined);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
declare class BaseFormHostDirective {
|
|
379
|
-
viewContainerRef: ViewContainerRef;
|
|
380
|
-
constructor(viewContainerRef: ViewContainerRef);
|
|
381
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
|
|
382
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
|
|
383
|
-
}
|
|
384
|
-
|
|
529
|
+
export declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
530
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
531
|
+
protected urlProperty: string;
|
|
532
|
+
protected resourceUrl: string;
|
|
533
|
+
private readonly runtimeConfiguration;
|
|
534
|
+
private readonly baseUrl;
|
|
535
|
+
protected httpClient: HttpClient;
|
|
536
|
+
protected headers: HttpHeaders;
|
|
537
|
+
/**
|
|
538
|
+
* Names of the two query parameters a filtered, sorted collection read is built from. Overridable
|
|
539
|
+
* because the workspace's contracts do not agree on them: `shared-api.yaml` and every feature that
|
|
540
|
+
* refers to it say `where` / `order`, while base-entity's *instances* resource says `rsql` / `sort`
|
|
541
|
+
* (`base-entity-api.yaml`, `listEntities`). The RSQL and the sort expression themselves are identical,
|
|
542
|
+
* so a subclass renames rather than reimplements — see `DynamicEntityService`.
|
|
543
|
+
*/
|
|
544
|
+
protected readonly filterParamName: string;
|
|
545
|
+
protected readonly sortParamName: string;
|
|
546
|
+
constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
547
|
+
delete(id: string): Observable<unknown>;
|
|
548
|
+
deleteAll(): Observable<unknown>;
|
|
549
|
+
findAll(page?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
550
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
551
|
+
private isPagedResponse;
|
|
552
|
+
private isEmptyBody;
|
|
553
|
+
/**
|
|
554
|
+
* Reads one entity by id. The `/%{id}` suffix is what makes this a single-entity read: without it the
|
|
555
|
+
* URL is the collection's, and the response mapper then sees a list where it expects one record — the
|
|
556
|
+
* Firestore and embedded implementations of this interface address one document, and so does this one.
|
|
557
|
+
*/
|
|
558
|
+
findById(id: string): Observable<void | PersistedEntity<Entity>>;
|
|
559
|
+
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
560
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
561
|
+
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
562
|
+
protected buildRsql(queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
563
|
+
private buildOrder;
|
|
564
|
+
private mapPagedResponse;
|
|
565
|
+
private mapSimpleResponse;
|
|
566
|
+
private mapEntityResponse;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Turns a closed string enum from an API contract (`MATERIAL_THEMES`, `REGION_TYPES`, `PORT_TYPES`,
|
|
570
|
+
* …) into dropdown options. Lives here next to `Selectable` itself rather than in one feature lib,
|
|
571
|
+
* because every metadata-driven feature that has an enum-backed DROPDOWN needs it and none of them
|
|
572
|
+
* depend on each other — the same reason WIDGET_REGISTRY sits in this lib.
|
|
573
|
+
*/
|
|
574
|
+
export declare const toSelectables: (values: readonly string[]) => Array<Selectable>;
|
|
575
|
+
export declare class BaseFormHostDirective {
|
|
576
|
+
viewContainerRef: ViewContainerRef;
|
|
577
|
+
constructor(viewContainerRef: ViewContainerRef);
|
|
578
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
|
|
579
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
|
|
580
|
+
}
|
|
385
581
|
type RuleSeverity = 'ERROR' | 'WARNING' | 'INFO';
|
|
386
582
|
interface EvaluatableRule {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
583
|
+
id: string;
|
|
584
|
+
expression: string;
|
|
585
|
+
severity: RuleSeverity;
|
|
586
|
+
message?: string;
|
|
587
|
+
translocoId?: string;
|
|
588
|
+
enabled?: boolean;
|
|
589
|
+
fields?: string[];
|
|
394
590
|
}
|
|
395
591
|
interface RuleEvaluationResult {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
592
|
+
ruleId: string;
|
|
593
|
+
passed: boolean;
|
|
594
|
+
severity: RuleSeverity;
|
|
595
|
+
message?: string;
|
|
596
|
+
translocoId?: string;
|
|
597
|
+
error?: string;
|
|
598
|
+
fields?: string[];
|
|
403
599
|
}
|
|
404
600
|
interface RuleEngine {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
declare const RULE_ENGINE: InjectionToken<RuleEngine>;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
601
|
+
loadRulesFor(context: string): Observable<EvaluatableRule[]>;
|
|
602
|
+
evaluate(entity: unknown, rule: EvaluatableRule): RuleEvaluationResult;
|
|
603
|
+
}
|
|
604
|
+
export declare const RULE_ENGINE: InjectionToken<RuleEngine>;
|
|
605
|
+
export declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit, OnDestroy {
|
|
606
|
+
baseEntityForm: FormGroup;
|
|
607
|
+
entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
608
|
+
entity: Signal<Entity>;
|
|
609
|
+
entityId: InputSignal<string>;
|
|
610
|
+
isAbstract: Signal<boolean>;
|
|
611
|
+
isNewObject: Signal<boolean>;
|
|
612
|
+
store: Signal<BaseEntityStoreApi<Entity>>;
|
|
613
|
+
componentHost: BaseFormHostDirective;
|
|
614
|
+
/**
|
|
615
|
+
* True while an embedded child's screen is open below this form. This form keeps running — that is what
|
|
616
|
+
* carries its unsaved edits across the round trip — but it gives up the surface to the child.
|
|
617
|
+
*/
|
|
618
|
+
readonly hasActiveEmbeddedChild: WritableSignal<boolean>;
|
|
619
|
+
violations: WritableSignal<RuleEvaluationResult[]>;
|
|
620
|
+
hasErrorViolations: Signal<boolean>;
|
|
621
|
+
saveDisabled: Signal<boolean>;
|
|
622
|
+
private readonly entityFormBuilder;
|
|
623
|
+
private readonly formBuilder;
|
|
624
|
+
protected readonly formNavigator: {
|
|
625
|
+
activeRouteSegment: Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
626
|
+
activeTabSegment: Signal<string | undefined>;
|
|
627
|
+
tabSegments: Signal<string[]>;
|
|
628
|
+
breadcrumb: Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
629
|
+
entityName: Signal<string>;
|
|
630
|
+
navigationError?: Signal<string | undefined> | undefined;
|
|
631
|
+
navigateTo: Signal<string>;
|
|
632
|
+
responsePayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
633
|
+
requestPayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
634
|
+
returnTo: Signal<string>;
|
|
635
|
+
formSnapshot: Signal<Record<string, unknown> | undefined>;
|
|
636
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
637
|
+
determineCurrentUrl: () => string;
|
|
638
|
+
determineOwnerUrl: () => string;
|
|
639
|
+
determineActiveRouteSegment: () => void;
|
|
640
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
641
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
642
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
643
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
644
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
645
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
646
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
647
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
648
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
649
|
+
registerTabSegments: (segments: string[]) => void;
|
|
650
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
651
|
+
destroyNavigationTracking: () => void;
|
|
652
|
+
initializeNavigationTracking: () => void;
|
|
653
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
654
|
+
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
655
|
+
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
656
|
+
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
657
|
+
setEntityName: (entityName: string) => void;
|
|
658
|
+
} & import("@ngrx/signals").StateSource<{
|
|
659
|
+
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
660
|
+
activeTabSegment: string | undefined;
|
|
661
|
+
tabSegments: string[];
|
|
662
|
+
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
663
|
+
entityName: string;
|
|
664
|
+
navigationError?: string | undefined;
|
|
665
|
+
navigateTo: string;
|
|
666
|
+
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
667
|
+
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
668
|
+
returnTo: string;
|
|
669
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
670
|
+
}>;
|
|
671
|
+
private readonly logger;
|
|
672
|
+
private readonly ruleEngine;
|
|
673
|
+
private readonly violationsStore;
|
|
674
|
+
private rules;
|
|
675
|
+
private readonly fieldsWithRuleErrors;
|
|
676
|
+
private readonly ruleLoad$;
|
|
677
|
+
private ruleSubscription;
|
|
678
|
+
constructor();
|
|
679
|
+
ngOnInit(): void;
|
|
680
|
+
ngOnDestroy(): void;
|
|
681
|
+
onCancel(): Promise<void>;
|
|
682
|
+
onDelete(): Promise<void>;
|
|
683
|
+
onFieldBlur(): void;
|
|
684
|
+
onSubmit(): Promise<void>;
|
|
685
|
+
/**
|
|
686
|
+
* Leaving an embedded child goes to the form of the entity that contains it. Only a fallback: a drill-down
|
|
687
|
+
* already records where it came from. It is a page opened straight on its URL — a deep link, a reload —
|
|
688
|
+
* that has nothing recorded, and would otherwise land on the child's own list.
|
|
689
|
+
*/
|
|
690
|
+
private navigateBack;
|
|
691
|
+
private evaluateRules;
|
|
692
|
+
private applyFieldRuleErrors;
|
|
693
|
+
private clearFieldRuleErrors;
|
|
694
|
+
private loadRules;
|
|
695
|
+
private registerEffects;
|
|
696
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
697
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, {
|
|
698
|
+
"entityId": {
|
|
699
|
+
"alias": "entityId";
|
|
700
|
+
"required": true;
|
|
701
|
+
"isSignal": true;
|
|
702
|
+
};
|
|
703
|
+
}, {}, never, never, true, never>;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Resolves an entity's descriptor and store **by name**, whichever world the entity comes from: a
|
|
707
|
+
* compile-time `BaseEntityFacade` registered in `BASE_ENTITY_FACADE_REGISTRY`, or a `BaseEntityDefinition`
|
|
708
|
+
* synthesized at run-time by `DynamicEntityRegistry` and published into {@link ResolvedEntityCache}.
|
|
709
|
+
*
|
|
710
|
+
* Being the single lookup surface is what makes the metadata-defined case cost the rest of the library
|
|
711
|
+
* nothing. `EmbeddedAggregateAccessor` asks here for the root store of an aggregate and for the descriptor
|
|
712
|
+
* of every level below it; `resolveEmbeddedRouteContext` walks the containment graph through the
|
|
713
|
+
* descriptors it gets back; the embedded form controls read their child's label the same way. None of them
|
|
714
|
+
* changed, and none of them can tell the difference.
|
|
715
|
+
*
|
|
716
|
+
* Compile-time first. A host application that registered a facade did so on purpose — it may carry extra
|
|
717
|
+
* tabs, a hand-tuned layout or a Firestore repository — and a definition of the same name does not
|
|
718
|
+
* override that decision. The dynamic side is a fallback, in both senses.
|
|
719
|
+
*
|
|
720
|
+
* The synthesized side is read out of a cache rather than from the registry that builds it, so that this
|
|
721
|
+
* class — injected by half the library — does not depend on the facades, and through them on every
|
|
722
|
+
* repository implementation there is. See {@link ResolvedEntityCache}.
|
|
723
|
+
*/
|
|
724
|
+
export declare class BaseEntityDescriptorRegistry {
|
|
725
|
+
private readonly registry;
|
|
726
|
+
private readonly resolvedEntities;
|
|
727
|
+
private readonly injector;
|
|
728
|
+
getDescriptor(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
729
|
+
/**
|
|
730
|
+
* An embedded entity has a store too — see `EmbeddedEntityFacade`. It reads and writes the containing
|
|
731
|
+
* entity's document rather than an endpoint of its own, which is invisible from here.
|
|
732
|
+
*/
|
|
733
|
+
getStore<Store = unknown>(entityName: string | undefined): Store | undefined;
|
|
734
|
+
private resolveFacade;
|
|
735
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityDescriptorRegistry, never>;
|
|
736
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
737
|
+
}
|
|
738
|
+
declare class BaseEntityFormBuilder<Entity extends BaseEntity> {
|
|
739
|
+
private readonly logger;
|
|
740
|
+
buildForm(viewContainerRef: ViewContainerRef, baseEntityForm: FormGroup, store: BaseEntityStoreApi<Entity>, attrDescriptors: AbstractAttrDescriptor[], entity: Signal<Entity>, entityName: string, initialValues?: Record<string, unknown>): void;
|
|
741
|
+
private createFormControlFor;
|
|
742
|
+
private createFormControl;
|
|
743
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormBuilder<any>, never>;
|
|
744
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
745
|
+
}
|
|
746
|
+
export declare abstract class BaseFormControlComponent<Entity extends BaseEntity> {
|
|
747
|
+
config: InputSignal<BaseEntityAttrDescriptor>;
|
|
748
|
+
entity: InputSignal<Entity>;
|
|
749
|
+
entityName: InputSignal<string>;
|
|
750
|
+
formGroup: FormGroup;
|
|
751
|
+
store: BaseEntityStoreApi<Entity>;
|
|
752
|
+
/**
|
|
753
|
+
* Set by {@link BaseEntityFormBuilder} on every control it creates, for the controls that build sub-forms of
|
|
754
|
+
* their own. Handed over rather than injected because the builder maps control types to these very component
|
|
755
|
+
* classes — injecting it here would close a runtime import cycle (NG0919). The import above is type-only.
|
|
756
|
+
*/
|
|
757
|
+
formBuilder: BaseEntityFormBuilder<Entity>;
|
|
758
|
+
style: import("@angular/core").Signal<{
|
|
759
|
+
[p: string]: unknown;
|
|
760
|
+
} | null | undefined>;
|
|
761
|
+
linkedEntityName: import("@angular/core").Signal<string>;
|
|
762
|
+
linkedEntityDescriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
763
|
+
value: InputSignal<unknown>;
|
|
764
|
+
get testId(): string | null;
|
|
765
|
+
get hostStyle(): string | null;
|
|
766
|
+
protected readonly logger: NGXLogger;
|
|
767
|
+
protected readonly formNavigator: {
|
|
768
|
+
activeRouteSegment: import("@angular/core").Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
769
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
770
|
+
tabSegments: import("@angular/core").Signal<string[]>;
|
|
771
|
+
breadcrumb: import("@angular/core").Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
772
|
+
entityName: import("@angular/core").Signal<string>;
|
|
773
|
+
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
774
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
775
|
+
responsePayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
776
|
+
requestPayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
777
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
778
|
+
formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
779
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
780
|
+
determineCurrentUrl: () => string;
|
|
781
|
+
determineOwnerUrl: () => string;
|
|
782
|
+
determineActiveRouteSegment: () => void;
|
|
783
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
784
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
785
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
786
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
787
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
788
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
789
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
790
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
791
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
792
|
+
registerTabSegments: (segments: string[]) => void;
|
|
793
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
794
|
+
destroyNavigationTracking: () => void;
|
|
795
|
+
initializeNavigationTracking: () => void;
|
|
796
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
797
|
+
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
798
|
+
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
799
|
+
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
800
|
+
setEntityName: (entityName: string) => void;
|
|
801
|
+
} & import("@ngrx/signals").StateSource<{
|
|
802
|
+
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
803
|
+
activeTabSegment: string | undefined;
|
|
804
|
+
tabSegments: string[];
|
|
805
|
+
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
806
|
+
entityName: string;
|
|
807
|
+
navigationError?: string | undefined;
|
|
808
|
+
navigateTo: string;
|
|
809
|
+
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
810
|
+
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
811
|
+
returnTo: string;
|
|
812
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
813
|
+
}>;
|
|
814
|
+
protected readonly descriptorRegistry: BaseEntityDescriptorRegistry;
|
|
815
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormControlComponent<any>, never>;
|
|
816
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseFormControlComponent<any>, "ng-component", never, {
|
|
817
|
+
"config": {
|
|
818
|
+
"alias": "config";
|
|
819
|
+
"required": true;
|
|
820
|
+
"isSignal": true;
|
|
821
|
+
};
|
|
822
|
+
"entity": {
|
|
823
|
+
"alias": "entity";
|
|
824
|
+
"required": true;
|
|
825
|
+
"isSignal": true;
|
|
826
|
+
};
|
|
827
|
+
"entityName": {
|
|
828
|
+
"alias": "entityName";
|
|
829
|
+
"required": true;
|
|
830
|
+
"isSignal": true;
|
|
831
|
+
};
|
|
832
|
+
"value": {
|
|
833
|
+
"alias": "value";
|
|
834
|
+
"required": true;
|
|
835
|
+
"isSignal": true;
|
|
836
|
+
};
|
|
837
|
+
}, {}, never, never, true, never>;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* To-many **containment** whose parts live in a table of their own — the child is persisted through its own
|
|
841
|
+
* endpoint and points back at this entity through the foreign key named by
|
|
842
|
+
* {@link BaseEntityDescriptor.parentReferenceAttrName}. This attribute therefore holds child **ids**, and the
|
|
843
|
+
* row text is resolved from the child's store.
|
|
844
|
+
*
|
|
845
|
+
* The difference from `RELATED_ENTITIES` is ownership, and it shows in what the buttons do: attaching a child
|
|
846
|
+
* also stamps this entity's id into the child's foreign key, and deleting a row **destroys the child**
|
|
847
|
+
* instead of merely detaching it. For a part that has no table of its own, see `EMBEDDED_COMPONENTS`.
|
|
848
|
+
*/
|
|
849
|
+
export declare class ComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
850
|
+
private readonly dialog;
|
|
851
|
+
private readonly componentStore;
|
|
852
|
+
ngOnInit(): void;
|
|
853
|
+
componentEntities(): PersistedEntity<BaseEntity>[];
|
|
854
|
+
/**
|
|
855
|
+
* The child's identifying text. A reference may still be stored as a whole object (seed data, a form
|
|
856
|
+
* snapshot), so its own attribute wins; otherwise the child is looked up in its store, and the id is what
|
|
857
|
+
* remains when the store has not loaded it.
|
|
858
|
+
*/
|
|
859
|
+
displayName(componentEntity: PersistedEntity<BaseEntity>): string;
|
|
860
|
+
addComponentTitle(): string;
|
|
861
|
+
navigateToComponentList(): void;
|
|
862
|
+
/** Destroys the child — a component has no life outside its parent — after the user confirms. */
|
|
863
|
+
deleteComponent(componentEntity: PersistedEntity<BaseEntity>): void;
|
|
864
|
+
/**
|
|
865
|
+
* The two declarations — this attribute's control type and the child's own descriptor — have to agree, and
|
|
866
|
+
* they are both authored by hand. Checking at first render turns a silent mis-declaration (a list that
|
|
867
|
+
* deletes what it should detach, or a child whose payload goes nowhere) into an error naming both sides.
|
|
868
|
+
*/
|
|
869
|
+
private assertContainmentContract;
|
|
870
|
+
/**
|
|
871
|
+
* The rows arrive as ids, so the child store has to hold the children for them to render as names. The
|
|
872
|
+
* parent's form may well be the first screen the user opens, which is why the load happens here rather
|
|
873
|
+
* than being left to the child's list page (`LookupComponent` loads its table the same way).
|
|
874
|
+
*/
|
|
875
|
+
private loadComponentEntities;
|
|
876
|
+
private attachSelectedComponentFromNavigatorResponse;
|
|
877
|
+
/** Stamps this entity's id into the child's foreign key, so the containment holds from the child's side too. */
|
|
878
|
+
private adoptComponent;
|
|
879
|
+
private storedComponent;
|
|
880
|
+
/** Writes the references back as ids — the child's payload belongs to the child's own endpoint, not here. */
|
|
881
|
+
private writeReferences;
|
|
882
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComponentsListComponent<any>, never>;
|
|
883
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComponentsListComponent<any>, "app-components-list", never, {}, {}, never, never, true, never>;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* One hop down an aggregate: the `EMBEDDED_COMPONENTS` attribute followed, and which of its rows.
|
|
887
|
+
* A path is the list of hops from the aggregate root, so `[]` addresses the root itself.
|
|
888
|
+
*/
|
|
889
|
+
interface EmbeddedPathStep {
|
|
890
|
+
attrName: string;
|
|
891
|
+
index: number;
|
|
892
|
+
}
|
|
893
|
+
type EmbeddedPath = readonly EmbeddedPathStep[];
|
|
894
|
+
/**
|
|
895
|
+
* A row as it sits in the payload. Not `BaseEntity`: an embedded row is not guaranteed to carry an `id` —
|
|
896
|
+
* `App Region` has none and is identified by `type` (see `referenceIdField`) — and `BaseEntity`'s only
|
|
897
|
+
* property is an optional `id`, so TypeScript's weak-type rule rejects exactly those rows.
|
|
898
|
+
*/
|
|
899
|
+
type EmbeddedRow = BaseEntity | Record<string, unknown>;
|
|
900
|
+
type Payload = Record<string, unknown>;
|
|
901
|
+
/**
|
|
902
|
+
* An embedded child has no table of its own, so it is addressed by its **position** inside the root's
|
|
903
|
+
* payload — `regions[0].navItems[2]` — rather than by a globally unique id. These functions are the only
|
|
904
|
+
* place that knows how to read and write such a position; everything above them (the service, the list
|
|
905
|
+
* control, the route context) works in terms of a path.
|
|
906
|
+
*
|
|
907
|
+
* They are deliberately free of Angular and of the store: an aggregate is a plain payload, and keeping the
|
|
908
|
+
* arithmetic pure is what makes the nested and id-less cases cheap to test.
|
|
909
|
+
*/
|
|
910
|
+
/** Resolves the object a path points at, or `undefined` when any hop is missing. */
|
|
911
|
+
declare function readOwner(root: unknown, path: EmbeddedPath): Payload | undefined;
|
|
912
|
+
/** The rows of one `EMBEDDED_COMPONENTS` attribute; an empty array when the attribute is unset. */
|
|
913
|
+
declare function readRows(root: unknown, path: EmbeddedPath, attrName: string): EmbeddedRow[];
|
|
914
|
+
/**
|
|
915
|
+
* A copy of `root` whose owner carries `rows` under `attrName`, sharing every untouched branch. The
|
|
916
|
+
* aggregate is persisted by replacing the root document wholesale, so a write has to rebuild only the spine
|
|
917
|
+
* from the root down to the owner.
|
|
918
|
+
*/
|
|
919
|
+
declare function writeRows(root: unknown, path: EmbeddedPath, attrName: string, rows: readonly EmbeddedRow[]): Payload;
|
|
920
|
+
/**
|
|
921
|
+
* Position of the row identified by `id`, or `-1`. Resolved through {@link rowId} rather than by comparing
|
|
922
|
+
* `id` directly, so that a lookup and the URL segment that arrives back cannot drift apart on an entity
|
|
923
|
+
* keyed by something else — `App Region` has no `id` at all and is identified by `type`.
|
|
924
|
+
*/
|
|
925
|
+
declare function indexOfRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): number;
|
|
926
|
+
declare function findRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow | undefined;
|
|
927
|
+
/** The value that identifies `row` in a URL segment — its `referenceIdField`, defaulting to `id`. */
|
|
928
|
+
declare function rowId(row: EmbeddedRow, referenceIdField?: string): string;
|
|
929
|
+
declare function appendRow(rows: readonly EmbeddedRow[], row: EmbeddedRow): EmbeddedRow[];
|
|
930
|
+
/** Replaces the row identified by `id`; appends when it is not there yet, so an add and a re-save agree. */
|
|
931
|
+
declare function replaceRow(rows: readonly EmbeddedRow[], id: string, row: EmbeddedRow, referenceIdField?: string): EmbeddedRow[];
|
|
932
|
+
declare function removeRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow[];
|
|
933
|
+
/** Widens a row to the shape the store's API is written in; embedded rows always carry their key field. */
|
|
934
|
+
declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): PersistedEntity<Entity>;
|
|
935
|
+
/**
|
|
936
|
+
* To-many **containment** whose parts have no table of their own — the child's payload travels inside this
|
|
937
|
+
* entity's payload, the way a sub-document does in a document store.
|
|
938
|
+
*
|
|
939
|
+
* The rows are only listed here; a row opens the child's own form, on a route nested below this one. That is
|
|
940
|
+
* what keeps a parent with many children, or with children that have children of their own, readable — and
|
|
941
|
+
* the child gets the full generated form rather than a cramped inline copy of it.
|
|
942
|
+
*
|
|
943
|
+
* The rows come from the child's own store, which reads them out of this entity's payload
|
|
944
|
+
* (`EmbeddedEntityService`), so adding, editing and deleting a child all go through the same
|
|
945
|
+
* List → Store → Service path as any other entity. What differs is only where that service writes: the
|
|
946
|
+
* containing document, saved as a whole. For a part that is persisted through an endpoint of its own, see
|
|
947
|
+
* `COMPONENTS`; for one that merely points at an independent entity, `RELATED_ENTITIES`.
|
|
948
|
+
*/
|
|
949
|
+
export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
950
|
+
private readonly dialog;
|
|
951
|
+
private readonly transloco;
|
|
952
|
+
private readonly aggregateAccessor;
|
|
953
|
+
private readonly componentStore;
|
|
954
|
+
/**
|
|
955
|
+
* The child's store holds exactly this attribute's rows: it resolves them from the containing document
|
|
956
|
+
* through the route, so it is already scoped to the entity this form is editing.
|
|
957
|
+
*/
|
|
958
|
+
readonly rows: Signal<EmbeddedRow[]>;
|
|
959
|
+
constructor();
|
|
960
|
+
ngOnInit(): void;
|
|
961
|
+
rowKey(row: EmbeddedRow): string;
|
|
962
|
+
/** The child's identifying text, falling back to whatever identifies it at all, then to its position. */
|
|
963
|
+
displayName(row: EmbeddedRow, index: number): string;
|
|
964
|
+
linkedEntityLabel(): string;
|
|
965
|
+
addComponentTitle(): string;
|
|
966
|
+
/**
|
|
967
|
+
* An embedded row is stored inside its owner, so there is nowhere to put one until the owner exists.
|
|
968
|
+
*
|
|
969
|
+
* Read off the route rather than off the entity: an id is no evidence of a document, because an entity type
|
|
970
|
+
* may well assign itself one at construction (`new TestEntity()` mints a uuid), which would make an unsaved
|
|
971
|
+
* owner look persisted and offer an add button writing into a document that is not there. The URL is what
|
|
972
|
+
* the child's own store resolves the rows through anyway, and it says `new` while the owner is unsaved.
|
|
973
|
+
* The entity's id remains the fallback for an application whose routes carry no entity name.
|
|
974
|
+
*/
|
|
975
|
+
ownerIsPersisted(): boolean;
|
|
976
|
+
openComponent(row: EmbeddedRow): void;
|
|
977
|
+
/** A new child is created on its own form, the same way an existing one is edited. */
|
|
978
|
+
addComponent(): void;
|
|
979
|
+
/** Destroys the child — an embedded component has no existence outside this payload — after confirmation. */
|
|
980
|
+
deleteComponent(row: EmbeddedRow): void;
|
|
981
|
+
/**
|
|
982
|
+
* Both declarations — this attribute's control type and the child's own descriptor — are written by hand
|
|
983
|
+
* and have to agree; checking at first render names both sides instead of silently rendering a list whose
|
|
984
|
+
* rows go nowhere on save.
|
|
985
|
+
*/
|
|
986
|
+
private assertContainmentContract;
|
|
987
|
+
/**
|
|
988
|
+
* Re-reads the rows whenever the containing document changes.
|
|
989
|
+
*
|
|
990
|
+
* The child's store holds a projection of that document, and it is a root singleton shared by every owner
|
|
991
|
+
* of this child type — so its rows are stale both before the document has loaded (a form opened directly on
|
|
992
|
+
* a URL) and after the user moves to a different owner. Depending on the document itself covers both, and
|
|
993
|
+
* cannot loop: the reload writes to the child's store, never to the root's.
|
|
994
|
+
*/
|
|
995
|
+
private registerRowReload;
|
|
996
|
+
/**
|
|
997
|
+
* Mirrors the rows into this attribute's control. A child's save writes the containing document itself, so
|
|
998
|
+
* the control would otherwise still hold the array as it looked when the form was built — and the owner's
|
|
999
|
+
* own save, which merges `form.value` over the entity, would write that stale array back.
|
|
1000
|
+
*/
|
|
1001
|
+
private registerFormControlSync;
|
|
1002
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentsListComponent<any>, never>;
|
|
1003
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentsListComponent<any>, "app-embedded-components-list", never, {}, {}, never, never, true, never>;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* One row of {@link EmbeddedComponentsListComponent}. Presentation only: opening and deleting both belong to
|
|
1007
|
+
* the list, which is the side that knows where the row sits in the containing document.
|
|
1008
|
+
*/
|
|
1009
|
+
export declare class EmbeddedComponentRefComponent {
|
|
1010
|
+
displayName: InputSignal<string>;
|
|
1011
|
+
disabled: InputSignal<boolean>;
|
|
1012
|
+
readonly openRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1013
|
+
readonly deleteRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1014
|
+
requestOpen(event: Event): void;
|
|
1015
|
+
requestDelete(): void;
|
|
1016
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentRefComponent, never>;
|
|
1017
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentRefComponent, "app-embedded-component-ref", never, {
|
|
1018
|
+
"displayName": {
|
|
1019
|
+
"alias": "displayName";
|
|
1020
|
+
"required": true;
|
|
1021
|
+
"isSignal": true;
|
|
1022
|
+
};
|
|
1023
|
+
"disabled": {
|
|
1024
|
+
"alias": "disabled";
|
|
1025
|
+
"required": false;
|
|
1026
|
+
"isSignal": true;
|
|
1027
|
+
};
|
|
1028
|
+
}, {
|
|
1029
|
+
"openRequested": "openRequested";
|
|
1030
|
+
"deleteRequested": "deleteRequested";
|
|
1031
|
+
}, never, never, true, never>;
|
|
1032
|
+
}
|
|
1033
|
+
interface RelatedEntityNameAttr {
|
|
1034
|
+
attrName: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
}
|
|
1037
|
+
declare class RelatedEntityRefComponent<Entity extends BaseEntity, RelatedEntity extends BaseEntity> {
|
|
1038
|
+
entity: InputSignal<Entity>;
|
|
1039
|
+
relatedEntity: InputSignal<PersistedEntity<RelatedEntity>>;
|
|
1040
|
+
relatedEntityNameAttr: InputSignal<RelatedEntityNameAttr>;
|
|
1041
|
+
disabled: InputSignal<boolean>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Which field of a raw row carries the id, when it is not `id` — the owning attribute's
|
|
1044
|
+
* `referenceIdField`. Needed on this component and not only on the list, because removal filters the
|
|
1045
|
+
* attribute's raw value and has to resolve each item's id the same way the rendering did.
|
|
1046
|
+
*/
|
|
1047
|
+
referenceIdField: InputSignal<string | undefined>;
|
|
1048
|
+
formGroup: InputSignal<FormGroup>;
|
|
1049
|
+
linkedEntityType: InputSignal<string>;
|
|
1050
|
+
private readonly formNavigator;
|
|
1051
|
+
relatedEntityName(): string;
|
|
1052
|
+
navigateToRelated(event: Event): void;
|
|
1053
|
+
removeRelatedEntity(): void;
|
|
1054
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntityRefComponent<any, any>, never>;
|
|
1055
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntityRefComponent<any, any>, "app-related-entity-ref", never, {
|
|
1056
|
+
"entity": {
|
|
1057
|
+
"alias": "entity";
|
|
1058
|
+
"required": true;
|
|
1059
|
+
"isSignal": true;
|
|
1060
|
+
};
|
|
1061
|
+
"relatedEntity": {
|
|
1062
|
+
"alias": "relatedEntity";
|
|
1063
|
+
"required": true;
|
|
1064
|
+
"isSignal": true;
|
|
1065
|
+
};
|
|
1066
|
+
"relatedEntityNameAttr": {
|
|
1067
|
+
"alias": "relatedEntityNameAttr";
|
|
1068
|
+
"required": true;
|
|
1069
|
+
"isSignal": true;
|
|
1070
|
+
};
|
|
1071
|
+
"disabled": {
|
|
1072
|
+
"alias": "disabled";
|
|
1073
|
+
"required": false;
|
|
1074
|
+
"isSignal": true;
|
|
1075
|
+
};
|
|
1076
|
+
"referenceIdField": {
|
|
1077
|
+
"alias": "referenceIdField";
|
|
1078
|
+
"required": false;
|
|
1079
|
+
"isSignal": true;
|
|
1080
|
+
};
|
|
1081
|
+
"formGroup": {
|
|
1082
|
+
"alias": "formGroup";
|
|
1083
|
+
"required": true;
|
|
1084
|
+
"isSignal": true;
|
|
1085
|
+
};
|
|
1086
|
+
"linkedEntityType": {
|
|
1087
|
+
"alias": "linkedEntityType";
|
|
1088
|
+
"required": true;
|
|
1089
|
+
"isSignal": true;
|
|
1090
|
+
};
|
|
1091
|
+
}, {}, never, never, true, never>;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* To-many **association**: the rows point at entities that exist independently of this one, so adding
|
|
1095
|
+
* picks an existing entity from the related list and deleting only detaches the reference. Containment —
|
|
1096
|
+
* where the related entity has exactly one owner and dies with the reference — is a different control type
|
|
1097
|
+
* (`COMPONENTS`), so do not extend this one with delete-the-entity behavior.
|
|
1098
|
+
*/
|
|
1099
|
+
export declare class RelatedEntitiesListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1100
|
+
ngOnInit(): void;
|
|
1101
|
+
relatedEntityNameAttr(): RelatedEntityNameAttr;
|
|
1102
|
+
relatedEntities(): PersistedEntity<BaseEntity>[];
|
|
1103
|
+
addRelatedEntityTitle(): string;
|
|
1104
|
+
navigateToRelatedList(): void;
|
|
1105
|
+
private addSelectedEntityFromNavigatorResponse;
|
|
1106
|
+
private describeFormState;
|
|
1107
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntitiesListComponent<any>, never>;
|
|
1108
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntitiesListComponent<any>, "app-related-entities-list", never, {}, {}, never, never, true, never>;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Resolves `key` through Transloco, returning `fallback` when the key is absent or unresolved. Shared
|
|
1112
|
+
* by {@link EntityLabelPipe} and the components that need the resolved label as a translation
|
|
1113
|
+
* parameter rather than as rendered text.
|
|
1114
|
+
*
|
|
1115
|
+
* The loaded translation is consulted before `translate()` — the same lookup transloco itself
|
|
1116
|
+
* performs — because an absent key would otherwise go through the missing-key handler, which logs a
|
|
1117
|
+
* warning. Falling back is normal here, not a defect: a descriptor may declare no `i18nScope` at all,
|
|
1118
|
+
* and a lazily-loaded scope is still absent on the renders that precede its load.
|
|
1119
|
+
*/
|
|
1120
|
+
export declare function translateLabel(transloco: TranslocoService, key: string | undefined, fallback: string): string;
|
|
482
1121
|
/**
|
|
483
1122
|
* Translates an entity/attribute name and falls back to the descriptor-provided name.
|
|
484
1123
|
*
|
|
@@ -491,341 +1130,1366 @@ declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnIn
|
|
|
491
1130
|
*
|
|
492
1131
|
* Impure so it re-evaluates when the active language or a lazy scope finishes loading.
|
|
493
1132
|
*/
|
|
494
|
-
declare class EntityLabelPipe implements PipeTransform, OnDestroy {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
declare
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
1133
|
+
export declare class EntityLabelPipe implements PipeTransform, OnDestroy {
|
|
1134
|
+
private readonly transloco;
|
|
1135
|
+
private readonly changeDetectorRef;
|
|
1136
|
+
private readonly subscription;
|
|
1137
|
+
constructor();
|
|
1138
|
+
transform(key: string | undefined, fallback: string): string;
|
|
1139
|
+
ngOnDestroy(): void;
|
|
1140
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityLabelPipe, never>;
|
|
1141
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EntityLabelPipe, "ppLabel", true>;
|
|
1142
|
+
}
|
|
1143
|
+
export declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
|
|
1144
|
+
export declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
|
|
1145
|
+
dataSource: MatTableDataSource<PersistedEntity<Entity>>;
|
|
1146
|
+
selection: SelectionModel<PersistedEntity<Entity>>;
|
|
1147
|
+
protected readonly entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
1148
|
+
private readonly logger;
|
|
1149
|
+
private readonly formNavigator;
|
|
1150
|
+
private readonly objectStoreService;
|
|
1151
|
+
columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
|
|
1152
|
+
displayedColumns: Signal<string[]>;
|
|
1153
|
+
sort: MatSort;
|
|
1154
|
+
paginator: MatPaginator;
|
|
1155
|
+
store: BaseEntityStoreApi<PersistedEntity<Entity>>;
|
|
1156
|
+
protected selectOrCreateMode: import("@angular/core").WritableSignal<boolean>;
|
|
1157
|
+
private requestPayload?;
|
|
1158
|
+
constructor();
|
|
1159
|
+
ngAfterViewInit(): void;
|
|
1160
|
+
ngOnInit(): void;
|
|
1161
|
+
onChangeSelection(entity?: PersistedEntity<Entity>): void;
|
|
1162
|
+
onNavigateToDetails(entity: PersistedEntity<Entity>): void;
|
|
1163
|
+
onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): void;
|
|
1164
|
+
onRowClick(entity: PersistedEntity<Entity>): void;
|
|
1165
|
+
onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
|
|
1166
|
+
onToggleAllRows(): void;
|
|
1167
|
+
onCancelSelectOrCreate(): Promise<void>;
|
|
1168
|
+
onSelectEntity(): Promise<void>;
|
|
1169
|
+
private cancelSelections;
|
|
1170
|
+
private doFilter;
|
|
1171
|
+
private getPropertyValue;
|
|
1172
|
+
private loadAllData;
|
|
1173
|
+
protected registerEffects(): void;
|
|
1174
|
+
isAllSelected(): boolean;
|
|
1175
|
+
isSelected(row: PersistedEntity<Entity>): boolean;
|
|
1176
|
+
canSelectEntity(): boolean;
|
|
1177
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
|
|
1178
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
|
|
1179
|
+
}
|
|
1180
|
+
export declare const ACTIVE_ENTITY_FACADE: InjectionToken<BaseEntityFacade<BaseEntity>>;
|
|
1181
|
+
interface EntityTabsState {
|
|
1182
|
+
activeTabs: string[];
|
|
1183
|
+
currentTab: string | undefined;
|
|
1184
|
+
}
|
|
1185
|
+
export declare function BaseEntityTabsStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
1186
|
+
state: {
|
|
1187
|
+
activeTabs: string[];
|
|
1188
|
+
currentTab: string | undefined;
|
|
1189
|
+
};
|
|
1190
|
+
props: {};
|
|
1191
|
+
methods: {
|
|
1192
|
+
reset: () => void;
|
|
1193
|
+
tabIsActive: (tabName: string) => void;
|
|
1194
|
+
tabIsInactive: (tabName: string) => void;
|
|
1195
|
+
};
|
|
556
1196
|
}>;
|
|
557
|
-
|
|
558
1197
|
type BaseEntityFacadeRegistry = Record<string, ProviderToken<BaseEntityFacade<BaseEntity>>>;
|
|
559
|
-
declare const BASE_ENTITY_FACADE_REGISTRY: InjectionToken<BaseEntityFacadeRegistry>;
|
|
560
|
-
declare class EntityRegistryComponent {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
1198
|
+
export declare const BASE_ENTITY_FACADE_REGISTRY: InjectionToken<BaseEntityFacadeRegistry>;
|
|
1199
|
+
export declare class EntityRegistryComponent {
|
|
1200
|
+
private readonly registry;
|
|
1201
|
+
private readonly injector;
|
|
1202
|
+
private readonly entityRouteRegistry;
|
|
1203
|
+
private readonly queryParams;
|
|
1204
|
+
private readonly descriptors;
|
|
1205
|
+
protected registryJson: import("@angular/core").Signal<string>;
|
|
1206
|
+
private buildDescriptors;
|
|
1207
|
+
private serializeAttr;
|
|
1208
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRegistryComponent, never>;
|
|
1209
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityRegistryComponent, "pp-entity-registry", never, {}, {}, never, never, true, never>;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* The knowledge layer of `base-entity-api.yaml` as the frontend reads it: what an entity *type* is,
|
|
1213
|
+
* declared as data rather than as a TypeScript class with a `BaseEntityFacade` beside it.
|
|
1214
|
+
*
|
|
1215
|
+
* The model is read by two surfaces and it is deliberately one model for both. At **run time** a
|
|
1216
|
+
* definition arrives as JSON and is turned into a `BaseEntityDescriptor` by
|
|
1217
|
+
* `dynamic-entity.descriptor.ts`, so the descriptor is the thing the framework already knows how to
|
|
1218
|
+
* render. In the **designer** the very same rows are the entity being edited — see
|
|
1219
|
+
* `base-entity-authoring/` — which is what keeps the modelling tool and the runtime from drifting apart.
|
|
1220
|
+
*
|
|
1221
|
+
* Classes rather than interfaces, and only because of that second surface: `BaseEntityStore.createEntity()`
|
|
1222
|
+
* mints the blank row an `Add` opens a form on, and that needs a constructor. They stay plain data — a
|
|
1223
|
+
* definition read by `EntityDefinitionService` is the parsed JSON, never an instance of these classes, so
|
|
1224
|
+
* nothing may rely on `instanceof` or on a method.
|
|
1225
|
+
*
|
|
1226
|
+
* Field names mirror the contract exactly. Where the contract and the frontend disagree — its
|
|
1227
|
+
* `formControlType` enum is a superset of `FormControlType`, its `code`s are what the descriptor calls
|
|
1228
|
+
* entity *names* — the translation is the descriptor factory's job and is documented there.
|
|
1229
|
+
*/
|
|
1230
|
+
/** `EntityDefinitionStatus` of the contract. Only `ACTIVE` definitions are rendered. */
|
|
1231
|
+
type EntityDefinitionStatus = 'DRAFT' | 'ACTIVE' | 'DEPRECATED';
|
|
1232
|
+
/** `ValueKind` of the contract: what the attribute's value *is*, as opposed to how it is edited. */
|
|
1233
|
+
type EntityValueKind = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATE_TIME' | 'ENUM' | 'REFERENCE';
|
|
1234
|
+
/**
|
|
1235
|
+
* The three enums of the contract, as the authoring form's dropdown options.
|
|
1236
|
+
*
|
|
1237
|
+
* Spelled out next to the types they enumerate rather than derived from anything: a TypeScript union has
|
|
1238
|
+
* no run-time representation, so the list and the type have to be written twice — declaring them side by
|
|
1239
|
+
* side is what makes a divergence visible in one diff.
|
|
1240
|
+
*
|
|
1241
|
+
* {@link ENTITY_FORM_CONTROL_TYPES} is the **contract's** `FormControlType`, which is what the backend
|
|
1242
|
+
* validates a definition against — not the `FormControlType` of `abstact-attr.descriptor.ts`, whose extra
|
|
1243
|
+
* members (`ADDITIONAL_PROPERTIES`, `FLEX_BOX`, `LABEL`, `TAGS`, `TITLE`) are rendering concerns a
|
|
1244
|
+
* definition cannot name. `CONTROL_TYPES` in `dynamic-entity.descriptor.ts` maps one onto the other.
|
|
1245
|
+
*/
|
|
1246
|
+
export declare const ENTITY_DEFINITION_STATUSES: readonly EntityDefinitionStatus[];
|
|
1247
|
+
export declare const ENTITY_VALUE_KINDS: readonly EntityValueKind[];
|
|
1248
|
+
export declare const ENTITY_FORM_CONTROL_TYPES: readonly string[];
|
|
1249
|
+
/**
|
|
1250
|
+
* One attribute of a definition — the contract's `BaseEntityAttribute`.
|
|
1251
|
+
*
|
|
1252
|
+
* `formControlType` is a plain string rather than the frontend's `FormControlType` enum: the contract
|
|
1253
|
+
* declares control types the frontend has no component for (`TEXT`, `NUMBER`, `ENUM_SELECT`, …), and
|
|
1254
|
+
* narrowing here would push the mapping into a cast at the parse boundary, where there is nothing
|
|
1255
|
+
* sensible to do about a value that does not fit.
|
|
1256
|
+
*/
|
|
1257
|
+
export declare class EntityAttributeDefinition implements BaseEntity {
|
|
1258
|
+
/**
|
|
1259
|
+
* Declared, never assigned. The contract does give an attribute a read-only `id`, but nothing addresses
|
|
1260
|
+
* one by it: `code` is unique within the definition, it is the path segment of
|
|
1261
|
+
* `PUT .../attributes/{attributeCode}`, and it is what `ENTITY_ATTRIBUTE_ID_FIELD` points the embedded
|
|
1262
|
+
* list at. `BaseEntity`'s only property is an optional `id` and TypeScript's weak-type rule rejects a
|
|
1263
|
+
* type sharing no property with it, so the field is declared to satisfy that — `declare` emits nothing,
|
|
1264
|
+
* and the payload stays exactly the shape `BaseEntityAttributeInput` describes.
|
|
1265
|
+
*/
|
|
1266
|
+
readonly id?: string;
|
|
1267
|
+
code: string;
|
|
1268
|
+
name?: string;
|
|
1269
|
+
/**
|
|
1270
|
+
* Not part of the contract's `BaseEntityAttributeInput`, and therefore not authorable: the attribute
|
|
1271
|
+
* form offers no control for it, because a value typed into one would be dropped by the next save. Kept
|
|
1272
|
+
* on the model so that a backend which gains the field round-trips it untouched.
|
|
1273
|
+
*/
|
|
1274
|
+
description?: string;
|
|
1275
|
+
displayOrder?: number;
|
|
1276
|
+
valueKind?: EntityValueKind;
|
|
1277
|
+
formControlType: string;
|
|
1278
|
+
isMultiValued?: boolean;
|
|
1279
|
+
required?: boolean;
|
|
1280
|
+
indexed?: boolean;
|
|
1281
|
+
defaultValue?: unknown;
|
|
1282
|
+
/** Only meaningful for `valueKind: ENUM`; becomes the dropdown's options. */
|
|
1283
|
+
enumValues?: string[];
|
|
1284
|
+
/**
|
|
1285
|
+
* **Code** of the definition this attribute points at — a child carried inline
|
|
1286
|
+
* (`EMBEDDED_COMPONENTS`) or a parent referenced by key (`FOREIGN_KEY`). The descriptor's
|
|
1287
|
+
* `linkedEntityType` holds the entity *name* of the same definition.
|
|
1288
|
+
*/
|
|
1289
|
+
linkedEntityType?: string;
|
|
1290
|
+
/** Marks the attribute that titles an instance — the descriptor's `isLinkToDetails`. */
|
|
1291
|
+
isLinkToDetails?: boolean;
|
|
1292
|
+
constructor(init?: Partial<EntityAttributeDefinition>);
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* An entity type — the contract's `BaseEntityDefinition`.
|
|
1296
|
+
*
|
|
1297
|
+
* {@link id} is a **mirror of {@link code}** rather than an independent field, maintained by
|
|
1298
|
+
* `EntityDefinitionMapper`. The contract addresses a definition by `code`
|
|
1299
|
+
* (`/entity-definitions/{code}`) while the generated screens address a record by `id`: every
|
|
1300
|
+
* single-record URL `BaseEntityRestService` builds comes from `id`, and so does the details link
|
|
1301
|
+
* `BaseFormNavigatorSingletonStore` renders. Mirroring the two in the mapper is what lets the stock
|
|
1302
|
+
* screens author definitions unchanged — the same arrangement `StateMachineDefinition` uses for its
|
|
1303
|
+
* `entityName`. The read-only uuid the contract also calls `id` is not carried: nothing addresses a
|
|
1304
|
+
* definition by it, and `BaseEntityDefinitionInput` has no field to send it back in.
|
|
1305
|
+
*/
|
|
1306
|
+
export declare class EntityDefinition implements BaseEntity {
|
|
1307
|
+
/** Mirror of {@link code}; maintained by the mapper and never edited. See the class comment. */
|
|
1308
|
+
id?: string;
|
|
1309
|
+
code: string;
|
|
1310
|
+
name: string;
|
|
1311
|
+
description?: string;
|
|
1312
|
+
status?: EntityDefinitionStatus;
|
|
1313
|
+
/** **Codes** of the definitions that may aggregate this one; empty for a stand-alone entity. */
|
|
1314
|
+
componentParents?: string[];
|
|
1315
|
+
/** True when this definition's payload travels inside its parent's and it has no rows of its own. */
|
|
1316
|
+
isEmbedded?: boolean;
|
|
1317
|
+
attributes?: EntityAttributeDefinition[];
|
|
1318
|
+
version?: number;
|
|
1319
|
+
createdAt?: string;
|
|
1320
|
+
updatedAt?: string;
|
|
1321
|
+
constructor(init?: Partial<EntityDefinition>);
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* An instance of a metadata-defined entity, as the framework's components see it: **flat**.
|
|
1325
|
+
*
|
|
1326
|
+
* The contract keeps the attribute values in a nested `payload` (`EntityObject`), which no generated
|
|
1327
|
+
* form or table could bind to — `BaseEntityFormBuilder` addresses a control by `attrName` on the entity
|
|
1328
|
+
* itself, and `BaseEntityListComponent` reads a cell the same way. `DynamicEntityMapper` flattens on the
|
|
1329
|
+
* way in and re-nests on the way out, so this shape is what the whole frontend works with and the
|
|
1330
|
+
* envelope never leaks past the repository.
|
|
1331
|
+
*
|
|
1332
|
+
* `version` rides along because the update endpoint requires it for optimistic locking; it is a property
|
|
1333
|
+
* of the row, not of the entity's metadata, which is why no attribute descriptor ever names it.
|
|
1334
|
+
*/
|
|
1335
|
+
interface DynamicEntity {
|
|
1336
|
+
id?: string;
|
|
1337
|
+
version?: number;
|
|
1338
|
+
[attrName: string]: unknown;
|
|
1339
|
+
}
|
|
1340
|
+
/** The `content` page every list endpoint of the contract answers with. */
|
|
1341
|
+
interface EntityDefinitionPage {
|
|
1342
|
+
content?: EntityDefinition[];
|
|
1343
|
+
}
|
|
1344
|
+
/** Only an `ACTIVE` definition is rendered; a draft is being authored and a deprecated one is on its way out. */
|
|
1345
|
+
declare function isRenderable(definition: EntityDefinition): boolean;
|
|
1346
|
+
/** `BaseConfiguration` key naming the org-scoped root of the base-entity endpoints. */
|
|
1347
|
+
export declare const ENTITY_SERVICE_ROOT_KEY = "ENTITY_SERVICE_ROOT";
|
|
1348
|
+
/**
|
|
1349
|
+
* Reads the tenant's entity definitions — `GET /organizations/{orgKey}/entity-definitions`.
|
|
1350
|
+
*
|
|
1351
|
+
* **All of them in one call**, rather than one call per entity the shell happens to need. Two things need
|
|
1352
|
+
* the whole set: an `AppDefinition` route names an entity by its `name` while a definition is keyed by
|
|
1353
|
+
* `code`, and an `EMBEDDED_COMPONENTS` attribute names its child by `code` too — so both lookups are
|
|
1354
|
+
* over the collection. Fetching by code would mean a request per level of every aggregate.
|
|
1355
|
+
*
|
|
1356
|
+
* Not a `BaseEntityRestService` subclass, unlike every other service in this library: those exist to give
|
|
1357
|
+
* an entity a *store* whose rows the generated screens edit, and a definition is not edited here — it is
|
|
1358
|
+
* read once and turned into a descriptor. The designer's own CRUD over definitions is a separate surface
|
|
1359
|
+
* with its own facade.
|
|
1360
|
+
*
|
|
1361
|
+
* A failure resolves to `[]` rather than propagating. The root falls back to `BACKEND_SERVICE_ROOT` (see
|
|
1362
|
+
* {@link serviceRootOf}) and a deployment may point that at a host which does not serve this resource at
|
|
1363
|
+
* all — the json-server mock does not — so "no definitions" has to be an ordinary answer. What the caller
|
|
1364
|
+
* renders then is the same "no entity type registered" state as for an unknown entity, which is the truth.
|
|
1365
|
+
*/
|
|
1366
|
+
export declare class EntityDefinitionService {
|
|
1367
|
+
private readonly httpClient;
|
|
1368
|
+
private readonly runtimeConfiguration;
|
|
1369
|
+
findAll(): Observable<EntityDefinition[]>;
|
|
1370
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionService, never>;
|
|
1371
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* The tenant's entity definitions, fetched once and indexed both ways.
|
|
1375
|
+
*
|
|
1376
|
+
* **The one place that knows a definition's `code` and its entity `name` are different things.** A
|
|
1377
|
+
* definition is keyed by `code` (`order`) — that is what the instance endpoints take as a path segment and
|
|
1378
|
+
* what an `EMBEDDED_COMPONENTS` attribute names its child by. A `BaseEntityDescriptor` is keyed by
|
|
1379
|
+
* `entityName` (`Order`) — that is what an `AppDefinition` route names, what `BASE_ENTITY_FACADE_REGISTRY`
|
|
1380
|
+
* is keyed by, and what `BaseFormNavigatorSingletonStore` builds URLs from. Everything downstream of this
|
|
1381
|
+
* class works in names; everything upstream in codes.
|
|
1382
|
+
*
|
|
1383
|
+
* The fetch is memoized as a **promise**, not as its result: several `ENTITY` routes of one application
|
|
1384
|
+
* resolve concurrently while its routes are being built, and awaiting the same in-flight request is what
|
|
1385
|
+
* keeps that one request rather than one per route.
|
|
1386
|
+
*/
|
|
1387
|
+
export declare class EntityDefinitionRegistry {
|
|
1388
|
+
private readonly service;
|
|
1389
|
+
private definitions?;
|
|
1390
|
+
/** Every renderable definition, by `code`. */
|
|
1391
|
+
load(): Promise<ReadonlyMap<string, EntityDefinition>>;
|
|
1392
|
+
/** The definition named `entityName`, i.e. whose `name` is that. */
|
|
1393
|
+
byName(entityName: string | undefined): Promise<EntityDefinition | undefined>;
|
|
1394
|
+
/** The definition with this `code` — how an embedded child and a foreign key name their target. */
|
|
1395
|
+
byCode(code: string | undefined): Promise<EntityDefinition | undefined>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Discards the cache, so the next read fetches again.
|
|
1398
|
+
*
|
|
1399
|
+
* For the designer: a definition edited through its own CRUD screens changes what the previewed
|
|
1400
|
+
* application should render, and nothing else would ever invalidate a session-long cache.
|
|
1401
|
+
*/
|
|
1402
|
+
reset(): void;
|
|
1403
|
+
private fetch;
|
|
1404
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionRegistry, never>;
|
|
1405
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Resolves a definition by its `code` — how an attribute names an embedded child or a foreign-key target.
|
|
1409
|
+
* Supplied by the caller rather than injected, so this module stays a pure function of its inputs.
|
|
1410
|
+
*/
|
|
1411
|
+
type DefinitionLookup = (code: string) => EntityDefinition | undefined;
|
|
1412
|
+
/**
|
|
1413
|
+
* A control type the frontend can render.
|
|
1414
|
+
*
|
|
1415
|
+
* An unrecognized value falls back to `TEXT_BOX` rather than throwing. A definition may name a control the
|
|
1416
|
+
* running frontend has not caught up to — the same situation an `AppDefinition` naming an unknown route
|
|
1417
|
+
* kind is in, and treated the same way: degrade at the one field concerned instead of taking a screen
|
|
1418
|
+
* down. A text box shows the value and lets it be edited, which is the least wrong thing to do with an
|
|
1419
|
+
* attribute nobody has a widget for.
|
|
1420
|
+
*/
|
|
1421
|
+
export declare function controlTypeOf(attribute: EntityAttributeDefinition): FormControlType;
|
|
1422
|
+
/**
|
|
1423
|
+
* Turns one entity definition into the descriptor the generated screens render from.
|
|
1424
|
+
*
|
|
1425
|
+
* The result is an ordinary {@link BaseEntityDescriptor} — the same object a hand-written
|
|
1426
|
+
* `createDescriptor()` returns — which is the whole point: nothing downstream of here can tell a
|
|
1427
|
+
* metadata-defined entity from a compiled one. `store` is left unset; the facade binds it (see
|
|
1428
|
+
* `BaseEntityFacade.descriptor`).
|
|
1429
|
+
*
|
|
1430
|
+
* Three translations happen here, all of them from the contract's vocabulary to the descriptor's:
|
|
1431
|
+
* - **code → name.** `componentParents` and every `linkedEntityType` name a definition by `code`, while
|
|
1432
|
+
* the descriptor's equivalents name an entity by `entityName`. A code with no definition behind it is
|
|
1433
|
+
* dropped rather than passed through: `embeddedAttrFor()` and `isComponentOf()` compare against names,
|
|
1434
|
+
* so a stray code would silently match nothing anyway, and dropping it keeps a broken reference from
|
|
1435
|
+
* also breaking `isEmbedded`'s "must name a parent" invariant.
|
|
1436
|
+
* - **`enumValues` → `selectables`.** Through `toSelectables`, so the options are keyed exactly as a
|
|
1437
|
+
* hand-written descriptor's are.
|
|
1438
|
+
* - **child `isLinkToDetails` → `referenceIdField`.** See {@link referenceIdFieldOf}.
|
|
1439
|
+
*
|
|
1440
|
+
* Attributes are ordered by `displayOrder`, which is the authored field order and therefore the form's
|
|
1441
|
+
* and the table's column order. Ties keep the order the backend sent, so a definition that sets no
|
|
1442
|
+
* `displayOrder` at all still renders in its declared order.
|
|
1443
|
+
*/
|
|
1444
|
+
export declare function descriptorOf(definition: EntityDefinition, lookup: DefinitionLookup): BaseEntityDescriptor;
|
|
1445
|
+
/**
|
|
1446
|
+
* What identifies one embedded row in a URL segment.
|
|
1447
|
+
*
|
|
1448
|
+
* An embedded row has no `id` — it is addressed by its position in the owner's payload, and the URL
|
|
1449
|
+
* carries a *key* that `indexOfRow` looks that position up by. The contract has no `referenceIdField`, so
|
|
1450
|
+
* it is derived: the child definition's `isLinkToDetails` attribute is by construction the one that
|
|
1451
|
+
* titles a row, and therefore the one a user would recognize in a URL.
|
|
1452
|
+
*
|
|
1453
|
+
* **Not cosmetic.** With no `referenceIdField`, `rowId()` reads `row['id']`, which an embedded row does
|
|
1454
|
+
* not have, and returns `''` — whereupon `indexOfRow` answers `-1` for every row and no embedded form can
|
|
1455
|
+
* be opened at all. So the fallback for a child that declares no title attribute matters, and it depends
|
|
1456
|
+
* on what kind of child it is:
|
|
1457
|
+
* - **embedded** — its leading attribute, the first by `displayOrder`. Authoring the flag is one
|
|
1458
|
+
* checkbox, and forgetting it would otherwise make every row of that definition silently unopenable:
|
|
1459
|
+
* the list renders, the rows are there, clicking one does nothing. The leading field is what the row's
|
|
1460
|
+
* list entry is labelled with anyway, so it is also the segment a user would expect in the URL.
|
|
1461
|
+
* - **not embedded** — `'id'`, the default, which is right for a child that does carry ids.
|
|
1462
|
+
*
|
|
1463
|
+
* A heuristic either way, and the same one twice over: uniqueness among sibling rows is the author's to
|
|
1464
|
+
* guarantee, exactly as it already is for an `isLinkToDetails` attribute.
|
|
1465
|
+
*/
|
|
1466
|
+
export declare function referenceIdFieldOf(attribute: EntityAttributeDefinition, lookup: DefinitionLookup): string;
|
|
1467
|
+
/**
|
|
1468
|
+
* Between the contract's `EntityObject` envelope and the flat entity the generated screens bind to.
|
|
1469
|
+
*
|
|
1470
|
+
* The contract nests the attribute values in `payload`, keyed by attribute code. Nothing in the framework
|
|
1471
|
+
* can bind to that: `BaseEntityFormBuilder` adds a control per `attrName` and reads its initial value with
|
|
1472
|
+
* `Reflect.get(entity, attrName)`, `BaseEntityListComponent` reads a cell the same way, and RSQL filters
|
|
1473
|
+
* are built from `attrName` too. So the envelope is opened here, at the repository boundary, and closed
|
|
1474
|
+
* again on the way out — which is the only reason `BaseEntityListComponent` and `BaseEntityFormComponent`
|
|
1475
|
+
* need no knowledge of metadata-defined entities at all.
|
|
1476
|
+
*
|
|
1477
|
+
* `id` and `version` travel on the flat entity beside the attributes. `id` because `PersistedEntity`
|
|
1478
|
+
* requires it and the store keys rows by it; `version` because the update endpoint rejects a payload whose
|
|
1479
|
+
* version does not match the stored one, and the only place to carry it between a read and a write is the
|
|
1480
|
+
* entity the form edited. Neither can collide with an attribute unless a definition declares an attribute
|
|
1481
|
+
* of that name, in which case the envelope wins — see {@link fromDto}.
|
|
1482
|
+
*/
|
|
1483
|
+
export declare class DynamicEntityMapper implements BaseEntityMapper<DynamicEntity> {
|
|
1484
|
+
private readonly entityDefinitionCode;
|
|
1485
|
+
constructor(entityDefinitionCode: string);
|
|
1486
|
+
/**
|
|
1487
|
+
* `{id, version, payload: {...}}` → `{id, version, ...payload}`.
|
|
1488
|
+
*
|
|
1489
|
+
* The envelope is spread **after** the payload, so an attribute that happens to be called `id` or
|
|
1490
|
+
* `version` cannot shadow the row's identity or its lock. A tenant is free to declare such an attribute
|
|
1491
|
+
* — the backend stores it in the payload without complaint — and losing the real id to it would make the
|
|
1492
|
+
* row unaddressable.
|
|
1493
|
+
*
|
|
1494
|
+
* A response that is not an object yields an empty entity rather than throwing: `assertPersistedEntity`
|
|
1495
|
+
* in `BaseEntityRestService` is the check that turns a nonsense response into an error, and it gives a
|
|
1496
|
+
* better message than a `TypeError` from here.
|
|
1497
|
+
*/
|
|
1498
|
+
fromDto(dto: unknown): DynamicEntity;
|
|
1499
|
+
/**
|
|
1500
|
+
* `{id, version, ...attributes}` → `{entityDefinitionCode, version, payload: {...attributes}}`.
|
|
1501
|
+
*
|
|
1502
|
+
* One shape for both verbs, though the contract declares two: `EntityObjectInput` (POST) has
|
|
1503
|
+
* `entityDefinitionCode` + `payload`, `EntityObjectUpdate` (PUT) has `version` + `payload`. Emitting the
|
|
1504
|
+
* union sends each endpoint one field it does not declare, which Jackson ignores — Spring Boot leaves
|
|
1505
|
+
* `FAIL_ON_UNKNOWN_PROPERTIES` off. The alternative is a mapper that knows which verb is about to be
|
|
1506
|
+
* used, which `BaseEntityMapper` has no way to tell it and which would put HTTP knowledge in a mapper.
|
|
1507
|
+
*
|
|
1508
|
+
* `id` is deliberately **not** sent: it is a path segment on update and assigned by the server on
|
|
1509
|
+
* create, so a body carrying it could only ever disagree with the URL.
|
|
1510
|
+
*/
|
|
1511
|
+
toDto(entity: DynamicEntity): unknown;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* The repository of one metadata-defined entity type —
|
|
1515
|
+
* `/organizations/{orgKey}/entities/{entityDefinitionCode}`.
|
|
1516
|
+
*
|
|
1517
|
+
* A plain `BaseEntityRestService`, which is the point: the operation layer of the contract is an ordinary
|
|
1518
|
+
* paged collection with an RSQL filter, so nothing about reading, filtering, paging or writing needs new
|
|
1519
|
+
* code. Two details differ from the rest of the workspace, and only two:
|
|
1520
|
+
*
|
|
1521
|
+
* - **The collection is per definition.** `entities/order` and `entities/dynamic-entity` are different
|
|
1522
|
+
* resources, so the definition code is part of the resource URL rather than a query parameter, and one
|
|
1523
|
+
* service instance serves one entity type — exactly as a hand-written service does.
|
|
1524
|
+
* - **The query parameters are named differently.** `listEntities` in `base-entity-api.yaml` calls them
|
|
1525
|
+
* `rsql` and `sort` where `shared-api.yaml` and every feature built on it say `where` and `order`. The
|
|
1526
|
+
* expressions are the same; only the names differ, hence the two overrides.
|
|
1527
|
+
*
|
|
1528
|
+
* Constructed directly by `DynamicEntityFacade` rather than provided, so the definition code can be a
|
|
1529
|
+
* constructor argument. It must be constructed inside an injection context — the base class injects
|
|
1530
|
+
* `HttpClient` and `RUNTIME_CONFIGURATION` in field initializers.
|
|
1531
|
+
*/
|
|
1532
|
+
export declare class DynamicEntityService extends BaseEntityRestService<DynamicEntity> {
|
|
1533
|
+
protected readonly filterParamName = "rsql";
|
|
1534
|
+
protected readonly sortParamName = "sort";
|
|
1535
|
+
constructor(entityDefinitionCode: string);
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Facade of an entity whose payload lives inside another entity's document. Everything but the repository
|
|
1539
|
+
* and the store's notion of a key is inherited: the descriptor, the tabs, the container state — so an
|
|
1540
|
+
* embedded entity registers in `BASE_ENTITY_FACADE_REGISTRY` alongside the routable ones and its list and
|
|
1541
|
+
* form are the stock components.
|
|
1542
|
+
*
|
|
1543
|
+
* The descriptor still has to declare `componentParent` and `isEmbedded`, and the containing entity still
|
|
1544
|
+
* has to reference it with `FormControlType.EMBEDDED_COMPONENTS`; the form control checks both agree.
|
|
1545
|
+
*/
|
|
1546
|
+
export declare abstract class EmbeddedEntityFacade<Entity extends BaseEntity> extends BaseEntityFacade<Entity> {
|
|
1547
|
+
private _accessor?;
|
|
1548
|
+
/** Takes no mapper: an embedded row is carried, and mapped, by the containing entity's payload. */
|
|
1549
|
+
protected createService(): BaseEntityService<Entity>;
|
|
1550
|
+
/**
|
|
1551
|
+
* The generic store, keyed by whatever identifies an embedded row rather than by `id`.
|
|
1552
|
+
*
|
|
1553
|
+
* An embedded child is not guaranteed to have one — `App Region` is identified by `type`, the contract
|
|
1554
|
+
* giving a region no id — and the store is what the details form reads its row from (`loadById`) and
|
|
1555
|
+
* what a delete removes it from. Keyed by `id` alone those would silently miss every such row, or, since
|
|
1556
|
+
* `undefined === undefined`, hit the wrong one.
|
|
1557
|
+
*
|
|
1558
|
+
* The field is read per call rather than captured, for the same reason the accessor resolves per call:
|
|
1559
|
+
* one store serves every owner of this child type, and which attribute's rows it stands for is decided
|
|
1560
|
+
* by the route that is open.
|
|
1561
|
+
*/
|
|
1562
|
+
protected createStoreClass(): Type<unknown>;
|
|
1563
|
+
private readonly rowKeyOf;
|
|
1564
|
+
private get accessor();
|
|
1565
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedEntityFacade<any>, never>;
|
|
1566
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* The class a metadata-defined entity's store instantiates for a new row.
|
|
1570
|
+
*
|
|
1571
|
+
* A class rather than an object literal because `BaseEntityFacade` needs a `Type<Entity>`: the store calls
|
|
1572
|
+
* `new entityType()` in `createEntity()`, and `entityNameFromType()` reads `.name` off it for the devtools
|
|
1573
|
+
* label. One class per definition, named after it, so two entities do not share a devtools store name.
|
|
1574
|
+
*
|
|
1575
|
+
* The constructor seeds the attributes' authored `defaultValue`s, which is what makes a new-row form open
|
|
1576
|
+
* with `status: DRAFT` rather than empty — `BaseEntityFormBuilder` reads each control's initial value off
|
|
1577
|
+
* the entity the store created.
|
|
1578
|
+
*/
|
|
1579
|
+
export declare function dynamicEntityTypeOf(definition: EntityDefinition): Type<DynamicEntity>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Facade of an entity that exists only as metadata.
|
|
1582
|
+
*
|
|
1583
|
+
* Everything a hand-written facade contributes is contributed here from a `BaseEntityDefinition` instead:
|
|
1584
|
+
* the descriptor (synthesized by `descriptorOf`), the repository (`DynamicEntityService` over the
|
|
1585
|
+
* definition's own collection) and — inherited untouched — the signal store with its tabs and container
|
|
1586
|
+
* state. That is what lets `BaseEntityContainerComponent`, the list, the form, the toolbar and the status
|
|
1587
|
+
* bar work on a designer-created entity with no change of their own.
|
|
1588
|
+
*
|
|
1589
|
+
* Instantiated by `DynamicEntityRegistry` rather than provided as a token, because there is no token to
|
|
1590
|
+
* declare at compile time: which entities exist is a fact about the tenant's data. It must be constructed
|
|
1591
|
+
* inside an injection context (`runInInjectionContext`) — the base class injects `Injector` in a field
|
|
1592
|
+
* initializer.
|
|
1593
|
+
*
|
|
1594
|
+
* Deliberately **not** `@Injectable()`, unlike every hand-written facade: its constructor parameters are a
|
|
1595
|
+
* definition and a descriptor, which are not injection tokens, and the decorator makes the compiler demand
|
|
1596
|
+
* that they be (NG2003). Nothing is lost — the decorator is what lets Angular *construct* a class, and this
|
|
1597
|
+
* one is constructed by hand.
|
|
1598
|
+
*/
|
|
1599
|
+
export declare class DynamicEntityFacade extends BaseEntityFacade<DynamicEntity> {
|
|
1600
|
+
private readonly definition;
|
|
1601
|
+
private readonly synthesizedDescriptor;
|
|
1602
|
+
readonly entityType: Type<DynamicEntity>;
|
|
1603
|
+
constructor(definition: EntityDefinition, synthesizedDescriptor: BaseEntityDescriptor);
|
|
1604
|
+
/** The `entities/{code}` collection. Bypasses the base class's `backendRoot`/`endpoint` pair, which
|
|
1605
|
+
* expects the two to be declared as fields by a subclass written by hand. */
|
|
1606
|
+
protected createService(): BaseEntityService<DynamicEntity>;
|
|
1607
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Facade of a metadata-defined entity whose payload travels inside its parent's — an
|
|
1611
|
+
* `isEmbedded: true` definition.
|
|
1612
|
+
*
|
|
1613
|
+
* Differs from {@link DynamicEntityFacade} in exactly what `EmbeddedEntityFacade` already differs in: the
|
|
1614
|
+
* repository reads and writes the containing entity's document rather than a collection of its own, and
|
|
1615
|
+
* the store is keyed by the row's `referenceIdField` rather than by `id`. Both come from the base class;
|
|
1616
|
+
* this only supplies the descriptor and the row type.
|
|
1617
|
+
*
|
|
1618
|
+
* Undecorated for the same reason as {@link DynamicEntityFacade}.
|
|
1619
|
+
*/
|
|
1620
|
+
export declare class DynamicEmbeddedEntityFacade extends EmbeddedEntityFacade<DynamicEntity> {
|
|
1621
|
+
private readonly synthesizedDescriptor;
|
|
1622
|
+
readonly entityType: Type<DynamicEntity>;
|
|
1623
|
+
constructor(definition: EntityDefinition, synthesizedDescriptor: BaseEntityDescriptor);
|
|
1624
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
1625
|
+
}
|
|
1626
|
+
/** One metadata-defined entity, ready to render. */
|
|
1627
|
+
interface ResolvedDynamicEntity {
|
|
1628
|
+
entityName: string;
|
|
1629
|
+
descriptor: BaseEntityDescriptor;
|
|
1630
|
+
facade: BaseEntityFacade<BaseEntity>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Token the facade answers to. `EmbeddedChildRoute.facade` and `ACTIVE_ENTITY_FACADE` are
|
|
1633
|
+
* `ProviderToken`s, so a facade that was never declared as a provider still needs one — see
|
|
1634
|
+
* {@link DynamicEntityRegistry.tokenFor}.
|
|
1635
|
+
*/
|
|
1636
|
+
facadeToken: ProviderToken<BaseEntityFacade<BaseEntity>>;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Builds and holds the facades of metadata-defined entities — the counterpart of
|
|
1640
|
+
* `BASE_ENTITY_FACADE_REGISTRY` for entity types that exist only as `BaseEntityDefinition` rows.
|
|
1641
|
+
*
|
|
1642
|
+
* `resolve` is async because the definitions have to be fetched; everything after that is synchronous, and
|
|
1643
|
+
* deliberately so. Once an entity is resolved, `descriptorOf` and `storeOf` answer immediately, which is
|
|
1644
|
+
* what lets `BaseEntityDescriptorRegistry` — and through it `EmbeddedAggregateAccessor`, the embedded route
|
|
1645
|
+
* context and every embedded form control — keep the synchronous signature they already have.
|
|
1646
|
+
*
|
|
1647
|
+
* **Resolving an entity resolves its whole aggregate.** An `EMBEDDED_COMPONENTS` attribute names a child
|
|
1648
|
+
* definition, and that child needs a descriptor and a store of its own before its rows can be listed on the
|
|
1649
|
+
* parent's form. Doing it here, in one pass, is what makes the parent's form work on the first render
|
|
1650
|
+
* rather than after a second navigation.
|
|
1651
|
+
*
|
|
1652
|
+
* Everything is created inside `runInInjectionContext`: facades inject `Injector`, the REST service injects
|
|
1653
|
+
* `HttpClient`, and `resolve` is called from a route builder that has already awaited — at which point the
|
|
1654
|
+
* ambient injection context is gone.
|
|
1655
|
+
*/
|
|
1656
|
+
export declare class DynamicEntityRegistry {
|
|
1657
|
+
private readonly definitions;
|
|
1658
|
+
private readonly resolvedEntities;
|
|
1659
|
+
private readonly injector;
|
|
1660
|
+
private readonly resolved;
|
|
1661
|
+
private readonly tokens;
|
|
1662
|
+
/**
|
|
1663
|
+
* The entity named `entityName`, or `undefined` when this tenant has no such definition — which is an
|
|
1664
|
+
* ordinary answer, not an error: an `AppDefinition` may name an entity that has been renamed or deleted,
|
|
1665
|
+
* and the caller renders "no entity type registered" for it.
|
|
1666
|
+
*/
|
|
1667
|
+
resolve(entityName: string | undefined): Promise<ResolvedDynamicEntity | undefined>;
|
|
1668
|
+
/** The descriptor of an already-resolved entity. Synchronous; `undefined` before {@link resolve}. */
|
|
1669
|
+
descriptorOf(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
1670
|
+
/** The store of an already-resolved entity, bound into its descriptor by the facade. */
|
|
1671
|
+
storeOf(entityName: string | undefined): unknown;
|
|
1672
|
+
/**
|
|
1673
|
+
* Token the facade of an already-resolved entity answers to, for a caller that has to *provide* it — a
|
|
1674
|
+
* route branch binding `ACTIVE_ENTITY_FACADE`. `undefined` before {@link resolve}, so that nothing can
|
|
1675
|
+
* hand the router a token whose factory would throw on the first navigation into it.
|
|
1676
|
+
*/
|
|
1677
|
+
facadeTokenOf(entityName: string | undefined): ProviderToken<BaseEntityFacade<BaseEntity>> | undefined;
|
|
1678
|
+
/**
|
|
1679
|
+
* Discards every built facade, so the next `resolve` rebuilds from freshly fetched definitions.
|
|
1680
|
+
*
|
|
1681
|
+
* For the designer: an edited definition means a different descriptor. The tokens are kept — an
|
|
1682
|
+
* `InjectionToken`'s root factory is called once and its result cached by the injector, so a token
|
|
1683
|
+
* handed out earlier has to keep answering; it reads through {@link resolved}, which is why replacing
|
|
1684
|
+
* the entry is enough.
|
|
1685
|
+
*/
|
|
1686
|
+
reset(): void;
|
|
1687
|
+
/**
|
|
1688
|
+
* The facade of `entityName` as a token.
|
|
1689
|
+
*
|
|
1690
|
+
* One token per entity name, created once and kept: `EmbeddedChildRoute.facade` is a `ProviderToken` that
|
|
1691
|
+
* `baseEntityRoutes` turns into `{ provide: ACTIVE_ENTITY_FACADE, useExisting: token }`, and a second
|
|
1692
|
+
* token for the same entity would give the same routes two facades and therefore two stores.
|
|
1693
|
+
*
|
|
1694
|
+
* The factory reads through {@link resolved} rather than closing over the facade, so that a `reset()`
|
|
1695
|
+
* followed by a re-`resolve` is visible through a token the router still holds.
|
|
1696
|
+
*/
|
|
1697
|
+
private tokenFor;
|
|
1698
|
+
/**
|
|
1699
|
+
* Synthesizes one definition's descriptor and facade, then recurses into the children its
|
|
1700
|
+
* `EMBEDDED_COMPONENTS` attributes name.
|
|
1701
|
+
*
|
|
1702
|
+
* `building` guards the recursion: an embedded child may nest inside itself (base-app's `App Nav Item`
|
|
1703
|
+
* does), which is a finite definition graph but an infinite tree. The child is registered before the
|
|
1704
|
+
* recursion so a self-reference finds the entry that is being built rather than starting a second one.
|
|
1705
|
+
*/
|
|
1706
|
+
private build;
|
|
1707
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicEntityRegistry, never>;
|
|
1708
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* An embedded child to mount under an entity's details route. The entity's descriptor has to reference it
|
|
1712
|
+
* with `FormControlType.EMBEDDED_COMPONENTS`, and the child's own descriptor has to name the entity as a
|
|
1713
|
+
* `componentParent`.
|
|
1714
|
+
*/
|
|
1715
|
+
interface EmbeddedChildRoute {
|
|
1716
|
+
entityName: string;
|
|
1717
|
+
facade: ProviderToken<BaseEntityFacade<BaseEntity>>;
|
|
1718
|
+
/** Extra providers for the branch — a transloco scope, most often. */
|
|
1719
|
+
providers?: Array<Provider | EnvironmentProviders>;
|
|
1720
|
+
/**
|
|
1721
|
+
* The child's own embedded children. A thunk so a child may name itself: `App Nav Item` nests inside
|
|
1722
|
+
* `App Nav Item`, which no eager value could express.
|
|
1723
|
+
*/
|
|
1724
|
+
children?: () => EmbeddedChildRoute[];
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* The list and details routes of one entity, plus a branch per embedded child.
|
|
1728
|
+
*
|
|
1729
|
+
* An embedded child is addressed by its position in the containing document, so its screens hang **below**
|
|
1730
|
+
* the owner's details route — `test-entity/1/details/embedded-component/embedded_1_1/details`. That nesting
|
|
1731
|
+
* is not decoration: it is what carries the path, so a deep link and a refresh resolve to the same row, and
|
|
1732
|
+
* what makes the child unreachable except through its parent, since the parent's segments are part of the
|
|
1733
|
+
* URL that matches at all.
|
|
1734
|
+
*
|
|
1735
|
+
* The branch is attached with `loadChildren` rather than `children` because it is expanded one level per
|
|
1736
|
+
* navigation. A child that names itself would otherwise be an infinite structure; lazily, it is finite at
|
|
1737
|
+
* any moment and Angular memoizes each level it has expanded.
|
|
1738
|
+
*/
|
|
1739
|
+
export declare function baseEntityRoutes(embeddedChildren?: EmbeddedChildRoute[], extraTabs?: EntityTabDescriptor[]): Routes;
|
|
1740
|
+
/** The stand-alone entity routes, unchanged for every caller that has no embedded children to mount. */
|
|
1741
|
+
export declare const BASE_ENTITY_ROUTES: Routes;
|
|
1742
|
+
/** Everything needed to mount one entity's List and Details screens somewhere. */
|
|
1743
|
+
interface EntityScreens {
|
|
1744
|
+
descriptor: BaseEntityDescriptor;
|
|
1745
|
+
/** The branches to hand to `baseEntityRoutes`, one per `EMBEDDED_COMPONENTS` attribute, recursively. */
|
|
1746
|
+
embeddedChildren: EmbeddedChildRoute[];
|
|
1747
|
+
/**
|
|
1748
|
+
* The descriptor's own extra tabs plus whatever the registered {@link EntityTabContributor}s offered —
|
|
1749
|
+
* the value to hand `baseEntityRoutes`, so that every tab the tab bar renders a link for has a route
|
|
1750
|
+
* answering to it. Mirrors `descriptor.extraTabs`, which this resolver has already updated.
|
|
1751
|
+
*/
|
|
1752
|
+
extraTabs: EntityTabDescriptor[];
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Resolves an entity by name to its descriptor and the embedded branches below it — **whether the entity is
|
|
1756
|
+
* compiled in or exists only as metadata**.
|
|
1757
|
+
*
|
|
1758
|
+
* This is the seam that keeps the run-time shell from having to care about the difference. `base-app`'s
|
|
1759
|
+
* route renderer asks for an entity by the name an `AppDefinition` route gave it and gets the same answer
|
|
1760
|
+
* either way: a descriptor with a store bound, and the `EmbeddedChildRoute[]` that `baseEntityRoutes`
|
|
1761
|
+
* already knows how to mount. A tenant may perfectly well have an application whose screens are half
|
|
1762
|
+
* compiled (`Document`, with its content editor) and half authored, and neither has to know about the other.
|
|
1763
|
+
*
|
|
1764
|
+
* Compile-time facades win. If an entity name is in `BASE_ENTITY_FACADE_REGISTRY`, that registration is the
|
|
1765
|
+
* host application's explicit decision — it may attach extra tabs or a hand-tuned layout a synthesized
|
|
1766
|
+
* descriptor cannot know about — and a definition of the same name does not override it.
|
|
1767
|
+
*/
|
|
1768
|
+
export declare class EntityScreenResolver {
|
|
1769
|
+
private readonly facadeRegistry;
|
|
1770
|
+
private readonly dynamicRegistry;
|
|
1771
|
+
private readonly injector;
|
|
1772
|
+
private readonly tabContributors;
|
|
1773
|
+
/** `undefined` when neither a facade nor a definition answers to `entityName`. */
|
|
1774
|
+
resolve(entityName: string | undefined): Promise<EntityScreens | undefined>;
|
|
1775
|
+
/**
|
|
1776
|
+
* The descriptor's extra tabs after every contributor has been asked — and **written back onto the
|
|
1777
|
+
* descriptor**, because that is what `BaseEntityTabsComponent` renders the links from. The routes are
|
|
1778
|
+
* built from the returned array, so the two cannot disagree.
|
|
1779
|
+
*
|
|
1780
|
+
* Deduplicated by segment, and mutated in place rather than replaced: a compile-time descriptor is a
|
|
1781
|
+
* singleton that may be resolved more than once (two routes mounting the same entity, or base-app
|
|
1782
|
+
* re-rendering after a definition changed), and both a duplicated tab and a descriptor whose array
|
|
1783
|
+
* identity changed under a rendered tab bar are bugs this has already had.
|
|
1784
|
+
*
|
|
1785
|
+
* A contributor that throws is skipped with the others left intact: it is offering a screen, and an
|
|
1786
|
+
* entity's List and Details are not worth failing over one feature that could not make up its mind.
|
|
1787
|
+
*/
|
|
1788
|
+
private extraTabsOf;
|
|
1789
|
+
private tabsFrom;
|
|
1790
|
+
/**
|
|
1791
|
+
* The branches for one descriptor's embedded children — **one level of them**.
|
|
1792
|
+
*
|
|
1793
|
+
* Each branch carries a *thunk* for the level below it rather than an expanded tree, which is what
|
|
1794
|
+
* `EmbeddedChildRoute.children` is for and what makes the depth unbounded: `baseEntityRoutes` calls the
|
|
1795
|
+
* thunk from a `loadChildren`, once per navigation into that level. So a child type that nests inside
|
|
1796
|
+
* itself — base-app's `App Nav Item`, or any definition whose `EMBEDDED_COMPONENTS` attribute names its
|
|
1797
|
+
* own — is finite at any moment and expands as far as the user drills. An eagerly built tree could not
|
|
1798
|
+
* express that structure at all, and would not terminate trying.
|
|
1799
|
+
*
|
|
1800
|
+
* A child with neither a facade nor a resolved definition is **skipped**: its rows are still listed on
|
|
1801
|
+
* the owner's form (they are part of the owner's payload), they just cannot be opened. That is a better
|
|
1802
|
+
* reading of an incomplete aggregate than refusing to mount the owner's screens at all.
|
|
1803
|
+
*/
|
|
1804
|
+
private embeddedChildrenOf;
|
|
1805
|
+
private childRouteOf;
|
|
1806
|
+
/** Only the *compile-time* descriptor: `BaseEntityDescriptorRegistry` would answer for both. */
|
|
1807
|
+
private compileTimeDescriptorOf;
|
|
1808
|
+
private compileTimeFacadeOf;
|
|
1809
|
+
private descriptorOf;
|
|
1810
|
+
private facadeTokenOf;
|
|
1811
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityScreenResolver, never>;
|
|
1812
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Contributes extra tabs to *another* feature's entity — the cross-cutting counterpart of declaring
|
|
1816
|
+
* `extraTabs` on a descriptor.
|
|
1817
|
+
*
|
|
1818
|
+
* The descriptor hook covers the case where the feature owning the entity also owns the extra screen:
|
|
1819
|
+
* `Document` adds its content editor, a `State Machine Definition` adds the modeler. It cannot cover the
|
|
1820
|
+
* opposite case, which is what this is for — base-state has a screen to offer `Order`, and neither
|
|
1821
|
+
* base-entity nor whoever authored the `order` definition can be expected to know that. A contributor is
|
|
1822
|
+
* asked about every entity whose screens are mounted through {@link EntityScreenResolver}, and answers for
|
|
1823
|
+
* the ones it recognizes.
|
|
1824
|
+
*
|
|
1825
|
+
* **Asked once per entity, when its screens are resolved.** {@link tabsFor} may therefore be asynchronous —
|
|
1826
|
+
* a contributor typically has to fetch something to know whether it has anything to offer — and the answer
|
|
1827
|
+
* is fixed for the life of the resolved entity. A tab whose *content* varies is the tab component's
|
|
1828
|
+
* business; a tab whose *existence* varies while the application runs is not expressible here, and should
|
|
1829
|
+
* be a tab that always exists and says it has nothing to show.
|
|
1830
|
+
*
|
|
1831
|
+
* Contributed tabs are appended after the descriptor's own, so a feature's own screens keep the order it
|
|
1832
|
+
* declared them in, and are deduplicated by `segment`: the same contributor answering twice for one
|
|
1833
|
+
* descriptor — which happens whenever a compile-time descriptor, being a singleton, is resolved again —
|
|
1834
|
+
* must not stack the tab up.
|
|
1835
|
+
*/
|
|
1836
|
+
interface EntityTabContributor {
|
|
1837
|
+
/** The tabs this contributor offers `descriptor`, or an empty array — the usual answer. */
|
|
1838
|
+
tabsFor(descriptor: BaseEntityDescriptor): Promise<EntityTabDescriptor[]> | EntityTabDescriptor[];
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* The registered {@link EntityTabContributor}s. A `multi` token, so every feature adds its own without
|
|
1842
|
+
* any of them knowing about the others; absent entirely when no feature contributes, which is why every
|
|
1843
|
+
* reader injects it optionally.
|
|
1844
|
+
*/
|
|
1845
|
+
export declare const ENTITY_TAB_CONTRIBUTORS: InjectionToken<readonly EntityTabContributor[]>;
|
|
1846
|
+
interface EntityScreenRouteOptions {
|
|
1847
|
+
/** Entity whose screens to mount, by descriptor name. */
|
|
1848
|
+
entityName: string | undefined;
|
|
1849
|
+
/**
|
|
1850
|
+
* What {@link EntityScreenResolver} answered. Absent — an entity with neither a facade nor a definition —
|
|
1851
|
+
* yields a leaf route whose component renders "no entity type registered" instead of no route at all.
|
|
1852
|
+
*/
|
|
1853
|
+
screens?: EntityScreens;
|
|
1854
|
+
/**
|
|
1855
|
+
* Path this route is mounted at, if any. Only read to decide whether the entity's own segment is already
|
|
1856
|
+
* there; pass the route's own `path`, not the URL prefix above it.
|
|
1857
|
+
*/
|
|
1858
|
+
hostPath?: string;
|
|
1859
|
+
/** Extra route `data` the host wants alongside what this sets. */
|
|
1860
|
+
data?: Record<string, unknown>;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* One entity's screens as a `Route` — component, `data` and the children that make List and Details real
|
|
1864
|
+
* routes.
|
|
1865
|
+
*
|
|
1866
|
+
* The `Route` is returned rather than registered, so it composes: a hand-written application spreads it into
|
|
1867
|
+
* its own route config, and base-app's `AppRouteRenderer` spreads it into what an `AppDefinition` authored.
|
|
1868
|
+
* `path` is deliberately **not** set — that belongs to whoever mounts this.
|
|
1869
|
+
*
|
|
1870
|
+
* Everything about the URL shape lives here rather than in any one host, because the rules are
|
|
1871
|
+
* base-entity's: `BaseFormNavigatorSingletonStore` composes every entity URL as
|
|
1872
|
+
* `<base>/<snakeCaseName(entityName)>/list` or `<base>/<snakeCaseName(entityName)>/<id>/details`, and
|
|
1873
|
+
* derives `<base>` by counting segments back from the current URL. A host that got this wrong would see
|
|
1874
|
+
* every tab click and row link do nothing at all — see {@link entityScreenChildren}.
|
|
1875
|
+
*/
|
|
1876
|
+
export declare function entityScreenRoute({ entityName, screens, hostPath, data }: EntityScreenRouteOptions): Route;
|
|
1877
|
+
/** Route `data` key under which {@link entityScreenRoute} puts the descriptor to render. */
|
|
1878
|
+
export declare const ENTITY_DESCRIPTOR_ROUTE_DATA_KEY = "entityDescriptor";
|
|
1879
|
+
/**
|
|
1880
|
+
* Route `data` key naming the entity the route *asked* for — which is all this component needs, and needs
|
|
1881
|
+
* even when nothing answered to it.
|
|
1882
|
+
*
|
|
1883
|
+
* Not `ENTITY_NAME_ROUTE_DATA_KEY`, deliberately: that key marks the route owning the entity's URL segment,
|
|
1884
|
+
* and everything that reads it — `readEmbeddedBreadcrumb`, `EntityRouteRegistry` — would take this route to
|
|
1885
|
+
* be that one. See the note in {@link entityScreenRoute}.
|
|
1886
|
+
*/
|
|
1887
|
+
export declare const REQUESTED_ENTITY_ROUTE_DATA_KEY = "requestedEntityName";
|
|
1888
|
+
/**
|
|
1889
|
+
* Hosts one entity's generated screens at a route: List and Details, with the tab bar, toolbar and status
|
|
1890
|
+
* bar `BaseEntityTabsComponent` brings, and the outlet its own child routes render in.
|
|
1891
|
+
*
|
|
1892
|
+
* The descriptor is **read off the route, not resolved here**. Whoever built the route resolved it — see
|
|
1893
|
+
* {@link entityScreenRoute} — so it is on `data` by the time this component exists. That is deliberate:
|
|
1894
|
+
* resolving here would mean an `await` inside the component, hence a frame with no container, and therefore
|
|
1895
|
+
* no `<router-outlet>`, while a child route (`…/order/list`) is already activated.
|
|
1896
|
+
*
|
|
1897
|
+
* Works for an entity of either kind, because a descriptor is a descriptor: one whose facade was compiled in
|
|
1898
|
+
* and one synthesized from a `BaseEntityDefinition` reach here the same way. That is what lets an
|
|
1899
|
+
* application mount metadata-defined entity screens with no knowledge of where the descriptor came from —
|
|
1900
|
+
* and with no dependency on base-app, which merely happens to be one caller.
|
|
1901
|
+
*
|
|
1902
|
+
* Without a descriptor the route stays a leaf and says so. A warning rather than a failure: whatever names
|
|
1903
|
+
* the entity — an `AppDefinition` route, a hand-written route in an application — is allowed to be ahead of
|
|
1904
|
+
* what is deployed, and the link that leads here has to render something.
|
|
1905
|
+
*/
|
|
1906
|
+
export declare class BaseEntityScreensComponent {
|
|
1907
|
+
private readonly route;
|
|
1908
|
+
protected readonly entityName: import("@angular/core").Signal<string | undefined>;
|
|
1909
|
+
protected readonly descriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
1910
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityScreensComponent, never>;
|
|
1911
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityScreensComponent, "base-entity-screens", never, {}, {}, never, never, true, never>;
|
|
1912
|
+
}
|
|
1913
|
+
/** One `<entity>/<id>/details` step of the URL: which entity, and which instance of it. */
|
|
1914
|
+
interface EmbeddedRouteLevel {
|
|
1915
|
+
entityName: string;
|
|
1916
|
+
/** `undefined` on a list route, {@link BaseUrlSegments.NewEntity} for a row being created. */
|
|
1917
|
+
entityId: string | undefined;
|
|
1918
|
+
}
|
|
1919
|
+
/** A {@link EmbeddedRouteLevel} with the two URLs the level can be navigated by. */
|
|
1920
|
+
interface EmbeddedBreadcrumbLevel extends EmbeddedRouteLevel {
|
|
1921
|
+
/** This level's own screen — its details form, or its list while no row is named. */
|
|
1922
|
+
url: string;
|
|
1923
|
+
/** The prefix the level's own `<entity>/...` segments hang off, which a sibling URL is built on. */
|
|
1924
|
+
baseUrl: string;
|
|
1925
|
+
}
|
|
1926
|
+
/** Everything the store's service needs to read and write one embedded level's rows. */
|
|
1927
|
+
interface EmbeddedRouteContext {
|
|
1928
|
+
rootEntityName: string;
|
|
1929
|
+
rootId: string;
|
|
1930
|
+
/** Hops from the root down to the **owner** of these rows; `[]` when the owner is the root itself. */
|
|
1931
|
+
path: EmbeddedPath;
|
|
1932
|
+
/** The owner's attribute carrying these rows. */
|
|
1933
|
+
attrName: string;
|
|
1934
|
+
entityName: string;
|
|
1935
|
+
referenceIdField?: string;
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* The chain of entities the URL walks through, outermost first — `Test Entity/1`, then
|
|
1939
|
+
* `Embedded Component/embedded_1_1`, and so on. It reads the URL only, which is what makes a deep link and a
|
|
1940
|
+
* page refresh resolve to the same row as a drill-down.
|
|
1941
|
+
*
|
|
1942
|
+
* The entity name sits on the container route and the id on its `:entityId/details` child, and the router
|
|
1943
|
+
* hands both **down** to the routes nested below them. Three rules undo that inheritance:
|
|
1944
|
+
*
|
|
1945
|
+
* - a name counts only from the route that *declares* it in its config, not from every descendant that
|
|
1946
|
+
* inherited it — see {@link declaredEntityName};
|
|
1947
|
+
* - a name repeated while the level below it still has no id is that level's own details route echoing its
|
|
1948
|
+
* container, not a new level — whereas a repeat *after* an id is a genuinely self-nesting child
|
|
1949
|
+
* (`app-nav-item/a/details/app-nav-item/b/details`), which `App Nav Item` needs;
|
|
1950
|
+
* - an id counts only from the route that actually declares `:entityId`, so a nested branch does not adopt
|
|
1951
|
+
* the id of the entity it hangs under.
|
|
1952
|
+
*/
|
|
1953
|
+
declare function readEmbeddedRouteChain(snapshot: ActivatedRouteSnapshot | null): EmbeddedRouteLevel[];
|
|
1954
|
+
/**
|
|
1955
|
+
* The same chain, each level carrying the URL of its own screen — which is what turns it into a
|
|
1956
|
+
* breadcrumb the user can walk back up.
|
|
1957
|
+
*
|
|
1958
|
+
* The URL is accumulated from the segments of the routes the walk passes, so a level's `url` ends at the
|
|
1959
|
+
* last route that belongs to *it*: `<owner>/<id>/details` for a level a row is named on. `baseUrl` stops
|
|
1960
|
+
* one step earlier, before the level's own entity segment, and is what a sibling list or details URL is
|
|
1961
|
+
* built on.
|
|
1962
|
+
*/
|
|
1963
|
+
declare function readEmbeddedBreadcrumb(snapshot: ActivatedRouteSnapshot | null): EmbeddedBreadcrumbLevel[];
|
|
1964
|
+
/**
|
|
1965
|
+
* The part of a URL chain that is **one aggregate**: the longest tail in which every level is an embedded
|
|
1966
|
+
* component of the level above it.
|
|
1967
|
+
*
|
|
1968
|
+
* A URL may walk through entities that have nothing to do with each other. The designer's Preview tab is the
|
|
1969
|
+
* case that forced this: a previewed application's screens are mounted *below* `app-definition/<id>`, so an
|
|
1970
|
+
* order line's chain reads `App Definition` -> `Order` -> `Order Line`. Taking the outermost level as the
|
|
1971
|
+
* aggregate root then asks `App Definition` for an embedded `Order` it has never heard of, and nothing
|
|
1972
|
+
* resolves — which showed up as every embedded list in a previewed application coming up empty, and every
|
|
1973
|
+
* link into an embedded row bouncing back to the form it was clicked on.
|
|
1974
|
+
*
|
|
1975
|
+
* Walking back from the deepest level and stopping at the first pair that is not a containment expresses
|
|
1976
|
+
* "one aggregate" without needing to know *why* the outer levels are there. For an ordinary authoring URL,
|
|
1977
|
+
* where the whole chain is one aggregate, it stops at the root and changes nothing.
|
|
1978
|
+
*/
|
|
1979
|
+
declare function aggregateChainOf<Level extends EmbeddedRouteLevel>(levels: readonly Level[], descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): Level[];
|
|
1980
|
+
/**
|
|
1981
|
+
* Turns the URL chain into a path into the root's payload. Resolving the hops needs the payload itself,
|
|
1982
|
+
* because a row's position is what addresses it — the URL carries the row's *key*, and only the aggregate
|
|
1983
|
+
* knows where that key currently sits.
|
|
1984
|
+
*
|
|
1985
|
+
* Returns `undefined` when the chain names no embedded level, when a descriptor is missing, or when an
|
|
1986
|
+
* intermediate row cannot be found — a stale deep link, which the caller turns into a redirect rather than
|
|
1987
|
+
* into a form bound to the wrong row.
|
|
1988
|
+
*/
|
|
1989
|
+
declare function resolveEmbeddedRouteContext(levels: readonly EmbeddedRouteLevel[], rootPayload: unknown, descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): EmbeddedRouteContext | undefined;
|
|
1990
|
+
/** An embedded level resolved against the live aggregate: where its rows are, and who owns the document. */
|
|
1991
|
+
interface ResolvedEmbeddedAggregate {
|
|
1992
|
+
context: EmbeddedRouteContext;
|
|
1993
|
+
rootStore: BaseEntityStoreApi<BaseEntity>;
|
|
1994
|
+
rootPayload: unknown;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Resolves an embedded entity's place in the aggregate that is currently open, and is the single point that
|
|
1998
|
+
* knows an embedded write is really a write of the **root** document.
|
|
1999
|
+
*
|
|
2000
|
+
* The lookup is done per call rather than held as state: the stores are root singletons, while the row an
|
|
2001
|
+
* embedded store stands for changes with every navigation.
|
|
2002
|
+
*/
|
|
2003
|
+
export declare class EmbeddedAggregateAccessor {
|
|
2004
|
+
private readonly router;
|
|
2005
|
+
private readonly descriptorRegistry;
|
|
2006
|
+
/** `undefined` when no aggregate holding `entityName` is open — the caller decides whether that is an error. */
|
|
2007
|
+
resolve(entityName: string): ResolvedEmbeddedAggregate | undefined;
|
|
2008
|
+
/**
|
|
2009
|
+
* The store of the document `entityName`'s rows live in, resolved from the route alone.
|
|
2010
|
+
*
|
|
2011
|
+
* Unlike {@link resolve} this answers before the document has loaded, which is what lets a caller depend on
|
|
2012
|
+
* it reactively: an embedded store's rows are a projection of the containing document, so whoever reads
|
|
2013
|
+
* them has to be told when that document arrives or changes.
|
|
2014
|
+
*/
|
|
2015
|
+
rootStoreFor(entityName: string): BaseEntityStoreApi<BaseEntity> | undefined;
|
|
2016
|
+
/** Persists the aggregate with `rootPayload` replaced — an embedded row has no endpoint of its own. */
|
|
2017
|
+
writeRoot(resolved: ResolvedEmbeddedAggregate, rootPayload: Record<string, unknown>): Promise<void>;
|
|
2018
|
+
/**
|
|
2019
|
+
* The URL chain, ending at `entityName`.
|
|
2020
|
+
*
|
|
2021
|
+
* The route chain does not always reach the entity being asked about: the rows of a *nested* embedded
|
|
2022
|
+
* attribute are listed on their owner's form, so `Embedded Detail`'s store is read while the deepest
|
|
2023
|
+
* active route is still `Embedded Component`. Appending the level in that case is what lets one form host
|
|
2024
|
+
* the list of the next level down.
|
|
2025
|
+
*/
|
|
2026
|
+
private levelsFor;
|
|
2027
|
+
/** The levels of {@link levelsFor} that form one aggregate. See {@link aggregateChainOf}. */
|
|
2028
|
+
private aggregateOf;
|
|
2029
|
+
private deepestActivatedRoute;
|
|
2030
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedAggregateAccessor, never>;
|
|
2031
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* The repository of an **embedded** entity: one that has no endpoint of its own because its payload travels
|
|
2035
|
+
* inside its parent's document.
|
|
2036
|
+
*
|
|
2037
|
+
* It is the only piece of the embedded story the rest of the framework does not already have. Because
|
|
2038
|
+
* `BaseEntityStore` reaches the outside world through exactly this interface, swapping the repository is
|
|
2039
|
+
* enough — the child's `BaseEntityListComponent` and `BaseEntityFormComponent`, and the store between them,
|
|
2040
|
+
* are the stock ones and know nothing about any of this.
|
|
2041
|
+
*
|
|
2042
|
+
* A write is a write of the whole root document (see {@link EmbeddedAggregateAccessor.writeRoot}), which is
|
|
2043
|
+
* what makes a child's Save persist immediately rather than waiting for the root's form.
|
|
2044
|
+
*/
|
|
2045
|
+
export declare class EmbeddedEntityService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
2046
|
+
private readonly entityName;
|
|
2047
|
+
private readonly accessor;
|
|
2048
|
+
constructor(entityName: string, accessor: EmbeddedAggregateAccessor);
|
|
2049
|
+
/**
|
|
2050
|
+
* The row arrives with its key already set — `createEntity()` mints one for an `id`-bearing child, and a
|
|
2051
|
+
* child keyed by something else (`App Region` by `type`) gets it from the form — so there is no
|
|
2052
|
+
* server-assigned identity to wait for.
|
|
2053
|
+
*/
|
|
2054
|
+
add(entity: Entity): Observable<PersistedEntity<Entity>>;
|
|
2055
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
2056
|
+
delete(id: string): Observable<unknown>;
|
|
2057
|
+
deleteAll(): Observable<unknown>;
|
|
2058
|
+
findAll(): Observable<PersistedEntity<Entity>[]>;
|
|
2059
|
+
/**
|
|
2060
|
+
* Ignores the query: an embedded attribute holds the rows of exactly one owner, so there is nothing to
|
|
2061
|
+
* page or filter server-side. Returning a bare array puts the store on its unpaged branch, where
|
|
2062
|
+
* `totalElements` follows the row count.
|
|
2063
|
+
*/
|
|
2064
|
+
findByQuery(): Observable<PersistedEntity<Entity>[]>;
|
|
2065
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
2066
|
+
/**
|
|
2067
|
+
* Reads without an aggregate are answered with nothing rather than an error: a store's `onInit` load runs
|
|
2068
|
+
* as soon as it is injected, which can be before the route that gives it an owner has activated.
|
|
2069
|
+
*/
|
|
2070
|
+
private rows;
|
|
2071
|
+
private rowsOf;
|
|
2072
|
+
private commit;
|
|
2073
|
+
/** A write without an owner would silently go nowhere, so it names the entity instead. */
|
|
2074
|
+
private require;
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Makes an embedded route survive a page refresh.
|
|
2078
|
+
*
|
|
2079
|
+
* Reached by drilling down, the aggregate is already in the root's store; reached by a deep link it is not,
|
|
2080
|
+
* and nothing else would load it — an embedded store reads its rows out of the root's payload, so it would
|
|
2081
|
+
* come up empty and the form would bind to nothing. Guards run before any component is created and
|
|
2082
|
+
* parent-before-child, which is exactly the ordering the nested case needs, and returning a `UrlTree` is how
|
|
2083
|
+
* a link to a row that no longer exists lands somewhere sensible instead of on an empty form.
|
|
2084
|
+
*/
|
|
2085
|
+
export declare const embeddedAggregateGuard: CanActivateFn;
|
|
2086
|
+
/**
|
|
2087
|
+
* The branch route of an embedded level: it hands the level's descriptor to the form below it and adds
|
|
2088
|
+
* nothing else.
|
|
2089
|
+
*
|
|
2090
|
+
* Where a stand-alone entity gets `BaseEntityContainerComponent` — tab bar, toolbar, status bar — an
|
|
2091
|
+
* embedded level deliberately gets none of that. Its rows are already listed on the form of the entity
|
|
2092
|
+
* that contains it, so a list tab would be a second way to the same thing, and a second tab bar and
|
|
2093
|
+
* status bar inside the owner's would say twice what the breadcrumb in
|
|
2094
|
+
* `BaseEntityStatusbarComponent` says once. Drilling down replaces the surface; it does not nest chrome
|
|
2095
|
+
* inside chrome.
|
|
2096
|
+
*/
|
|
2097
|
+
export declare class EmbeddedEntityHostComponent {
|
|
2098
|
+
private readonly facade;
|
|
2099
|
+
private readonly snackBar;
|
|
2100
|
+
protected readonly entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
2101
|
+
constructor();
|
|
2102
|
+
/**
|
|
2103
|
+
* An embedded write is a write of the containing document, and it fails the same way any other write
|
|
2104
|
+
* can — so the level reports it, even though it has no toolbar of its own.
|
|
2105
|
+
*
|
|
2106
|
+
* Unlike `BaseEntityContainerComponent` this host does **not** reset the store when it is destroyed:
|
|
2107
|
+
* an embedded store's rows are a projection of the owner's document, and emptying them on the way back
|
|
2108
|
+
* up would blank the very row list the user returns to.
|
|
2109
|
+
*/
|
|
2110
|
+
private registerEffects;
|
|
2111
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedEntityHostComponent, never>;
|
|
2112
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedEntityHostComponent, "base-embedded-entity-host", never, {}, {}, never, never, true, never>;
|
|
2113
|
+
}
|
|
2114
|
+
export declare enum NavigatorCommand {
|
|
2115
|
+
SELECT_OR_CREATE = "SelectOrCreate",
|
|
2116
|
+
EDIT = "Edit"
|
|
586
2117
|
}
|
|
587
2118
|
interface NavigationPayload {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
2119
|
+
command: NavigatorCommand;
|
|
2120
|
+
attrName?: string;
|
|
2121
|
+
payload?: object;
|
|
2122
|
+
context?: unknown;
|
|
592
2123
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
2124
|
+
export declare enum RouteSegments {
|
|
2125
|
+
LIST_ROUTE = "LIST_ROUTE",
|
|
2126
|
+
DETAILS_ROUTE = "DETAILS_ROUTE",
|
|
2127
|
+
/**
|
|
2128
|
+
* One of an entity's extra tabs (see `EntityTabDescriptor`) — `<entity>/<id>/content` and the like.
|
|
2129
|
+
* Which segments count is registered by {@link BaseEntityTabsComponent}, because the store has no
|
|
2130
|
+
* descriptors of its own: a URL tail is only a tab if some entity on screen declared it as one, and an
|
|
2131
|
+
* unregistered tail stays `undefined` exactly as before.
|
|
2132
|
+
*/
|
|
2133
|
+
ENTITY_TAB_ROUTE = "ENTITY_TAB_ROUTE"
|
|
597
2134
|
}
|
|
598
2135
|
interface NavigationState {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
2136
|
+
activeRouteSegment: RouteSegments | undefined;
|
|
2137
|
+
/**
|
|
2138
|
+
* The extra tab the current URL ends in, when {@link activeRouteSegment} is `ENTITY_TAB_ROUTE`. Which
|
|
2139
|
+
* tab is open cannot be read off the enum, since every extra tab shares that one value.
|
|
2140
|
+
*/
|
|
2141
|
+
activeTabSegment: string | undefined;
|
|
2142
|
+
/** Extra tab segments the entities currently on screen declare. See {@link RouteSegments.ENTITY_TAB_ROUTE}. */
|
|
2143
|
+
tabSegments: string[];
|
|
2144
|
+
/**
|
|
2145
|
+
* The entities the current URL walks through, outermost first — what the status bar renders as a
|
|
2146
|
+
* breadcrumb. Derived from the route, never remembered, so a deep link and a refresh describe the same
|
|
2147
|
+
* hierarchy as a drill-down.
|
|
2148
|
+
*/
|
|
2149
|
+
breadcrumb: EmbeddedBreadcrumbLevel[];
|
|
2150
|
+
entityName: string;
|
|
2151
|
+
navigationError?: string;
|
|
2152
|
+
navigateTo: string;
|
|
2153
|
+
responsePayloads: Map<string, NavigationPayload>;
|
|
2154
|
+
requestPayloads: Map<string, NavigationPayload>;
|
|
2155
|
+
returnTo: string;
|
|
2156
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
607
2157
|
}
|
|
608
|
-
declare
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
2158
|
+
export declare function snakeCaseName(entityName: string): string;
|
|
2159
|
+
export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Type<{
|
|
2160
|
+
activeRouteSegment: import("@angular/core").Signal<RouteSegments | undefined>;
|
|
2161
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
2162
|
+
tabSegments: import("@angular/core").Signal<string[]>;
|
|
2163
|
+
breadcrumb: import("@angular/core").Signal<EmbeddedBreadcrumbLevel[]>;
|
|
2164
|
+
entityName: import("@angular/core").Signal<string>;
|
|
2165
|
+
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
2166
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
2167
|
+
responsePayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2168
|
+
requestPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2169
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
2170
|
+
formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
2171
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
2172
|
+
determineCurrentUrl: () => string;
|
|
2173
|
+
determineOwnerUrl: () => string;
|
|
2174
|
+
determineActiveRouteSegment: () => void;
|
|
2175
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
2176
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
2177
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2178
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: NavigationPayload) => Promise<void>;
|
|
2179
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2180
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2181
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2182
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2183
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
2184
|
+
registerTabSegments: (segments: string[]) => void;
|
|
2185
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
2186
|
+
destroyNavigationTracking: () => void;
|
|
2187
|
+
initializeNavigationTracking: () => void;
|
|
2188
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
2189
|
+
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
2190
|
+
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
2191
|
+
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
2192
|
+
setEntityName: (entityName: string) => void;
|
|
2193
|
+
} & import("@ngrx/signals").StateSource<{
|
|
2194
|
+
activeRouteSegment: RouteSegments | undefined;
|
|
2195
|
+
activeTabSegment: string | undefined;
|
|
2196
|
+
tabSegments: string[];
|
|
2197
|
+
breadcrumb: EmbeddedBreadcrumbLevel[];
|
|
2198
|
+
entityName: string;
|
|
2199
|
+
navigationError?: string | undefined;
|
|
2200
|
+
navigateTo: string;
|
|
2201
|
+
responsePayloads: Map<string, NavigationPayload>;
|
|
2202
|
+
requestPayloads: Map<string, NavigationPayload>;
|
|
2203
|
+
returnTo: string;
|
|
2204
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
2205
|
+
}>>;
|
|
2206
|
+
export declare function BaseFormNavigatorStore(entityName: string): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
2207
|
+
state: {};
|
|
2208
|
+
props: {
|
|
2209
|
+
activeRouteSegment: import("@angular/core").Signal<RouteSegments | undefined>;
|
|
2210
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
2211
|
+
breadcrumb: import("@angular/core").Signal<EmbeddedBreadcrumbLevel[]>;
|
|
2212
|
+
entityName: import("@angular/core").Signal<string>;
|
|
2213
|
+
navigationError: import("@angular/core").Signal<string | undefined> | undefined;
|
|
2214
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
2215
|
+
navigatorPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2216
|
+
requestPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2217
|
+
responsePayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2218
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
619
2219
|
determineActiveRouteSegment: () => void;
|
|
2220
|
+
determineCurrentUrl: () => string;
|
|
2221
|
+
determineOwnerUrl: () => string;
|
|
620
2222
|
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
621
|
-
|
|
622
|
-
|
|
2223
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
2224
|
+
navigateToDetails: (id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2225
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: NavigationPayload) => Promise<void>;
|
|
2226
|
+
navigateToList: (returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
623
2227
|
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
624
2228
|
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
2229
|
+
navigateToTab: (id: string, segment: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
625
2230
|
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
626
|
-
|
|
627
|
-
initializeNavigationTracking: () => void;
|
|
628
|
-
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
2231
|
+
registerTabSegments: (segments: string[]) => void;
|
|
629
2232
|
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
630
2233
|
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
631
2234
|
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
activeRouteSegment: RouteSegments | undefined;
|
|
635
|
-
entityName: string;
|
|
636
|
-
navigationError?: string | undefined;
|
|
637
|
-
navigateTo: string;
|
|
638
|
-
responsePayloads: Map<string, NavigationPayload>;
|
|
639
|
-
requestPayloads: Map<string, NavigationPayload>;
|
|
640
|
-
returnTo: string;
|
|
641
|
-
formSnapshot: Record<string, unknown> | undefined;
|
|
642
|
-
}>>;
|
|
643
|
-
declare function BaseFormNavigatorStore(entityName: string): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
644
|
-
state: {};
|
|
645
|
-
props: {
|
|
646
|
-
activeRouteSegment: _angular_core.Signal<RouteSegments | undefined>;
|
|
647
|
-
entityName: _angular_core.Signal<string>;
|
|
648
|
-
navigationError: _angular_core.Signal<string | undefined> | undefined;
|
|
649
|
-
navigateTo: _angular_core.Signal<string>;
|
|
650
|
-
navigatorPayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
651
|
-
requestPayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
652
|
-
responsePayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
653
|
-
returnTo: _angular_core.Signal<string>;
|
|
654
|
-
determineActiveRouteSegment: () => void;
|
|
655
|
-
determineCurrentUrl: () => string;
|
|
656
|
-
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
657
|
-
navigateToDetails: (id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
658
|
-
navigateToList: (returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
659
|
-
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
660
|
-
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
661
|
-
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
662
|
-
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
663
|
-
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
664
|
-
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
665
|
-
};
|
|
666
|
-
methods: {};
|
|
2235
|
+
};
|
|
2236
|
+
methods: {};
|
|
667
2237
|
}>;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
declare
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
declare function provideEntityRouteRegistry(): EnvironmentProviders;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
2238
|
+
export declare const ENTITY_NAME_ROUTE_DATA_KEY = "entityName";
|
|
2239
|
+
/** Marks a route branch as an embedded child, which is addressed relative to its owner rather than absolutely. */
|
|
2240
|
+
export declare const EMBEDDED_ENTITY_ROUTE_DATA_KEY = "embeddedEntity";
|
|
2241
|
+
export declare class EntityRouteRegistry {
|
|
2242
|
+
private readonly router;
|
|
2243
|
+
private readonly basePaths;
|
|
2244
|
+
scan(): void;
|
|
2245
|
+
observeLazyLoads(): void;
|
|
2246
|
+
basePath(entityName: string): string | undefined;
|
|
2247
|
+
listPath(entityName: string): string | undefined;
|
|
2248
|
+
detailsPath(entityName: string, id: string): string | undefined;
|
|
2249
|
+
registeredEntities(): ReadonlyArray<string>;
|
|
2250
|
+
private walk;
|
|
2251
|
+
private append;
|
|
2252
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRouteRegistry, never>;
|
|
2253
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2254
|
+
}
|
|
2255
|
+
export declare function provideEntityRouteRegistry(): EnvironmentProviders;
|
|
2256
|
+
/**
|
|
2257
|
+
* Talks to Firestore straight from the browser, bypassing the OpenAPI contract entirely.
|
|
2258
|
+
*
|
|
2259
|
+
* @deprecated Use `BaseEntityRestService` against the contract. This adapter is kept for consumers
|
|
2260
|
+
* who deploy on Firestore; ProcessPuzzle itself no longer does, so it is no longer exercised by any
|
|
2261
|
+
* environment here.
|
|
2262
|
+
*
|
|
2263
|
+
* Why this path is being retired rather than kept as an option:
|
|
2264
|
+
* - **It is a second seam.** With an adapter chosen in the client, every feature has to be built
|
|
2265
|
+
* twice, and only the REST half is covered by a contract test. Drift on this side is undetectable
|
|
2266
|
+
* until it reaches a user.
|
|
2267
|
+
* - **Its paging is a fiction.** `findByQueryAsync` reports `totalPages: 1` and
|
|
2268
|
+
* `totalElements: content.length`, so a paginator tells the truth on REST and guesses here.
|
|
2269
|
+
* - **Firestore cannot answer the query language.** `createQuery` maps a
|
|
2270
|
+
* {@link BaseEntityQueryCondition} onto Firestore constraints, which have no substring or
|
|
2271
|
+
* case-insensitive compare, and silently drop documents that lack the `orderBy` field.
|
|
2272
|
+
* - **Authorization ends up in two dialects** — `firestore.rules` here, server-side policy there —
|
|
2273
|
+
* so tenant isolation has to be got right twice.
|
|
2274
|
+
*
|
|
2275
|
+
* Nothing about it is broken today and no removal date is set, but only one call site is left to
|
|
2276
|
+
* migrate before it can go: `BaseEntityFacade.createService` still returns it when
|
|
2277
|
+
* `BACKEND_SERVICE_PROVIDER` is not `rest`. `ApplicationPropertyService` in `base-widget` no longer
|
|
2278
|
+
* extends it, and the testbed's own Firestore sample is gone — its entities are served through the
|
|
2279
|
+
* contract like every other deployment's.
|
|
2280
|
+
*
|
|
2281
|
+
* Both of its dependencies on `@angular/fire` are injected rather than imported: the instance as
|
|
2282
|
+
* {@link FIRESTORE} rather than the `Firestore` class, and the module functions as {@link FIRESTORE_API}.
|
|
2283
|
+
* Each token's own file says which testability problem it solves.
|
|
2284
|
+
*/
|
|
2285
|
+
export declare class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
2286
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
2287
|
+
protected collectionName: string;
|
|
2288
|
+
protected collection: import("@firebase/firestore").CollectionReference<DocumentData, DocumentData>;
|
|
2289
|
+
protected readonly firestore: import("@angular/fire/firestore").Firestore;
|
|
2290
|
+
protected readonly firestoreApi: import("@processpuzzle/base-entity").FirestoreApi;
|
|
2291
|
+
constructor(entityMapper: BaseEntityMapper<Entity>, collectionName: string);
|
|
2292
|
+
add(entity: Entity): Observable<PersistedEntity<Entity>>;
|
|
2293
|
+
delete(id: string): Observable<unknown>;
|
|
2294
|
+
deleteAll(): Observable<unknown>;
|
|
2295
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2296
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
2297
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2298
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
2299
|
+
protected addAsync(entity: Entity): Promise<PersistedEntity<Entity>>;
|
|
2300
|
+
protected createQuery(queryCondition: BaseEntityQueryCondition): import("@firebase/firestore").Query<DocumentData, DocumentData>;
|
|
2301
|
+
protected findByQueryAsync(queryCondition: BaseEntityQueryCondition): Promise<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2302
|
+
protected mapCollection(source: Observable<unknown[]>): PersistedEntity<Entity>[];
|
|
2303
|
+
protected mapDocument(docData: unknown): PersistedEntity<Entity>;
|
|
2304
|
+
private mapEntity;
|
|
2305
|
+
private updateAsync;
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* The Firestore instance {@link BaseEntityFirestoreService} reads and writes through.
|
|
2309
|
+
*
|
|
2310
|
+
* The service used to inject `@angular/fire`'s `Firestore` class directly. Angular matches providers by
|
|
2311
|
+
* object identity, and a bare specifier does not always resolve to one object: mock the barrel, or let a
|
|
2312
|
+
* build inline it on one side of the graph and import it on the other, and the module the service imports
|
|
2313
|
+
* is a second instance of the same file. The class is then two distinct tokens — one registered, the other
|
|
2314
|
+
* asked for — and DI fails with `NG0201: No provider found for Firestore`.
|
|
2315
|
+
*
|
|
2316
|
+
* An `InjectionToken` declared here is a single object owned by this library. Note the `import type`: it
|
|
2317
|
+
* carries no runtime dependency on `@angular/fire/firestore`, which is what keeps this module out of the
|
|
2318
|
+
* blast radius when a test replaces the barrel, and so keeps the token one object.
|
|
2319
|
+
*
|
|
2320
|
+
* Applications that deploy on Firestore bind it with `provideFirestoreToken()`, next to their existing
|
|
2321
|
+
* `provideFirestore(...)` call.
|
|
2322
|
+
*/
|
|
2323
|
+
export declare const FIRESTORE: InjectionToken<Firestore>;
|
|
2324
|
+
/**
|
|
2325
|
+
* The subset of the Firestore module API that {@link BaseEntityFirestoreService} calls.
|
|
2326
|
+
*/
|
|
2327
|
+
interface FirestoreApi {
|
|
2328
|
+
readonly collection: typeof collection;
|
|
2329
|
+
readonly deleteDoc: typeof deleteDoc;
|
|
2330
|
+
readonly doc: typeof doc;
|
|
2331
|
+
readonly getDoc: typeof getDoc;
|
|
2332
|
+
readonly getDocs: typeof getDocs;
|
|
2333
|
+
readonly limit: typeof limit;
|
|
2334
|
+
readonly orderBy: typeof orderBy;
|
|
2335
|
+
readonly query: typeof query;
|
|
2336
|
+
readonly setDoc: typeof setDoc;
|
|
2337
|
+
readonly updateDoc: typeof updateDoc;
|
|
2338
|
+
readonly where: typeof where;
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Firestore's free functions, reached through DI instead of imported at each call site.
|
|
2342
|
+
*
|
|
2343
|
+
* This exists so the adapter can be tested deterministically, and the indirection is the only way to get
|
|
2344
|
+
* that here. The suite used to `vi.mock('@angular/fire/firestore')` and assert on the mocked functions.
|
|
2345
|
+
* That is a bare specifier, which the Angular unit-test system does allow — but whether the replacement
|
|
2346
|
+
* reaches *this library's* modules is not stable: the builder may inline the barrel into the source bundle,
|
|
2347
|
+
* where a mock cannot touch it. The suite consequently passed or failed at roughly even odds on an
|
|
2348
|
+
* unchanged commit — surfacing either as the real `collection()` rejecting a plain object, or, since the
|
|
2349
|
+
* real `Firestore` class then became the token the service asked for, as
|
|
2350
|
+
* `NG0201: No provider found for Firestore`. CI failed on the coin flip.
|
|
2351
|
+
*
|
|
2352
|
+
* Nor can the barrel be hidden behind a relative re-export and that mocked instead: the runner rejects it
|
|
2353
|
+
* outright — *"vi.mock and related methods are not supported for relative imports with the Angular
|
|
2354
|
+
* unit-test system. Please use Angular TestBed for mocking dependencies."* This token is that advice taken.
|
|
2355
|
+
*
|
|
2356
|
+
* The default factory returns the real functions, so an application binds nothing.
|
|
2357
|
+
*/
|
|
2358
|
+
export declare const FIRESTORE_API: InjectionToken<FirestoreApi>;
|
|
2359
|
+
/**
|
|
2360
|
+
* Binds {@link FIRESTORE} to the instance `provideFirestore(...)` registered, for an application that
|
|
2361
|
+
* deploys `BaseEntityFirestoreService` against a real Firestore.
|
|
2362
|
+
*
|
|
2363
|
+
* One line next to the `provideFirestore(...)` call:
|
|
2364
|
+
* ```ts
|
|
2365
|
+
* providers: [provideFirebaseApp(() => initializeApp(config)), provideFirestore(() => getFirestore()), provideFirestoreToken()]
|
|
2366
|
+
* ```
|
|
2367
|
+
*
|
|
2368
|
+
* It lives in its own file on purpose. `firestore.token.ts` must not import `@angular/fire/firestore` at
|
|
2369
|
+
* run-time — see the note there — and this is where the one import that has to exist is confined.
|
|
2370
|
+
*/
|
|
2371
|
+
export declare function provideFirestoreToken(): Provider;
|
|
2372
|
+
export declare enum FlexDirection {
|
|
2373
|
+
CONTAINER = 0,
|
|
2374
|
+
COLUMN = 1,
|
|
2375
|
+
ROW = 2
|
|
2376
|
+
}
|
|
2377
|
+
export declare class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
2378
|
+
readonly attrDescriptors: AbstractAttrDescriptor[];
|
|
2379
|
+
readonly direction: FlexDirection;
|
|
2380
|
+
constructor(attrDescriptors: AbstractAttrDescriptor[], direction: FlexDirection);
|
|
2381
|
+
}
|
|
720
2382
|
/**
|
|
721
2383
|
* Defines an entity data transformer capable of transforming data to and from the server.
|
|
722
2384
|
*/
|
|
723
2385
|
interface IEntityTransformer {
|
|
724
|
-
|
|
725
|
-
|
|
2386
|
+
fromServer?: (data: unknown, criteria?: unknown) => unknown;
|
|
2387
|
+
toServer?: (entity: unknown, criteria?: unknown) => unknown;
|
|
726
2388
|
}
|
|
727
2389
|
interface EntityOptions {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
2390
|
+
modelName: string;
|
|
2391
|
+
pluralName: string;
|
|
2392
|
+
uriName: string;
|
|
2393
|
+
transform?: IEntityTransformer;
|
|
732
2394
|
}
|
|
733
2395
|
/**
|
|
734
2396
|
* Class decorator for entity classes
|
|
735
2397
|
* @param options Configuration options for the entity
|
|
736
2398
|
* @returns Class decorator function
|
|
737
2399
|
*/
|
|
738
|
-
declare function Entity(options: EntityOptions): ClassDecorator;
|
|
2400
|
+
export declare function Entity(options: EntityOptions): ClassDecorator;
|
|
739
2401
|
/**
|
|
740
2402
|
* Gets entity options from an entity instance
|
|
741
2403
|
* @param instance An instance of a class decorated with @Entity
|
|
742
2404
|
* @returns The entity options or undefined if not found
|
|
743
2405
|
*/
|
|
744
|
-
declare function getEntityOptions(instance: object | null | undefined): EntityOptions | undefined;
|
|
2406
|
+
export declare function getEntityOptions(instance: object | null | undefined): EntityOptions | undefined;
|
|
745
2407
|
/**
|
|
746
2408
|
* Property decorator for marking entity properties as ID fields
|
|
747
2409
|
* @returns PropertyDecorator function
|
|
748
2410
|
*/
|
|
749
|
-
declare function Id(): PropertyDecorator;
|
|
2411
|
+
export declare function Id(): PropertyDecorator;
|
|
750
2412
|
/**
|
|
751
2413
|
* Gets all property names marked with @Id decorator from an entity instance
|
|
752
2414
|
* @param instance An instance of a class with properties decorated with @Id
|
|
753
2415
|
* @returns Array of property names marked as IDs or empty array if none found
|
|
754
2416
|
*/
|
|
755
|
-
declare function getEntityIds(instance: object | null | undefined): string[];
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
2417
|
+
export declare function getEntityIds(instance: object | null | undefined): string[];
|
|
2418
|
+
export declare enum BaseUrlSegments {
|
|
2419
|
+
DetailsForm = "details",
|
|
2420
|
+
EntityID = "entityId",
|
|
2421
|
+
Feed = "feed",
|
|
2422
|
+
ListForm = "list",
|
|
2423
|
+
NewEntity = "new",
|
|
2424
|
+
UnknownEntity = "unknown"
|
|
2425
|
+
}
|
|
2426
|
+
export declare const RuleViolationsSingletonStore: import("@angular/core").Type<{
|
|
2427
|
+
entityName: import("@angular/core").Signal<string | undefined>;
|
|
2428
|
+
violations: import("@angular/core").Signal<RuleEvaluationResult[]>;
|
|
2429
|
+
errorCount: import("@angular/core").Signal<number>;
|
|
2430
|
+
warningCount: import("@angular/core").Signal<number>;
|
|
2431
|
+
infoCount: import("@angular/core").Signal<number>;
|
|
2432
|
+
hasViolations: import("@angular/core").Signal<boolean>;
|
|
2433
|
+
setViolations: (entityName: string, violations: RuleEvaluationResult[]) => void;
|
|
2434
|
+
clearViolations: () => void;
|
|
2435
|
+
} & import("@ngrx/signals").StateSource<{
|
|
2436
|
+
entityName: string | undefined;
|
|
2437
|
+
violations: RuleEvaluationResult[];
|
|
771
2438
|
}>>;
|
|
772
|
-
|
|
773
2439
|
interface LookupTable extends BaseEntity {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
2440
|
+
key: string;
|
|
2441
|
+
value: string | number;
|
|
2442
|
+
description?: string;
|
|
777
2443
|
}
|
|
778
|
-
|
|
779
2444
|
/**
|
|
780
2445
|
* Defines a single column in the exported PDF table.
|
|
781
2446
|
* Maps directly from your entity descriptor's field definitions.
|
|
782
2447
|
*/
|
|
783
2448
|
interface PdfColumnDefinition {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
2449
|
+
/** Field key on the entity object — used to extract the value */
|
|
2450
|
+
field: string;
|
|
2451
|
+
/** Display label used as the column header in the PDF */
|
|
2452
|
+
header: string;
|
|
2453
|
+
/**
|
|
2454
|
+
* Optional value formatter. If omitted, the raw value is coerced to string.
|
|
2455
|
+
* Receives the raw field value and the full entity row.
|
|
2456
|
+
*/
|
|
2457
|
+
formatter?: (value: unknown, row: Record<string, unknown>) => string;
|
|
2458
|
+
/**
|
|
2459
|
+
* Relative column width weight. Columns without a width share the remaining
|
|
2460
|
+
* space equally. Example: set to 2 for a "description" column that should be
|
|
2461
|
+
* twice as wide as a typical "status" column.
|
|
2462
|
+
*/
|
|
2463
|
+
width?: number;
|
|
2464
|
+
/** Text alignment within the column. Defaults to 'left'. */
|
|
2465
|
+
align?: 'left' | 'center' | 'right';
|
|
801
2466
|
}
|
|
802
2467
|
interface PdfExportOptions {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
2468
|
+
/** PDF filename (without extension). Defaults to 'export'. */
|
|
2469
|
+
filename?: string;
|
|
2470
|
+
/** Document title rendered at the top of the first page. */
|
|
2471
|
+
title?: string;
|
|
2472
|
+
/** Optional subtitle line rendered below the title. */
|
|
2473
|
+
subtitle?: string;
|
|
2474
|
+
/**
|
|
2475
|
+
* Page orientation. The service auto-selects 'landscape' when there are
|
|
2476
|
+
* more than 5 columns unless you override this explicitly.
|
|
2477
|
+
*/
|
|
2478
|
+
orientation?: 'portrait' | 'landscape';
|
|
2479
|
+
/** ISO 216 page size. Defaults to 'a4'. */
|
|
2480
|
+
pageSize?: 'a4' | 'a3' | 'letter';
|
|
2481
|
+
/**
|
|
2482
|
+
* Whether to include a page footer with page number and export timestamp.
|
|
2483
|
+
* Defaults to true.
|
|
2484
|
+
*/
|
|
2485
|
+
includeFooter?: boolean;
|
|
821
2486
|
}
|
|
822
2487
|
interface PdfExportResult {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
2488
|
+
success: boolean;
|
|
2489
|
+
filename: string;
|
|
2490
|
+
rowCount: number;
|
|
2491
|
+
error?: string;
|
|
827
2492
|
}
|
|
828
|
-
|
|
829
2493
|
/**
|
|
830
2494
|
* Generates and downloads a PDF table from entity store data, client-side.
|
|
831
2495
|
*
|
|
@@ -850,30 +2514,29 @@ interface PdfExportResult {
|
|
|
850
2514
|
* npm install jspdf jspdf-autotable
|
|
851
2515
|
* npm install --save-dev @types/jspdf-autotable
|
|
852
2516
|
*/
|
|
853
|
-
declare class PdfExportService {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
|
|
2517
|
+
export declare class PdfExportService {
|
|
2518
|
+
/** Tracks whether a PDF generation is currently in progress. */
|
|
2519
|
+
readonly exporting: import("@angular/core").WritableSignal<boolean>;
|
|
2520
|
+
/**
|
|
2521
|
+
* Exports entities to a PDF and triggers a browser download.
|
|
2522
|
+
*
|
|
2523
|
+
* @param entities The raw entity array — typically `store.entities()`.
|
|
2524
|
+
* @param columns Column definitions derived from the entity descriptor.
|
|
2525
|
+
* @param options Title, filename, orientation, page size.
|
|
2526
|
+
*/
|
|
2527
|
+
export(entities: Record<string, unknown>[], columns: PdfColumnDefinition[], options?: PdfExportOptions): Promise<PdfExportResult>;
|
|
2528
|
+
private generate;
|
|
2529
|
+
/**
|
|
2530
|
+
* Formats a raw entity field value as a readable string for the PDF cell.
|
|
2531
|
+
* Handles the common cases; override per-column with a custom `formatter`.
|
|
2532
|
+
*/
|
|
2533
|
+
private formatValue;
|
|
2534
|
+
/** Renders ISO date strings as locale dates, leaving all other strings untouched. */
|
|
2535
|
+
private formatString;
|
|
2536
|
+
private drawFooter;
|
|
2537
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PdfExportService, never>;
|
|
2538
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2539
|
+
}
|
|
877
2540
|
/**
|
|
878
2541
|
* Converts a BaseEntityDescriptor's attribute descriptors into PdfColumnDefinition[]
|
|
879
2542
|
* for {@link PdfExportService}.
|
|
@@ -887,8 +2550,7 @@ declare class PdfExportService {
|
|
|
887
2550
|
* Type-appropriate alignment and value formatters are derived from `formControlType` so
|
|
888
2551
|
* booleans, dates, tags and artifacts render sensibly without per-field configuration.
|
|
889
2552
|
*/
|
|
890
|
-
declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[]): PdfColumnDefinition[];
|
|
891
|
-
|
|
2553
|
+
export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[]): PdfColumnDefinition[];
|
|
892
2554
|
type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' | 'includeFooter'>;
|
|
893
2555
|
/**
|
|
894
2556
|
* Asks the user for the few PDF layout choices we expose — orientation, page size and
|
|
@@ -896,16 +2558,329 @@ type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' |
|
|
|
896
2558
|
*
|
|
897
2559
|
* Closes with a {@link PdfExportDialogResult} on Export, or `undefined` on Cancel.
|
|
898
2560
|
*/
|
|
899
|
-
declare class PdfExportOptionsDialog {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
2561
|
+
export declare class PdfExportOptionsDialog {
|
|
2562
|
+
private readonly dialogRef;
|
|
2563
|
+
protected readonly orientation: import("@angular/core").WritableSignal<"portrait" | "landscape">;
|
|
2564
|
+
protected readonly pageSize: import("@angular/core").WritableSignal<"a4" | "a3" | "letter">;
|
|
2565
|
+
protected readonly includeFooter: import("@angular/core").WritableSignal<boolean>;
|
|
2566
|
+
protected onExport(): void;
|
|
2567
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PdfExportOptionsDialog, never>;
|
|
2568
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PdfExportOptionsDialog, "base-entity-pdf-export-options-dialog", never, {}, {}, never, never, true, never>;
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Transloco scope of this library — the generic screen labels (`base_entity.tabs.*`,
|
|
2572
|
+
* `base_entity.toolbar.*`) every generated list and form renders.
|
|
2573
|
+
*
|
|
2574
|
+
* Declared here as a constant so the scope name has one home; the routes and components that register
|
|
2575
|
+
* it still spell the alias out, because transloco camel-cases a default alias and would turn
|
|
2576
|
+
* `base_entity` into `baseEntity`, missing every key below it.
|
|
2577
|
+
*/
|
|
2578
|
+
export declare const BASE_ENTITY_TRANSLOCO_SCOPE = "base_entity";
|
|
2579
|
+
/**
|
|
2580
|
+
* Key roots of the two entities of the **authoring** branch — the screens with which a tenant declares its
|
|
2581
|
+
* entity types (`base-entity-authoring/`).
|
|
2582
|
+
*
|
|
2583
|
+
* Children of {@link BASE_ENTITY_TRANSLOCO_SCOPE} rather than scopes of their own, and this is the one
|
|
2584
|
+
* feature where that is not merely convenient: the labels of the entity being authored and the framework's
|
|
2585
|
+
* own `base_entity.tabs.*` are owned by the same library, so one scope registration covers the whole branch
|
|
2586
|
+
* and `BASE_ENTITY_AUTHORING_ROUTES` registers exactly one.
|
|
2587
|
+
*
|
|
2588
|
+
* These label the *authoring form*, not the entities it declares. The label of a declared entity comes from
|
|
2589
|
+
* its own definition and is resolved through {@link EntityLabelPipe}'s fallback, which is why no key here
|
|
2590
|
+
* ever names a tenant's entity.
|
|
2591
|
+
*/
|
|
2592
|
+
export declare const ENTITY_DEFINITION_I18N_SCOPE = "base_entity.entity_definition";
|
|
2593
|
+
export declare const ENTITY_ATTRIBUTE_I18N_SCOPE = "base_entity.entity_attribute";
|
|
2594
|
+
/**
|
|
2595
|
+
* Where this library's transloco bundles come from when the application ships without its assets.
|
|
2596
|
+
*
|
|
2597
|
+
* Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into
|
|
2598
|
+
* `BASE_ENTITY_FACADE_REGISTRY`. The scope normally arrives as a static file — the build copies it into
|
|
2599
|
+
* `assets/i18n/base_entity` and the loader tries the asset first — so this is reached only by a host
|
|
2600
|
+
* that skips that copy step. It is declared here rather than in the application because which backend
|
|
2601
|
+
* owns a scope is base-entity's knowledge, not its caller's.
|
|
2602
|
+
*/
|
|
2603
|
+
export declare const BASE_ENTITY_TRANSLATION_SOURCE: TranslationSource;
|
|
2604
|
+
/**
|
|
2605
|
+
* The authoring branch of the knowledge layer: the list and form of an `Entity Definition`, and the
|
|
2606
|
+
* `Entity Attribute` level below it. Mounted by the designer under `/design/entities` — see
|
|
2607
|
+
* `DESIGN_ROUTES`.
|
|
2608
|
+
*
|
|
2609
|
+
* These are the screens with which a tenant *declares* its entity types. Not to be confused with the
|
|
2610
|
+
* screens those declarations produce: those are mounted by `entityScreenRoute` / `EntityScreenResolver`,
|
|
2611
|
+
* which read the very rows this branch writes.
|
|
2612
|
+
*
|
|
2613
|
+
* The path segment has to be `snakeCaseName('Entity Definition')`, because
|
|
2614
|
+
* `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — the same constraint
|
|
2615
|
+
* `BASE_APP_ROUTES`, `BASE_RULE_ROUTES` and `BASE_STATE_ROUTES` carry.
|
|
2616
|
+
*
|
|
2617
|
+
* `entityName` in `data` is not decoration: `readEmbeddedBreadcrumb` pushes a level when it meets the route
|
|
2618
|
+
* that *declares* the name, and takes that level's base URL from the URL accumulated so far. It has to sit
|
|
2619
|
+
* on the route contributing the definition's own segment — here — or every URL built on that level doubles
|
|
2620
|
+
* the segment.
|
|
2621
|
+
*
|
|
2622
|
+
* As for base-app, base-document, base-widget, base-state and base-workflow, the hosting application has to
|
|
2623
|
+
* spread `BASE_ENTITY_AUTHORING_FACADE_PROVIDERS` and `BASE_ENTITY_AUTHORING_ENTITY_FACADES` into its own
|
|
2624
|
+
* providers: both levels resolve their store and descriptor through `BASE_ENTITY_FACADE_REGISTRY`, and a
|
|
2625
|
+
* library cannot contribute to that token without replacing it.
|
|
2626
|
+
*/
|
|
2627
|
+
export declare const BASE_ENTITY_AUTHORING_ROUTES: Routes;
|
|
2628
|
+
/**
|
|
2629
|
+
* The facades of the definition graph, to be spread into the application's `providers`.
|
|
2630
|
+
*
|
|
2631
|
+
* The embedded one is here for the same reason the routable one is: an embedded entity has a facade like any
|
|
2632
|
+
* other — that is what gives it a store — and only its repository differs, reading and writing the
|
|
2633
|
+
* `Entity Definition` document rather than an endpoint of its own.
|
|
2634
|
+
*/
|
|
2635
|
+
export declare const BASE_ENTITY_AUTHORING_FACADE_PROVIDERS: Provider[];
|
|
2636
|
+
/**
|
|
2637
|
+
* The same facades keyed by entity name, to be spread into the application's `BASE_ENTITY_FACADE_REGISTRY`
|
|
2638
|
+
* value.
|
|
2639
|
+
*
|
|
2640
|
+
* Every entity an `EMBEDDED_COMPONENTS` attribute of this branch names has to appear here, or the control
|
|
2641
|
+
* throws on first render rather than showing a list whose rows go nowhere on save — the registry is how it
|
|
2642
|
+
* reaches the child's store and descriptor. Spread rather than provided separately, because the token holds
|
|
2643
|
+
* one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the application's own entities
|
|
2644
|
+
* instead of adding to them.
|
|
2645
|
+
*
|
|
2646
|
+
* Note what these two entries do *not* do: they register the screens that author definitions, not the
|
|
2647
|
+
* entities a definition declares. Those stay absent from the registry on purpose — a compile-time facade
|
|
2648
|
+
* wins over a synthesized one, so registering `Order` here would override the metadata path that
|
|
2649
|
+
* `EntityScreenResolver` exists to take.
|
|
2650
|
+
*/
|
|
2651
|
+
export declare const BASE_ENTITY_AUTHORING_ENTITY_FACADES: BaseEntityFacadeRegistry;
|
|
2652
|
+
/**
|
|
2653
|
+
* Entity names of the definition graph, kept in one dependency-free module.
|
|
2654
|
+
*
|
|
2655
|
+
* They live here rather than next to their descriptors because the graph is cyclic: the
|
|
2656
|
+
* `Entity Definition` descriptor aggregates `Entity Attribute`, and that one names the definition back as
|
|
2657
|
+
* its `componentParent`. Each descriptor module re-exports its own name, so importers are unaffected.
|
|
2658
|
+
* Same arrangement as base-state's `state-entity-names.ts` and base-app's `app-entity-names.ts`.
|
|
2659
|
+
*
|
|
2660
|
+
* `BASE_ENTITY_FACADE_REGISTRY` is one flat map for the whole application, so a name has to be specific
|
|
2661
|
+
* enough that no other feature would plausibly claim it. These two also have a second reason to be
|
|
2662
|
+
* distinctive: a *tenant* authors entity names through these very screens, and a definition named
|
|
2663
|
+
* `Entity Definition` would then shadow the screens that created it.
|
|
2664
|
+
*/
|
|
2665
|
+
export declare const ENTITY_DEFINITION_ENTITY_NAME = "Entity Definition";
|
|
2666
|
+
export declare const ENTITY_ATTRIBUTE_ENTITY_NAME = "Entity Attribute";
|
|
2667
|
+
export declare function createEntityDefinitionDescriptor(): BaseEntityDescriptor;
|
|
2668
|
+
/**
|
|
2669
|
+
* An `EntityAttributeDefinition` is identified by `code`, unique within its definition — the contract
|
|
2670
|
+
* gives it a read-only uuid nothing addresses it by. Referencing attributes therefore have to set
|
|
2671
|
+
* `referenceIdField = 'code'`; see the `attributes` attribute of the `Entity Definition` descriptor.
|
|
2672
|
+
*/
|
|
2673
|
+
export declare const ENTITY_ATTRIBUTE_ID_FIELD = "code";
|
|
2674
|
+
export declare function createEntityAttributeDescriptor(): BaseEntityDescriptor;
|
|
2675
|
+
/** `BaseEntityAttributeInput` of `base-entity-api.yaml`, plus the `id` a response carries. */
|
|
2676
|
+
interface EntityAttributeDto {
|
|
2677
|
+
id?: string;
|
|
2678
|
+
code?: string;
|
|
2679
|
+
name?: string;
|
|
2680
|
+
description?: string;
|
|
2681
|
+
displayOrder?: number;
|
|
2682
|
+
valueKind?: EntityValueKind;
|
|
2683
|
+
formControlType?: string;
|
|
2684
|
+
isMultiValued?: boolean;
|
|
2685
|
+
required?: boolean;
|
|
2686
|
+
indexed?: boolean;
|
|
2687
|
+
defaultValue?: unknown;
|
|
2688
|
+
enumValues?: string[];
|
|
2689
|
+
linkedEntityType?: string;
|
|
2690
|
+
isLinkToDetails?: boolean;
|
|
2691
|
+
}
|
|
2692
|
+
/** `BaseEntityDefinition` on the way in, `BaseEntityDefinitionInput` on the way out. */
|
|
2693
|
+
interface EntityDefinitionDto {
|
|
2694
|
+
id?: string;
|
|
2695
|
+
code?: string;
|
|
2696
|
+
name?: string;
|
|
2697
|
+
description?: string;
|
|
2698
|
+
status?: EntityDefinitionStatus;
|
|
2699
|
+
componentParents?: string[];
|
|
2700
|
+
isEmbedded?: boolean;
|
|
2701
|
+
attributes?: EntityAttributeDto[];
|
|
2702
|
+
version?: number;
|
|
2703
|
+
createdAt?: string;
|
|
2704
|
+
updatedAt?: string;
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* Translates between the `BaseEntityDefinition` DTO of `base-entity-api.yaml` and the entity the generated
|
|
2708
|
+
* screens author.
|
|
2709
|
+
*
|
|
2710
|
+
* Three things are worth knowing about it.
|
|
2711
|
+
*
|
|
2712
|
+
* **`id` is a mirror of `code`.** The contract addresses a definition by `code`
|
|
2713
|
+
* (`/entity-definitions/{code}`) while the generic screens address a record by `id` — so the mapper is
|
|
2714
|
+
* where the two meet, rather than every caller. It mirrors on the way *in* only: the request body is
|
|
2715
|
+
* `BaseEntityDefinitionInput`, which has no `id`, so `toDto` emits none and the path segment stays the sole
|
|
2716
|
+
* source of truth. The read-only uuid a response calls `id` is deliberately dropped, and can be, because
|
|
2717
|
+
* nothing sends it back. (base-state's mapper does emit an `id`, for a reason that does not apply here: it
|
|
2718
|
+
* used to be read by json-server, which no longer serves any platform feature.)
|
|
2719
|
+
*
|
|
2720
|
+
* **The nested rows are mapped element by element**, not passed through. An embedded row is edited as the
|
|
2721
|
+
* parsed JSON it arrived as, so a field the wire spelled differently from the model would leave its control
|
|
2722
|
+
* empty and silently drop the value on the next save. Mapping each row keeps that class of bug out of the
|
|
2723
|
+
* attribute descriptor even though nothing is spelled two ways today.
|
|
2724
|
+
*
|
|
2725
|
+
* **`PUT /entity-definitions/{code}` is a full replacement**, so `toDto` emits `attributes` unconditionally
|
|
2726
|
+
* — an absent list is an emptied definition, not an untouched one. The three fields the contract marks
|
|
2727
|
+
* `readOnly` (`version`, `createdAt`, `updatedAt`) are for the same reason *not* emitted: the form shows
|
|
2728
|
+
* them disabled, and sending a value back would be claiming to own something the backend assigns.
|
|
2729
|
+
*/
|
|
2730
|
+
export declare class EntityDefinitionMapper implements BaseEntityMapper<EntityDefinition> {
|
|
2731
|
+
fromDto(dto: unknown): EntityDefinition;
|
|
2732
|
+
toDto(entity: EntityDefinition): EntityDefinitionDto;
|
|
2733
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionMapper, never>;
|
|
2734
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* CRUD access to `/organizations/{orgKey}/entity-definitions` — the knowledge-layer resource of
|
|
2738
|
+
* `base-entity-api.yaml`, as the designer writes it. As in base-rule, base-app and base-state, the
|
|
2739
|
+
* organization is part of the configured service root, so the tenant is a deployment concern rather than
|
|
2740
|
+
* something every call has to carry.
|
|
2741
|
+
*
|
|
2742
|
+
* A second service over the same resource as {@link EntityDefinitionService}, and deliberately so — the two
|
|
2743
|
+
* answer different questions. That one reads **all** definitions in one call and caches them for the
|
|
2744
|
+
* session, because a run-time shell needs the whole set to resolve a `linkedEntityType` code and swallows a
|
|
2745
|
+
* failure as "no definitions". This one is a `BaseEntityRestService`, which is what gives a definition a
|
|
2746
|
+
* *store*: paged reads, `findById`, POST, PUT, DELETE, and errors that reach the screen instead of being
|
|
2747
|
+
* turned into an empty list. Merging them would mean either a designer that cannot report a failed save or
|
|
2748
|
+
* a shell that breaks a preview over one.
|
|
2749
|
+
*
|
|
2750
|
+
* `ENTITY_SERVICE_ROOT` is optional in `BaseConfiguration`: `serviceRootOf` falls back to
|
|
2751
|
+
* `BACKEND_SERVICE_ROOT`, which is what every deployment of this workspace configures today.
|
|
2752
|
+
*
|
|
2753
|
+
* Nothing is added on top of the generic CRUD. The contract's incremental attribute endpoints
|
|
2754
|
+
* (`POST/PUT/DELETE .../attributes/{attributeCode}`) are not used: the attributes are edited as an embedded
|
|
2755
|
+
* list inside the definition's own form, so the whole definition is what gets PUT — the "PUT the whole
|
|
2756
|
+
* definition for bulk changes" path the contract names on `addAttribute` itself.
|
|
2757
|
+
*/
|
|
2758
|
+
export declare class EntityDefinitionAuthoringService extends BaseEntityRestService<EntityDefinition> {
|
|
2759
|
+
protected entityMapper: EntityDefinitionMapper;
|
|
2760
|
+
constructor(entityMapper: EntityDefinitionMapper);
|
|
2761
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionAuthoringService, never>;
|
|
2762
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* The stock CRUD store. Like `StateMachineDefinitionStore` and unlike `AppDefinitionStore` there is no extra
|
|
2766
|
+
* feature to add: a definition's `status` is authored as an ordinary dropdown, not promoted through a
|
|
2767
|
+
* publish endpoint, and its `version` is an optimistic lock rather than a lifecycle.
|
|
2768
|
+
*
|
|
2769
|
+
* `providedIn: 'root'` because the store outlives the route: the designer's list, the attribute levels below
|
|
2770
|
+
* it and `EntityDefinitionContainerComponent` all read the same rows.
|
|
2771
|
+
*/
|
|
2772
|
+
export declare const EntityDefinitionStore: import("@angular/core").Type<{
|
|
2773
|
+
entities: import("@angular/core").Signal<EntityDefinition[]>;
|
|
2774
|
+
number: import("@angular/core").Signal<number>;
|
|
2775
|
+
size: import("@angular/core").Signal<number>;
|
|
2776
|
+
totalElements: import("@angular/core").Signal<number>;
|
|
2777
|
+
totalPages: import("@angular/core").Signal<number>;
|
|
2778
|
+
currentId: import("@angular/core").Signal<string | undefined>;
|
|
2779
|
+
currentEntity: import("@ngrx/signals").DeepSignal<EntityDefinition> | import("@angular/core").Signal<undefined>;
|
|
2780
|
+
isLoading: import("@angular/core").Signal<boolean>;
|
|
2781
|
+
error: import("@angular/core").Signal<string | undefined>;
|
|
2782
|
+
selectedEntities: import("@angular/core").Signal<EntityDefinition[]>;
|
|
2783
|
+
activeTabs: import("@angular/core").Signal<string[]>;
|
|
2784
|
+
currentTab: import("@angular/core").Signal<string | undefined>;
|
|
2785
|
+
filterKey: import("@angular/core").Signal<string | undefined>;
|
|
2786
|
+
countOfEntities: import("@angular/core").Signal<number>;
|
|
2787
|
+
matTableDataSource: import("@angular/core").Signal<import("@angular/material/table").MatTableDataSource<EntityDefinition, import("@angular/material/paginator").MatPaginator>>;
|
|
2788
|
+
clearCurrentEntity: () => void;
|
|
2789
|
+
createEntity: () => EntityDefinition;
|
|
2790
|
+
add: (entity: EntityDefinition) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
2791
|
+
delete: (id: string) => Promise<void>;
|
|
2792
|
+
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
2793
|
+
deselectAll: () => void;
|
|
2794
|
+
deselectEntity: (id: string) => void;
|
|
2795
|
+
load: import("@ngrx/signals/rxjs-interop").RxMethod<import("@processpuzzle/base-entity").BaseEntityQueryCondition>;
|
|
2796
|
+
loadById: (id: string) => EntityDefinition | undefined;
|
|
2797
|
+
resetErrorState: () => void;
|
|
2798
|
+
selectEntity: (id: string) => void;
|
|
2799
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
2800
|
+
update: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
2801
|
+
reset: () => void;
|
|
2802
|
+
tabIsActive: (tabName: string) => void;
|
|
2803
|
+
tabIsInactive: (tabName: string) => void;
|
|
2804
|
+
doFilter: (filterKey: string) => void;
|
|
2805
|
+
} & import("@ngrx/signals").StateSource<{
|
|
2806
|
+
entities: EntityDefinition[];
|
|
2807
|
+
number: number;
|
|
2808
|
+
size: number;
|
|
2809
|
+
totalElements: number;
|
|
2810
|
+
totalPages: number;
|
|
2811
|
+
currentId: string | undefined;
|
|
2812
|
+
currentEntity: EntityDefinition | undefined;
|
|
2813
|
+
isLoading: boolean;
|
|
2814
|
+
error: string | undefined;
|
|
2815
|
+
selectedEntities: EntityDefinition[];
|
|
2816
|
+
activeTabs: string[];
|
|
2817
|
+
currentTab: string | undefined;
|
|
2818
|
+
filterKey: string | undefined;
|
|
2819
|
+
}>>;
|
|
2820
|
+
/**
|
|
2821
|
+
* The routable `Entity Definition`. Everything the generated screens need comes off this facade, which is
|
|
2822
|
+
* what `ACTIVE_ENTITY_FACADE` hands to the container, the list and the form.
|
|
2823
|
+
*
|
|
2824
|
+
* The mapper and the service are injected rather than constructed, so both stay `providedIn: 'root'`
|
|
2825
|
+
* singletons — the store's repository and this facade's have to be the same object, or a save would not be
|
|
2826
|
+
* visible to the rows the list already holds.
|
|
2827
|
+
*/
|
|
2828
|
+
export declare class EntityDefinitionFacade extends BaseEntityFacade<EntityDefinition> {
|
|
2829
|
+
readonly entityType: typeof EntityDefinition;
|
|
2830
|
+
private readonly mapperRef;
|
|
2831
|
+
private readonly serviceRef;
|
|
2832
|
+
protected createMapper(): EntityDefinitionMapper;
|
|
2833
|
+
protected createService(): EntityDefinitionAuthoringService;
|
|
2834
|
+
protected createStoreClass(): Type<unknown>;
|
|
2835
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
2836
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionFacade, never>;
|
|
2837
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* The one embedded level of a definition: its attributes, carried inside the definition document.
|
|
2841
|
+
*
|
|
2842
|
+
* A facade like any other — that is what gives it a store, and so a working list and form — with only its
|
|
2843
|
+
* repository differing: `EmbeddedEntityService` reads and writes the `Entity Definition` being edited
|
|
2844
|
+
* rather than an endpoint of its own. It takes no mapper for the same reason; the rows are mapped by
|
|
2845
|
+
* `EntityDefinitionMapper` as part of the owner's payload.
|
|
2846
|
+
*/
|
|
2847
|
+
export declare class EntityAttributeFacade extends EmbeddedEntityFacade<EntityAttributeDefinition> {
|
|
2848
|
+
readonly entityType: typeof EntityAttributeDefinition;
|
|
2849
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
2850
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityAttributeFacade, never>;
|
|
2851
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* Hosts the generic container for `Entity Definition`, and invalidates the two run-time caches when the
|
|
2855
|
+
* author leaves the section.
|
|
2856
|
+
*
|
|
2857
|
+
* The container takes no inputs: `BaseEntityContainerComponent` resolves its descriptor and its store from
|
|
2858
|
+
* `ACTIVE_ENTITY_FACADE`, which `BASE_ENTITY_AUTHORING_ROUTES` binds to `EntityDefinitionFacade` — the same
|
|
2859
|
+
* token every level below it resolves through, so the definition and its attributes are reached the same
|
|
2860
|
+
* way. A component of this library's own is nevertheless what the route mounts, and the cache reset is the
|
|
2861
|
+
* whole reason.
|
|
2862
|
+
*
|
|
2863
|
+
* **Why the reset.** `EntityDefinitionRegistry` memoizes the tenant's definitions for the session, and
|
|
2864
|
+
* `DynamicEntityRegistry` memoizes the descriptors and facades synthesized from them. That is right for a
|
|
2865
|
+
* run-time shell, where metadata does not change under a running application — and wrong in the designer,
|
|
2866
|
+
* where changing it is the point: a definition edited here decides what the Preview tab and every
|
|
2867
|
+
* `EntityScreenResolver`-mounted screen should render next, and nothing else would ever invalidate a
|
|
2868
|
+
* session-long cache. Both registries name this caller in their own `reset()` docs.
|
|
2869
|
+
*
|
|
2870
|
+
* Only `DynamicEntityRegistry` is asked, because its `reset()` cascades to `EntityDefinitionRegistry` —
|
|
2871
|
+
* discarding the descriptors without discarding the definitions they were built from would rebuild the same
|
|
2872
|
+
* descriptors.
|
|
2873
|
+
*
|
|
2874
|
+
* **Why on destroy** rather than after each save: leaving the section is the last moment before a stale
|
|
2875
|
+
* descriptor could be rendered, it happens once, and it cannot be mistaken for a change when the author only
|
|
2876
|
+
* looked. Refetching after a visit that edited nothing costs one request; the alternative — resetting on
|
|
2877
|
+
* every mutation of the store's row set — also fires on a page change and a filter.
|
|
2878
|
+
*/
|
|
2879
|
+
export declare class EntityDefinitionContainerComponent implements OnDestroy {
|
|
2880
|
+
private readonly dynamicEntities;
|
|
2881
|
+
ngOnDestroy(): void;
|
|
2882
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionContainerComponent, never>;
|
|
2883
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityDefinitionContainerComponent, "pp-entity-definition-container", never, {}, {}, never, never, true, never>;
|
|
2884
|
+
}
|
|
2885
|
+
export type { ArtifactAttr, BaseEntity, BaseEntityDescriptorOptions, BaseEntityFacadeRegistry, BaseEntityFormBuilder, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, DefinitionLookup, DynamicEntity, EmbeddedBreadcrumbLevel, EmbeddedChildRoute, EmbeddedPath, EmbeddedPathStep, EmbeddedRouteContext, EmbeddedRouteLevel, EmbeddedRow, EntityDefinitionStatus, EntityOptions, EntityScreenRouteOptions, EntityScreens, EntityServiceKind, EntityTabContributor, EntityTabDescriptor, EntityValueKind, EvaluatableRule, FilterCondition, FirestoreApi, LookupTable, NavigationPayload, NavigationState, ObjectUriResponse, OrderByCondition, PdfColumnDefinition, PdfExportDialogResult, PdfExportOptions, PdfExportResult, PersistedBaseEntity, PersistedEntity, ResolvedDynamicEntity, ResolvedEmbeddedAggregate, RuleEngine, RuleEvaluationResult, RuleSeverity, Selectable, SelectablesInput };
|
|
2886
|
+
//# sourceMappingURL=processpuzzle-base-entity.d.ts.map
|