@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,4 +1,7 @@
1
+ /** Supported API versions for the bookmarks service. */
1
2
  export declare enum ApiVersion {
3
+ /** Bookmarks API version 1.0. */
2
4
  v1 = "1.0",
5
+ /** Bookmarks API version 2.0. */
3
6
  v2 = "2.0"
4
7
  }
@@ -1,3 +1,16 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Bookmarks API client and types.
5
+ *
6
+ * Provides {@link BookmarksApiClient} for CRUD operations on bookmarks
7
+ * and favourite management, with versioned endpoints (`v1`, `v2`).
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { BookmarksApiClient } from '@equinor/fusion-framework-module-services/bookmarks';
12
+ * ```
13
+ */
1
14
  export { BookmarksApiClient, default } from './client';
2
15
  export { ApiVersion } from './api-version';
3
16
  export * from './schemas';
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
+ /** Zod schema that parses an ISO-8601 datetime string into a `Date` object. */
2
3
  export declare const ApiDateSchema: z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>;
4
+ /** Zod schema for a person reference in a bookmark response. */
3
5
  export declare const ApiPersonSchema: {
4
6
  "1.0": z.ZodObject<{
5
7
  azureUniqueId: z.ZodString;
@@ -21,6 +23,7 @@ export declare const ApiPersonSchema: {
21
23
  }>>>;
22
24
  }, z.core.$strip>;
23
25
  };
26
+ /** Zod schema for the source system of a bookmark. */
24
27
  export declare const ApiSourceSystem: {
25
28
  "1.0": z.ZodObject<{
26
29
  identifier: z.ZodString;
@@ -28,6 +31,7 @@ export declare const ApiSourceSystem: {
28
31
  subSystem: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
32
  }, z.core.$strip>;
30
33
  };
34
+ /** Zod schema for a Fusion context reference attached to a bookmark. */
31
35
  export declare const ApiFusionContext: {
32
36
  "1.0": z.ZodObject<{
33
37
  id: z.ZodString;
@@ -156,6 +160,12 @@ export declare const ApiBookmarkSchema: {
156
160
  }, z.core.$strip>>>;
157
161
  }, z.core.$strip>;
158
162
  };
163
+ /**
164
+ * Zod schema for the bookmark payload.
165
+ *
166
+ * Accepts a record of key-value pairs, a JSON string, or `undefined`.
167
+ * JSON strings are automatically parsed into objects.
168
+ */
159
169
  export declare const ApiBookmarkPayload: {
160
170
  readonly "1.0": z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString]>>>, z.ZodTransform<any, string | Record<string, unknown>>>;
161
171
  };
@@ -1,5 +1,22 @@
1
+ /**
2
+ * Re-exported shared types scoped for the bookmarks service.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  import type { FilterAllowedApiVersions as FilterAllowApiVersionsBase, ExtractApiVersion as ExtractApiVersionBase } from '../types';
2
7
  import type { ApiVersion } from './api-version';
3
8
  export { ClientMethodType, ClientMethod, ApiClientArguments } from '../types';
9
+ /**
10
+ * Union of allowed version keys and values for the bookmarks API.
11
+ *
12
+ * @template TAllowed - Subset of `ApiVersion` keys to include.
13
+ */
4
14
  export type FilterAllowedApiVersions<TAllowed extends string = keyof typeof ApiVersion> = FilterAllowApiVersionsBase<typeof ApiVersion, TAllowed>;
15
+ /**
16
+ * Extracts the concrete version string from a key-or-value version identifier
17
+ * for the bookmarks API.
18
+ *
19
+ * @template TVersion - The version string to resolve.
20
+ * @template TAllowed - Constraint on allowed versions.
21
+ */
5
22
  export type ExtractApiVersion<TVersion extends string, TAllowed extends string = FilterAllowedApiVersions> = ExtractApiVersionBase<typeof ApiVersion, TVersion, TAllowed>;
@@ -1,7 +1,21 @@
1
1
  import type { ApiClientFactory } from './types';
2
+ /**
3
+ * Configuration interface for the services module.
4
+ *
5
+ * Consumers can set `createClient` to override how HTTP clients are resolved
6
+ * for each backend service. When left `undefined`, the module automatically
7
+ * resolves clients through the HTTP module and service-discovery module.
8
+ */
2
9
  export interface IApiConfigurator {
3
- /** Method for creating IHttpClients */
10
+ /** Optional factory for creating named HTTP clients. */
4
11
  createClient?: ApiClientFactory;
5
12
  }
13
+ /**
14
+ * Default configurator for the services module.
15
+ *
16
+ * Implements {@link IApiConfigurator} with an initially empty configuration.
17
+ * The module initialization step populates `createClient` if it was not
18
+ * provided during configuration.
19
+ */
6
20
  export declare class ApiConfigurator implements IApiConfigurator {
7
21
  }
@@ -1,4 +1,5 @@
1
1
  import { ApiVersion } from './static';
2
+ /** Context entity returned by the v1 context API. */
2
3
  type ApiContextEntity_v1 = {
3
4
  id: string;
4
5
  externalId: string | null;
@@ -11,22 +12,37 @@ type ApiContextEntity_v1 = {
11
12
  created: string;
12
13
  updated: string | null;
13
14
  };
15
+ /** Placeholder for the v2 context entity (not yet defined). */
14
16
  type ApiContextEntity_v2 = unknown;
15
17
  type ApiContextEntityTypes = {
16
18
  [ApiVersion.v1]: ApiContextEntity_v1;
17
19
  [ApiVersion.v2]: ApiContextEntity_v2;
18
20
  };
21
+ /**
22
+ * Version-aware context entity type.
23
+ *
24
+ * Resolves to the concrete entity shape for a given {@link ApiVersion}.
25
+ *
26
+ * @template T - An `ApiVersion` member (e.g. `ApiVersion.v1`).
27
+ */
19
28
  export type ApiContextEntity<T extends string = ApiVersion> = T extends ApiVersion ? ApiContextEntityTypes[T] : unknown;
20
29
  /** === types === */
30
+ /** Context type metadata returned by the v1 context API. */
21
31
  type ApiContextType_v1 = {
22
32
  id: string;
23
33
  isChildType: boolean;
24
34
  parentTypeIds: string[] | null;
25
35
  };
36
+ /** Placeholder for the v2 context type (not yet defined). */
26
37
  type ApiContextType_v2 = unknown;
27
38
  type ApiContextTypeTypes = {
28
39
  [ApiVersion.v1]: ApiContextType_v1;
29
40
  [ApiVersion.v2]: ApiContextType_v2;
30
41
  };
42
+ /**
43
+ * Version-aware context type metadata.
44
+ *
45
+ * @template T - An `ApiVersion` member.
46
+ */
31
47
  export type ApiContextType<T extends ApiVersion> = ApiContextTypeTypes[T];
32
48
  export {};
@@ -4,24 +4,50 @@ import { ApiVersion } from './static';
4
4
  import { type GetContextFn, type GetContextResponse, type GetContextResult } from './get';
5
5
  import { type QueryContextFn, type QueryContextResponse, type QueryContextResult } from './query';
6
6
  import { type RelatedContextFn, type RelatedContextResponse, type RelatedContextResult } from './related';
7
+ /**
8
+ * Typed API client for the Fusion context service.
9
+ *
10
+ * Delegates to versioned endpoint implementations for fetching a single context,
11
+ * querying contexts by search criteria, and listing related contexts.
12
+ *
13
+ * @template TMethod - The client execution method (`'json'` or `'json$'`).
14
+ * @template TClient - The underlying HTTP client type.
15
+ */
7
16
  export declare class ContextApiClient<TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TClient extends IHttpClient = IHttpClient> {
8
17
  protected _client: TClient;
9
18
  protected _method: TMethod;
19
+ /** Returns the {@link ApiVersion} enum for version-constant access. */
10
20
  get Version(): typeof ApiVersion;
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: TClient, _method: TMethod);
12
26
  /**
13
- * Fetch context by id
14
- * @see {@link get/client}
27
+ * Fetch a single context entity by its identifier.
28
+ *
29
+ * @template TVersion - The API version key (e.g. `'v1'`).
30
+ * @template TResult - The expected response type.
31
+ * @param version - API version to use.
32
+ * @returns The context entity matching the provided arguments.
15
33
  */
16
34
  get<TVersion extends string = keyof typeof ApiVersion, TResult = GetContextResponse<TVersion>>(version: TVersion, ...args: Parameters<GetContextFn<TVersion, TMethod, TClient, TResult>>): GetContextResult<TVersion, TMethod, TResult>;
17
35
  /**
18
- * Query context service
19
- * @see {@link query/client}
36
+ * Query the context service with search criteria.
37
+ *
38
+ * @template TVersion - The API version key (e.g. `'v1'`).
39
+ * @template TResult - The expected response type.
40
+ * @param version - API version to use.
41
+ * @returns An array of context entities matching the query.
20
42
  */
21
43
  query<TVersion extends string = keyof typeof ApiVersion, TResult = QueryContextResponse<TVersion>>(version: TVersion, ...args: Parameters<QueryContextFn<TVersion, TMethod, TClient, TResult>>): QueryContextResult<TVersion, TMethod, TResult>;
22
44
  /**
23
- * Query context service
24
- * @see {@link query/client}
45
+ * List contexts related to a specific context entity.
46
+ *
47
+ * @template TVersion - The API version key (e.g. `'v1'`).
48
+ * @template TResult - The expected response type.
49
+ * @param version - API version to use.
50
+ * @returns An array of related context entities.
25
51
  */
26
52
  related<TVersion extends string = keyof typeof ApiVersion, TResult = RelatedContextResponse<TVersion>>(version: TVersion, ...args: Parameters<RelatedContextFn<TVersion, TMethod, TClient, TResult>>): RelatedContextResult<TVersion, TMethod, TResult>;
27
53
  }
@@ -2,10 +2,15 @@ import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-m
2
2
  import type { ApiVersion } from '..';
3
3
  import type { ClientMethod, GetContextArgs, GetContextResponse, GetContextResult } from './types';
4
4
  /**
5
- * Method for fetching context item from context service
6
- * @param client - client for execution of request
7
- * @param version - version of API to call
8
- * @param method - client method to call
5
+ * Creates a curried function that fetches a single context entity by ID.
6
+ *
7
+ * @template TVersion - The API version key (e.g. `'v1'`).
8
+ * @template TMethod - The client execution method (`'json'` or `'json$'`).
9
+ * @template TClient - The underlying HTTP client type.
10
+ * @param client - HTTP client used to execute the request.
11
+ * @param version - API version to call.
12
+ * @param method - Client method to use (defaults to `'json'`).
13
+ * @returns A function that accepts context args and returns the result.
9
14
  */
10
15
  export declare const getContext: <TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod = keyof ClientMethod, TClient extends IHttpClient = IHttpClient>(client: TClient, version: TVersion, method?: TMethod) => <T = GetContextResponse<TVersion>>(args: GetContextArgs<TVersion>, init?: ClientRequestInit<TClient, T>) => GetContextResult<TVersion, TMethod, T>;
11
16
  export default getContext;
@@ -1,7 +1,9 @@
1
1
  import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
2
  import { ApiVersion, type ApiContextEntity, type ClientMethod } from '..';
3
3
  export { ApiClientArguments, ClientMethod } from '..';
4
+ /** Arguments for fetching a single context in API v1. */
4
5
  type GetContextArgs_v1 = {
6
+ /** The unique context identifier. */
5
7
  id: string;
6
8
  };
7
9
  type GetContextArgs_v2 = GetContextArgs_v1;
@@ -9,11 +11,36 @@ type GetContextArgsTypes = {
9
11
  [ApiVersion.v1]: GetContextArgs_v1;
10
12
  [ApiVersion.v2]: GetContextArgs_v2;
11
13
  };
14
+ /**
15
+ * Version-aware argument type for the get-context endpoint.
16
+ *
17
+ * @template T - API version key.
18
+ */
12
19
  export type GetContextArgs<T extends string> = T extends keyof typeof ApiVersion ? GetContextArgsTypes[(typeof ApiVersion)[T]] : unknown;
13
20
  type GetContextResponseTypes = {
14
21
  [ApiVersion.v1]: ApiContextEntity<ApiVersion.v1>;
15
22
  [ApiVersion.v2]: ApiContextEntity<ApiVersion.v2>;
16
23
  };
24
+ /**
25
+ * Version-aware response type for the get-context endpoint.
26
+ *
27
+ * @template T - API version key.
28
+ */
17
29
  export type GetContextResponse<T> = T extends keyof typeof ApiVersion ? GetContextResponseTypes[(typeof ApiVersion)[T]] : unknown;
30
+ /**
31
+ * Function signature for the get-context endpoint.
32
+ *
33
+ * @template TVersion - API version key.
34
+ * @template TMethod - Client execution method.
35
+ * @template TClient - HTTP client type.
36
+ * @template TResult - Expected response type.
37
+ */
18
38
  export type GetContextFn<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TClient extends IHttpClient = IHttpClient, TResult = GetContextResponse<TVersion>> = (args: GetContextArgs<TVersion>, init?: ClientRequestInit<TClient, TResult>) => GetContextResult<TVersion, TMethod, TResult>;
39
+ /**
40
+ * Result type for the get-context endpoint, derived from `ClientMethod`.
41
+ *
42
+ * @template TVersion - API version key.
43
+ * @template TMethod - Client execution method.
44
+ * @template TResult - Expected response type.
45
+ */
19
46
  export type GetContextResult<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TResult = GetContextResponse<TVersion>> = ClientMethod<TResult>[TMethod];
@@ -1,3 +1,16 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Context API client and types.
5
+ *
6
+ * Provides {@link ContextApiClient} for fetching, querying, and listing
7
+ * related contexts, with versioned endpoints (`v1`, `v2`).
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { ContextApiClient } from '@equinor/fusion-framework-module-services/context';
12
+ * ```
13
+ */
1
14
  export { ContextApiClient, default } from './client';
