@ngrx/signals 20.1.0 → 21.0.0-rc.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/fesm2022/ngrx-signals-entities.mjs.map +1 -1
- package/fesm2022/ngrx-signals-events.mjs +219 -57
- package/fesm2022/ngrx-signals-events.mjs.map +1 -1
- package/fesm2022/ngrx-signals-rxjs-interop.mjs +4 -4
- package/fesm2022/ngrx-signals-rxjs-interop.mjs.map +1 -1
- package/fesm2022/ngrx-signals.mjs +11 -8
- package/fesm2022/ngrx-signals.mjs.map +1 -1
- package/migrations/18_0_0-rc_3-protected-state/index.js +54 -23
- package/migrations/18_0_0-rc_3-protected-state/index.js.map +1 -1
- package/migrations/18_0_0-rc_3-writablestatesource/index.js +45 -12
- package/migrations/18_0_0-rc_3-writablestatesource/index.js.map +1 -1
- package/migrations/19_0_0-rc_0-props/index.js +72 -83
- package/migrations/19_0_0-rc_0-props/index.js.map +1 -1
- package/migrations/21_0_0-beta_0-rename-withEffects-to-withEventHandlers/index.js +103 -0
- package/migrations/21_0_0-beta_0-rename-withEffects-to-withEventHandlers/index.js.map +1 -0
- package/migrations/migration.json +5 -0
- package/package.json +8 -8
- package/schematics/ng-add/index.js +5 -5
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics-core/index.js +1 -1
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +198 -240
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +68 -85
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +7 -7
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +20 -20
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +21 -21
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +4 -26
- package/schematics-core/utility/json-utilts.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +110 -141
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +2 -3
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +3 -3
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +13 -13
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/strings.js +12 -12
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +12 -12
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +78 -180
- package/schematics-core/utility/visitors.js.map +1 -1
- package/types/ngrx-signals-entities.d.ts +324 -0
- package/types/ngrx-signals-events.d.ts +360 -0
- package/types/ngrx-signals-rxjs-interop.d.ts +15 -0
- package/{testing/src/unprotected.d.ts → types/ngrx-signals-testing.d.ts} +5 -3
- package/types/ngrx-signals.d.ts +332 -0
- package/entities/index.d.ts +0 -1
- package/entities/src/entity-config.d.ts +0 -17
- package/entities/src/helpers.d.ts +0 -25
- package/entities/src/index.d.ts +0 -18
- package/entities/src/models.d.ts +0 -24
- package/entities/src/updaters/add-entities.d.ts +0 -17
- package/entities/src/updaters/add-entity.d.ts +0 -17
- package/entities/src/updaters/prepend-entities.d.ts +0 -17
- package/entities/src/updaters/prepend-entity.d.ts +0 -17
- package/entities/src/updaters/remove-all-entities.d.ts +0 -6
- package/entities/src/updaters/remove-entities.d.ts +0 -10
- package/entities/src/updaters/remove-entity.d.ts +0 -6
- package/entities/src/updaters/set-all-entities.d.ts +0 -17
- package/entities/src/updaters/set-entities.d.ts +0 -17
- package/entities/src/updaters/set-entity.d.ts +0 -17
- package/entities/src/updaters/update-all-entities.d.ts +0 -17
- package/entities/src/updaters/update-entities.d.ts +0 -56
- package/entities/src/updaters/update-entity.d.ts +0 -29
- package/entities/src/updaters/upsert-entities.d.ts +0 -17
- package/entities/src/updaters/upsert-entity.d.ts +0 -17
- package/entities/src/with-entities.d.ts +0 -22
- package/events/index.d.ts +0 -1
- package/events/src/case-reducer.d.ts +0 -20
- package/events/src/dispatcher.d.ts +0 -33
- package/events/src/event-creator-group.d.ts +0 -33
- package/events/src/event-creator.d.ts +0 -9
- package/events/src/event-instance.d.ts +0 -8
- package/events/src/events-service.d.ts +0 -47
- package/events/src/index.d.ts +0 -9
- package/events/src/inject-dispatch.d.ts +0 -46
- package/events/src/with-effects.d.ts +0 -28
- package/events/src/with-reducer.d.ts +0 -30
- package/index.d.ts +0 -1
- package/rxjs-interop/index.d.ts +0 -1
- package/rxjs-interop/src/index.d.ts +0 -1
- package/rxjs-interop/src/rx-method.d.ts +0 -12
- package/src/deep-computed.d.ts +0 -2
- package/src/deep-signal.d.ts +0 -6
- package/src/index.d.ts +0 -16
- package/src/signal-method.d.ts +0 -7
- package/src/signal-state.d.ts +0 -4
- package/src/signal-store-assertions.d.ts +0 -2
- package/src/signal-store-feature.d.ts +0 -29
- package/src/signal-store-models.d.ts +0 -30
- package/src/signal-store.d.ts +0 -115
- package/src/state-source.d.ts +0 -23
- package/src/ts-helpers.d.ts +0 -11
- package/src/with-computed.d.ts +0 -12
- package/src/with-feature.d.ts +0 -26
- package/src/with-hooks.d.ts +0 -14
- package/src/with-linked-state.d.ts +0 -52
- package/src/with-methods.d.ts +0 -8
- package/src/with-props.d.ts +0 -8
- package/src/with-state.d.ts +0 -11
- package/testing/index.d.ts +0 -1
- package/testing/src/index.d.ts +0 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { PartialStateUpdater, SignalStoreFeature, EmptyFeatureResult } from '@ngrx/signals';
|
|
2
|
+
import { Signal } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type EntityId = string | number;
|
|
5
|
+
type EntityMap<Entity> = Record<EntityId, Entity>;
|
|
6
|
+
type EntityState<Entity> = {
|
|
7
|
+
entityMap: EntityMap<Entity>;
|
|
8
|
+
ids: EntityId[];
|
|
9
|
+
};
|
|
10
|
+
type NamedEntityState<Entity, Collection extends string> = {
|
|
11
|
+
[K in keyof EntityState<Entity> as `${Collection}${Capitalize<K>}`]: EntityState<Entity>[K];
|
|
12
|
+
};
|
|
13
|
+
type EntityProps<Entity> = {
|
|
14
|
+
entities: Signal<Entity[]>;
|
|
15
|
+
};
|
|
16
|
+
type NamedEntityProps<Entity, Collection extends string> = {
|
|
17
|
+
[K in keyof EntityProps<Entity> as `${Collection}${Capitalize<K>}`]: EntityProps<Entity>[K];
|
|
18
|
+
};
|
|
19
|
+
type SelectEntityId<Entity> = (entity: Entity) => EntityId;
|
|
20
|
+
type EntityPredicate<Entity> = (entity: Entity) => boolean;
|
|
21
|
+
type EntityChanges<Entity> = Partial<Entity> | ((entity: Entity) => Partial<Entity>);
|
|
22
|
+
|
|
23
|
+
declare function addEntity<Entity extends {
|
|
24
|
+
id: EntityId;
|
|
25
|
+
}>(entity: Entity): PartialStateUpdater<EntityState<Entity>>;
|
|
26
|
+
declare function addEntity<Entity, Collection extends string>(entity: Entity, config: {
|
|
27
|
+
collection: Collection;
|
|
28
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
29
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
30
|
+
declare function addEntity<Entity extends {
|
|
31
|
+
id: EntityId;
|
|
32
|
+
}, Collection extends string>(entity: Entity, config: {
|
|
33
|
+
collection: Collection;
|
|
34
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
35
|
+
declare function addEntity<Entity>(entity: Entity, config: {
|
|
36
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
37
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
38
|
+
|
|
39
|
+
declare function addEntities<Entity extends {
|
|
40
|
+
id: EntityId;
|
|
41
|
+
}>(entities: Entity[]): PartialStateUpdater<EntityState<Entity>>;
|
|
42
|
+
declare function addEntities<Entity, Collection extends string>(entities: Entity[], config: {
|
|
43
|
+
collection: Collection;
|
|
44
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
45
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
46
|
+
declare function addEntities<Entity extends {
|
|
47
|
+
id: EntityId;
|
|
48
|
+
}, Collection extends string>(entities: Entity[], config: {
|
|
49
|
+
collection: Collection;
|
|
50
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
51
|
+
declare function addEntities<Entity>(entities: Entity[], config: {
|
|
52
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
53
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
54
|
+
|
|
55
|
+
declare function prependEntity<Entity extends {
|
|
56
|
+
id: EntityId;
|
|
57
|
+
}>(entity: Entity): PartialStateUpdater<EntityState<Entity>>;
|
|
58
|
+
declare function prependEntity<Entity, Collection extends string>(entity: Entity, config: {
|
|
59
|
+
collection: Collection;
|
|
60
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
61
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
62
|
+
declare function prependEntity<Entity extends {
|
|
63
|
+
id: EntityId;
|
|
64
|
+
}, Collection extends string>(entity: Entity, config: {
|
|
65
|
+
collection: Collection;
|
|
66
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
67
|
+
declare function prependEntity<Entity>(entity: Entity, config: {
|
|
68
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
69
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
70
|
+
|
|
71
|
+
declare function prependEntities<Entity extends {
|
|
72
|
+
id: EntityId;
|
|
73
|
+
}>(entities: Entity[]): PartialStateUpdater<EntityState<Entity>>;
|
|
74
|
+
declare function prependEntities<Entity, Collection extends string>(entities: Entity[], config: {
|
|
75
|
+
collection: Collection;
|
|
76
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
77
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
78
|
+
declare function prependEntities<Entity extends {
|
|
79
|
+
id: EntityId;
|
|
80
|
+
}, Collection extends string>(entities: Entity[], config: {
|
|
81
|
+
collection: Collection;
|
|
82
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
83
|
+
declare function prependEntities<Entity>(entities: Entity[], config: {
|
|
84
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
85
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
86
|
+
|
|
87
|
+
declare function removeEntity(id: EntityId): PartialStateUpdater<EntityState<any>>;
|
|
88
|
+
declare function removeEntity<Collection extends string>(id: EntityId, config: {
|
|
89
|
+
collection: Collection;
|
|
90
|
+
}): PartialStateUpdater<NamedEntityState<any, Collection>>;
|
|
91
|
+
|
|
92
|
+
declare function removeEntities(ids: EntityId[]): PartialStateUpdater<EntityState<any>>;
|
|
93
|
+
declare function removeEntities<Entity>(predicate: EntityPredicate<Entity>): PartialStateUpdater<EntityState<Entity>>;
|
|
94
|
+
declare function removeEntities<Collection extends string>(ids: EntityId[], config: {
|
|
95
|
+
collection: Collection;
|
|
96
|
+
}): PartialStateUpdater<NamedEntityState<any, Collection>>;
|
|
97
|
+
declare function removeEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E, Collection> ? E : never>(predicate: EntityPredicate<Entity>, config: {
|
|
98
|
+
collection: Collection;
|
|
99
|
+
}): PartialStateUpdater<State>;
|
|
100
|
+
|
|
101
|
+
declare function removeAllEntities(): PartialStateUpdater<EntityState<any>>;
|
|
102
|
+
declare function removeAllEntities<Collection extends string>(config: {
|
|
103
|
+
collection: Collection;
|
|
104
|
+
}): PartialStateUpdater<NamedEntityState<any, Collection>>;
|
|
105
|
+
|
|
106
|
+
declare function setEntity<Entity extends {
|
|
107
|
+
id: EntityId;
|
|
108
|
+
}>(entity: Entity): PartialStateUpdater<EntityState<Entity>>;
|
|
109
|
+
declare function setEntity<Entity, Collection extends string>(entity: Entity, config: {
|
|
110
|
+
collection: Collection;
|
|
111
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
112
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
113
|
+
declare function setEntity<Entity extends {
|
|
114
|
+
id: EntityId;
|
|
115
|
+
}, Collection extends string>(entity: Entity, config: {
|
|
116
|
+
collection: Collection;
|
|
117
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
118
|
+
declare function setEntity<Entity>(entity: Entity, config: {
|
|
119
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
120
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
121
|
+
|
|
122
|
+
declare function setEntities<Entity extends {
|
|
123
|
+
id: EntityId;
|
|
124
|
+
}>(entities: Entity[]): PartialStateUpdater<EntityState<Entity>>;
|
|
125
|
+
declare function setEntities<Entity, Collection extends string>(entities: Entity[], config: {
|
|
126
|
+
collection: Collection;
|
|
127
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
128
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
129
|
+
declare function setEntities<Entity extends {
|
|
130
|
+
id: EntityId;
|
|
131
|
+
}, Collection extends string>(entities: Entity[], config: {
|
|
132
|
+
collection: Collection;
|
|
133
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
134
|
+
declare function setEntities<Entity>(entities: Entity[], config: {
|
|
135
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
136
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
137
|
+
|
|
138
|
+
declare function setAllEntities<Entity extends {
|
|
139
|
+
id: EntityId;
|
|
140
|
+
}>(entities: Entity[]): PartialStateUpdater<EntityState<Entity>>;
|
|
141
|
+
declare function setAllEntities<Entity, Collection extends string>(entities: Entity[], config: {
|
|
142
|
+
collection: Collection;
|
|
143
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
144
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
145
|
+
declare function setAllEntities<Entity extends {
|
|
146
|
+
id: EntityId;
|
|
147
|
+
}, Collection extends string>(entities: Entity[], config: {
|
|
148
|
+
collection: Collection;
|
|
149
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
150
|
+
declare function setAllEntities<Entity>(entities: Entity[], config: {
|
|
151
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
152
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
153
|
+
|
|
154
|
+
declare function updateEntity<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E, Collection> ? E : never>(update: {
|
|
155
|
+
id: EntityId;
|
|
156
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
157
|
+
}, config: {
|
|
158
|
+
collection: Collection;
|
|
159
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
160
|
+
}): PartialStateUpdater<State>;
|
|
161
|
+
declare function updateEntity<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E extends {
|
|
162
|
+
id: EntityId;
|
|
163
|
+
}, Collection> ? E : never>(update: {
|
|
164
|
+
id: EntityId;
|
|
165
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
166
|
+
}, config: {
|
|
167
|
+
collection: Collection;
|
|
168
|
+
}): PartialStateUpdater<State>;
|
|
169
|
+
declare function updateEntity<Entity>(update: {
|
|
170
|
+
id: EntityId;
|
|
171
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
172
|
+
}, config: {
|
|
173
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
174
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
175
|
+
declare function updateEntity<Entity extends {
|
|
176
|
+
id: EntityId;
|
|
177
|
+
}>(update: {
|
|
178
|
+
id: EntityId;
|
|
179
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
180
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
181
|
+
|
|
182
|
+
declare function updateEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E, Collection> ? E : never>(update: {
|
|
183
|
+
ids: EntityId[];
|
|
184
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
185
|
+
}, config: {
|
|
186
|
+
collection: Collection;
|
|
187
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
188
|
+
}): PartialStateUpdater<State>;
|
|
189
|
+
declare function updateEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E, Collection> ? E : never>(update: {
|
|
190
|
+
predicate: EntityPredicate<Entity>;
|
|
191
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
192
|
+
}, config: {
|
|
193
|
+
collection: Collection;
|
|
194
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
195
|
+
}): PartialStateUpdater<State>;
|
|
196
|
+
declare function updateEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E extends {
|
|
197
|
+
id: EntityId;
|
|
198
|
+
}, Collection> ? E : never>(update: {
|
|
199
|
+
ids: EntityId[];
|
|
200
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
201
|
+
}, config: {
|
|
202
|
+
collection: Collection;
|
|
203
|
+
}): PartialStateUpdater<State>;
|
|
204
|
+
declare function updateEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E extends {
|
|
205
|
+
id: EntityId;
|
|
206
|
+
}, Collection> ? E : never>(update: {
|
|
207
|
+
predicate: EntityPredicate<Entity>;
|
|
208
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
209
|
+
}, config: {
|
|
210
|
+
collection: Collection;
|
|
211
|
+
}): PartialStateUpdater<State>;
|
|
212
|
+
declare function updateEntities<Entity>(update: {
|
|
213
|
+
ids: EntityId[];
|
|
214
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
215
|
+
}, config: {
|
|
216
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
217
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
218
|
+
declare function updateEntities<Entity>(update: {
|
|
219
|
+
predicate: EntityPredicate<Entity>;
|
|
220
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
221
|
+
}, config: {
|
|
222
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
223
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
224
|
+
declare function updateEntities<Entity extends {
|
|
225
|
+
id: EntityId;
|
|
226
|
+
}>(update: {
|
|
227
|
+
ids: EntityId[];
|
|
228
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
229
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
230
|
+
declare function updateEntities<Entity extends {
|
|
231
|
+
id: EntityId;
|
|
232
|
+
}>(update: {
|
|
233
|
+
predicate: EntityPredicate<Entity>;
|
|
234
|
+
changes: EntityChanges<NoInfer<Entity>>;
|
|
235
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
236
|
+
|
|
237
|
+
declare function updateAllEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E, Collection> ? E : never>(changes: EntityChanges<NoInfer<Entity>>, config: {
|
|
238
|
+
collection: Collection;
|
|
239
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
240
|
+
}): PartialStateUpdater<State>;
|
|
241
|
+
declare function updateAllEntities<Collection extends string, State extends NamedEntityState<any, Collection>, Entity = State extends NamedEntityState<infer E extends {
|
|
242
|
+
id: EntityId;
|
|
243
|
+
}, Collection> ? E : never>(changes: EntityChanges<NoInfer<Entity>>, config: {
|
|
244
|
+
collection: Collection;
|
|
245
|
+
}): PartialStateUpdater<State>;
|
|
246
|
+
declare function updateAllEntities<Entity>(changes: EntityChanges<NoInfer<Entity>>, config: {
|
|
247
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
248
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
249
|
+
declare function updateAllEntities<Entity extends {
|
|
250
|
+
id: EntityId;
|
|
251
|
+
}>(changes: EntityChanges<NoInfer<Entity>>): PartialStateUpdater<EntityState<Entity>>;
|
|
252
|
+
|
|
253
|
+
declare function upsertEntity<Entity extends {
|
|
254
|
+
id: EntityId;
|
|
255
|
+
}>(entity: Entity): PartialStateUpdater<EntityState<Entity>>;
|
|
256
|
+
declare function upsertEntity<Entity, Collection extends string>(entity: Entity, config: {
|
|
257
|
+
collection: Collection;
|
|
258
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
259
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
260
|
+
declare function upsertEntity<Entity extends {
|
|
261
|
+
id: EntityId;
|
|
262
|
+
}, Collection extends string>(entity: Entity, config: {
|
|
263
|
+
collection: Collection;
|
|
264
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
265
|
+
declare function upsertEntity<Entity>(entity: Entity, config: {
|
|
266
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
267
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
268
|
+
|
|
269
|
+
declare function upsertEntities<Entity extends {
|
|
270
|
+
id: EntityId;
|
|
271
|
+
}>(entities: Entity[]): PartialStateUpdater<EntityState<Entity>>;
|
|
272
|
+
declare function upsertEntities<Entity, Collection extends string>(entities: Entity[], config: {
|
|
273
|
+
collection: Collection;
|
|
274
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
275
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
276
|
+
declare function upsertEntities<Entity extends {
|
|
277
|
+
id: EntityId;
|
|
278
|
+
}, Collection extends string>(entities: Entity[], config: {
|
|
279
|
+
collection: Collection;
|
|
280
|
+
}): PartialStateUpdater<NamedEntityState<Entity, Collection>>;
|
|
281
|
+
declare function upsertEntities<Entity>(entities: Entity[], config: {
|
|
282
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
283
|
+
}): PartialStateUpdater<EntityState<Entity>>;
|
|
284
|
+
|
|
285
|
+
declare function entityConfig<Entity, Collection extends string>(config: {
|
|
286
|
+
entity: Entity;
|
|
287
|
+
collection: Collection;
|
|
288
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
289
|
+
}): typeof config;
|
|
290
|
+
declare function entityConfig<Entity>(config: {
|
|
291
|
+
entity: Entity;
|
|
292
|
+
selectId: SelectEntityId<NoInfer<Entity>>;
|
|
293
|
+
}): typeof config;
|
|
294
|
+
declare function entityConfig<Entity, Collection extends string>(config: {
|
|
295
|
+
entity: Entity;
|
|
296
|
+
collection: Collection;
|
|
297
|
+
}): typeof config;
|
|
298
|
+
declare function entityConfig<Entity>(config: {
|
|
299
|
+
entity: Entity;
|
|
300
|
+
}): typeof config;
|
|
301
|
+
|
|
302
|
+
declare function withEntities<Entity>(): SignalStoreFeature<EmptyFeatureResult, {
|
|
303
|
+
state: EntityState<Entity>;
|
|
304
|
+
props: EntityProps<Entity>;
|
|
305
|
+
methods: {};
|
|
306
|
+
}>;
|
|
307
|
+
declare function withEntities<Entity, Collection extends string>(config: {
|
|
308
|
+
entity: Entity;
|
|
309
|
+
collection: Collection;
|
|
310
|
+
}): SignalStoreFeature<EmptyFeatureResult, {
|
|
311
|
+
state: NamedEntityState<Entity, Collection>;
|
|
312
|
+
props: NamedEntityProps<Entity, Collection>;
|
|
313
|
+
methods: {};
|
|
314
|
+
}>;
|
|
315
|
+
declare function withEntities<Entity>(config: {
|
|
316
|
+
entity: Entity;
|
|
317
|
+
}): SignalStoreFeature<EmptyFeatureResult, {
|
|
318
|
+
state: EntityState<Entity>;
|
|
319
|
+
props: EntityProps<Entity>;
|
|
320
|
+
methods: {};
|
|
321
|
+
}>;
|
|
322
|
+
|
|
323
|
+
export { addEntities, addEntity, entityConfig, prependEntities, prependEntity, removeAllEntities, removeEntities, removeEntity, setAllEntities, setEntities, setEntity, updateAllEntities, updateEntities, updateEntity, upsertEntities, upsertEntity, withEntities };
|
|
324
|
+
export type { EntityChanges, EntityId, EntityMap, EntityProps, EntityState, NamedEntityProps, NamedEntityState, SelectEntityId };
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { PartialStateUpdater, Prettify, SignalStoreFeatureResult, StateSignals, WritableStateSource, SignalStoreFeature, EmptyFeatureResult } from '@ngrx/signals';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Type, Provider, Injector } from '@angular/core';
|
|
4
|
+
import { OperatorFunction, Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
type EventInstance<Type extends string, Payload> = {
|
|
7
|
+
type: Type;
|
|
8
|
+
payload: Payload;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type EventCreator<Type extends string, Payload> = ((payload: Payload) => EventInstance<Type, Payload>) & {
|
|
12
|
+
type: Type;
|
|
13
|
+
};
|
|
14
|
+
declare function event<Type extends string>(type: Type): EventCreator<Type, void>;
|
|
15
|
+
declare function event<Type extends string, Payload>(type: Type, payload: Payload): EventCreator<Type, Payload>;
|
|
16
|
+
|
|
17
|
+
type CaseReducerResult<State extends object, EventCreators extends EventCreator<string, any>[]> = {
|
|
18
|
+
reducer: CaseReducer<State, EventCreators>;
|
|
19
|
+
events: EventCreators;
|
|
20
|
+
};
|
|
21
|
+
type CaseReducer<State extends object, EventCreators extends EventCreator<string, any>[]> = (event: {
|
|
22
|
+
[K in keyof EventCreators]: ReturnType<EventCreators[K]>;
|
|
23
|
+
}[number], state: State) => Partial<State> | PartialStateUpdater<State> | Array<Partial<State> | PartialStateUpdater<State>>;
|
|
24
|
+
/**
|
|
25
|
+
* @description
|
|
26
|
+
*
|
|
27
|
+
* Creates a case reducer that can be used with the `withReducer` feature.
|
|
28
|
+
*/
|
|
29
|
+
declare function on<State extends object, EventCreators extends EventCreator<string, any>[]>(...args: [
|
|
30
|
+
...events: [...EventCreators],
|
|
31
|
+
reducer: CaseReducer<NoInfer<State>, NoInfer<EventCreators>>
|
|
32
|
+
]): CaseReducerResult<State, EventCreators>;
|
|
33
|
+
|
|
34
|
+
type EventScope = 'self' | 'parent' | 'global';
|
|
35
|
+
type EventScopeConfig = {
|
|
36
|
+
scope: EventScope;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
*
|
|
41
|
+
* Marks a single event to be dispatched in the specified scope.
|
|
42
|
+
* Used in a tuple alongside an event to indicate its dispatch scope.
|
|
43
|
+
*
|
|
44
|
+
* @usageNotes
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { signalStore, type } from '@ngrx/signals';
|
|
48
|
+
* import { event, Events, withEffects } from '@ngrx/signals/events';
|
|
49
|
+
* import { mapResponse } from '@ngrx/operators';
|
|
50
|
+
*
|
|
51
|
+
* const opened = event('[Users Page] Opened');
|
|
52
|
+
* const loadedSuccess = event('[Users API] Loaded Success', type<User[]>());
|
|
53
|
+
* const loadedFailure = event('[Users API] Loaded Failure', type<string>());
|
|
54
|
+
*
|
|
55
|
+
* const UsersStore = signalStore(
|
|
56
|
+
* withEffects((
|
|
57
|
+
* _,
|
|
58
|
+
* events = inject(Events),
|
|
59
|
+
* usersService = inject(UsersService)
|
|
60
|
+
* ) => ({
|
|
61
|
+
* loadUsers$: events.on(opened).pipe(
|
|
62
|
+
* exhaustMap(() =>
|
|
63
|
+
* usersService.getAll().pipe(
|
|
64
|
+
* mapResponse({
|
|
65
|
+
* next: (users) => loadedSuccess(users),
|
|
66
|
+
* error: (error: { message: string }) => [
|
|
67
|
+
* loadedFailure(error.message),
|
|
68
|
+
* toScope('global'),
|
|
69
|
+
* ],
|
|
70
|
+
* }),
|
|
71
|
+
* ),
|
|
72
|
+
* ),
|
|
73
|
+
* ),
|
|
74
|
+
* })),
|
|
75
|
+
* );
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare function toScope(scope: EventScope): EventScopeConfig;
|
|
79
|
+
/**
|
|
80
|
+
* @description
|
|
81
|
+
*
|
|
82
|
+
* RxJS operator that maps all emitted events in the stream to be dispatched
|
|
83
|
+
* in the specified scope.
|
|
84
|
+
*
|
|
85
|
+
* @usageNotes
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { signalStore, type } from '@ngrx/signals';
|
|
89
|
+
* import { event, Events, withEffects } from '@ngrx/signals/events';
|
|
90
|
+
* import { mapResponse } from '@ngrx/operators';
|
|
91
|
+
*
|
|
92
|
+
* const opened = event('[Users Page] Opened');
|
|
93
|
+
* const loadedSuccess = event('[Users API] Loaded Success', type<User[]>());
|
|
94
|
+
* const loadedFailure = event('[Users API] Loaded Failure', type<string>());
|
|
95
|
+
*
|
|
96
|
+
* const UsersStore = signalStore(
|
|
97
|
+
* withEffects((
|
|
98
|
+
* _,
|
|
99
|
+
* events = inject(Events),
|
|
100
|
+
* usersService = inject(UsersService)
|
|
101
|
+
* ) => ({
|
|
102
|
+
* loadUsers$: events.on(opened).pipe(
|
|
103
|
+
* exhaustMap(() =>
|
|
104
|
+
* usersService.getAll().pipe(
|
|
105
|
+
* mapResponse({
|
|
106
|
+
* next: (users) => loadedSuccess(users),
|
|
107
|
+
* error: (error: { message: string }) =>
|
|
108
|
+
* loadedFailure(error.message),
|
|
109
|
+
* }),
|
|
110
|
+
* mapToScope('parent'),
|
|
111
|
+
* ),
|
|
112
|
+
* ),
|
|
113
|
+
* ),
|
|
114
|
+
* })),
|
|
115
|
+
* );
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function mapToScope<T extends EventInstance<string, unknown>>(scope: EventScope): OperatorFunction<T, [T, EventScopeConfig]>;
|
|
119
|
+
|
|
120
|
+
declare abstract class BaseEvents {
|
|
121
|
+
protected readonly events$: Observable<EventInstance<string, unknown>>;
|
|
122
|
+
protected constructor(parentEventsToken: Type<BaseEvents>);
|
|
123
|
+
on(): Observable<EventInstance<string, unknown>>;
|
|
124
|
+
on<EventCreators extends EventCreator<string, any>[]>(...events: [...EventCreators]): Observable<{
|
|
125
|
+
[K in keyof EventCreators]: ReturnType<EventCreators[K]>;
|
|
126
|
+
}[number]>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @description
|
|
130
|
+
*
|
|
131
|
+
* Globally provided service for listening to dispatched events.
|
|
132
|
+
*
|
|
133
|
+
* @usageNotes
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { event, Events } from '@ngrx/signals/events';
|
|
137
|
+
*
|
|
138
|
+
* const increment = event('[Counter Page] Increment');
|
|
139
|
+
*
|
|
140
|
+
* \@Component({ /* ... *\/ })
|
|
141
|
+
* class Counter {
|
|
142
|
+
* readonly #events = inject(Events);
|
|
143
|
+
*
|
|
144
|
+
* constructor() {
|
|
145
|
+
* this.#events
|
|
146
|
+
* .on(increment)
|
|
147
|
+
* .pipe(takeUntilDestroyed())
|
|
148
|
+
* .subscribe(() => /* handle increment event *\/);
|
|
149
|
+
* }
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare class Events extends BaseEvents {
|
|
154
|
+
constructor();
|
|
155
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Events, never>;
|
|
156
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Events>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @description
|
|
160
|
+
*
|
|
161
|
+
* Globally provided service for listening to dispatched events.
|
|
162
|
+
* Receives events before the `Events` service and is primarily used for
|
|
163
|
+
* handling state transitions.
|
|
164
|
+
*/
|
|
165
|
+
declare class ReducerEvents extends BaseEvents {
|
|
166
|
+
constructor();
|
|
167
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReducerEvents, never>;
|
|
168
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ReducerEvents>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @description
|
|
173
|
+
*
|
|
174
|
+
* Globally provided service for dispatching events.
|
|
175
|
+
*
|
|
176
|
+
* @usageNotes
|
|
177
|
+
*
|
|
178
|
+
* ```ts
|
|
179
|
+
* import { Dispatcher, event } from '@ngrx/signals/events';
|
|
180
|
+
*
|
|
181
|
+
* const increment = event('[Counter Page] Increment');
|
|
182
|
+
*
|
|
183
|
+
* \@Component({ /* ... *\/ })
|
|
184
|
+
* class Counter {
|
|
185
|
+
* readonly #dispatcher = inject(Dispatcher);
|
|
186
|
+
*
|
|
187
|
+
* increment(): void {
|
|
188
|
+
* this.#dispatcher.dispatch(increment());
|
|
189
|
+
* }
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare class Dispatcher {
|
|
194
|
+
protected readonly reducerEvents: ReducerEvents;
|
|
195
|
+
protected readonly events: Events;
|
|
196
|
+
protected readonly parentDispatcher: Dispatcher | null;
|
|
197
|
+
dispatch(event: EventInstance<string, unknown>, config?: EventScopeConfig): void;
|
|
198
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Dispatcher, never>;
|
|
199
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Dispatcher>;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @description
|
|
203
|
+
*
|
|
204
|
+
* Provides scoped instances of Dispatcher and Events services.
|
|
205
|
+
* Enables event dispatching within a specific component or feature scope.
|
|
206
|
+
*
|
|
207
|
+
* @usageNotes
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* import { Dispatcher, event } from '@ngrx/signals/events';
|
|
211
|
+
*
|
|
212
|
+
* const increment = event('[Counter Page] Increment');
|
|
213
|
+
*
|
|
214
|
+
* \@Component({
|
|
215
|
+
* /* ... *\/
|
|
216
|
+
* providers: [provideDispatcher()],
|
|
217
|
+
* })
|
|
218
|
+
* class Counter {
|
|
219
|
+
* readonly #dispatcher = inject(Dispatcher);
|
|
220
|
+
*
|
|
221
|
+
* increment(): void {
|
|
222
|
+
* // Dispatching an event to the local Dispatcher.
|
|
223
|
+
* this.#dispatcher.dispatch(increment());
|
|
224
|
+
*
|
|
225
|
+
* // Dispatching an event to the parent Dispatcher.
|
|
226
|
+
* this.#dispatcher.dispatch(increment(), { scope: 'parent' });
|
|
227
|
+
*
|
|
228
|
+
* // Dispatching an event to the global Dispatcher.
|
|
229
|
+
* this.#dispatcher.dispatch(increment(), { scope: 'global' });
|
|
230
|
+
* }
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
declare function provideDispatcher(): Provider[];
|
|
235
|
+
|
|
236
|
+
type EventType<Source extends string, EventName extends string> = `[${Source}] ${EventName}`;
|
|
237
|
+
type EventCreatorGroup<Source extends string, Events extends Record<string, any>> = {
|
|
238
|
+
readonly [EventName in keyof Events]: EventName extends string ? EventCreator<EventType<Source, EventName>, Events[EventName]> : never;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* @description
|
|
242
|
+
*
|
|
243
|
+
* Creates a group of event creators.
|
|
244
|
+
*
|
|
245
|
+
* @usageNotes
|
|
246
|
+
*
|
|
247
|
+
* ```ts
|
|
248
|
+
* import { type } from '@ngrx/signals';
|
|
249
|
+
* import { eventGroup } from '@ngrx/signals/events';
|
|
250
|
+
*
|
|
251
|
+
* const counterPageEvents = eventGroup({
|
|
252
|
+
* source: 'Counter Page',
|
|
253
|
+
* events: {
|
|
254
|
+
* increment: type<void>(),
|
|
255
|
+
* decrement: type<void>(),
|
|
256
|
+
* set: type<number>(),
|
|
257
|
+
* },
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function eventGroup<Source extends string, Events extends Record<string, unknown>>(config: {
|
|
262
|
+
source: Source;
|
|
263
|
+
events: Events;
|
|
264
|
+
}): Prettify<EventCreatorGroup<Source, Events>>;
|
|
265
|
+
|
|
266
|
+
type SelfDispatchingEvents<EventGroup extends Record<string, EventCreator<string, any>>> = {
|
|
267
|
+
readonly [EventName in keyof EventGroup]: Parameters<EventGroup[EventName]> extends [infer Payload] ? (payload: Payload) => void : () => void;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* @description
|
|
271
|
+
*
|
|
272
|
+
* Creates self-dispatching events for a given event group.
|
|
273
|
+
*
|
|
274
|
+
* @usageNotes
|
|
275
|
+
*
|
|
276
|
+
* ```ts
|
|
277
|
+
* import { type } from '@ngrx/signals';
|
|
278
|
+
* import { eventGroup, injectDispatch } from '@ngrx/signals/events';
|
|
279
|
+
*
|
|
280
|
+
* const counterPageEvents = eventGroup({
|
|
281
|
+
* source: 'Counter Page',
|
|
282
|
+
* events: {
|
|
283
|
+
* increment: type<void>(),
|
|
284
|
+
* decrement: type<void>(),
|
|
285
|
+
* },
|
|
286
|
+
* });
|
|
287
|
+
*
|
|
288
|
+
* \@Component({ /* ... *\/ })
|
|
289
|
+
* class Counter {
|
|
290
|
+
* readonly dispatch = injectDispatch(counterPageEvents);
|
|
291
|
+
*
|
|
292
|
+
* increment(): void {
|
|
293
|
+
* this.dispatch.increment();
|
|
294
|
+
* }
|
|
295
|
+
*
|
|
296
|
+
* decrement(): void {
|
|
297
|
+
* this.dispatch.decrement();
|
|
298
|
+
* }
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
declare function injectDispatch<EventGroup extends Record<string, EventCreator<string, any>>>(events: EventGroup, config?: {
|
|
303
|
+
injector?: Injector;
|
|
304
|
+
}): ((config: EventScopeConfig) => Prettify<SelfDispatchingEvents<EventGroup>>) & Prettify<SelfDispatchingEvents<EventGroup>>;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @description
|
|
308
|
+
*
|
|
309
|
+
* SignalStore feature for defining event handlers.
|
|
310
|
+
*
|
|
311
|
+
* @usageNotes
|
|
312
|
+
*
|
|
313
|
+
* ```ts
|
|
314
|
+
* import { signalStore, withState } from '@ngrx/signals';
|
|
315
|
+
* import { event, Events, withEventHandlers } from '@ngrx/signals/events';
|
|
316
|
+
*
|
|
317
|
+
* const increment = event('[Counter Page] Increment');
|
|
318
|
+
* const decrement = event('[Counter Page] Decrement');
|
|
319
|
+
*
|
|
320
|
+
* const CounterStore = signalStore(
|
|
321
|
+
* withState({ count: 0 }),
|
|
322
|
+
* withEventHandlers(({ count }, events = inject(Events)) => ({
|
|
323
|
+
* logCount$: events.on(increment, decrement).pipe(
|
|
324
|
+
* tap(({ type }) => console.log(type, count())),
|
|
325
|
+
* ),
|
|
326
|
+
* })),
|
|
327
|
+
* );
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
declare function withEventHandlers<Input extends SignalStoreFeatureResult>(handlersFactory: (store: Prettify<StateSignals<Input['state']> & Input['props'] & Input['methods'] & WritableStateSource<Prettify<Input['state']>>>) => Record<string, Observable<unknown>> | Observable<unknown>[]): SignalStoreFeature<Input, EmptyFeatureResult>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @description
|
|
334
|
+
*
|
|
335
|
+
* SignalStore feature for defining state transitions based on dispatched events.
|
|
336
|
+
*
|
|
337
|
+
* @usageNotes
|
|
338
|
+
*
|
|
339
|
+
* ```ts
|
|
340
|
+
* import { signalStore, type, withState } from '@ngrx/signals';
|
|
341
|
+
* import { event, on, withReducer } from '@ngrx/signals/events';
|
|
342
|
+
*
|
|
343
|
+
* const set = event('[Counter Page] Set', type<number>());
|
|
344
|
+
*
|
|
345
|
+
* const CounterStore = signalStore(
|
|
346
|
+
* withState({ count: 0 }),
|
|
347
|
+
* withReducer(
|
|
348
|
+
* on(set, ({ payload }) => ({ count: payload })),
|
|
349
|
+
* ),
|
|
350
|
+
* );
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function withReducer<State extends object>(...caseReducers: CaseReducerResult<State, EventCreator<string, any>[]>[]): SignalStoreFeature<{
|
|
354
|
+
state: State;
|
|
355
|
+
props: {};
|
|
356
|
+
methods: {};
|
|
357
|
+
}, EmptyFeatureResult>;
|
|
358
|
+
|
|
359
|
+
export { Dispatcher, Events, ReducerEvents, event, eventGroup, injectDispatch, mapToScope, on, provideDispatcher, toScope, withEventHandlers, withReducer };
|
|
360
|
+
export type { EventCreator, EventInstance, EventScope, EventScopeConfig };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
type RxMethodRef = {
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
};
|
|
7
|
+
type RxMethod<Input> = ((input: Input | (() => Input) | Observable<Input>, config?: {
|
|
8
|
+
injector?: Injector;
|
|
9
|
+
}) => RxMethodRef) & RxMethodRef;
|
|
10
|
+
declare function rxMethod<Input>(generator: (source$: Observable<Input>) => Observable<unknown>, config?: {
|
|
11
|
+
injector?: Injector;
|
|
12
|
+
}): RxMethod<Input>;
|
|
13
|
+
|
|
14
|
+
export { rxMethod };
|
|
15
|
+
export type { RxMethod };
|