@sinequa/atomic 2.3.2 → 2.5.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 (50) hide show
  1. package/README.md +117 -54
  2. package/dist/atomic.cjs +1 -1
  3. package/dist/atomic.js +2 -2
  4. package/dist/client/create-api.d.ts +4 -4
  5. package/dist/configurations/auth-mode.d.ts +2 -2
  6. package/dist/configurations/global.config.d.ts +33 -2
  7. package/dist/configurations/global.config.d.ts.map +1 -1
  8. package/dist/helpers/aggregation-count.d.ts +68 -0
  9. package/dist/helpers/aggregation-count.d.ts.map +1 -0
  10. package/dist/helpers/column-resolver.d.ts.map +1 -1
  11. package/dist/helpers/index.d.ts +1 -0
  12. package/dist/helpers/index.d.ts.map +1 -1
  13. package/dist/helpers/utils.d.ts +42 -7
  14. package/dist/helpers/utils.d.ts.map +1 -1
  15. package/dist/spfx/index.cjs +1 -1
  16. package/dist/spfx/index.js +2 -2
  17. package/dist/src-BcyahlCg.cjs +1 -0
  18. package/dist/{src-QHeKpRHd.js → src-vDryIxd0.js} +632 -583
  19. package/dist/types/search/Article.d.ts +8 -0
  20. package/dist/types/search/Article.d.ts.map +1 -1
  21. package/dist/types/search/DidYouMeanItem.d.ts +29 -1
  22. package/dist/types/search/DidYouMeanItem.d.ts.map +1 -1
  23. package/dist/types/search/QueryIntent.d.ts +8 -1
  24. package/dist/types/search/QueryIntent.d.ts.map +1 -1
  25. package/dist/types/search/QueryIntentDatasets.d.ts +0 -3
  26. package/dist/types/search/QueryIntentDatasets.d.ts.map +1 -1
  27. package/dist/types/search/index.d.ts +3 -1
  28. package/dist/types/search/index.d.ts.map +1 -1
  29. package/dist/utils/date.d.ts +10 -2
  30. package/dist/utils/date.d.ts.map +1 -1
  31. package/dist/utils/index.d.ts +1 -0
  32. package/dist/utils/index.d.ts.map +1 -1
  33. package/dist/utils/query-params.d.ts +20 -3
  34. package/dist/utils/query-params.d.ts.map +1 -1
  35. package/dist/web-api/helpers/handle-response.d.ts.map +1 -1
  36. package/dist/web-api/helpers/methods/send-request.d.ts +0 -4
  37. package/dist/web-api/helpers/methods/send-request.d.ts.map +1 -1
  38. package/dist/web-api/v1/fetch-aggregation.d.ts +26 -5
  39. package/dist/web-api/v1/fetch-aggregation.d.ts.map +1 -1
  40. package/dist/web-api/v1/fetch-labels.d.ts.map +1 -1
  41. package/dist/web-api/v1/fetch-preview.d.ts +11 -4
  42. package/dist/web-api/v1/fetch-preview.d.ts.map +1 -1
  43. package/dist/web-api/v1/fetch-query.d.ts +10 -3
  44. package/dist/web-api/v1/fetch-query.d.ts.map +1 -1
  45. package/dist/web-api/v2/fetch-forgot-password.d.ts +5 -1
  46. package/dist/web-api/v2/fetch-forgot-password.d.ts.map +1 -1
  47. package/package.json +2 -1
  48. package/dist/src-DQYL0h7T.cjs +0 -1
  49. package/dist/types/interfaces/json.d.ts +0 -7
  50. package/dist/types/interfaces/json.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  <div align="center">
2
2
 
3
3
  <img src="https://img.shields.io/npm/v/@sinequa/atomic?style=for-the-badge&color=0ea5e9&label=@sinequa%2Fatomic" alt="npm version" />
4
- <img src="https://img.shields.io/badge/TypeScript-5.x-3178c6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
4
+ <img src="https://img.shields.io/badge/TypeScript-7.x-3178c6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
5
5
  <img src="https://img.shields.io/badge/ESM-ready-f59e0b?style=for-the-badge" alt="ESM" />
6
6
  <img src="https://img.shields.io/badge/SPFx-ready-0078d4?style=for-the-badge&logo=microsoftsharepoint&logoColor=white" alt="SPFx" />
7
- <img src="https://img.shields.io/npm/l/@sinequa/atomic?style=for-the-badge&color=22c55e" alt="MIT License" />
8
7
 
9
8
  <br /><br />
10
9
 
@@ -14,7 +13,7 @@
14
13
  Authentication, search, aggregations, datasets, preview — everything typed, tree-shakable, zero runtime dependencies.
15
14
  SPFx-ready via the `@sinequa/atomic/spfx` subpath export.
16
15
 
