@equinor/fusion-framework-module-services 7.2.1 → 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.
Files changed (139) hide show
  1. package/CHANGELOG.md +24 -16
  2. package/README.md +125 -0
  3. package/dist/esm/bookmarks/api-version.js +3 -0
  4. package/dist/esm/bookmarks/api-version.js.map +1 -1
  5. package/dist/esm/bookmarks/index.js +13 -0
  6. package/dist/esm/bookmarks/index.js.map +1 -1
  7. package/dist/esm/bookmarks/schemas.js +10 -0
  8. package/dist/esm/bookmarks/schemas.js.map +1 -1
  9. package/dist/esm/bookmarks/types.js +5 -0
  10. package/dist/esm/bookmarks/types.js.map +1 -1
  11. package/dist/esm/configurator.js +7 -0
  12. package/dist/esm/configurator.js.map +1 -1
  13. package/dist/esm/context/client.js +32 -6
  14. package/dist/esm/context/client.js.map +1 -1
  15. package/dist/esm/context/get/client.js +9 -4
  16. package/dist/esm/context/get/client.js.map +1 -1
  17. package/dist/esm/context/index.js +13 -0
  18. package/dist/esm/context/index.js.map +1 -1
  19. package/dist/esm/context/query/client.js +9 -1
  20. package/dist/esm/context/query/client.js.map +1 -1
  21. package/dist/esm/context/related/client.js +9 -1
  22. package/dist/esm/context/related/client.js.map +1 -1
  23. package/dist/esm/context/static.js +3 -2
  24. package/dist/esm/context/static.js.map +1 -1
  25. package/dist/esm/errors.js +14 -0
  26. package/dist/esm/errors.js.map +1 -1
  27. package/dist/esm/index.js +14 -0
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/module.js +39 -7
  30. package/dist/esm/module.js.map +1 -1
  31. package/dist/esm/notification/client.js +56 -14
  32. package/dist/esm/notification/client.js.map +1 -1
  33. package/dist/esm/notification/index.js +14 -0
  34. package/dist/esm/notification/index.js.map +1 -1
  35. package/dist/esm/notification/static.js +3 -2
  36. package/dist/esm/notification/static.js.map +1 -1
  37. package/dist/esm/people/client.js +58 -5
  38. package/dist/esm/people/client.js.map +1 -1
  39. package/dist/esm/people/index.js +13 -0
  40. package/dist/esm/people/index.js.map +1 -1
  41. package/dist/esm/people/person-details/client.js +10 -4
  42. package/dist/esm/people/person-details/client.js.map +1 -1
  43. package/dist/esm/people/person-photo/client.js +10 -4
  44. package/dist/esm/people/person-photo/client.js.map +1 -1
  45. package/dist/esm/people/query/client.js +10 -4
  46. package/dist/esm/people/query/client.js.map +1 -1
  47. package/dist/esm/people/static.js +3 -0
  48. package/dist/esm/people/static.js.map +1 -1
  49. package/dist/esm/people/utils.js +19 -0
  50. package/dist/esm/people/utils.js.map +1 -1
  51. package/dist/esm/provider.js +37 -2
  52. package/dist/esm/provider.js.map +1 -1
  53. package/dist/esm/utils.js +2 -11
  54. package/dist/esm/utils.js.map +1 -1
  55. package/dist/esm/version.js +1 -1
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/dist/types/bookmarks/api-version.d.ts +3 -0
  58. package/dist/types/bookmarks/index.d.ts +13 -0
  59. package/dist/types/bookmarks/schemas.d.ts +10 -0
  60. package/dist/types/bookmarks/types.d.ts +17 -0
  61. package/dist/types/configurator.d.ts +15 -1
  62. package/dist/types/context/api-models.d.ts +16 -0
  63. package/dist/types/context/client.d.ts +32 -6
  64. package/dist/types/context/get/client.d.ts +9 -4
  65. package/dist/types/context/get/types.d.ts +27 -0
  66. package/dist/types/context/index.d.ts +13 -0
  67. package/dist/types/context/query/client.d.ts +9 -1
  68. package/dist/types/context/query/types.d.ts +35 -0
  69. package/dist/types/context/related/client.d.ts +9 -1
  70. package/dist/types/context/related/types.d.ts +36 -0
  71. package/dist/types/context/static.d.ts +3 -2
  72. package/dist/types/errors.d.ts +14 -0
  73. package/dist/types/index.d.ts +14 -0
  74. package/dist/types/module.d.ts +41 -6
  75. package/dist/types/notification/api-models.d.ts +20 -1
  76. package/dist/types/notification/client.d.ts +56 -14
  77. package/dist/types/notification/index.d.ts +14 -0
  78. package/dist/types/notification/static.d.ts +3 -2
  79. package/dist/types/people/api-models.d.ts +26 -0
  80. package/dist/types/people/api-models.v2.d.ts +1 -0
  81. package/dist/types/people/api-models.v4.d.ts +24 -0
  82. package/dist/types/people/client.d.ts +58 -5
  83. package/dist/types/people/index.d.ts +13 -0
  84. package/dist/types/people/person-details/client.d.ts +10 -4
  85. package/dist/types/people/person-details/types.d.ts +21 -0
  86. package/dist/types/people/person-photo/client.d.ts +10 -4
  87. package/dist/types/people/person-photo/types.d.ts +17 -0
  88. package/dist/types/people/query/client.d.ts +10 -4
  89. package/dist/types/people/query/types.d.ts +19 -0
  90. package/dist/types/people/resolve/types.d.ts +7 -0
  91. package/dist/types/people/static.d.ts +3 -0
  92. package/dist/types/people/suggest/types.d.ts +7 -0
  93. package/dist/types/people/utils.d.ts +19 -0
  94. package/dist/types/provider.d.ts +69 -4
  95. package/dist/types/types.d.ts +40 -15
  96. package/dist/types/utils.d.ts +2 -11
  97. package/dist/types/version.d.ts +1 -1
  98. package/package.json +9 -9
  99. package/src/bookmarks/api-version.ts +3 -0
  100. package/src/bookmarks/index.ts +14 -0
  101. package/src/bookmarks/schemas.ts +10 -0
  102. package/src/bookmarks/types.ts +18 -0
  103. package/src/configurator.ts +15 -1
  104. package/src/context/api-models.ts +16 -0
  105. package/src/context/client.ts +32 -6
  106. package/src/context/get/client.ts +9 -4
  107. package/src/context/get/types.ts +27 -0
  108. package/src/context/index.ts +14 -0
  109. package/src/context/query/client.ts +9 -1
  110. package/src/context/query/types.ts +35 -0
  111. package/src/context/related/client.ts +9 -1
  112. package/src/context/related/types.ts +36 -0
  113. package/src/context/static.ts +3 -2
  114. package/src/errors.ts +14 -0
  115. package/src/index.ts +15 -0
  116. package/src/module.ts +47 -7
  117. package/src/notification/api-models.ts +20 -1
  118. package/src/notification/client.ts +56 -14
  119. package/src/notification/index.ts +15 -0
  120. package/src/notification/static.ts +3 -2
  121. package/src/people/api-models.ts +26 -1
  122. package/src/people/api-models.v2.ts +1 -0
  123. package/src/people/api-models.v4.ts +24 -0
  124. package/src/people/client.ts +58 -5
  125. package/src/people/index.ts +14 -0
  126. package/src/people/person-details/client.ts +10 -4
  127. package/src/people/person-details/types.ts +21 -0
  128. package/src/people/person-photo/client.ts +10 -4
  129. package/src/people/person-photo/types.ts +17 -0
  130. package/src/people/query/client.ts +10 -4
  131. package/src/people/query/types.ts +19 -0
  132. package/src/people/resolve/types.ts +7 -0
  133. package/src/people/static.ts +3 -0
  134. package/src/people/suggest/types.ts +7 -0
  135. package/src/people/utils.ts +19 -0
  136. package/src/provider.ts +79 -8
  137. package/src/types.ts +40 -15
  138. package/src/utils.ts +2 -11
  139. package/src/version.ts +1 -1
