@equinor/fusion-framework-react-components-people-provider 2.0.2 → 2.0.4
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/CHANGELOG.md +22 -0
- package/dist/esm/{PeopleResolver.js → PeopleResolverComponent.js} +11 -1
- package/dist/esm/PeopleResolverComponent.js.map +1 -0
- package/dist/esm/PeopleResolverProvider.js +13 -1
- package/dist/esm/PeopleResolverProvider.js.map +1 -1
- package/dist/esm/PersonController.js +146 -36
- package/dist/esm/PersonController.js.map +1 -1
- package/dist/esm/create-resolver.js +22 -10
- package/dist/esm/create-resolver.js.map +1 -1
- package/dist/esm/{makeResolver.js → make-resolver.js} +2 -2
- package/dist/esm/make-resolver.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/PeopleResolverComponent.d.ts +22 -0
- package/dist/types/PeopleResolverProvider.d.ts +12 -1
- package/dist/types/PersonController.d.ts +98 -1
- package/dist/types/{makeResolver.d.ts → make-resolver.d.ts} +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -10
- package/src/{PeopleResolver.tsx → PeopleResolverComponent.tsx} +12 -3
- package/src/PeopleResolverProvider.tsx +13 -1
- package/src/PersonController.ts +154 -38
- package/src/create-resolver.ts +22 -13
- package/src/{makeResolver.tsx → make-resolver.tsx} +1 -1
- package/src/version.ts +1 -1
- package/dist/esm/PeopleResolver.js.map +0 -1
- package/dist/esm/makeResolver.js.map +0 -1
- package/dist/types/PeopleResolver.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @equinor/fusion-framework-react-components-people-provider
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 80c3e4a: Internal: resolve `fusion-lint` `no-todo-without-issue` warning by referencing tracking issue #5088.
|
|
8
|
+
- 80c3e4a: Internal: align source filenames with their exports (`PeopleResolver.tsx` → `PeopleResolverComponent.tsx`, `makeResolver.tsx` → `make-resolver.tsx`) while preserving existing public entrypoints; no public API changes.
|
|
9
|
+
- 80c3e4a: Internal: add intent comments to `.pipe()` operator chains in `PersonController.ts` and `create-resolver.ts`, replacing several non-functional placeholder comments with meaningful ones, to satisfy the `require-intent-comment/rxjs` lint rule. No functional change.
|
|
10
|
+
- 80c3e4a: Internal: add missing TSDoc comments to `PeopleResolverComponent`, `PeopleResolverProvider`, and to the `PersonController` class, its constructor, and its public/protected methods, to satisfy the `require-tsdoc`/`require-component-tsdoc` lint rules. No functional change.
|
|
11
|
+
- 80c3e4a: Internal: add intent comments to control-flow statements and iterator calls in `PeopleResolver.tsx`, `PeopleResolverProvider.tsx`, and `create-resolver.ts` to satisfy the `require-intent-comment/flow` and `require-intent-comment/iterators` lint rules. No functional change.
|
|
12
|
+
- 80c3e4a: Internal: added intent comments to control-flow and RxJS iterator constructs
|
|
13
|
+
in `PersonController.ts`, satisfying the `require-intent-comment` lint rule.
|
|
14
|
+
No behavior change.
|
|
15
|
+
- 80c3e4a: Internal: add missing intent comments for `as`/`as unknown as` type assertions and inline separate re-exports at their definition site, per `fusion-lint`'s `require-intent-comment/type-assertion` and `no-separate-export` rules. No behavior changes.
|
|
16
|
+
|
|
17
|
+
## 2.0.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 033f11d: Update the dev portal and people provider packages to use the latest person components.
|
|
22
|
+
- Update the dev portal and people provider packages to use `@equinor/fusion-wc-person` 3.5.5.
|
|
23
|
+
- Pull in the latest person component fixes without changing either package API.
|
|
24
|
+
|
|
3
25
|
## 2.0.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -6,15 +6,25 @@ PersonAvatarElement;
|
|
|
6
6
|
PersonCardElement;
|
|
7
7
|
PersonListItemElement;
|
|
8
8
|
PersonSelectElement;
|
|
9
|
+
/**
|
|
10
|
+
* Wraps the `fwc-person-provider` web component, wiring the given `PersonResolver` into it
|
|
11
|
+
* once the underlying custom element is ready.
|
|
12
|
+
*
|
|
13
|
+
* @param props - Component props
|
|
14
|
+
* @param props.resolver - The resolver used to fetch person data, photos, and search results
|
|
15
|
+
* @param props.children - Elements rendered inside the person provider, typically person-related components
|
|
16
|
+
* @returns The rendered `fwc-person-provider` element wrapping the given children
|
|
17
|
+
*/
|
|
9
18
|
export const PeopleResolverComponent = (props) => {
|
|
10
19
|
const { resolver, children } = props;
|
|
11
20
|
const ref = useRef(null);
|
|
12
21
|
// when the element is ready, set the resolver
|
|
13
22
|
useEffect(() => {
|
|
23
|
+
// Only assign the resolver once the custom element ref has mounted
|
|
14
24
|
if (ref.current && resolver) {
|
|
15
25
|
ref.current.resolver = resolver;
|
|
16
26
|
}
|
|
17
27
|
}, [resolver]);
|
|
18
28
|
return _jsx("fwc-person-provider", { ref: ref, children: children });
|
|
19
29
|
};
|
|
20
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=PeopleResolverComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeopleResolverComponent.js","sourceRoot":"","sources":["../../src/PeopleResolverComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0B,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EAEjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAcnC,qBAAqB,CAAC;AACtB,mBAAmB,CAAC;AACpB,iBAAiB,CAAC;AAClB,qBAAqB,CAAC;AACtB,mBAAmB,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAsD,EAAE,EAAE;IAChG,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAC;IAEvD,8CAA8C;IAC9C,SAAS,CAAC,GAAG,EAAE;QACb,mEAAmE;QACnE,IAAI,GAAG,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC5B,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAClC,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,8BAAqB,GAAG,EAAE,GAAG,YAAG,QAAQ,GAAuB,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, useMemo } from 'react';
|
|
3
3
|
import { useModule } from '@equinor/fusion-framework-react-module';
|
|
4
|
-
import { makeResolver } from './
|
|
4
|
+
import { makeResolver } from './make-resolver';
|
|
5
|
+
/**
|
|
6
|
+
* Provides person resolution to its children by wiring up a `PersonResolver` built from the
|
|
7
|
+
* framework's `services` module.
|
|
8
|
+
*
|
|
9
|
+
* @param props - Component props
|
|
10
|
+
* @param props.children - Elements that will have access to the person resolver
|
|
11
|
+
* @param props.options - Optional controller options, such as a fallback image for missing photos
|
|
12
|
+
* @param props.fallback - Optional fallback rendered while the resolver component is suspended
|
|
13
|
+
* @returns The rendered people resolver provider wrapping the given children
|
|
14
|
+
* @throws Error if the `services` module has not been registered on the framework
|
|
15
|
+
*/
|
|
5
16
|
export const PeopleResolverProvider = (props) => {
|
|
6
17
|
const { children, options, fallback } = props;
|
|
7
18
|
const services = useModule('services');
|
|
19
|
+
// Fail fast when the services module has not been registered on the framework
|
|
8
20
|
if (!services) {
|
|
9
21
|
throw Error('missing service module');
|
|
10
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeopleResolverProvider.js","sourceRoot":"","sources":["../../src/PeopleResolverProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0C,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PeopleResolverProvider.js","sourceRoot":"","sources":["../../src/PeopleResolverProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0C,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC3E,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,QAAQ,GAAG,SAAS,CAAiB,UAAU,CAAC,CAAC;IACvD,8EAA8E;IAC9E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACtF,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAI,IAAI,YAClC,KAAC,SAAS,cAAE,QAAQ,GAAa,GACxB,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { Query } from '@equinor/fusion-query';
|
|
|
5
5
|
import { queryValue } from '@equinor/fusion-query/operators';
|
|
6
6
|
const personMatcher = (args) => (value) => {
|
|
7
7
|
const { azureId, upn } = args;
|
|
8
|
+
// Both identifiers must match when both are supplied to avoid a false-positive match
|
|
8
9
|
if (azureId && upn) {
|
|
9
10
|
return (value.upn?.toLocaleLowerCase() === upn.toLocaleLowerCase() &&
|
|
10
11
|
value.azureUniqueId === azureId);
|
|
@@ -17,12 +18,21 @@ const personMatcher = (args) => (value) => {
|
|
|
17
18
|
}
|
|
18
19
|
return false;
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Default implementation of {@link IPersonController}, backed by a {@link PeopleApiClient} and
|
|
23
|
+
* a set of {@link Query} caches for people, searches, photos, suggestions, and resolves.
|
|
24
|
+
*/
|
|
20
25
|
export class PersonController {
|
|
21
26
|
#personQuery;
|
|
22
27
|
#personSearchQuery;
|
|
23
28
|
#personPhotoQuery;
|
|
24
29
|
#personSuggestQuery;
|
|
25
30
|
#personResolveQuery;
|
|
31
|
+
/**
|
|
32
|
+
* @param client - The people API client used to fetch person data, photos, and search results
|
|
33
|
+
* @param options - Optional controller options, such as a fallback image for missing photos
|
|
34
|
+
* @throws Error if the photo request fails for a reason other than a fallback-eligible 404
|
|
35
|
+
*/
|
|
26
36
|
constructor(client, options) {
|
|
27
37
|
const expire = 3 * 60 * 1000;
|
|
28
38
|
this.#personQuery = new Query({
|
|
@@ -31,13 +41,16 @@ export class PersonController {
|
|
|
31
41
|
key: ({ azureId }) => azureId,
|
|
32
42
|
client: {
|
|
33
43
|
fn: ({ azureId }, signal) => {
|
|
44
|
+
// Filter out expired positions from the fetched person's result before returning it
|
|
34
45
|
return client
|
|
35
46
|
.get('v4', 'json$', { azureId, expand: ['manager', 'positions'] }, { signal })
|
|
36
47
|
.pipe(map((result) => {
|
|
37
48
|
const { positions = [] } = result;
|
|
49
|
+
// Drop positions that have already expired so stale data isn't shown
|
|
50
|
+
const activePositions = positions.filter((x) => new Date(x.appliesTo) > new Date());
|
|
38
51
|
return {
|
|
39
52
|
...result,
|
|
40
|
-
positions:
|
|
53
|
+
positions: activePositions,
|
|
41
54
|
};
|
|
42
55
|
}));
|
|
43
56
|
},
|
|
@@ -59,9 +72,11 @@ export class PersonController {
|
|
|
59
72
|
key: ({ azureId }) => azureId,
|
|
60
73
|
client: {
|
|
61
74
|
fn: ({ azureId }, signal) => {
|
|
75
|
+
// Extract the blob from the response, falling back to a placeholder image on 404
|
|
62
76
|
return client.photo('v2', 'blob$', { azureId }, { signal }).pipe(map((result) => {
|
|
63
77
|
return result.blob;
|
|
64
78
|
}), catchError((err) => {
|
|
79
|
+
// Fall back to a placeholder image when the person genuinely has no photo
|
|
65
80
|
if (err.name === 'ApiProviderError' &&
|
|
66
81
|
err.response?.status === 404 &&
|
|
67
82
|
options?.fallbackImage) {
|
|
@@ -79,6 +94,7 @@ export class PersonController {
|
|
|
79
94
|
client: {
|
|
80
95
|
fn: ({ search, systemAccounts }, signal) => {
|
|
81
96
|
const types = ['Person'];
|
|
97
|
+
// System accounts are opt-in since they're excluded from suggestions by default
|
|
82
98
|
if (systemAccounts) {
|
|
83
99
|
types.push('SystemAccount');
|
|
84
100
|
}
|
|
@@ -109,25 +125,49 @@ export class PersonController {
|
|
|
109
125
|
* Suggest persons matching the given search string.
|
|
110
126
|
* Search string can be a part of display name, mail, upn or the full azureId.
|
|
111
127
|
* If systemAccounts is true, it will also include system accounts in the result.
|
|
128
|
+
*
|
|
129
|
+
* @param args - The search string, whether to include system accounts, and an optional abort signal
|
|
130
|
+
* @returns An observable emitting the matching suggestions
|
|
112
131
|
*/
|
|
113
132
|
suggest(args) {
|
|
114
133
|
const { search, systemAccounts, signal } = args;
|
|
134
|
+
// Unwrap the query result to just its value
|
|
115
135
|
return this.#personSuggestQuery.query({ search, systemAccounts }, { signal }).pipe(queryValue);
|
|
116
136
|
}
|
|
117
137
|
/**
|
|
118
138
|
* Resolve person details for given identifiers, which can be a mix of azureIds and upns.
|
|
139
|
+
*
|
|
140
|
+
* @param args - The identifiers to resolve and an optional abort signal
|
|
141
|
+
* @returns An observable emitting the resolved person details
|
|
119
142
|
*/
|
|
120
143
|
resolve(args) {
|
|
121
144
|
const { resolveIds, signal } = args;
|
|
145
|
+
// Unwrap the query result to just its value
|
|
122
146
|
return this.#personResolveQuery.query({ resolveIds }, { signal }).pipe(queryValue);
|
|
123
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Search for persons matching the given search string.
|
|
150
|
+
*
|
|
151
|
+
* @param args - The search string and an optional abort signal
|
|
152
|
+
* @returns An observable emitting the search results
|
|
153
|
+
*/
|
|
124
154
|
search(args) {
|
|
125
155
|
const { search, signal } = args;
|
|
156
|
+
// Unwrap the query result to just its value
|
|
126
157
|
return this.#personSearchQuery.query({ search }, { signal }).pipe(queryValue);
|
|
127
158
|
}
|
|
128
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Fetch the photo of a person, resolving by azureId when available, falling back to upn.
|
|
161
|
+
*
|
|
162
|
+
* TODO(#5088): why does this need to have data?!?
|
|
163
|
+
*
|
|
164
|
+
* @param args - A matcher (azureId and/or upn) plus an optional abort signal
|
|
165
|
+
* @returns An observable emitting the object URL of the person's photo
|
|
166
|
+
* @throws Error if neither azureId nor upn is provided
|
|
167
|
+
*/
|
|
129
168
|
getPhoto(args) {
|
|
130
169
|
const { azureId, upn, signal } = args;
|
|
170
|
+
// Prefer resolving by azureId when available, falling back to upn
|
|
131
171
|
if (azureId) {
|
|
132
172
|
return this._getPersonPhotoByAzureId(azureId, signal);
|
|
133
173
|
}
|
|
@@ -136,8 +176,16 @@ export class PersonController {
|
|
|
136
176
|
}
|
|
137
177
|
throw Error('invalid args provided');
|
|
138
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Fetch full person details, resolving by azureId when available, falling back to upn.
|
|
181
|
+
*
|
|
182
|
+
* @param args - A matcher (azureId and/or upn) plus an optional abort signal
|
|
183
|
+
* @returns An observable emitting the person details
|
|
184
|
+
* @throws Error if neither azureId nor upn is provided
|
|
185
|
+
*/
|
|
139
186
|
getPerson(args) {
|
|
140
187
|
const { azureId, upn, signal } = args;
|
|
188
|
+
// Prefer resolving by azureId when available, falling back to upn
|
|
141
189
|
if (azureId) {
|
|
142
190
|
return this._getPersonByAzureId(azureId, signal);
|
|
143
191
|
}
|
|
@@ -146,8 +194,16 @@ export class PersonController {
|
|
|
146
194
|
}
|
|
147
195
|
throw Error('invalid args provided');
|
|
148
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Fetch v2 person info, resolving by azureId when available, falling back to upn.
|
|
199
|
+
*
|
|
200
|
+
* @param args - A matcher (azureId and/or upn) plus an optional abort signal
|
|
201
|
+
* @returns An observable emitting the v2 person info
|
|
202
|
+
* @throws Error if neither azureId nor upn is provided
|
|
203
|
+
*/
|
|
149
204
|
getPersonInfo(args) {
|
|
150
205
|
const { azureId, upn, signal } = args;
|
|
206
|
+
// Prefer resolving by azureId when available, falling back to upn
|
|
151
207
|
if (azureId) {
|
|
152
208
|
return this._getPersonInfoById(azureId, signal);
|
|
153
209
|
}
|
|
@@ -156,63 +212,117 @@ export class PersonController {
|
|
|
156
212
|
}
|
|
157
213
|
throw Error('invalid args provided');
|
|
158
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve a full v4 person by upn, via cache and live lookup.
|
|
217
|
+
*
|
|
218
|
+
* @param upn - The person's upn
|
|
219
|
+
* @param signal - Optional abort signal
|
|
220
|
+
* @returns An observable emitting the resolved v4 person
|
|
221
|
+
*/
|
|
159
222
|
_getPersonByUpn(upn, signal) {
|
|
160
223
|
const abort$ = signal ? fromEvent(signal, 'abort') : EMPTY;
|
|
161
|
-
|
|
224
|
+
// Resolve the v2 person info by upn, then use its azureId to fetch the full v4 person
|
|
225
|
+
const personByAzureId$ = this._getPersonInfoByUpn(upn, signal).pipe(filter(isApiPerson('v2')), switchMap(({ azureUniqueId: azureId }) => {
|
|
162
226
|
return this._getPersonByAzureId(azureId, signal);
|
|
163
|
-
}))
|
|
164
|
-
|
|
165
|
-
filter(isApiPerson('v4')), takeUntil(abort$));
|
|
227
|
+
}));
|
|
228
|
+
// Emit from cache first, then fall back to the live lookup, stopping once a v4 person arrives
|
|
229
|
+
return concat(this._personCache$({ upn }), personByAzureId$).pipe(filter(isApiPerson('v4')), takeUntil(abort$));
|
|
166
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Fetch a full v4 person by azureId.
|
|
233
|
+
*
|
|
234
|
+
* @param azureId - The person's azureId
|
|
235
|
+
* @param signal - Optional abort signal
|
|
236
|
+
* @returns An observable emitting the fetched v4 person
|
|
237
|
+
*/
|
|
167
238
|
_getPersonByAzureId(azureId, signal) {
|
|
239
|
+
// Unwrap the query result to just its value
|
|
168
240
|
return this.#personQuery.query({ azureId }, { signal }).pipe(queryValue);
|
|
169
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Resolve v2 person info by azureId, via cache and live lookup.
|
|
244
|
+
*
|
|
245
|
+
* @param azureId - The person's azureId
|
|
246
|
+
* @param signal - Optional abort signal
|
|
247
|
+
* @returns An observable emitting the resolved v2 person info
|
|
248
|
+
*/
|
|
170
249
|
_getPersonInfoById(azureId, signal) {
|
|
171
250
|
const abort$ = signal ? fromEvent(signal, 'abort') : EMPTY;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this._personCache$({ azureId }), this._queryCache$({ azureId }), this._getPersonByAzureId(azureId, signal)).pipe(
|
|
175
|
-
/** */
|
|
176
|
-
filter(isApiPerson('v2')), takeUntil(abort$));
|
|
251
|
+
// Emit from caches first, then fall back to a live lookup, keeping only v2 persons
|
|
252
|
+
return concat(this._personCache$({ azureId }), this._queryCache$({ azureId }), this._getPersonByAzureId(azureId, signal)).pipe(filter(isApiPerson('v2')), takeUntil(abort$));
|
|
177
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Resolve v2 person info by upn, via cache and search-based lookup.
|
|
256
|
+
*
|
|
257
|
+
* @param upn - The person's upn
|
|
258
|
+
* @param signal - Optional abort signal
|
|
259
|
+
* @returns An observable emitting the resolved v2 person info
|
|
260
|
+
*/
|
|
178
261
|
_getPersonInfoByUpn(upn, signal) {
|
|
179
262
|
const matcher = personMatcher({ upn });
|
|
180
263
|
const abort$ = signal ? fromEvent(signal, 'abort') : EMPTY;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
264
|
+
// Search by upn, then narrow the results down to the single matching entry, if any
|
|
265
|
+
const searchMatch$ = this.#personSearchQuery.query({ search: upn }, { signal }).pipe(map((x) => {
|
|
266
|
+
// Narrow the search results down to the one entry matching this upn/azureId
|
|
267
|
+
const match = x.value.find(matcher);
|
|
268
|
+
return match;
|
|
269
|
+
}), find(isApiPerson('v2')));
|
|
270
|
+
// Emit from caches first, then fall back to the search-based lookup, keeping only v2 persons
|
|
271
|
+
return concat(this._personCache$({ upn }), this._queryCache$({ upn }), searchMatch$).pipe(find(isApiPerson('v2')), filter(isApiPerson('v2')), takeUntil(abort$));
|
|
186
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Fetch a person's photo by azureId as an object URL.
|
|
275
|
+
*
|
|
276
|
+
* @param azureId - The person's azureId
|
|
277
|
+
* @param signal - Optional abort signal
|
|
278
|
+
* @returns An observable emitting the photo's object URL
|
|
279
|
+
*/
|
|
187
280
|
_getPersonPhotoByAzureId(azureId, signal) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
take(1), map((result) => URL.createObjectURL(result.value)));
|
|
281
|
+
// Take just the first emission and convert the blob result to an object URL
|
|
282
|
+
return this.#personPhotoQuery.query({ azureId }, { signal }).pipe(take(1), map((result) => URL.createObjectURL(result.value)));
|
|
191
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Fetch a person's photo by upn, resolving their azureId first.
|
|
286
|
+
*
|
|
287
|
+
* @param upn - The person's upn
|
|
288
|
+
* @param signal - Optional abort signal
|
|
289
|
+
* @returns An observable emitting the photo's object URL
|
|
290
|
+
*/
|
|
192
291
|
_getPersonPhotoByUpn(upn, signal) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
take(1), switchMap((x) => this._getPersonPhotoByAzureId(x.azureUniqueId, signal)));
|
|
292
|
+
// Take just the first emission, then fetch the photo using its resolved azureId
|
|
293
|
+
return this._getPersonInfoByUpn(upn, signal).pipe(take(1), switchMap((x) => this._getPersonPhotoByAzureId(x.azureUniqueId, signal)));
|
|
196
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Search the person-query cache for a matching v4 person.
|
|
297
|
+
*
|
|
298
|
+
* @param args - A matcher (azureId and/or upn) used to find the cached entry
|
|
299
|
+
* @returns An observable emitting the matching cached v4 person, if any
|
|
300
|
+
*/
|
|
197
301
|
_personCache$(args) {
|
|
198
302
|
const mather = personMatcher(args);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
303
|
+
// Search the person-query cache for the first matching v4 entry
|
|
304
|
+
return this.#personQuery.cache.state$.pipe(take(1), map((x) => {
|
|
305
|
+
// Search each cached query result entry for the one matching this person
|
|
306
|
+
const match = Object.values(x).find((x) => mather(x.value));
|
|
307
|
+
return match?.value;
|
|
308
|
+
}), find(isApiPerson('v4')), filter(isApiPerson('v4')));
|
|
204
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Search the search-query cache for a matching v2 person.
|
|
312
|
+
*
|
|
313
|
+
* @param args - A matcher (azureId and/or upn) used to find the cached entry
|
|
314
|
+
* @returns An observable emitting the matching cached v2 person, if any
|
|
315
|
+
*/
|
|
205
316
|
_queryCache$(args) {
|
|
206
317
|
const mather = personMatcher(args);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
find(isApiPerson('v2')));
|
|
318
|
+
// Search the search-query cache for the first matching v2 entry
|
|
319
|
+
return this.#personSearchQuery.cache.state$.pipe(take(1), switchMap((entry) => {
|
|
320
|
+
// Expand the cache entry's records and find the one matching this person
|
|
321
|
+
return from(Object.values(entry)).pipe(map((x) => {
|
|
322
|
+
// Search each cached entry's results for the one matching this person
|
|
323
|
+
const match = x.value.find((x) => mather(x));
|
|
324
|
+
return match;
|
|
325
|
+
}), find(isApiPerson('v2')));
|
|
216
326
|
}), find(isApiPerson('v2')), filter(isApiPerson('v2')));
|
|
217
327
|
}
|
|
218
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonController.js","sourceRoot":"","sources":["../../src/PersonController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AAKrF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAiB7D,MAAM,aAAa,GACjB,CAAC,IAAiB,EAAE,EAAE,CACtB,CAAqD,KAAQ,EAAc,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,OAAO,CACL,KAAK,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,GAAG,CAAC,iBAAiB,EAAE;YAC1D,KAAK,CAAC,aAAa,KAAK,OAAO,CAChC,CAAC;IACJ,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC,aAAa,KAAK,OAAO,CAAC;IACzC,CAAC;SAAM,IAAI,GAAG,EAAE,CAAC;QACf,OAAO,KAAK,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAiBJ,MAAM,OAAO,gBAAgB;IAC3B,YAAY,CAA4D;IACxE,kBAAkB,CAA8D;IAChF,iBAAiB,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S,CAAC,CAAC,KAAK,EAAE,EAAE;YAClB,yEAAyE;YACzE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACR,sEAAsE;gBACtE,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,EACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CACxB,CAAC;QACJ,CAAC,CAAC,EACF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EACvB,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAC1B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import { firstValueFrom, map } from 'rxjs';
|
|
2
2
|
export const createResolver = (controller) => ({
|
|
3
3
|
getDetails(args) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// Remap the controller result to the public PersonDetails shape
|
|
5
|
+
return firstValueFrom(controller.getPerson(args).pipe(map((x) => {
|
|
6
|
+
// Controller result uses azureUniqueId; remap to azureId and cast to the public PersonDetails shape.
|
|
7
|
+
return { ...x, azureId: x.azureUniqueId };
|
|
8
|
+
})));
|
|
7
9
|
},
|
|
8
10
|
getInfo(args) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// Remap the controller result to the public PersonInfo shape
|
|
12
|
+
return firstValueFrom(controller.getPersonInfo(args).pipe(map((x) => {
|
|
13
|
+
// Controller result uses azureUniqueId; remap to azureId and cast to the public PersonInfo shape.
|
|
14
|
+
return { ...x, azureId: x.azureUniqueId };
|
|
15
|
+
})));
|
|
12
16
|
},
|
|
13
17
|
getPhoto(args) {
|
|
14
18
|
return firstValueFrom(controller.getPhoto(args));
|
|
15
19
|
},
|
|
16
20
|
search(args) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
azureId
|
|
20
|
-
|
|
21
|
+
// Remap each result's azureUniqueId to azureId and cast to the public PersonInfo shape.
|
|
22
|
+
return firstValueFrom(controller.search(args).pipe(map((x) => {
|
|
23
|
+
// Remap each result's azureUniqueId to azureId and cast to the public PersonInfo shape.
|
|
24
|
+
const mapped = x.map((x) => {
|
|
25
|
+
// Controller result uses azureUniqueId; remap to azureId and cast to the public PersonInfo shape.
|
|
26
|
+
return {
|
|
27
|
+
...x,
|
|
28
|
+
azureId: x.azureUniqueId,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return mapped;
|
|
32
|
+
})));
|
|
21
33
|
},
|
|
22
34
|
suggest(args) {
|
|
23
35
|
return firstValueFrom(controller.suggest(args));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-resolver.js","sourceRoot":"","sources":["../../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAK3C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAA6B,EAAkB,EAAE,CAAC,CAAC;IAChF,UAAU,CAAC,IAAI;QACb,OAAO,cAAc,CACnB,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"create-resolver.js","sourceRoot":"","sources":["../../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAK3C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAA6B,EAAkB,EAAE,CAAC,CAAC;IAChF,UAAU,CAAC,IAAI;QACb,gEAAgE;QAChE,OAAO,cAAc,CACnB,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,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 -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { lazy } from 'react';
|
|
3
|
-
import { PeopleResolverComponent } from './
|
|
3
|
+
import { PeopleResolverComponent } from './PeopleResolverComponent';
|
|
4
4
|
import { PersonController } from './PersonController';
|
|
5
5
|
import { createResolver } from './create-resolver';
|
|
6
6
|
export const makeResolver = (services, options) => {
|
|
@@ -14,4 +14,4 @@ export const makeResolver = (services, options) => {
|
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=make-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-resolver.js","sourceRoot":"","sources":["../../src/make-resolver.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAgC,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAsB,EAAE,OAAiC,EAAE,EAAE;IACxF,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QACnD,MAAM,UAAU,GAAG,IAAI,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAA2C,EAAE,EAAE,CAAC,CAC3E,KAAC,uBAAuB,IAAC,QAAQ,EAAE,QAAQ,YAAG,QAAQ,GAA2B,CAClF,CAAC;QACF,OAAO;YACL,OAAO,EAAE,SAAS;SACnB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/esm/version.js
CHANGED