17
- [Docs](https://sinequa.github.io/sba-mint/atomic/intro) · [API Reference](https://sinequa.github.io/sba-mint/atomic/api/app)
16
+ [Docs](./docs/index.mdx) · [Get started](./docs/start/index.mdx) · [Reference](./docs/reference/index.mdx)
18
17
 
19
18
  </div>
20
19
 
@@ -39,16 +38,26 @@ npm install @microsoft/sp-http --save-peer
39
38
  ## At a glance
40
39
 
41
40
  ```typescript
42
- import { login, isAuthenticated, fetchQuery, fetchAggregation } from '@sinequa/atomic';
41
+ import { setGlobalConfig, isAuthenticated, login, fetchQuery } from '@sinequa/atomic';
42
+
43
+ setGlobalConfig({ app: 'my-app', backendUrl: 'https://my-sinequa-server.example.com' });
43
44
 
44
45
  if (!isAuthenticated()) {
45
46
  await login({ username: 'alice', password: 's3cr3t' });
46
47
  }
47
48
 
48
- const results = await fetchQuery({ query: 'knowledge management', pageSize: 10 });
49
- const facets = await fetchAggregation({ aggregation: 'company', query: 'knowledge management' });
49
+ // A query is a plain object; only `name` — the query web service — is required.
50
+ const result = await fetchQuery({ name: '<your-query>', text: 'knowledge management', pageSize: 10 });
51
+
52
+ // One round-trip: the documents are in `records`, the facet counts in `aggregations`.
53
+ // Check `$error` before concluding anything from an empty `records`.
54
+ const { records, aggregations, $error } = result;
50
55
  ```
51
56
 
57
+ `fetchAggregation(aggregation, query)` is for **paging** an aggregation you already received — it
58
+ takes the `Aggregation` object off `result.aggregations` and the same query, as two positional
59
+ arguments. See [Aggregations](./docs/search/aggregations.mdx).
60
+
52
61
  ---
53
62
 
54
63
  ## SharePoint Framework (SPFx)
@@ -67,14 +76,17 @@ const client = await this.context.aadHttpClientFactory
67
76
  initializeAadHttpClient(client);
68
77
 
69
78
  // All subsequent API calls route through AadHttpClient automatically:
70
- const results = await fetchQuery({ name: '_query', text: 'knowledge management' });
79
+ const results = await fetchQuery({ name: '<your-query>', text: 'knowledge management' });
71
80
  ```
72
81
 
73
82
  Call `initializeAadHttpClient(null)` to detach the client (e.g. in `onDispose`).
74
83
 
75
84
  > The `./spfx` subpath re-exports everything from `@sinequa/atomic` and adds
76
- > `initializeAadHttpClient`, `AadHttpClientLike`, and `AadHttpResponseLike`.
77
- > Standard (non-SPFx) consumers use `@sinequa/atomic` directly — no changes needed.
85
+ > `initializeAadHttpClient`, `aadHttpClientManager`, `createSpfxHttpAdapter`, `AadHttpClientLike`
86
+ > and `AadHttpResponseLike`. `initializeAadHttpClient` registers the client globally for the free
87
+ > functions; `createSpfxHttpAdapter(aadHttpClient)` is the same transport as an `httpAdapter` for
88
+ > `createAtomicClient`. Standard (non-SPFx) consumers use `@sinequa/atomic` directly — no changes
89
+ > needed. See [SPFx](./docs/integration/spfx.mdx).
78
90
 
79
91
  ---
80
92
 
@@ -83,9 +95,11 @@ Call `initializeAadHttpClient(null)` to detach the client (e.g. in `onDispose`).
83
95
  ### Client (experimental)
84
96
 
85
97
  `createAtomicClient(config)` returns an isolated client — its own configuration, session and event
86
- subscribers — exposing `client.config`, `client.auth` and `client.http`. Several clients can target
87
- different backends from the same page, and each takes its `fetch`/`storage`/`logger` as
88
- configuration, which removes the need for module mocks in tests.
98
+ subscribers — exposing `client.config`, `client.configure()`, `client.initializeConfig()`,
99
+ `client.auth`, `client.http` and `client.api` (the typed endpoints, e.g.
100
+ `client.api.query.search(query)`). Several clients can target different backends from the same page,
101
+ and each takes its transport and auth knobs as configuration (`httpAdapter`, and
102
+ `auth: { fetch, storage, logger }`), which removes the need for module mocks in tests.
89
103
 
90
104
  ```typescript
91
105
  import { createAtomicClient } from '@sinequa/atomic';
@@ -98,6 +112,7 @@ const results = await client.http.post('api/v1/search.query', { text: 'hello' })
98
112
  The free functions below keep working unchanged: they run on a default client whose configuration
99
113
  **is** `globalConfig`, and `getDefaultClient()` hands back that very instance — useful from code
100
114
  that cannot receive one (a distributed web component, a plugin).
115
+ See [The client](./docs/core/client.mdx) and [Multiple backends](./docs/integration/multiple-backends.mdx).
101
116
 
102
117
  ### Authentication
103
118
 
@@ -105,34 +120,41 @@ Full auth lifecycle — from first handshake to logout.
105
120
 
106
121
  | Export | Description |
107
122
  |---|---|
108
- | `isAuthenticated()` | Returns `true` when a valid token is present |
109
- | `login(credentials?)` | Login — switches on the resolved `authMode` (credentials / SSO / OAuth / SAML / bearer) |
123
+ | `isAuthenticated()` | Synchronous. `true` when a CSRF token is stored **or** a token-less session was recorded (ambient SSO issues no client token) |
124
+ | `hasSession()` | Asks the server when nothing is stored, and never redirects — unlike `login()` |
125
+ | `login(credentials?)` | Login — switches on the resolved `authMode` (credentials / SSO / OAuth / SAML / bearer / unknown) |
110
126
  | `logout()` | Clears session, returns the server's `redirectUrl` |
111
- | `clearSessionTokens()` | Drops the in-memory/stored session tokens without a server round-trip |
127
+ | `clearSessionTokens()` | Drops the local session (tokens, token-less flag) and emits `authenticated: false`, without a server round-trip |
112
128
  | `detectAuthMode(config, preLogin?)` | Pure resolution of the `AuthMode` from config + server pre-login (no I/O) |
113
129
  | `getToken()` / `setToken(token)` | Read/write the stored CSRF token |
114
- | `getJWToken(credentials?)` | Fetches a JWT from the server, returns the CSRF token |
130
+ | `requestWebTokenSession(credentials?)` | POSTs `security.webtoken`. The JWT lands in a cookie; the returned (and stored) value is the **CSRF token**. Omit the credentials to use the configured bearer token |
115
131
  | `getCsrfToken()` | CSRF token for mutating requests |
116
132
  | `deleteWebTokenCookie()` | Explicitly removes the web token cookie |
117
- | `onAuthEvent(event, handler)` | Typed subscription to the auth lifecycle (`authenticated`, `unauthorized`, `tokenRefreshed`, `loggedOut`) — returns the unsubscribe function |
118
- | `tryAutoAuthentication()` | Probes the server for auto-authentication (OIDC) — used by `login()` in `unknown` mode |
133
+ | `onAuthEvent(event, handler)` | Typed subscription to the auth lifecycle (`authenticated`, `unauthorized`, `requestFailed`, `tokenRefreshed`, `loggedOut`) — returns the unsubscribe function |
134
+ | `tryAutoAuthentication()` | Probes a protected endpoint for server-side auto-authentication (OIDC, IIS Negotiate) — used by `login()` in `sso`, `unknown` and `bearer` modes. Never throws |
135
+ | `isRedirectPending()` | Whether an OAuth/SAML redirect is in flight and has not established a session yet |
119
136
  | `tryOAuthAuthentication()` / `trySAMLAuthentication()` | Redirect to the configured identity provider (with a one-shot redirect-loop guard) |
120
137
  | `emitAuthenticatedEvent(bool)` | Dispatches the DOM `'authenticated'` CustomEvent (on `document`, bubbles to `window`) |
121
138
 
139
+ > `getJWToken` is **`@deprecated`**: it is an alias of `requestWebTokenSession`, renamed because the
140
+ > old name suggested it returned the JWT. It will be removed in the next major.
141
+
122
142
  The authentication layer is configurable via `setGlobalConfig({ auth: { … } })` (`AuthOptions`):
123
- request timeout, auto-auth probe endpoint, injectable storage/logger/fetch, and the requests'
124
- `credentials` mode.
143
+ `timeoutMs`, `probeEndpoint`, injectable `storage`/`logger`/`fetch`, the requests' `credentials`
144
+ mode, and `recoverFromUnauthorized` — the hook that re-establishes a session after a 401 and gets
145
+ the request replayed once. See [Authentication](./docs/auth/index.mdx) and
146
+ [Handling 401](./docs/auth/handling-401.mdx).
125
147
 
126
148
  ```typescript
127
149
  import { isAuthenticated, login, logout } from '@sinequa/atomic';
128
150
 
129
151
  if (!isAuthenticated()) {
130
- // Auto-resolve: reuse an existing session if any, otherwise try SSO and
131
- // fall back to the credentials form. Provider resolved from server config.
152
+ // Auto-resolve: reuse an existing session if any, otherwise follow the resolved
153
+ // `authMode` — in `unknown` mode, probe for SSO then fall back to the credentials form.
132
154
  const ok = await login();
133
155
 
134
- // — or — credential-based login, bypasses SSO
135
- const ok = await login({ username: 'alice', password: 's3cr3t' });
156
+ // — or — explicit credentials, which bypass mode detection entirely.
157
+ const okWithCredentials = await login({ username: 'alice', password: 's3cr3t' });
136
158
  }
137
159
 
138
160
  const redirectUrl = await logout();
@@ -144,7 +166,7 @@ const redirectUrl = await logout();
144
166
  typed discriminated union — no more juggling overlapping booleans:
145
167
 
146
168
  ```typescript
147
- import { AuthMode, setGlobalConfig } from '@sinequa/atomic';
169
+ import { AuthMode, globalConfig, setGlobalConfig } from '@sinequa/atomic';
148
170
 
149
171
  setGlobalConfig({ authMode: AuthMode.credentials() }); // username/password form
150
172
  setGlobalConfig({ authMode: AuthMode.sso() }); // browser/proxy-injected auth
@@ -153,14 +175,16 @@ setGlobalConfig({ authMode: AuthMode.saml('my-provider') }); // redirect to a S
153
175
  setGlobalConfig({ authMode: AuthMode.bearer(token) }); // server-to-server bearer token
154
176
  setGlobalConfig({ authMode: AuthMode.unknown() }); // try SSO, then fall back to credentials
155
177
 
156
- // `login()` and `detectAuthMode()` branch on `authMode.kind`:
157
- const kind = globalConfig.authMode.kind; // 'credentials' | 'sso' | 'oauth' | 'saml' | 'bearer' | 'unknown'
178
+ // `login()` and `detectAuthMode()` branch on `authMode.kind`. Every key of `globalConfig` is
179
+ // optional, so read it through `?.` — the default is `AuthMode.unknown()`.
180
+ const kind = globalConfig.authMode?.kind; // 'credentials' | 'sso' | 'oauth' | 'saml' | 'bearer' | 'unknown'
158
181
  ```
159
182
 
160
183
  > **Migrating from 1.x:** the booleans `useCredentials` / `useSSO` / `useSAML` are now
161
184
  > **`@deprecated` read-only getters** derived from `authMode`. Reading them still works, and writing
162
185
  > them through `setGlobalConfig({ useSSO: true })` is translated into the matching `authMode` — so
163
186
  > existing code keeps working. Prefer `authMode.kind` (and the `AuthMode.*` constructors) in new code.
187
+ > Full upgrade notes: [Migrating from 1.x](./docs/reference/migrating-from-1x.mdx).
164
188
 
165
189
  ---
166
190
 
@@ -171,7 +195,9 @@ Every Sinequa v1 endpoint has a typed wrapper.
171
195
  ```typescript
172
196
  import {
173
197
  fetchApp,
198
+ fetchAppPreLogin,
174
199
  fetchQuery,
200
+ fetchBulkQuery,
175
201
  fetchAggregation,
176
202
  fetchDataset,
177
203
  fetchPreview,
@@ -179,15 +205,18 @@ import {
179
205
  fetchSimilarDocuments,
180
206
  fetchSponsoredLinks,
181
207
  fetchSuggest,
182
- fetchTextChunk,
208
+ fetchTextChunks,
183
209
  fetchUserSettings,
184
- fetchAudit,
185
210
  fetchLabels,
186
211
  fetchQueryExport,
187
212
  fetchQueryIntent,
213
+ searchPrincipals,
188
214
  } from '@sinequa/atomic';
189
215
  ```
190
216
 
217
+ Auditing is not a `fetch*` function: use `Audit.notify(...)`, plus the record decorators
218
+ `addAuditAdditionalInfo`, `addSessionId` and `addUrl`. See [Audit](./docs/integration/audit.mdx).
219
+
191
220
  ### Web API — v2
192
221
 
193
222
  ```typescript
@@ -195,10 +224,13 @@ import {
195
224
  fetchUserProfile,
196
225
  fetchVersion,
197
226
  fetchChangePassword,
198
- fetchForgotPassword,
227
+ fetchSendPasswordResetEmail,
199
228
  } from '@sinequa/atomic';
200
229
  ```
201
230
 
231
+ The full endpoint list — with the `client.api` method and the free function for each — is in
232
+ [Endpoints](./docs/reference/endpoints.mdx).
233
+
202
234
  ---
203
235
 
204
236
  ### Helpers
@@ -207,16 +239,20 @@ Utilities for transforming Sinequa data structures.
207
239
 
208
240
  ```typescript
209
241
  import {
210
- getMetadata,
211
- getMetadataWithValues, // parses comma-separated metadata strings
242
+ getMetadata, // metadata of an article as `string[]` (splits comma-separated values)
243
+ getMetadataWithValues, // same, as `{ display, value }[]`
212
244
  makeColumn,
245
+ extraColumns,
213
246
  resolveToColumnName,
247
+ resultPages,
214
248
  escapeExpr,
215
249
  guid,
216
250
  isObject,
217
251
  } from '@sinequa/atomic';
218
252
  ```
219
253
 
254
+ More in [Helpers](./docs/reference/helpers.mdx).
255
+
220
256
  #### Filter builder
221
257
 
222
258
  Build structured `query.filters` without hand-writing filter objects. Combinators ignore falsy
@@ -235,11 +271,16 @@ const filters = filter.and(
235
271
  onlyRecent && filter.between('modified', '2024-01-01', '2024-12-31'),
236
272
  );
237
273
 
238
- await fetchQuery({ name: '_query', text: 'report', filters });
274
+ await fetchQuery({ name: '<your-query>', text: 'report', filters });
239
275
  ```
240
276
 
241
277
  Leaf operators: `eq` · `neq` · `gt` · `gte` · `lt` · `lte` · `like` · `contains` · `regex` · `isNull` · `isNotNull` · `in` · `between`. Combinators: `and` · `or` · `not`.
242
278
 
279
+ `filter.distribution(field, item.value)` handles the one case the leaf operators cannot: a
280
+ **distribution** aggregation item (a date or size bucket), whose `value` is an expression the server
281
+ built rather than a value. Passing it to `filter.eq` makes the backend answer
282
+ `500 — "Field type error"`. See [Filters](./docs/search/filters.mdx).
283
+
243
284
  ---
244
285
 
245
286
  ### Utilities
@@ -247,15 +288,19 @@ Leaf operators: `eq` · `neq` · `gt` · `gte` · `lt` · `lte` · `like` · `co
247
288
  ```typescript
248
289
  import {
249
290
  bisect,
250
- formatDate,
251
- parseDate,
252
- logger,
253
- queryParamsToString,
254
- toSQL,
255
- syslang,
291
+ sysLang, // resolves `all[fr]tous[de]alle` against a locale
292
+ getRelativeDate, // and `getOffsetFromDates`
293
+ getQueryParamsFromUrl, // and `getUrlParamsFromQueryParams`, `getFiltersFromUrl`, …
294
+ addConcepts, // and `getConcepts`, `parseText`, `rewriteText`, `removeConcept(s)`
295
+ notify,
296
+ configureLogger, // and the `debug` / `info` / `warn` / `error` bindings, `LogLevel`
256
297
  } from '@sinequa/atomic';
257
298
  ```
258
299
 
300
+ > The library's verbosity is set with `configureLogger({ level: LogLevel.DEBUG })`, **not** through
301
+ > a configuration key. See [Logging](./docs/integration/logging.mdx) and
302
+ > [URL state](./docs/search/url-state.mdx).
303
+
259
304
  ---
260
305
 
261
306
  ## Types
@@ -275,6 +320,8 @@ import type {
275
320
  } from '@sinequa/atomic';
276
321
  ```
277
322
 
323
+ Which type comes back from which call: [Type map](./docs/reference/types-map.mdx).
324
+
278
325
  ---
279
326
 
280
327
  ## Configuration
@@ -291,23 +338,40 @@ setGlobalConfig({
291
338
  authMode: AuthMode.unknown(), // optional — defaults to `unknown`
292
339
  });
293
340
 
294
- // read it back
295
- console.log(globalConfig.backendUrl, globalConfig.authMode.kind);
341
+ // read it back — every key is optional on `globalConfig`, so `?.` is required
342
+ console.log(globalConfig.backendUrl, globalConfig.authMode?.kind);
296
343
  ```
297
344
 
298
- > `appInitializerFn` is also exported as an alias of `initializeAppConfig()`, which resolves the
299
- > `authMode` from the server pre-login response during app bootstrap.
345
+ Call `initializeAppConfig()` once at bootstrap: it fills in `backendUrl`/`app` from the browser URL
346
+ when they were not provided, then resolves the `authMode` from the server's pre-login response.
347
+
348
+ > `appInitializerFn` is a **`@deprecated`** alias of `initializeAppConfig` — use the latter.
349
+
350
+ Three declared keys are read by nothing, and setting them has no effect: `logLevel` (set the level
351
+ with `configureLogger({ level })`), `loginPath` (routing is yours — use `recoverFromUnauthorized` or
352
+ the `unauthorized` event) and `createRoutes`. Every key, with its default:
353
+ [Configuration keys](./docs/reference/config-keys.mdx).
300
354
 
301
355
  ---
302
356
 
303
357
  ## Testing
304
358
 
305
359
  ```bash
306
- npm test # run the vitest suite
307
- npm test -- --ui # interactive UI
360
+ npm test # vitest, watch mode
361
+ npm test -- --watch=false # single run (what CI does)
308
362
  ```
309
363
 
310
- Coverage spans authentication flows (`AuthMode` detection, OAuth, SAML, credentials), all API endpoints, error handling, the filter builder, metadata parsing, date utilities, and SQL helpers.
364
+ `--ui` is not available out of the box: `@vitest/ui` is an optional peer of vitest and is not
365
+ installed here — `npm i -D @vitest/ui` first.
366
+
367
+ Coverage is deepest on authentication (`AuthMode` detection, OAuth, SAML, credentials, tokens,
368
+ 401 recovery) and on the HTTP helpers. On the endpoints it is targeted rather than exhaustive —
369
+ `fetchQuery`, `fetchAggregation`, `fetchPrincipal`, `searchPrincipals`, `fetchApp` and the
370
+ document-upload containers. Also covered: the filter builder, metadata parsing, column resolution,
371
+ pagination, date utilities and the SQL value helper.
372
+
373
+ Injecting `fetch`, `storage` and `logger` through the configuration is what lets a test avoid module
374
+ mocks — see [Testing](./docs/integration/testing.mdx).
311
375
 
312
376
  ---
313
377
 
@@ -326,18 +390,17 @@ npm run dev:pack # build + pack locally
326
390
  1. All tests must pass.
327
391
  2. Lint with [Biome](https://biomejs.dev/) — `npx @biomejs/biome check --write .`
328
392
  3. Follow [Conventional Commits](https://www.conventionalcommits.org/).
329
- 4. New public API → add tests + JSDoc.
330
-
331
- ---
332
-
333
- ## License
334
-
335
- MIT — see [LICENSE](./LICENSE).
393
+ 4. Any change touching `src/` needs a **changeset** in the same commit (`npm run changeset`, then
394
+ `npm run changeset:status` to check) — the `changeset-check` CI job blocks the merge without one.
395
+ Add `#skip-changeset` to the MR title for a change that does not touch the published library.
396
+ Full guide, with examples: [`CONTRIBUTING-changesets.md`](./CONTRIBUTING-changesets.md).
397
+ 5. New public API → add tests + JSDoc, and export it from `src/index.ts` (a helper that is written
398
+ and tested but not re-exported from the barrel is not part of the public API).
336
399
 
337
400
  ---
338
401
 
339
402
  <div align="center">
340
403
 
341
- Built for the [Sinequa](https://www.sinequa.com/) ecosystem · [Report an issue](https://github.com/Product/sba-atomic-js/issues)
404
+ Built for the [Sinequa](https://www.sinequa.com/) ecosystem · [Report an issue](https://gitlab.chapsvision.in/sinequa/rnd/sba-atomic-js/-/issues)
342
405
 
343
406
  </div>
package/dist/atomic.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-DQYL0h7T.cjs");exports.API=e.st,exports.ApiError=e.In,exports.Audit=e.bt,exports.AuditEventType=e.Kt,exports.AuthMode=e.qn,exports.DidYouMeanKind=e.Ht,exports.EngineType=e.Gt,exports.EngineTypeModifier=e.Wt,exports.LogLevel=e.$n,exports.MINIMUM_COMPATIBLE_SERVER_API_VERSION=e.Ut,exports.RFMDisplay=e.Vt,exports.ServerError=e.Nn,exports.TimeoutError=e.En,exports.UnauthorizedError=e.Fn,exports.addAuditAdditionalInfo=e.xt,exports.addConcepts=e.g,exports.addSessionId=e.St,exports.addUrl=e.Ct,exports.aggItemRegex=e.C,exports.aggregationItemStrictCompare=e.w,exports.appInitializerFn=e.Qt,exports.applyConfig=e.Wn,exports.assertNever=e._n,exports.bisect=e.S,exports.buildPathsAndLevels=e.it,exports.clearSessionTokens=e.un,exports.configureLogger=e.er,exports.createAtomicClient=e.k,exports.createContainer=e.L,exports.createHeaders=e.Ln,exports.createHeadersWithContext=e.Rn,exports.createTimeoutController=e.Tn,exports.createUserProfile=e.M,Object.defineProperty(exports,"debug",{enumerable:!0,get:function(){return e.tr}}),exports.del=e.on,exports.delWithContext=e.sn,exports.deleteContainerDocuments=e.R,exports.deleteContainers=e.z,exports.deleteUserProfileProperty=e.N,exports.deleteUserSettings=e.G,exports.deleteWebTokenCookie=e.fn,exports.detectAuthMode=e.Sn,exports.emitAuthenticatedEvent=e.Bn,Object.defineProperty(exports,"error",{enumerable:!0,get:function(){return e.nr}}),exports.escapeExpr=e.wt,exports.expiresSoon=e.Yt,exports.extraColumns=e.zt,exports.fetchAggregation=e.yt,exports.fetchApp=e.$t,exports.fetchAppPreLogin=e.en,exports.fetchBulkQuery=e.at,exports.fetchChangePassword=e.W,exports.fetchDataset=e.gt,exports.fetchDatasetList=e._t,exports.fetchDatasets=e.vt,exports.fetchLabels=e.mt,exports.fetchPreview=e.ft,exports.fetchPreviewUrl=e.pt,exports.fetchPrincipal=e.ct,exports.fetchPrincipalList=e.lt,exports.fetchPrincipalUserid=e.ut,exports.fetchPrincipalUserids=e.dt,exports.fetchQuery=e.ot,exports.fetchQueryExport=e.rt,exports.fetchQueryIntent=e.nt,exports.fetchSendPasswordResetEmail=e.I,exports.fetchSimilarDocuments=e.et,exports.fetchSponsoredLinks=e.$,exports.fetchSuggest=e.X,exports.fetchSuggestField=e.Z,exports.fetchSuggestQuery=e.Q,exports.fetchTextChunks=e.Y,exports.fetchUserProfile=e.P,exports.fetchUserSettings=e.K,exports.fetchVersion=e.j,exports.filter=e.Lt,exports.get=e.bn,exports.getConcepts=e._,exports.getContainer=e.B,exports.getCsrfToken=e.yn,exports.getDefaultClient=e.A,exports.getFiltersFromURI=e.r,exports.getFiltersFromUrl=e.i,exports.getHelpIndexUrl=e.t,exports.getIdFromUrl=e.a,exports.getJWToken=e.hn,exports.getMetadata=e.Ft,exports.getMetadataWithValues=e.It,exports.getOffsetFromDates=e.m,exports.getQueryPageFromUrl=e.o,exports.getQueryParamsFromUrl=e.s,exports.getQueryTabFromUrl=e.c,exports.getQueryTextFromUrl=e.l,exports.getRelativeDate=e.h,exports.getTime=e.Tt,exports.getToken=e.zn,exports.getUrlParamsFromQueryParams=e.u,exports.getWithContext=e.xn,exports.globalConfig=e.Gn,exports.guid=e.Et,exports.handleResponse=e.jn,exports.handleResponseWithContext=e.Mn,exports.hasSession=e.vn,Object.defineProperty(exports,"info",{enumerable:!0,get:function(){return e.rr}}),exports.initializeAppConfig=e.tn,exports.isArrayBuffer=e.Dt,exports.isAuthenticated=e.cn,exports.isBlob=e.Ot,exports.isDate=e.kt,exports.isExpired=e.Xt,exports.isExternalAuthMode=e.Jn,exports.isJsonable=e.At,exports.isNotInputEvent=e.p,exports.isObject=e.jt,exports.isRedirectPending=e.ln,exports.isString=e.Mt,exports.labels=e.ht,exports.legacyBooleansToAuthMode=e.Yn,exports.legacyFilterToFilter=e.Rt,exports.listContainerDocuments=e.V,exports.listContainers=e.H,exports.login=e.pn,exports.logout=e.dn,exports.makeColumn=e.Bt,exports.notify=e.f,exports.onAuthEvent=e.ar,exports.openParentNodes=e.T,exports.parseText=e.v,exports.parseValueAndOperatorFromItem=e.E,exports.patch=e.in,exports.patchUserProfile=e.F,exports.patchUserSettings=e.q,exports.patchWithContext=e.an,exports.post=e.Dn,exports.postWithContext=e.On,exports.put=e.nn,exports.putWithContext=e.rn,exports.queryParamsFromUrl=e.d,exports.removeConcept=e.y,exports.removeConcepts=e.b,exports.requestWebTokenSession=e.gn,exports.resolveBearerToken=e.Xn,exports.resolveNoAutoAuthentication=e.kn,exports.resolveNoAutoAuthenticationWithContext=e.An,exports.resolveOAuthProvider=e.Zn,exports.resolveSAMLProvider=e.Qn,exports.resolveToColumnName=e.qt,exports.resultPages=e.Pt,exports.rewriteText=e.x,exports.saveUserSettings=e.J,exports.searchPrincipals=e.tt,exports.setGlobalConfig=e.Kn,exports.setToken=e.Pn,exports.sha512=e.Nt,exports.suggestionsToTreeAggregationNodes=e.D,exports.sysLang=e.n,exports.toDate=e.Zt,exports.translateAggregationToDateOptions=e.O,exports.tryAutoAuthentication=e.mn,exports.tryOAuthAuthentication=e.wn,exports.trySAMLAuthentication=e.Cn,exports.updateContainer=e.U,Object.defineProperty(exports,"warn",{enumerable:!0,get:function(){return e.ir}}),exports.withRetry=e.Jt;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-BcyahlCg.cjs");exports.API=e.ft,exports.ApiError=e.Vn,exports.Audit=e.Tt,exports.AuditEventType=e.Qt,exports.AuthMode=e.Qn,exports.DEFAULT_AGGREGATION_COUNT=e.en,exports.DidYouMeanKind=e.Jt,exports.EngineType=e.Zt,exports.EngineTypeModifier=e.Xt,exports.LogLevel=e.ir,exports.MINIMUM_COMPATIBLE_SERVER_API_VERSION=e.Yt,exports.RFMDisplay=e.qt,exports.ServerError=e.Rn,exports.TimeoutError=e.jn,exports.UnauthorizedError=e.Bn,exports.addAuditAdditionalInfo=e.Et,exports.addConcepts=e.b,exports.addSessionId=e.Dt,exports.addUrl=e.Ot,exports.aggItemRegex=e.D,exports.aggregationHasMore=e.tn,exports.aggregationItemStrictCompare=e.O,exports.appInitializerFn=e.rn,exports.applyConfig=e.Yn,exports.assertNever=e.Sn,exports.bisect=e.E,exports.buildPathsAndLevels=e.lt,exports.clearSessionTokens=e.hn,exports.configureLogger=e.ar,exports.createAtomicClient=e.N,exports.createContainer=e.V,exports.createHeaders=e.Hn,exports.createHeadersWithContext=e.Un,exports.createTimeoutController=e.An,exports.createUserProfile=e.I,Object.defineProperty(exports,"debug",{enumerable:!0,get:function(){return e.or}}),exports.del=e.dn,exports.delWithContext=e.fn,exports.deleteContainerDocuments=e.H,exports.deleteContainers=e.U,exports.deleteUserProfileProperty=e.L,exports.deleteUserSettings=e.Y,exports.deleteWebTokenCookie=e._n,exports.detectAuthMode=e.Dn,exports.emitAuthenticatedEvent=e.Gn,Object.defineProperty(exports,"error",{enumerable:!0,get:function(){return e.sr}}),exports.escapeExpr=e.kt,exports.expiresSoon=e.n,exports.extraColumns=e.Gt,exports.fetchAggregation=e.wt,exports.fetchApp=e.in,exports.fetchAppPreLogin=e.an,exports.fetchBulkQuery=e.ut,exports.fetchChangePassword=e.J,exports.fetchDataset=e.xt,exports.fetchDatasetList=e.St,exports.fetchDatasets=e.Ct,exports.fetchLabels=e.yt,exports.fetchPreview=e._t,exports.fetchPreviewUrl=e.vt,exports.fetchPrincipal=e.pt,exports.fetchPrincipalList=e.mt,exports.fetchPrincipalUserid=e.ht,exports.fetchPrincipalUserids=e.gt,exports.fetchQuery=e.dt,exports.fetchQueryExport=e.ct,exports.fetchQueryIntent=e.st,exports.fetchSendPasswordResetEmail=e.B,exports.fetchSimilarDocuments=e.at,exports.fetchSponsoredLinks=e.it,exports.fetchSuggest=e.et,exports.fetchSuggestField=e.tt,exports.fetchSuggestQuery=e.nt,exports.fetchTextChunks=e.$,exports.fetchUserProfile=e.R,exports.fetchUserSettings=e.X,exports.fetchVersion=e.F,exports.filter=e.Ut,exports.get=e.Tn,exports.getConcepts=e.x,exports.getContainer=e.W,exports.getCsrfToken=e.wn,exports.getDefaultClient=e.P,exports.getFiltersFromURI=e.s,exports.getFiltersFromUrl=e.c,exports.getHelpIndexUrl=e.a,exports.getIdFromUrl=e.l,exports.getJWToken=e.bn,exports.getMetadata=e.Vt,exports.getMetadataWithValues=e.Ht,exports.getOffsetFromDates=e.v,exports.getQueryPageFromUrl=e.u,exports.getQueryParamsFromUrl=e.d,exports.getQueryTabFromUrl=e.f,exports.getQueryTextFromUrl=e.p,exports.getRelativeDate=e.y,exports.getTime=e.At,exports.getToken=e.Wn,exports.getUrlParamsFromQueryParams=e.m,exports.getWithContext=e.En,exports.globalConfig=e.Xn,exports.guid=e.jt,exports.handleResponse=e.In,exports.handleResponseWithContext=e.Ln,exports.hasSession=e.Cn,exports.hashString=e.Mt,Object.defineProperty(exports,"info",{enumerable:!0,get:function(){return e.cr}}),exports.initializeAppConfig=e.on,exports.isArrayBuffer=e.Nt,exports.isAuthenticated=e.pn,exports.isBlob=e.Pt,exports.isDate=e.Ft,exports.isExpired=e.r,exports.isExternalAuthMode=e.$n,exports.isJsonable=e.It,exports.isNotInputEvent=e._,exports.isObject=e.Lt,exports.isRedirectPending=e.mn,exports.isString=e.Rt,exports.labels=e.bt,exports.legacyBooleansToAuthMode=e.er,exports.legacyFilterToFilter=e.Wt,exports.listContainerDocuments=e.G,exports.listContainers=e.K,exports.login=e.vn,exports.logout=e.gn,exports.makeColumn=e.Kt,exports.notify=e.g,exports.onAuthEvent=e.ur,exports.openParentNodes=e.k,exports.parseText=e.S,exports.parseValueAndOperatorFromItem=e.A,exports.patch=e.ln,exports.patchUserProfile=e.z,exports.patchUserSettings=e.Z,exports.patchWithContext=e.un,exports.post=e.Mn,exports.postWithContext=e.Nn,exports.put=e.sn,exports.putWithContext=e.cn,exports.queryParamsFromUrl=e.h,exports.removeConcept=e.C,exports.removeConcepts=e.w,exports.requestWebTokenSession=e.xn,exports.resolveAggregationCount=e.nn,exports.resolveBearerToken=e.tr,exports.resolveNoAutoAuthentication=e.Pn,exports.resolveNoAutoAuthenticationWithContext=e.Fn,exports.resolveOAuthProvider=e.nr,exports.resolveSAMLProvider=e.rr,exports.resolveToColumnName=e.$t,exports.resultPages=e.Bt,exports.rewriteText=e.T,exports.saveUserSettings=e.Q,exports.searchPrincipals=e.ot,exports.setGlobalConfig=e.Zn,exports.setToken=e.zn,exports.sha512=e.zt,exports.suggestionsToTreeAggregationNodes=e.j,exports.sysLang=e.o,exports.toDate=e.i,exports.toSqlValue=e.rt,exports.translateAggregationToDateOptions=e.M,exports.tryAutoAuthentication=e.yn,exports.tryOAuthAuthentication=e.kn,exports.trySAMLAuthentication=e.On,exports.updateContainer=e.q,Object.defineProperty(exports,"warn",{enumerable:!0,get:function(){return e.lr}}),exports.withRetry=e.t;
package/dist/atomic.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as e, $n as t, $t as n, A as r, An as i, At as a, B as o, Bn as s, Bt as c, C as l, Cn as u, Ct as d, D as f, Dn as p, Dt as m, E as h, En as g, Et as _, F as v, Fn as y, Ft as b, G as x, Gn as S, Gt as C, H as w, Ht as T, I as E, In as D, It as O, J as k, Jn as A, Jt as j, K as M, Kn as N, Kt as P, L as F, Ln as I, Lt as L, M as R, Mn as z, Mt as B, N as V, Nn as H, Nt as U, O as W, On as G, Ot as K, P as q, Pn as J, Pt as Y, Q as X, Qn as Z, Qt as Q, R as $, Rn as ee, Rt as te, S as ne, Sn as re, St as ie, T as ae, Tn as oe, Tt as se, U as ce, Ut as le, V as ue, Vt as de, W as fe, Wn as pe, Wt as me, X as he, Xn as ge, Xt as _e, Y as ve, Yn as ye, Yt as be, Z as xe, Zn as Se, Zt as Ce, _ as we, _n as Te, _t as Ee, a as De, an as Oe, ar as ke, at as Ae, b as je, bn as Me, bt as Ne, c as Pe, cn as Fe, ct as Ie, d as Le, dn as Re, dt as ze, en as Be, er as Ve, et as He, f as Ue, fn as We, ft as Ge, g as Ke, gn as qe, gt as Je, h as Ye, hn as Xe, ht as Ze, i as Qe, in as $e, ir as et, it as tt, j as nt, jn as rt, jt as it, k as at, kn as ot, kt as st, l as ct, ln as lt, lt as ut, m as dt, mn as ft, mt as pt, n as mt, nn as ht, nr as gt, nt as _t, o as vt, on as yt, ot as bt, p as xt, pn as St, pt as Ct, q as wt, qn as Tt, qt as Et, r as Dt, rn as Ot, rr as kt, rt as At, s as jt, sn as Mt, st as Nt, t as Pt, tn as Ft, tr as It, tt as Lt, u as Rt, un as zt, ut as Bt, v as Vt, vn as Ht, vt as Ut, w as Wt, wn as Gt, wt as Kt, x as qt, xn as Jt, xt as Yt, y as Xt, yn as Zt, yt as Qt, z as $t, zn as en, zt as tn } from "./src-QHeKpRHd.js";
2
- export { Nt as API, D as ApiError, Ne as Audit, P as AuditEventType, Tt as AuthMode, T as DidYouMeanKind, C as EngineType, me as EngineTypeModifier, t as LogLevel, le as MINIMUM_COMPATIBLE_SERVER_API_VERSION, de as RFMDisplay, H as ServerError, g as TimeoutError, y as UnauthorizedError, Yt as addAuditAdditionalInfo, Ke as addConcepts, ie as addSessionId, d as addUrl, l as aggItemRegex, Wt as aggregationItemStrictCompare, Q as appInitializerFn, pe as applyConfig, Te as assertNever, ne as bisect, tt as buildPathsAndLevels, zt as clearSessionTokens, Ve as configureLogger, at as createAtomicClient, F as createContainer, I as createHeaders, ee as createHeadersWithContext, oe as createTimeoutController, R as createUserProfile, It as debug, yt as del, Mt as delWithContext, $ as deleteContainerDocuments, $t as deleteContainers, V as deleteUserProfileProperty, x as deleteUserSettings, We as deleteWebTokenCookie, re as detectAuthMode, s as emitAuthenticatedEvent, gt as error, Kt as escapeExpr, be as expiresSoon, tn as extraColumns, Qt as fetchAggregation, n as fetchApp, Be as fetchAppPreLogin, Ae as fetchBulkQuery, fe as fetchChangePassword, Je as fetchDataset, Ee as fetchDatasetList, Ut as fetchDatasets, pt as fetchLabels, Ge as fetchPreview, Ct as fetchPreviewUrl, Ie as fetchPrincipal, ut as fetchPrincipalList, Bt as fetchPrincipalUserid, ze as fetchPrincipalUserids, bt as fetchQuery, At as fetchQueryExport, _t as fetchQueryIntent, E as fetchSendPasswordResetEmail, He as fetchSimilarDocuments, e as fetchSponsoredLinks, he as fetchSuggest, xe as fetchSuggestField, X as fetchSuggestQuery, ve as fetchTextChunks, q as fetchUserProfile, M as fetchUserSettings, nt as fetchVersion, L as filter, Me as get, we as getConcepts, o as getContainer, Zt as getCsrfToken, r as getDefaultClient, Dt as getFiltersFromURI, Qe as getFiltersFromUrl, Pt as getHelpIndexUrl, De as getIdFromUrl, Xe as getJWToken, b as getMetadata, O as getMetadataWithValues, dt as getOffsetFromDates, vt as getQueryPageFromUrl, jt as getQueryParamsFromUrl, Pe as getQueryTabFromUrl, ct as getQueryTextFromUrl, Ye as getRelativeDate, se as getTime, en as getToken, Rt as getUrlParamsFromQueryParams, Jt as getWithContext, S as globalConfig, _ as guid, rt as handleResponse, z as handleResponseWithContext, Ht as hasSession, kt as info, Ft as initializeAppConfig, m as isArrayBuffer, Fe as isAuthenticated, K as isBlob, st as isDate, _e as isExpired, A as isExternalAuthMode, a as isJsonable, xt as isNotInputEvent, it as isObject, lt as isRedirectPending, B as isString, Ze as labels, ye as legacyBooleansToAuthMode, te as legacyFilterToFilter, ue as listContainerDocuments, w as listContainers, St as login, Re as logout, c as makeColumn, Ue as notify, ke as onAuthEvent, ae as openParentNodes, Vt as parseText, h as parseValueAndOperatorFromItem, $e as patch, v as patchUserProfile, wt as patchUserSettings, Oe as patchWithContext, p as post, G as postWithContext, ht as put, Ot as putWithContext, Le as queryParamsFromUrl, Xt as removeConcept, je as removeConcepts, qe as requestWebTokenSession, ge as resolveBearerToken, ot as resolveNoAutoAuthentication, i as resolveNoAutoAuthenticationWithContext, Se as resolveOAuthProvider, Z as resolveSAMLProvider, Et as resolveToColumnName, Y as resultPages, qt as rewriteText, k as saveUserSettings, Lt as searchPrincipals, N as setGlobalConfig, J as setToken, U as sha512, f as suggestionsToTreeAggregationNodes, mt as sysLang, Ce as toDate, W as translateAggregationToDateOptions, ft as tryAutoAuthentication, Gt as tryOAuthAuthentication, u as trySAMLAuthentication, ce as updateContainer, et as warn, j as withRetry };
1
+ import { $ as e, $n as t, $t as n, A as r, An as i, At as a, B as o, Bn as s, Bt as c, C as l, Cn as u, Ct as d, D as f, Dn as p, Dt as m, E as h, En as g, Et as _, F as v, Fn as y, Ft as b, G as x, Gn as S, Gt as C, H as w, Hn as T, Ht as E, I as D, In as O, It as k, J as A, Jt as j, K as M, Kt as N, L as P, Ln as F, Lt as I, M as L, Mn as R, Mt as z, N as B, Nn as V, Nt as H, O as U, On as W, Ot as G, P as K, Pn as q, Pt as J, Q as Y, Qn as X, Qt as Z, R as Q, Rn as $, Rt as ee, S as te, Sn as ne, St as re, T as ie, Tn as ae, Tt as oe, U as se, Un as ce, Ut as le, V as ue, Vn as de, Vt as fe, W as pe, Wn as me, Wt as he, X as ge, Xn as _e, Xt as ve, Y as ye, Yn as be, Yt as xe, Z as Se, Zn as Ce, Zt as we, _ as Te, _n as Ee, _t as De, a as Oe, an as ke, ar as Ae, at as je, b as Me, bn as Ne, bt as Pe, c as Fe, cn as Ie, cr as Le, ct as Re, d as ze, dn as Be, dt as Ve, en as He, er as Ue, et as We, f as Ge, fn as Ke, ft as qe, g as Je, gn as Ye, gt as Xe, h as Ze, hn as Qe, ht as $e, i as et, in as tt, ir as nt, it as rt, j as it, jn as at, jt as ot, k as st, kn as ct, kt as lt, l as ut, ln as dt, lr as ft, lt as pt, m as mt, mn as ht, mt as gt, n as _t, nn as vt, nr as yt, nt as bt, o as xt, on as St, or as Ct, ot as wt, p as Tt, pn as Et, pt as Dt, q as Ot, qt as kt, r as At, rn as jt, rr as Mt, rt as Nt, s as Pt, sn as Ft, sr as It, st as Lt, t as Rt, tn as zt, tr as Bt, tt as Vt, u as Ht, un as Ut, ur as Wt, ut as Gt, v as Kt, vn as qt, vt as Jt, w as Yt, wn as Xt, wt as Zt, x as Qt, xn as $t, xt as en, y as tn, yn as nn, yt as rn, z as an, zn as on, zt as sn } from "./src-vDryIxd0.js";
2
+ export { qe as API, de as ApiError, oe as Audit, Z as AuditEventType, X as AuthMode, He as DEFAULT_AGGREGATION_COUNT, j as DidYouMeanKind, we as EngineType, ve as EngineTypeModifier, nt as LogLevel, xe as MINIMUM_COMPATIBLE_SERVER_API_VERSION, kt as RFMDisplay, $ as ServerError, at as TimeoutError, s as UnauthorizedError, _ as addAuditAdditionalInfo, Me as addConcepts, m as addSessionId, G as addUrl, f as aggItemRegex, zt as aggregationHasMore, U as aggregationItemStrictCompare, jt as appInitializerFn, be as applyConfig, ne as assertNever, h as bisect, pt as buildPathsAndLevels, Qe as clearSessionTokens, Ae as configureLogger, B as createAtomicClient, ue as createContainer, T as createHeaders, ce as createHeadersWithContext, i as createTimeoutController, D as createUserProfile, Ct as debug, Be as del, Ke as delWithContext, w as deleteContainerDocuments, se as deleteContainers, P as deleteUserProfileProperty, ye as deleteUserSettings, Ee as deleteWebTokenCookie, p as detectAuthMode, S as emitAuthenticatedEvent, It as error, lt as escapeExpr, _t as expiresSoon, C as extraColumns, Zt as fetchAggregation, tt as fetchApp, ke as fetchAppPreLogin, Gt as fetchBulkQuery, A as fetchChangePassword, en as fetchDataset, re as fetchDatasetList, d as fetchDatasets, rn as fetchLabels, De as fetchPreview, Jt as fetchPreviewUrl, Dt as fetchPrincipal, gt as fetchPrincipalList, $e as fetchPrincipalUserid, Xe as fetchPrincipalUserids, Ve as fetchQuery, Re as fetchQueryExport, Lt as fetchQueryIntent, o as fetchSendPasswordResetEmail, je as fetchSimilarDocuments, rt as fetchSponsoredLinks, We as fetchSuggest, Vt as fetchSuggestField, bt as fetchSuggestQuery, e as fetchTextChunks, Q as fetchUserProfile, ge as fetchUserSettings, v as fetchVersion, le as filter, ae as get, Qt as getConcepts, pe as getContainer, Xt as getCsrfToken, K as getDefaultClient, Pt as getFiltersFromURI, Fe as getFiltersFromUrl, Oe as getHelpIndexUrl, ut as getIdFromUrl, Ne as getJWToken, fe as getMetadata, E as getMetadataWithValues, Kt as getOffsetFromDates, Ht as getQueryPageFromUrl, ze as getQueryParamsFromUrl, Ge as getQueryTabFromUrl, Tt as getQueryTextFromUrl, tn as getRelativeDate, a as getTime, me as getToken, mt as getUrlParamsFromQueryParams, g as getWithContext, _e as globalConfig, ot as guid, O as handleResponse, F as handleResponseWithContext, u as hasSession, z as hashString, Le as info, St as initializeAppConfig, H as isArrayBuffer, Et as isAuthenticated, J as isBlob, b as isDate, At as isExpired, t as isExternalAuthMode, k as isJsonable, Te as isNotInputEvent, I as isObject, ht as isRedirectPending, ee as isString, Pe as labels, Ue as legacyBooleansToAuthMode, he as legacyFilterToFilter, x as listContainerDocuments, M as listContainers, qt as login, Ye as logout, N as makeColumn, Je as notify, Wt as onAuthEvent, st as openParentNodes, te as parseText, r as parseValueAndOperatorFromItem, dt as patch, an as patchUserProfile, Se as patchUserSettings, Ut as patchWithContext, R as post, V as postWithContext, Ft as put, Ie as putWithContext, Ze as queryParamsFromUrl, l as removeConcept, Yt as removeConcepts, $t as requestWebTokenSession, vt as resolveAggregationCount, Bt as resolveBearerToken, q as resolveNoAutoAuthentication, y as resolveNoAutoAuthenticationWithContext, yt as resolveOAuthProvider, Mt as resolveSAMLProvider, n as resolveToColumnName, c as resultPages, ie as rewriteText, Y as saveUserSettings, wt as searchPrincipals, Ce as setGlobalConfig, on as setToken, sn as sha512, it as suggestionsToTreeAggregationNodes, xt as sysLang, et as toDate, Nt as toSqlValue, L as translateAggregationToDateOptions, nn as tryAutoAuthentication, ct as tryOAuthAuthentication, W as trySAMLAuthentication, Ot as updateContainer, ft as warn, Rt as withRetry };
@@ -29,8 +29,8 @@ export declare function createApi(ctx: AtomicContext): {
29
29
  }, signal?: AbortSignal | undefined) => Promise<import("..").SecurityPrincipalSearchResponse>;
30
30
  };
