@equinor/fusion-framework-module-services 7.2.2-next.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -5
- package/README.md +125 -0
- package/dist/esm/bookmarks/api-version.js +3 -0
- package/dist/esm/bookmarks/api-version.js.map +1 -1
- package/dist/esm/bookmarks/index.js +13 -0
- package/dist/esm/bookmarks/index.js.map +1 -1
- package/dist/esm/bookmarks/schemas.js +10 -0
- package/dist/esm/bookmarks/schemas.js.map +1 -1
- package/dist/esm/bookmarks/types.js +5 -0
- package/dist/esm/bookmarks/types.js.map +1 -1
- package/dist/esm/configurator.js +7 -0
- package/dist/esm/configurator.js.map +1 -1
- package/dist/esm/context/client.js +32 -6
- package/dist/esm/context/client.js.map +1 -1
- package/dist/esm/context/get/client.js +9 -4
- package/dist/esm/context/get/client.js.map +1 -1
- package/dist/esm/context/index.js +13 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/query/client.js +9 -1
- package/dist/esm/context/query/client.js.map +1 -1
- package/dist/esm/context/related/client.js +9 -1
- package/dist/esm/context/related/client.js.map +1 -1
- package/dist/esm/context/static.js +3 -2
- package/dist/esm/context/static.js.map +1 -1
- package/dist/esm/errors.js +14 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/module.js +39 -7
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/notification/client.js +56 -14
- package/dist/esm/notification/client.js.map +1 -1
- package/dist/esm/notification/index.js +14 -0
- package/dist/esm/notification/index.js.map +1 -1
- package/dist/esm/notification/static.js +3 -2
- package/dist/esm/notification/static.js.map +1 -1
- package/dist/esm/people/client.js +58 -5
- package/dist/esm/people/client.js.map +1 -1
- package/dist/esm/people/index.js +13 -0
- package/dist/esm/people/index.js.map +1 -1
- package/dist/esm/people/person-details/client.js +10 -4
- package/dist/esm/people/person-details/client.js.map +1 -1
- package/dist/esm/people/person-photo/client.js +10 -4
- package/dist/esm/people/person-photo/client.js.map +1 -1
- package/dist/esm/people/query/client.js +10 -4
- package/dist/esm/people/query/client.js.map +1 -1
- package/dist/esm/people/static.js +3 -0
- package/dist/esm/people/static.js.map +1 -1
- package/dist/esm/people/utils.js +19 -0
- package/dist/esm/people/utils.js.map +1 -1
- package/dist/esm/provider.js +37 -2
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/utils.js +2 -11
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmarks/api-version.d.ts +3 -0
- package/dist/types/bookmarks/index.d.ts +13 -0
- package/dist/types/bookmarks/schemas.d.ts +10 -0
- package/dist/types/bookmarks/types.d.ts +17 -0
- package/dist/types/configurator.d.ts +15 -1
- package/dist/types/context/api-models.d.ts +16 -0
- package/dist/types/context/client.d.ts +32 -6
- package/dist/types/context/get/client.d.ts +9 -4
- package/dist/types/context/get/types.d.ts +27 -0
- package/dist/types/context/index.d.ts +13 -0
- package/dist/types/context/query/client.d.ts +9 -1
- package/dist/types/context/query/types.d.ts +35 -0
- package/dist/types/context/related/client.d.ts +9 -1
- package/dist/types/context/related/types.d.ts +36 -0
- package/dist/types/context/static.d.ts +3 -2
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/module.d.ts +41 -6
- package/dist/types/notification/api-models.d.ts +20 -1
- package/dist/types/notification/client.d.ts +56 -14
- package/dist/types/notification/index.d.ts +14 -0
- package/dist/types/notification/static.d.ts +3 -2
- package/dist/types/people/api-models.d.ts +26 -0
- package/dist/types/people/api-models.v2.d.ts +1 -0
- package/dist/types/people/api-models.v4.d.ts +24 -0
- package/dist/types/people/client.d.ts +58 -5
- package/dist/types/people/index.d.ts +13 -0
- package/dist/types/people/person-details/client.d.ts +10 -4
- package/dist/types/people/person-details/types.d.ts +21 -0
- package/dist/types/people/person-photo/client.d.ts +10 -4
- package/dist/types/people/person-photo/types.d.ts +17 -0
- package/dist/types/people/query/client.d.ts +10 -4
- package/dist/types/people/query/types.d.ts +19 -0
- package/dist/types/people/resolve/types.d.ts +7 -0
- package/dist/types/people/static.d.ts +3 -0
- package/dist/types/people/suggest/types.d.ts +7 -0
- package/dist/types/people/utils.d.ts +19 -0
- package/dist/types/provider.d.ts +69 -4
- package/dist/types/types.d.ts +40 -15
- package/dist/types/utils.d.ts +2 -11
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/bookmarks/api-version.ts +3 -0
- package/src/bookmarks/index.ts +14 -0
- package/src/bookmarks/schemas.ts +10 -0
- package/src/bookmarks/types.ts +18 -0
- package/src/configurator.ts +15 -1
- package/src/context/api-models.ts +16 -0
- package/src/context/client.ts +32 -6
- package/src/context/get/client.ts +9 -4
- package/src/context/get/types.ts +27 -0
- package/src/context/index.ts +14 -0
- package/src/context/query/client.ts +9 -1
- package/src/context/query/types.ts +35 -0
- package/src/context/related/client.ts +9 -1
- package/src/context/related/types.ts +36 -0
- package/src/context/static.ts +3 -2
- package/src/errors.ts +14 -0
- package/src/index.ts +15 -0
- package/src/module.ts +47 -7
- package/src/notification/api-models.ts +20 -1
- package/src/notification/client.ts +56 -14
- package/src/notification/index.ts +15 -0
- package/src/notification/static.ts +3 -2
- package/src/people/api-models.ts +26 -1
- package/src/people/api-models.v2.ts +1 -0
- package/src/people/api-models.v4.ts +24 -0
- package/src/people/client.ts +58 -5
- package/src/people/index.ts +14 -0
- package/src/people/person-details/client.ts +10 -4
- package/src/people/person-details/types.ts +21 -0
- package/src/people/person-photo/client.ts +10 -4
- package/src/people/person-photo/types.ts +17 -0
- package/src/people/query/client.ts +10 -4
- package/src/people/query/types.ts +19 -0
- package/src/people/resolve/types.ts +7 -0
- package/src/people/static.ts +3 -0
- package/src/people/suggest/types.ts +7 -0
- package/src/people/utils.ts +19 -0
- package/src/provider.ts +79 -8
- package/src/types.ts +40 -15
- package/src/utils.ts +2 -11
- package/src/version.ts +1 -1
|
@@ -2,67 +2,109 @@ import { createNotification, deleteNotification, getNotificationById, getNotific
|
|
|
2
2
|
import { ApiVersion } from './static';
|
|
3
3
|
import updateUserNotificationSettings from './settings/put';
|
|
4
4
|
import getUserNotificationSettings from './settings/get';
|
|
5
|
+
/**
|
|
6
|
+
* Typed API client for the Fusion notification service.
|
|
7
|
+
*
|
|
8
|
+
* Provides methods for notification CRUD operations, marking notifications
|
|
9
|
+
* as seen, and managing user notification settings.
|
|
10
|
+
*
|
|
11
|
+
* @template TMethod - The client execution method (`'json'` or `'json$'`).
|
|
12
|
+
* @template TClient - The underlying HTTP client type.
|
|
13
|
+
*/
|
|
5
14
|
export class NotificationApiClient {
|
|
6
15
|
_client;
|
|
7
16
|
_method;
|
|
17
|
+
/** Returns the {@link ApiVersion} enum for version-constant access. */
|
|
8
18
|
get Version() {
|
|
9
19
|
return ApiVersion;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @param _client - The HTTP client used to execute requests.
|
|
23
|
+
* @param _method - The execution method (`'json'` or `'json$'`).
|
|
24
|
+
*/
|
|
11
25
|
constructor(_client, _method) {
|
|
12
26
|
this._client = _client;
|
|
13
27
|
this._method = _method;
|
|
14
28
|
}
|
|
15
29
|
/**
|
|
16
|
-
* Fetch all notifications
|
|
17
|
-
*
|
|
30
|
+
* Fetch all notifications for the current user.
|
|
31
|
+
*
|
|
32
|
+
* @template TVersion - The API version key.
|
|
33
|
+
* @template TResult - The expected response type.
|
|
34
|
+
* @param version - API version to use.
|
|
35
|
+
* @returns All notifications matching the query.
|
|
18
36
|
*/
|
|
19
37
|
getAll(version, ...args) {
|
|
20
38
|
const fn = getNotifications(this._client, version, this._method);
|
|
21
39
|
return fn(...args);
|
|
22
40
|
}
|
|
23
41
|
/**
|
|
24
|
-
* Fetch notification by
|
|
25
|
-
*
|
|
42
|
+
* Fetch a single notification by its identifier.
|
|
43
|
+
*
|
|
44
|
+
* @template TVersion - The API version key.
|
|
45
|
+
* @template TResult - The expected response type.
|
|
46
|
+
* @param version - API version to use.
|
|
47
|
+
* @returns The notification with the specified ID.
|
|
26
48
|
*/
|
|
27
49
|
getById(version, ...args) {
|
|
28
50
|
const fn = getNotificationById(this._client, version, this._method);
|
|
29
51
|
return fn(...args);
|
|
30
52
|
}
|
|
31
53
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
54
|
+
* Mark a notification as seen by the current user.
|
|
55
|
+
*
|
|
56
|
+
* @template TVersion - The API version key.
|
|
57
|
+
* @template TResult - The expected response type.
|
|
58
|
+
* @param version - API version to use.
|
|
59
|
+
* @returns The updated notification.
|
|
34
60
|
*/
|
|
35
61
|
setSeenByUser(version, ...args) {
|
|
36
62
|
const fn = updateSeenByUser(this._client, version, this._method);
|
|
37
63
|
return fn(...args);
|
|
38
64
|
}
|
|
39
65
|
/**
|
|
40
|
-
* Create a notification
|
|
41
|
-
*
|
|
66
|
+
* Create a new notification.
|
|
67
|
+
*
|
|
68
|
+
* @template TVersion - The API version key.
|
|
69
|
+
* @template TResult - The expected response type.
|
|
70
|
+
* @param version - API version to use.
|
|
71
|
+
* @returns The created notification.
|
|
42
72
|
*/
|
|
43
73
|
create(version, ...args) {
|
|
44
74
|
const fn = createNotification(this._client, version, this._method);
|
|
45
75
|
return fn(...args);
|
|
46
76
|
}
|
|
47
77
|
/**
|
|
48
|
-
* Delete a notification
|
|
49
|
-
*
|
|
78
|
+
* Delete a notification by its identifier.
|
|
79
|
+
*
|
|
80
|
+
* @template TVersion - The API version key.
|
|
81
|
+
* @template TResult - The expected response type.
|
|
82
|
+
* @param version - API version to use.
|
|
83
|
+
* @returns The deletion result.
|
|
50
84
|
*/
|
|
51
85
|
delete(version, ...args) {
|
|
52
86
|
const fn = deleteNotification(this._client, version, this._method);
|
|
53
87
|
return fn(...args);
|
|
54
88
|
}
|
|
55
89
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
90
|
+
* Retrieve the current user's notification settings.
|
|
91
|
+
*
|
|
92
|
+
* @template TVersion - The API version key.
|
|
93
|
+
* @template TResult - The expected response type.
|
|
94
|
+
* @param version - API version to use.
|
|
95
|
+
* @returns The user's notification settings.
|
|
58
96
|
*/
|
|
59
97
|
getSettings(version, ...args) {
|
|
60
98
|
const fn = getUserNotificationSettings(this._client, version, this._method);
|
|
61
99
|
return fn(...args);
|
|
62
100
|
}
|
|
63
101
|
/**
|
|
64
|
-
* Update user notification settings
|
|
65
|
-
*
|
|
102
|
+
* Update the current user's notification settings.
|
|
103
|
+
*
|
|
104
|
+
* @template TVersion - The API version key.
|
|
105
|
+
* @template TResult - The expected response type.
|
|
106
|
+
* @param version - API version to use.
|
|
107
|
+
* @returns The updated notification settings.
|
|
66
108
|
*/
|
|
67
109
|
updateSettings(version, ...args) {
|
|
68
110
|
const fn = updateUserNotificationSettings(this._client, version, this._method);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/notification/client.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,OAAO,8BAGN,MAAM,gBAAgB,CAAC;AACxB,OAAO,2BAGN,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,qBAAqB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/notification/client.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,OAAO,8BAGN,MAAM,gBAAgB,CAAC;AACxB,OAAO,2BAGN,MAAM,gBAAgB,CAAC;A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E9E,MAAM,EAAE,GAAG,kBAAkB,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/F,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD;;;;;;;OAOG;IACI,WAAW,CAIhB,OAAiB,EACjB,GAAG,IAAoF;QAEvF,MAAM,EAAE,GAAG,2BAA2B,CACpC,IAAI,CAAC,OAAO,EACZ,OAAO,EACP,IAAI,CAAC,OAAO,CACb,CAAC;QACF,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD;;;;;;;OAOG;IACI,cAAc,CAInB,OAAiB,EACjB,GAAG,IAAoF;QAEvF,MAAM,EAAE,GAAG,8BAA8B,CACvC,IAAI,CAAC,OAAO,EACZ,OAAO,EACP,IAAI,CAAC,OAAO,CACb,CAAC;QACF,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Notification API client and types.
|
|
5
|
+
*
|
|
6
|
+
* Provides {@link NotificationApiClient} for creating, fetching, deleting
|
|
7
|
+
* notifications, marking them as seen, and managing user notification
|
|
8
|
+
* settings, with versioned endpoints (`v1`, `v2`).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { NotificationApiClient } from '@equinor/fusion-framework-module-services/notification';
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
export { NotificationApiClient, default } from './client';
|
|
2
16
|
export { ApiVersion } from './static';
|
|
3
17
|
export * from './api-models';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notification/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Supported API versions for the notification service. */
|
|
2
2
|
export var ApiVersion;
|
|
3
3
|
(function (ApiVersion) {
|
|
4
|
+
/** Notification API version 1.0. */
|
|
4
5
|
ApiVersion["v1"] = "1.0";
|
|
5
|
-
/** not in use
|
|
6
|
+
/** Notification API version 2.0 (not currently in use). */
|
|
6
7
|
ApiVersion["v2"] = "2.0";
|
|
7
8
|
})(ApiVersion || (ApiVersion = {}));
|
|
8
9
|
//# sourceMappingURL=static.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/notification/static.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/notification/static.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,oCAAoC;IACpC,wBAAU,CAAA;IACV,2DAA2D;IAC3D,wBAAU,CAAA;AACZ,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB"}
|
|
@@ -4,44 +4,97 @@ import { client as personQueryClient, } from './query';
|
|
|
4
4
|
import { client as personPhotoClient, } from './person-photo';
|
|
5
5
|
import { client as personSuggestClient, } from './suggest';
|
|
6
6
|
import { client as personResolveClient, } from './resolve';
|
|
7
|
+
/**
|
|
8
|
+
* Typed API client for the Fusion people service.
|
|
9
|
+
*
|
|
10
|
+
* Provides methods for fetching person details, querying persons,
|
|
11
|
+
* retrieving profile photos, getting suggestions, and resolving
|
|
12
|
+
* person identifiers.
|
|
13
|
+
*
|
|
14
|
+
* @template TClient - The underlying HTTP client type.
|
|
15
|
+
*/
|
|
7
16
|
export class PeopleApiClient {
|
|
8
17
|
_client;
|
|
18
|
+
/** Returns the {@link ApiVersion} enum for version-constant access. */
|
|
9
19
|
get Version() {
|
|
10
20
|
return ApiVersion;
|
|
11
21
|
}
|
|
22
|
+
/** @param _client - The HTTP client used to execute people requests. */
|
|
12
23
|
constructor(_client) {
|
|
13
24
|
this._client = _client;
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
|
-
* Fetch person by
|
|
27
|
+
* Fetch detailed information about a person by their Azure unique ID.
|
|
28
|
+
*
|
|
29
|
+
* @template TVersion - The API version key (e.g. `'v4'`).
|
|
30
|
+
* @template TArgs - Request argument type.
|
|
31
|
+
* @template TResult - Expected response type.
|
|
32
|
+
* @template TMethod - Client execution method (`'json'` or `'json$'`).
|
|
33
|
+
* @param version - API version to use.
|
|
34
|
+
* @param method - Client execution method.
|
|
35
|
+
* @param args - Request arguments including `azureId`.
|
|
36
|
+
* @param init - Optional request init overrides.
|
|
37
|
+
* @returns The person details.
|
|
17
38
|
*/
|
|
18
39
|
get(version, method, args, init) {
|
|
19
40
|
const fn = personDetailClient(this._client, version, method);
|
|
20
41
|
return fn(args, init);
|
|
21
42
|
}
|
|
22
43
|
/**
|
|
23
|
-
*
|
|
44
|
+
* Search for persons matching query criteria.
|
|
45
|
+
*
|
|
46
|
+
* @template TVersion - The API version key (e.g. `'v2'`).
|
|
47
|
+
* @template TArgs - Request argument type.
|
|
48
|
+
* @template TResult - Expected response type.
|
|
49
|
+
* @template TMethod - Client execution method.
|
|
50
|
+
* @param version - API version to use.
|
|
51
|
+
* @param method - Client execution method.
|
|
52
|
+
* @param args - Request arguments including `search` string.
|
|
53
|
+
* @param init - Optional request init overrides.
|
|
54
|
+
* @returns An array of matching person entities.
|
|
24
55
|
*/
|
|
25
56
|
query(version, method, args, init) {
|
|
26
57
|
const fn = personQueryClient(this._client, version, method);
|
|
27
58
|
return fn(args, init);
|
|
28
59
|
}
|
|
29
60
|
/**
|
|
30
|
-
*
|
|
61
|
+
* Fetch a person's profile photo as binary blob data.
|
|
62
|
+
*
|
|
63
|
+
* @template TVersion - The API version key (e.g. `'v2'`).
|
|
64
|
+
* @template TArgs - Request argument type.
|
|
65
|
+
* @template TResult - Expected response type.
|
|
66
|
+
* @template TMethod - Client execution method (`'blob'` or `'blob$'`).
|
|
67
|
+
* @param version - API version to use.
|
|
68
|
+
* @param method - Client execution method.
|
|
69
|
+
* @param args - Request arguments including `azureId`.
|
|
70
|
+
* @param init - Optional request init overrides.
|
|
71
|
+
* @returns The person's photo as a blob.
|
|
31
72
|
*/
|
|
32
73
|
photo(version, method, args, init) {
|
|
33
74
|
const fn = personPhotoClient(this._client, version, method);
|
|
34
75
|
return fn(args, init);
|
|
35
76
|
}
|
|
36
77
|
/**
|
|
37
|
-
*
|
|
78
|
+
* Fetch person suggestions (type-ahead / autocomplete).
|
|
79
|
+
*
|
|
80
|
+
* @template TResult - Expected response type.
|
|
81
|
+
* @template TMethod - Client execution method.
|
|
82
|
+
* @param method - Client execution method.
|
|
83
|
+
* @param init - Optional request init overrides.
|
|
84
|
+
* @returns Paginated suggestion results.
|
|
38
85
|
*/
|
|
39
86
|
suggest(method, init) {
|
|
40
87
|
const fn = personSuggestClient(this._client, method);
|
|
41
88
|
return fn(init);
|
|
42
89
|
}
|
|
43
90
|
/**
|
|
44
|
-
* Resolve person
|
|
91
|
+
* Resolve person identifiers to account information.
|
|
92
|
+
*
|
|
93
|
+
* @template TResult - Expected response type.
|
|
94
|
+
* @template TMethod - Client execution method.
|
|
95
|
+
* @param method - Client execution method.
|
|
96
|
+
* @param init - Optional request init overrides.
|
|
97
|
+
* @returns Array of resolved person results.
|
|
45
98
|
*/
|
|
46
99
|
resolve(method, init) {
|
|
47
100
|
const fn = personResolveClient(this._client, method);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/people/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,MAAM,IAAI,kBAAkB,GAK7B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,MAAM,IAAI,iBAAiB,GAK5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,MAAM,IAAI,iBAAiB,GAK5B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,MAAM,IAAI,mBAAmB,GAG9B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,MAAM,IAAI,mBAAmB,GAG9B,MAAM,WAAW,CAAC;AAEnB,MAAM,OAAO,eAAe;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/people/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,MAAM,IAAI,kBAAkB,GAK7B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,MAAM,IAAI,iBAAiB,GAK5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,MAAM,IAAI,iBAAiB,GAK5B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,MAAM,IAAI,mBAAmB,GAG9B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,MAAM,IAAI,mBAAmB,GAG9B,MAAM,WAAW,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IAUJ;IANtB,uEAAuE;IACvE,IAAI,OAAO;QACT,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,wEAAwE;IACxE,YAAsB,OAAgB;QAAhB,YAAO,GAAP,OAAO,C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/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* People API client and types.
|
|
5
|
+
*
|
|
6
|
+
* Provides {@link PeopleApiClient} for person lookups, search, photo retrieval,
|
|
7
|
+
* suggestions, and identifier resolution, with versioned endpoints (`v2`, `v4`).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { PeopleApiClient } from '@equinor/fusion-framework-module-services/people';
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export { PeopleApiClient, default } from './client';
|
|
2
15
|
export { ApiVersion } from './static';
|
|
3
16
|
export * from './api-models';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/people/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/people/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,cAAc,cAAc,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
3
|
+
* Creates a curried function that fetches detailed person information.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - Supported API version (e.g. `'v4'`).
|
|
6
|
+
* @template TMethod - Client execution method (`'json'` or `'json$'`).
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @template TArgs - Request argument type.
|
|
9
|
+
* @param client - HTTP client used to execute the request.
|
|
10
|
+
* @param version - API version to call.
|
|
11
|
+
* @param method - Client method to use (defaults to `'json'`).
|
|
12
|
+
* @returns A function that accepts person detail args and returns the result.
|
|
7
13
|
*/
|
|
8
14
|
export const client = (client, version, method = 'json') => (args, init) => client[method](...generateParameters(version, args, init));
|
|
9
15
|
export default client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/person-details/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/person-details/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,CAME,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAAW,EACX,IAAoC,EACI,EAAE,CAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAK9E,CAAC;AAEN,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
3
|
+
* Creates a curried function that fetches a person's profile photo.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - Supported API version (e.g. `'v2'`).
|
|
6
|
+
* @template TMethod - Client execution method (`'blob'` or `'blob$'`).
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @template TArgs - Request argument type.
|
|
9
|
+
* @param client - HTTP client used to execute the request.
|
|
10
|
+
* @param version - API version to call.
|
|
11
|
+
* @param method - Client method to use (defaults to `'blob'`).
|
|
12
|
+
* @returns A function that accepts photo args and returns blob data.
|
|
7
13
|
*/
|
|
8
14
|
export const client = (client, version, method = 'blob') => (args, init) => {
|
|
9
15
|
return client[method](...generateParameters(version, args, init));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/person-photo/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/person-photo/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,CAME,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAAW,EACX,IAAoC,EACN,EAAE;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC,CACnB,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CACjC,CAAC;AACpC,CAAC,CAAC;AAEJ,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
3
|
+
* Creates a curried function that queries the people service.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - Supported API version (e.g. `'v2'`).
|
|
6
|
+
* @template TMethod - Client execution method.
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @template TArgs - Request argument type.
|
|
9
|
+
* @param client - HTTP client used to execute the request.
|
|
10
|
+
* @param version - API version to call.
|
|
11
|
+
* @param method - Client method to use (defaults to `'json'`).
|
|
12
|
+
* @returns A function that accepts query args and returns person results.
|
|
7
13
|
*/
|
|
8
14
|
export const client = (client, version, method = 'json') => (args, init) => client[method](...generateParameters(version, args, init));
|
|
9
15
|
export default client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/query/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/people/query/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,CAME,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAAW,EACX,IAAoC,EACH,EAAE,CACnC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAI9E,CAAC;AAEN,eAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/** Supported API versions for the people service. */
|
|
1
2
|
export var ApiVersion;
|
|
2
3
|
(function (ApiVersion) {
|
|
4
|
+
/** People API version 2.0. */
|
|
3
5
|
ApiVersion["v2"] = "2.0";
|
|
6
|
+
/** People API version 4.0. */
|
|
4
7
|
ApiVersion["v4"] = "4.0";
|
|
5
8
|
})(ApiVersion || (ApiVersion = {}));
|
|
6
9
|
//# sourceMappingURL=static.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/people/static.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/people/static.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,8BAA8B;IAC9B,wBAAU,CAAA;IACV,8BAA8B;IAC9B,wBAAU,CAAA;AACZ,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB"}
|
package/dist/esm/people/utils.js
CHANGED
|
@@ -10,6 +10,25 @@ const requiredApiPersonAttributes = {
|
|
|
10
10
|
'azureUniqueId',
|
|
11
11
|
],
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Creates a type-guard function that validates whether a value conforms
|
|
15
|
+
* to the {@link ApiPerson} shape for a given API version.
|
|
16
|
+
*
|
|
17
|
+
* The guard checks that the value contains all required attributes
|
|
18
|
+
* defined for the specified version.
|
|
19
|
+
*
|
|
20
|
+
* @template V - API version key (e.g. `'v2'` or `'v4'`).
|
|
21
|
+
* @param version - The API version to validate against.
|
|
22
|
+
* @returns A type-guard function that narrows `T` to `ApiPerson<V>`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const isV4Person = isApiPerson('v4');
|
|
27
|
+
* if (isV4Person(data)) {
|
|
28
|
+
* console.log(data.azureUniqueId);
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
13
32
|
export const isApiPerson = (version) => {
|
|
14
33
|
/** todo add options for more strict check */
|
|
15
34
|
return (value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/people/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,4EAA4E;AAE5E,MAAM,2BAA2B,GAAG;IAClC,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;QACf,eAAe;QACf,kEAAkE;KAC5B;IACxC,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;QACf,kEAAkE;QAClE,eAAe;KACuB;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAoC,OAAU,EAAE,EAAE;IAC3E,6CAA6C;IAC7C,OAAO,CAAI,KAAQ,EAA+C,EAAE;QAClE,2D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AAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/esm/provider.js
CHANGED
|
@@ -4,16 +4,41 @@ import { ContextApiClient } from './context';
|
|
|
4
4
|
import BookmarksApiClient from './bookmarks/client';
|
|
5
5
|
import { NotificationApiClient } from './notification';
|
|
6
6
|
import { PeopleApiClient } from './people/client';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when an API response indicates a non-OK HTTP status.
|
|
9
|
+
*
|
|
10
|
+
* Contains the full {@link ApiProviderErrorResponse} (status, headers, body)
|
|
11
|
+
* so callers can inspect the failure details.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* try {
|
|
16
|
+
* await provider.createNotificationClient('json');
|
|
17
|
+
* } catch (err) {
|
|
18
|
+
* if (err instanceof ApiProviderError) {
|
|
19
|
+
* console.error(err.response.status, err.response.data);
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
8
24
|
export class ApiProviderError extends Error {
|
|
25
|
+
/** Structured HTTP response data associated with this error. */
|
|
9
26
|
response;
|
|
27
|
+
/**
|
|
28
|
+
* @param msg - Human-readable error message.
|
|
29
|
+
* @param response - The parsed HTTP response details.
|
|
30
|
+
* @param options - Standard `ErrorOptions` (e.g. `cause`).
|
|
31
|
+
*/
|
|
10
32
|
constructor(msg, response, options) {
|
|
11
33
|
super(msg, options);
|
|
12
34
|
this.response = response;
|
|
13
35
|
this.name = 'ApiProviderError';
|
|
14
36
|
}
|
|
15
37
|
}
|
|
16
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Validates that an HTTP response has an OK status.
|
|
40
|
+
* Throws an {@link ApiProviderError} with parsed body data when the response is not OK.
|
|
41
|
+
*/
|
|
17
42
|
const validateResponse = async (response) => {
|
|
18
43
|
if (!response.ok) {
|
|
19
44
|
const { headers, status, statusText, type, url, bodyUsed } = response;
|
|
@@ -29,6 +54,16 @@ const validateResponse = async (response) => {
|
|
|
29
54
|
});
|
|
30
55
|
}
|
|
31
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Default implementation of {@link IApiProvider}.
|
|
59
|
+
*
|
|
60
|
+
* Manages the lifecycle of domain-specific API clients (bookmarks, context,
|
|
61
|
+
* notification, people) by resolving named HTTP clients through the
|
|
62
|
+
* configured {@link ApiClientFactory} and attaching response-validation
|
|
63
|
+
* middleware.
|
|
64
|
+
*
|
|
65
|
+
* @template TClient - The underlying HTTP client type.
|
|
66
|
+
*/
|
|
32
67
|
export class ApiProvider extends BaseModuleProvider {
|
|
33
68
|
_createClientFn;
|
|
34
69
|
constructor(config) {
|
package/dist/esm/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAK/E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,kBAAkB,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAK/E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,kBAAkB,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,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AEM,KAAK,CAAC,wBAAwB,CACnC,MAAe;QAEf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QAC9D,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;QACzE,OAAO,IAAI,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,MAAe;QAEf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAC3D,sDAAsD;QACtD,uEAAuE;QACvE,4EAA4E;QAC5E,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,MAAe;QAEf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACzD,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;QACzE,OAAO,IAAI,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IACM,KAAK,CAAC,kBAAkB;QAC7B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACxD,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;QACzE,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { jsonSelector, } from '@equinor/fusion-framework-module-http/selectors';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param apiVersions - An object mapping API version strings to their corresponding versions.
|
|
6
|
-
* @param version - The version string to extract.
|
|
7
|
-
* @returns The extracted API version, or throws an error if the version is not supported.
|
|
8
|
-
*/
|
|
3
|
+
* Resolves an API version string from a named key or raw version value.\n *\n * Looks up `version` as a key in `apiVersions` first; if not found,\n * searches the object values for a direct match. Throws when neither\n * lookup succeeds.\n *\n * @template TApiVersions - Record mapping version names to version strings.\n * @template TAllowedApiVersion - Allowed version constraint.\n * @template TVersion - The version string provided by the caller.\n * @param apiVersions - Map of version names to version strings.\n * @param version - Version key or raw version string to resolve.\n * @returns The resolved API version string.\n * @throws {Error} When the version is not found in `apiVersions`.\n *\n * @example\n * ```ts\n * enum ApiVersions { v1 = '1.0', v2 = '2.0' }\n * extractVersion(ApiVersions, 'v1'); // '1.0'\n * extractVersion(ApiVersions, '1.0'); // '1.0'\n * ```\n */
|
|
9
4
|
export const extractVersion = (apiVersions, version) => {
|
|
10
5
|
if (version in apiVersions) {
|
|
11
6
|
return apiVersions[version];
|
|
@@ -17,10 +12,6 @@ export const extractVersion = (apiVersions, version) => {
|
|
|
17
12
|
return extractedVersion;
|
|
18
13
|
};
|
|
19
14
|
/**
|
|
20
|
-
* Creates a response selector that parses the response body
|
|
21
|
-
*
|
|
22
|
-
* @param schema - The Zod schema to use for parsing the response body.
|
|
23
|
-
* @returns A response selector function that parses the response body using the provided schema.
|
|
24
|
-
*/
|
|
15
|
+
* Creates a response selector that parses the HTTP response body with a Zod schema.\n *\n * Combines the built-in `jsonSelector` with Zod validation, ensuring the\n * response body matches the expected shape at runtime.\n *\n * @template Output - The validated output type produced by the schema.\n * @param schema - The Zod schema used to parse and validate the response body.\n * @returns A `ResponseSelector` that extracts JSON and runs it through `schema.parse`.\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * const UserSchema = z.object({ id: z.string(), name: z.string() });\n * const selector = schemaSelector(UserSchema);\n * ```\n */
|
|
25
16
|
export const schemaSelector = (schema) => async (response) => schema.parse(await jsonSelector(response));
|
|
26
17
|
//# sourceMappingURL=utils.js.map
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,YAAY,GACb,MAAM,iDAAiD,CAAC;AAIzD
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,YAAY,GACb,MAAM,iDAAiD,CAAC;AAIzD;m3BACm3B;AACn3B,MAAM,CAAC,MAAM,cAAc,GAAG,CAK5B,WAAyB,EACzB,OAAiB,EAC8C,EAAE;IACjE,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;QAC3B,OAAO,WAAW,CAAC,OAAO,CAAkE,CAAC;IAC/F,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;IAC/E,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,mBAAmB,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,gBAAiF,CAAC;AAC3F,CAAC,CAAC;AAEF;gpBACgpB;AAChpB,MAAM,CAAC,MAAM,cAAc,GACzB,CAAS,MAA2B,EAA4B,EAAE,CAClE,KAAK,EAAE,QAAgC,EAAE,EAAE,CACzC,MAAM,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|