2
15
  export { ApiVersion } from './static';
3
16
  export { ApiContextEntity } from './api-models';
@@ -2,7 +2,15 @@ import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-m
2
2
  import type { ApiVersion } from '..';
3
3
  import type { QueryContextArgs, QueryContextResponse, QueryContextResult, ClientMethod } from './types';
4
4
  /**
5
- * Function for querying the context service
5
+ * Creates a curried function that queries the context service.
6
+ *
7
+ * @template TVersion - The API version key.
8
+ * @template TMethod - The client execution method.
9
+ * @template TClient - The underlying HTTP client type.
10
+ * @param client - HTTP client used to execute the request.
11
+ * @param version - API version to call.
12
+ * @param method - Client method to use (defaults to `'json'`).
13
+ * @returns A function that accepts query args and returns context results.
6
14
  */
7
15
  export declare const queryContext: <TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod = keyof ClientMethod, TClient extends IHttpClient = IHttpClient>(client: TClient, version: TVersion, method?: TMethod) => <T = QueryContextResponse<TVersion>>(args: QueryContextArgs<TVersion>, init?: ClientRequestInit<TClient, T>) => QueryContextResult<TVersion, TMethod, T>;
8
16
  export default queryContext;
@@ -1,10 +1,20 @@
1
1
  import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