31
31
  query: {
32
- search: (query: import("..").Query, audit?: import("..").AuditEvents | undefined, queryIntentData?: import("..").QueryIntentData | undefined) => Promise<import("..").Result>;
33
- bulk: (queries: import("..").Query[], mode?: "parallel" | undefined, auditEvents?: import("..").AuditEvents | undefined) => Promise<import("..").Result[]>;
32
+ search: (query: import("..").Query, audit?: import("..").AuditEvents | undefined, queryIntentData?: import("..").QueryIntentData | undefined) => Promise<import("..").Result & import("..").ResultPages>;
33
+ bulk: (queries: import("..").Query[], mode?: "parallel" | undefined, auditEvents?: import("..").AuditEvents | undefined) => Promise<(import("..").Result & import("..").ResultPages)[]>;
34
34
  intent: (query: import("..").Query) => Promise<import("..").QueryIntentMatch[]>;
35
35
  export: (args_0: {
36
36
  model: import("..").ExportQueryModel;
@@ -38,7 +38,7 @@ export declare function createApi(ctx: AtomicContext): {
38
38
  query: import("..").Query;
39
39
  article?: import("..").Article;
40
40
  }) => Promise<Response>;
41
- aggregate: (aggregation: import("..").Aggregation, query: import("..").Query, audit?: import("..").AuditEvents | undefined) => Promise<import("..").Aggregation>;
41
+ aggregate: (aggregation: import("..").Aggregation, query: import("..").Query, audit?: import("..").AuditEvents | undefined, count?: number | undefined) => Promise<import("..").Aggregation>;
42
42
  sponsoredLinks: (webservice: string, query: import("..").Query) => Promise<import("..").LinkResult[]>;
43
43
  similarDocuments: (documentId: string, queryName: string, signal?: AbortSignal | undefined) => Promise<import("..").Article[]>;
44
44
  };
@@ -100,7 +100,7 @@ export declare function createApi(ctx: AtomicContext): {
100
100
  };
101
101
  password: {
102
102
  change: (newPassword: string, currentPassword?: string | undefined) => Promise<import("..").ChangePasswordResponse>;
103
- sendResetEmail: (userName: string) => Promise<import("..").PasswordResetEmailResponse>;
103
+ sendResetEmail: (userName: string, changePasswordRedirectUrl?: string | undefined) => Promise<import("..").PasswordResetEmailResponse>;
104
104
  };
105
105
  version: () => Promise<import("..").VersionResponse>;
106
106
  };