@@ -1,8 +1,14 @@
1
1
  import { ApiConfigurator } from './configurator';
2
2
  import { ApiProvider } from './provider';
3
+ /** Module registration key used to identify the services module. */
3
4
  export const moduleKey = 'services';
4
5
  /**
5
- * Method to trying to resolve method for creating an IHttpClient
6
+ * Creates the default {@link ApiClientFactory} by attempting named HTTP clients
7
+ * first, then falling back to service-discovery.
8
+ *
9
+ * @param http - The HTTP client provider from the `http` module.
10
+ * @param serviceDiscovery - Optional service-discovery provider for automatic client resolution.
11
+ * @returns A factory function that creates named HTTP clients.
6
12
  */
7
13
  const createDefaultClient = (http, serviceDiscovery) => async (name) => {
8
14
  if (http.hasClient(name)) {
@@ -14,7 +20,11 @@ const createDefaultClient = (http, serviceDiscovery) => async (name) => {
14
20
  throw Error(`failed to create http client for service ${name}`);
15
21
  };
16
22
  /**
17
- * Configure http-client
23
+ * Services module definition.
24
+ *
25
+ * Registers the `'services'` module, wires up the {@link ApiConfigurator},
26
+ * and initializes the {@link ApiProvider} with an HTTP client factory
27
+ * resolved from the `http` and optional `serviceDiscovery` modules.
18
28
  */
19
29
  export const module = {
20
30
  name: moduleKey,
@@ -37,8 +47,18 @@ export const module = {
37
47
  },
38
48
  };
39
49
  /**
40
- * Method for enabling the Service module
41
- * @param config - configuration object
50
+ * Registers the services module with the framework configurator.
51
+ *
52
+ * Call this during app configuration to make the services module
53
+ * available at runtime.
54
+ *
55
+ * @param config - The framework modules configurator.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { enableServices } from '@equinor/fusion-framework-module-services';
60
+ * configurator.addConfig(enableServices);
61
+ * ```
42
62
  */
43
63
  export const enableServices = (
44
64
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -46,12 +66,24 @@ config) => {
46
66
  config.addConfig({ module });
47
67
  };
48
68
  /**
69
+ * Creates a module configuration object for the services module
70
+ * with a custom configuration callback.
71
+ *
72
+ * Use this when you need to customise the services module (for example,
73
+ * supplying a custom `createClient` factory).
74
+ *
75
+ * @param configure - Callback that receives the {@link IApiConfigurator} for customisation.
76
+ * @returns A module configurator object that can be passed to `addConfig`.
77
+ *
49
78
  * @example
50
79
  * ```ts
51
- * config.addConfig(x => x.createClient(...));
80
+ * import { configureServices } from '@equinor/fusion-framework-module-services';
81
+ * configurator.addConfig(
82
+ * configureServices((cfg) => {
83
+ * cfg.createClient = myCustomClientFactory;
84
+ * }),
85
+ * );
52
86
  * ```
53
- * @param configure - Callback for configuring the module
54
- * @returns Configuration object
55
87
  */
56
88
  export const configureServices = (configure) => {
57
89
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAWA,OAAO,EAAyB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAqB,WAAW,EAAE,MAAM,YAAY,CAAC;AAM5D,MAAM,CAAC,MAAM,SAAS,GAAsB,UAAU,CAAC;AASvD;;GAEG;AACH,MAAM,mBAAmB,GACvB,CAAC,IAAyB,EAAE,gBAA2C,EAAoB,EAAE,CAC7F,KAAK,EAAE,IAAY,EAAE,EAAE;IACrB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC,YAAY,CAAC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B,CAAC;YAE1B,MAAM,CAAC,YAAY,GAAG,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YACzB,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,WAAW,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAChE,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;AAC5B,8DAA8D;AAC9D,MAAsC,EAChC,EAAE;IACR,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAmD,EACd,EAAE;IACvC,OAAO;QACL,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAQF,eAAe,MAAM,CAAC"}
@@ -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
- * @see {@link getAll/client}
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 id
25
- * @see {@link getById/client}
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
- * Set notification seen by user
33
- * @see {@link setSeenByUser/client}
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
- * @see {@link create/client}
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
- * @see {@link delete/client}
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
- * Get users notification settings
57
- * @see {@link getSettings/client}
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
- * @see {@link updateSettings/client}
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;IASpB;IACA;IANZ,IAAI,OAAO;QACT,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,YACY,OAAgB,EAChB,OAAgB;QADhB,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAS;IACzB,CAAC;IAEJ;;;OAGG;IACI,MAAM,CAIX,OAAiB,EACjB,GAAG,IAAyE;QAE5E,MAAM,EAAE,GAAG,gBAAgB,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7F,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,OAAO,CAIZ,OAAiB,EACjB,GAA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,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7F,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAIX,OAAiB,EACjB,GAAG,IAAyE;QAE5E,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;IAED;;;;;;;OAOG;IACI,MAAM,CAIX,OAAiB,EACjB,GAAG,IAA2E;QAE9E,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
- /** index of api versions of context service */
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 atm */
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,+CAA+C;AAC/C,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,wBAAU,CAAA;IACV,qBAAqB;IACrB,wBAAU,CAAA;AACZ,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB"}
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 id
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
- * Query person service
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
- * Photo person service
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
- * Suggest person service
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 service
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,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,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxF,OAAO,EAAE,CAAU,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,KAAK,CAMV,OAAiB,EACjB,MAAe,EACf,IAAW,EACX,IAA0C;QAE1C,MAAM,EAAE,GAAG,iBAAiB,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxF,OAAO,EAAE,CAAU,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACI,OAAO,CAIZ,MAAe,EACf,IAA0C;QAE1C,MAAM,EAAE,GAAG,mBAAmB,CAAmB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvE,OAAO,EAAE,CAAU,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IACI,OAAO,CAIZ,MAAe,EACf,IAA0C;QAE1C,MAAM,EAAE,GAAG,mBAAmB,CAAmB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvE,OAAO,EAAE,CAAU,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
@@ -1,3 +1,16 @@
1
+ /**
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
- * Method for fetching context item from context service
4
- * @param client - client for execution of request
5
- * @param version - version of API to call
6
- * @param method - client method to call
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;;;;;GAKG;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
+ {"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
- * Method for fetching context item from context service
4
- * @param client - client for execution of request
5
- * @param version - version of API to call
6
- * @param method - client method to call
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;;;;;GAKG;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
+ {"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
- * Method for fetching context item from context service
4
- * @param client - client for execution of request
5
- * @param version - version of API to call
6
- * @param method - client method to call
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;;;;;GAKG;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
+ {"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,UAGX;AAHD,WAAY,UAAU;IACpB,wBAAU,CAAA;IACV,wBAAU,CAAA;AACZ,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}
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"}
@@ -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,2DAA2D;QAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,2BAA2B,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
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;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAoC,OAAU,EAAE,EAAE;IAC3E,6CAA6C;IAC7C,OAAO,CAAI,KAAQ,EAA+C,EAAE;QAClE,2DAA2D;QAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,2BAA2B,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -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
- // TODO move to own file
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
- // TODO move to own file
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) {
@@ -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,o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2
2
  /**
3
- * Extracts the correct API version from the provided `apiVersions` object based on the given `version` parameter.
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 using the provided Zod schema.
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