2
  import { ApiVersion, type ApiContextEntity, type ClientMethod } from '..';
3
3
  export { ApiClientArguments, ClientMethod } from '..';
4
+ /**
5
+ * OData filter parameters for context queries.
6
+ *
7
+ * Used to narrow results by context type or external identifier.
8
+ */
4
9
  export type QueryContextOdataFilter = {
5
10
  type?: string[];
6
11
  externalId?: string;
7
12
  };
13
+ /**
14
+ * Structured OData query parameters for context search.
15
+ *
16
+ * Allows combining free-text search with type or external-ID filters.
17
+ */
8
18
  export type QueryContextOdataParameters = {
9
19
  search?: string;
10
20
  filter?: QueryContextOdataFilter;
@@ -18,6 +28,11 @@ type SearchContextArgTypes = {
18
28
  [ApiVersion.v1]: QueryContextArgs_v1;
19
29
  [ApiVersion.v2]: QueryContextArgs_v2;
20
30
  };
31
+ /**
32
+ * Version-aware argument type for the context query endpoint.
33
+ *
34
+ * @template T - API version key.
35
+ */
21
36
  export type QueryContextArgs<T> = T extends keyof typeof ApiVersion ? SearchContextArgTypes[(typeof ApiVersion)[T]] : {
22
37
  query: {
23
38
  search: string;
@@ -27,6 +42,26 @@ type QueryContextResponseTypes = {
27
42
  [ApiVersion.v1]: Array<ApiContextEntity<ApiVersion.v1>>;
28
43
  [ApiVersion.v2]: Array<ApiContextEntity<ApiVersion.v2>>;
29
44
  };
45
+ /**
46
+ * Version-aware response type for the context query endpoint.
47
+ *
48
+ * @template T - API version key.
49
+ */
30
50
  export type QueryContextResponse<T> = T extends keyof typeof ApiVersion ? QueryContextResponseTypes[(typeof ApiVersion)[T]] : unknown;
51
+ /**
52
+ * Function signature for the context query endpoint.
53
+ *
54
+ * @template TVersion - API version key.
55
+ * @template TMethod - Client execution method.
56
+ * @template TClient - HTTP client type.
57
+ * @template TResult - Expected response type.
58
+ */
31
59
  export type QueryContextFn<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TClient extends IHttpClient = IHttpClient, TResult = QueryContextResponse<TVersion>> = (args: QueryContextArgs<TVersion>, init?: ClientRequestInit<TClient, TResult>) => QueryContextResult<TVersion, TMethod, TResult>;
60
+ /**
61
+ * Result type for the context query endpoint.
62
+ *
63
+ * @template TVersion - API version key.
64
+ * @template TMethod - Client execution method.
65
+ * @template TResult - Expected response type.
66
+ */
32
67
  export type QueryContextResult<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TResult = QueryContextResponse<TVersion>> = ClientMethod<TResult>[TMethod];
@@ -2,7 +2,15 @@ import type { ClientRequestInit, IHttpClient } from '@equinor/fusion-framework-m
2
2
  import type { ApiVersion } from '..';
3
3
  import type { RelatedContextArgs, RelatedContextResponse, RelatedContextResult, ClientMethod } from './types';
4
4
  /**
5
- * Function for querying the context service
5
+ * Creates a curried function that fetches contexts related to a given context.
6
+ *
7
+ * @template TVersion - The API version key.
8
+ * @template TMethod - The client execution method.
9
+ * @template TClient - The underlying HTTP client type.
10
+ * @param client - HTTP client used to execute the request.
11
+ * @param version - API version to call.
12
+ * @param method - Client method to use (defaults to `'json'`).
13
+ * @returns A function that accepts relation args and returns related contexts.
6
14
  */
7
15
  export declare const relatedContexts: <TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod = keyof ClientMethod, TClient extends IHttpClient = IHttpClient>(client: TClient, version: TVersion, method?: TMethod) => <T = RelatedContextResponse<TVersion>>(args: RelatedContextArgs<TVersion>, init?: ClientRequestInit<TClient, T>) => RelatedContextResult<TVersion, TMethod, T>;
8
16
  export default relatedContexts;
@@ -1,13 +1,24 @@
1
1
  import type { IHttpClient, ClientRequestInit } from '@equinor/fusion-framework-module-http/client';
2
2
  import { ApiVersion, type ApiContextEntity, type ClientMethod } from '..';
3
3
  export { ApiClientArguments, ClientMethod } from '..';
4
+ /**
5
+ * Extended context entity that includes relationship metadata.
6
+ *
7
+ * @template T - An {@link ApiVersion} member.
8
+ */
4
9
  export type ApiRelatedContextEntity<T extends ApiVersion> = ApiContextEntity<T> & {
5
10
  relationSource: string;
6
11
  relationType: unknown;
7
12
  };
13
+ /**
14
+ * OData filter for narrowing related-context results by type.
15
+ */
8
16
  export type RelatedContextOdataFilter = {
9
17
  type?: string[];
10
18
  };
19
+ /**
20
+ * Structured OData query parameters for related-context lookups.
21
+ */
11
22
  export type RelatedContextOdataParameters = {
12
23
  search?: string;
13
24
  filter?: RelatedContextOdataFilter;
@@ -22,6 +33,11 @@ type RelatedContextArgTypes = {
22
33
  [ApiVersion.v1]: RelatedContextArgs_v1;
23
34
  [ApiVersion.v2]: RelatedContextArgs_v2;
24
35
  };
36
+ /**
37
+ * Version-aware argument type for the related-contexts endpoint.
38
+ *
39
+ * @template T - API version key.
40
+ */
25
41
  export type RelatedContextArgs<T> = T extends keyof typeof ApiVersion ? RelatedContextArgTypes[(typeof ApiVersion)[T]] : {
26
42
  id: string;
27
43
  };
@@ -29,6 +45,26 @@ type RelatedContextResponseTypes = {
29
45
  [ApiVersion.v1]: Array<ApiRelatedContextEntity<ApiVersion.v1>>;
30
46
  [ApiVersion.v2]: Array<ApiRelatedContextEntity<ApiVersion.v2>>;
31
47
  };
48
+ /**
49
+ * Version-aware response type for the related-contexts endpoint.
50
+ *
51
+ * @template T - API version key.
52
+ */
32
53
  export type RelatedContextResponse<T> = T extends keyof typeof ApiVersion ? RelatedContextResponseTypes[(typeof ApiVersion)[T]] : unknown;
54
+ /**
55
+ * Function signature for the related-contexts endpoint.
56
+ *
57
+ * @template TVersion - API version key.
58
+ * @template TMethod - Client execution method.
59
+ * @template TClient - HTTP client type.
60
+ * @template TResult - Expected response type.
61
+ */
33
62
  export type RelatedContextFn<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TClient extends IHttpClient = IHttpClient, TResult = RelatedContextResponse<TVersion>> = (args: RelatedContextArgs<TVersion>, init?: ClientRequestInit<TClient, TResult>) => RelatedContextResult<TVersion, TMethod, TResult>;
63
+ /**
64
+ * Result type for the related-contexts endpoint.
65
+ *
66
+ * @template TVersion - API version key.
67
+ * @template TMethod - Client execution method.
68
+ * @template TResult - Expected response type.
69
+ */
34
70
  export type RelatedContextResult<TVersion extends string = keyof typeof ApiVersion, TMethod extends keyof ClientMethod<unknown> = keyof ClientMethod<unknown>, TResult = RelatedContextResponse<TVersion>> = ClientMethod<TResult>[TMethod];
@@ -1,6 +1,7 @@
1
- /** index of api versions of context service */
1
+ /** Supported API versions for the context service. */
2
2
  export declare enum ApiVersion {
3
+ /** Context API version 1.0. */
3
4
  v1 = "1.0",
4
- /** not in use atm */
5
+ /** Context API version 2.0 (not currently in use). */
5
6
  v2 = "2.0"
6
7
  }
@@ -1,4 +1,18 @@
1
+ /**
2
+ * Error thrown when an API endpoint is called with a version string
3
+ * that does not match any supported API version.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * throw new UnsupportedApiVersion('3.0');
8
+ * // Error: unsupported version 3.0
9
+ * ```
10
+ */
1
11
  export declare class UnsupportedApiVersion extends Error {
2
12
  readonly version: string | number;
13
+ /**
14
+ * @param version - The unsupported version value that was requested.
15
+ * @param cause - Optional underlying error or context.
16
+ */
3
17
  constructor(version: string | number, cause?: unknown);
4
18
  }
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Typed API service clients for the Fusion Framework.\
5
+ * Provides factory-based access to bookmarks, context, notification, and
6
+ * people APIs with versioned endpoints, response validation, and support
7
+ * for both promise (`json`) and observable (`json$`) consumption patterns.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { enableServices } from '@equinor/fusion-framework-module-services';
12
+ * configurator.addConfig(enableServices);
13
+ * ```
14
+ */
1
15
  export * from './types';
2
16
  export type { ServicesModule, ServicesModuleKey } from './module';
3
17
  export { ApiConfigurator, IApiConfigurator } from './configurator';
@@ -3,28 +3,63 @@ import type { HttpModule } from '@equinor/fusion-framework-module-http';
3
3
  import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
4
4
  import { type IApiConfigurator } from './configurator';
5
5
  import { type IApiProvider } from './provider';
6
+ /** String literal type for the services module registration key. */
6
7
  export type ServicesModuleKey = 'services';
8
+ /** Module registration key used to identify the services module. */
7
9
  export declare const moduleKey: ServicesModuleKey;
10
+ /**
11
+ * Module definition for the services module.
12
+ *
13
+ * Declares the module key, provider type ({@link IApiProvider}),
14
+ * configurator type ({@link IApiConfigurator}), and required
15
+ * dependency modules (HTTP and service-discovery).
16
+ */
8
17
  export type ServicesModule = Module<ServicesModuleKey, IApiProvider, IApiConfigurator, [
9
18
  HttpModule,
10
19
  ServiceDiscoveryModule
11
20
  ]>;
12
21
  /**
13
- * Configure http-client
22
+ * Services module definition.
23
+ *
24
+ * Registers the `'services'` module, wires up the {@link ApiConfigurator},
25
+ * and initializes the {@link ApiProvider} with an HTTP client factory
26
+ * resolved from the `http` and optional `serviceDiscovery` modules.
14
27
  */
15
28
  export declare const module: ServicesModule;
16
29
  /**
17
- * Method for enabling the Service module
18
- * @param config - configuration object
30
+ * Registers the services module with the framework configurator.
31
+ *
32
+ * Call this during app configuration to make the services module
33
+ * available at runtime.
34
+ *
35
+ * @param config - The framework modules configurator.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { enableServices } from '@equinor/fusion-framework-module-services';
40
+ * configurator.addConfig(enableServices);
41
+ * ```
19
42
  */
20
43
  export declare const enableServices: (config: IModulesConfigurator<any, any>) => void;
21
44
  /**
45
+ * Creates a module configuration object for the services module
46
+ * with a custom configuration callback.
47
+ *
48
+ * Use this when you need to customise the services module (for example,
49
+ * supplying a custom `createClient` factory).
50
+ *
51
+ * @param configure - Callback that receives the {@link IApiConfigurator} for customisation.
52
+ * @returns A module configurator object that can be passed to `addConfig`.
53
+ *
22
54
  * @example
23
55
  * ```ts
24
- * config.addConfig(x => x.createClient(...));
56
+ * import { configureServices } from '@equinor/fusion-framework-module-services';
57
+ * configurator.addConfig(
58
+ * configureServices((cfg) => {
59
+ * cfg.createClient = myCustomClientFactory;
60
+ * }),
61
+ * );
25
62
  * ```
26
- * @param configure - Callback for configuring the module
27
- * @returns Configuration object
28
63
  */
29
64
  export declare const configureServices: (configure: (configurator: IApiConfigurator) => void) => IModuleConfigurator<ServicesModule>;
30
65
  declare module '@equinor/fusion-framework-module' {
@@ -1,4 +1,5 @@
1
1
  import { ApiVersion } from './static';
2
+ /** Notification entity returned by the v1 notification API. */
2
3
  type ApiNotificationEntity_v1 = {
3
4
  id: string;
4
5
  appKey: string;
@@ -14,15 +15,18 @@ type ApiNotificationEntity_v1 = {
14
15
  seen: string;
15
16
  sourceSystem: SourceSystem_v1;
16
17
  };
18
+ /** Source system metadata for a notification. */
17
19
  type SourceSystem_v1 = {
18
20
  name: string;
19
21
  subSystem: string;
20
22
  identifier: string;
21
23
  };
24
+ /** Application that created the notification. */
22
25
  type CreatedByApplication_v1 = {
23
26
  id: string;
24
27
  title: string;
25
28
  };
29
+ /** Person who created the notification. */
26
30
  type CreatedBy_v1 = {
27
31
  id: string;
28
32
  name: string;
@@ -30,26 +34,41 @@ type CreatedBy_v1 = {
30
34
  mail: string;
31
35
  accountType: string;
32
36
  };
37
+ /** Placeholder for the v2 notification entity (not yet defined). */
33
38
  type ApiNotificationEntity_v2 = unknown;
34
39
  type ApiNotificationEntityTypes = {
35
40
  [ApiVersion.v1]: ApiNotificationEntity_v1;
36
41
  [ApiVersion.v2]: ApiNotificationEntity_v2;
37
42
  };
43
+ /**
44
+ * Version-aware notification entity type.
45
+ *
46
+ * Resolves to the concrete entity shape for a given {@link ApiVersion}.
47
+ *
48
+ * @template T - An `ApiVersion` member string.
49
+ */
38
50
  export type ApiNotificationEntity<T extends string = ApiVersion> = T extends ApiVersion ? ApiNotificationEntityTypes[T] : unknown;
39
- /**User notification Settings */
51
+ /** User notification settings entity for API v1. */
40
52
  type ApiNotificationSettingsEntity_v1 = {
41
53
  email: boolean;
42
54
  delayInMinutes: number;
43
55
  appConfig: AppConfig_v1[];
44
56
  };
57
+ /** Per-application notification toggle within user settings. */
45
58
  type AppConfig_v1 = {
46
59
  appKey: string;
47
60
  enabled: boolean;
48
61
  };
62
+ /** Placeholder for the v2 notification settings entity (not yet defined). */
49
63
  type ApiNotificationSettingsEntity_v2 = unknown;
50
64
  type ApiNotificationSettingEntityTypes = {
51
65
  [ApiVersion.v1]: ApiNotificationSettingsEntity_v1;
52
66
  [ApiVersion.v2]: ApiNotificationSettingsEntity_v2;
53
67
  };
68
+ /**
69
+ * Version-aware notification settings entity type.
70
+ *
71
+ * @template T - An `ApiVersion` member string.
72
+ */
54
73
  export type ApiNotificationSettingsEntity<T extends string = ApiVersion> = T extends ApiVersion ? ApiNotificationSettingEntityTypes[T] : unknown;
55
74
  export {};