@@ -43,8 +43,8 @@ export declare const AuthMode: {
43
43
  * @param token - The Sinequa access token, sent as `Authorization: Bearer <token>`.
44
44
  * @param options.sessionCookie - Whether to also open a **server session** by exchanging the token
45
45
  * through `security.webtoken` (`tokenInCookie`). Defaults to `true`, and a server that refuses
46
- * the exchange falls back to the header alone — see {@link AuthMode} and the `bearer` section of
47
- * `docs/authentication/auth-mode.md`. Pass `false` for a headless, server-to-server consumer:
46
+ * the exchange falls back to the header alone — see {@link AuthMode} and `docs/auth/bearer.mdx`.
47
+ * Pass `false` for a headless, server-to-server consumer:
48
48
  * there is no browser to load anything on its own, so the roundtrip buys nothing.
49
49
  */
50
50
  readonly bearer: (token: string, options?: {
@@ -1,4 +1,5 @@
1
- import type { LogLevel } from "../utils";
1
+ import type { AggregationCounts } from "../helpers/aggregation-count";
2
+ import { type LogLevel } from "../utils/logger";
2
3
  import { type AuthMode as AuthModeType } from "./auth-mode";
3
4
  import type { AuthOptions } from "./auth-options";
4
5
  /**
@@ -16,7 +17,6 @@ export type AppGlobalConfig<T extends Record<string, unknown> = {}> = {
16
17
  autoOAuthProvider: string;
17
18
  autoSAMLProvider: string;
18
19
  bearerToken: string;
19
- loginPath: string;
20
20
  userOverride: {
21
21
  username: string;
22
22
  domain: string;
@@ -31,13 +31,44 @@ export type AppGlobalConfig<T extends Record<string, unknown> = {}> = {
31
31
  * when not configured, so the server keeps applying its own default.
32
32
  */
33
33
  uiLanguage: string;
34
+ /**
35
+ * The number of values the server returns per aggregation, keyed by aggregation name — the
36
+ * administrator's `CCAggregation.count`, which no query response repeats.
37
+ *
38
+ * Declare it (typically once at start-up, from `api.app.get()`) so `$hasMore` is computed against
39
+ * the real page size. Aggregations left out fall back to
40
+ * {@link DEFAULT_AGGREGATION_COUNT}. @see AggregationCounts
41
+ */
42
+ aggregationCounts: AggregationCounts;
34
43
  /** @deprecated Derived read-only getter computed from {@link authMode}. */
35
44
  useCredentials: boolean;
36
45
  /** @deprecated Derived read-only getter computed from {@link authMode}. */
37
46
  useSSO: boolean;
38
47
  /** @deprecated Derived read-only getter computed from {@link authMode}. */
39
48
  useSAML: boolean;
49
+ /**
50
+ * Verbosity of the library logger, applied by {@link setGlobalConfig}.
51
+ *
52
+ * It used to be declared, defaulted, and read by nothing — so an application that set it got
53
+ * silence, and the comment here described a boolean ("when true, the application logs more
54
+ * information") for a value that was never one. `setGlobalConfig({ logLevel })` now forwards to
55
+ * `configureLogger({ level })`.
56
+ *
57
+ * A client created with `createAtomicClient` does **not** apply it: the library logger is
58
+ * process-wide, so a second client repointing it would silence the first. Inject `auth.logger`
59
+ * per client instead.
60
+ */
40
61
  logLevel: LogLevel;
62
+ /**
63
+ * @deprecated Read by nothing in this library. Routing belongs to the application: react to the
64
+ * `unauthorized` event, or configure `auth.recoverFromUnauthorized`. It will stop being declared
65
+ * in the next major.
66
+ */
67
+ loginPath: string;
68
+ /**
69
+ * @deprecated Read by nothing in this library, and always has been. It will stop being declared in
70
+ * the next major.
71
+ */
41
72
  createRoutes: boolean;
42
73
  } & T;
43
74
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"global.config.d.ts","sourceRoot":"","sources":["../../src/configurations/global.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEL,KAAK,QAAQ,IAAI,YAAY,EAE9B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,YAAY,CAAC;IACvB,sGAAsG;IACtG,IAAI,EAAE,WAAW,CAAC;IAClB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,cAAc,EAAE,OAAO,CAAC;IACxB,2EAA2E;IAC3E,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,CAAC,CAAC;AAEN;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAIpE,CAAC;AAsCF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzD,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzD,IAAI,CAwBN;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"global.config.d.ts","sourceRoot":"","sources":["../../src/configurations/global.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAEL,KAAK,QAAQ,IAAI,YAAY,EAE9B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,YAAY,CAAC;IACvB,sGAAsG;IACtG,IAAI,EAAE,WAAW,CAAC;IAClB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,2EAA2E;IAC3E,cAAc,EAAE,OAAO,CAAC;IACxB,2EAA2E;IAC3E,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,CAAC,CAAC;AAEN;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAIpE,CAAC;AAsCF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzD,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzD,IAAI,CAwBN;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { Aggregation, Query } from "../types";
2
+ /**
3
+ * Page size assumed for an aggregation when nothing declares one.
4
+ *
5
+ * It mirrors the value the Sinequa administration proposes for
6
+ * [CCAggregation.count]{@link CCAggregation#count}, and it is a **fallback, not a fact**: a query
7
+ * web service configured with another count answers exactly the same way, so there is nothing in the
8
+ * response that would let the client notice. Declare the real sizes with
9
+ * {@link AggregationCounts} to get `$hasMore` right on those aggregations.
10
+ */
11
+ export declare const DEFAULT_AGGREGATION_COUNT = 10;
12
+ /**
13
+ * The number of values the server returns per aggregation, keyed by aggregation name.
14
+ *
15
+ * This is the administrator's decision — [CCAggregation.count]{@link CCAggregation#count}, *the
16
+ * maximum number of values to retrieve* — and the query response does not repeat it. An application
17
+ * that reads the configuration once at start-up can hand it over, and the whole library then sizes
18
+ * `$hasMore` and aggregation paging against the real values:
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const app = await client.api.app.get();
23
+ * client.configure({
24
+ * aggregationCounts: Object.fromEntries(
25
+ * app.queries["_query"].aggregations.map((a) => [a.name, a.count]),
26
+ * ),
27
+ * });
28
+ * ```
29
+ */
30
+ export type AggregationCounts = Record<string, number>;
31
+ /**
32
+ * The number of values the server was asked for, for one aggregation.
33
+ *
34
+ * No field of the response carries it, so it is reconstructed from the most specific source
35
+ * available:
36
+ *
37
+ * 1. `query.aggregations[name].count` — what *this* call explicitly requested, as an
38
+ * `action: "aggregate"` page does;
39
+ * 2. `counts[name]` — what the application declared once from the app configuration
40
+ * (see {@link AggregationCounts});
41
+ * 3. {@link DEFAULT_AGGREGATION_COUNT}, when nothing is known.
42
+ *
43
+ * @param name - The name of the aggregation.
44
+ * @param query - The query the aggregation came back from, if any.
45
+ * @param counts - The declared page sizes, if any.
46
+ * @returns The count to compare the received items against.
47
+ */
48
+ export declare function resolveAggregationCount(name: string, query?: Pick<Query, "aggregations">, counts?: AggregationCounts): number;
49
+ /**
50
+ * Whether more values remain to be fetched for an aggregation.
51
+ *
52
+ * The response has no "total values" field. Instead, **when values remain the server returns one
53
+ * item beyond the `count` it was asked for**: ask for 10 and you receive 11, the eleventh being a
54
+ * sentinel that means "there is more". That extra item is the only signal available, so the test is
55
+ * `items.length > count` — and never an equality, which would only ever hold for one particular
56
+ * configured count and leave every other facet silently claiming it is complete.
57
+ *
58
+ * Distributions and trees always report `false`, deliberately: paging a bucket list, or a level of a
59
+ * hierarchy (`action: "open"`), is not the same operation as paging a flat list of values.
60
+ *
61
+ * @param aggregation - The aggregation returned by the server.
62
+ * @param count - The number of values that were requested. @see resolveAggregationCount
63
+ * @returns Whether the aggregation has more values on the server.
64
+ */
65
+ export declare function aggregationHasMore(aggregation: Pick<Aggregation, "isDistribution" | "isTree"> & {
66
+ items?: Aggregation["items"];
67
+ }, count: number): boolean;
68
+ //# sourceMappingURL=aggregation-count.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregation-count.d.ts","sourceRoot":"","sources":["../../src/helpers/aggregation-count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAoBvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,EACnC,MAAM,CAAC,EAAE,iBAAiB,GACzB,MAAM,CAQR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,gBAAgB,GAAG,QAAQ,CAAC,GAAG;IAC5D,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC9B,EACD,KAAK,EAAE,MAAM,GACZ,OAAO,CAKT"}