@viu/emporix-sdk 4.5.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @viu/emporix-sdk
2
2
 
3
+ ## 4.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#404](https://github.com/viuteam/emporix-sdk/pull/404) [`9570c99`](https://github.com/viuteam/emporix-sdk/commit/9570c9932f393c695c593fe31f2a7c0bfda24c06) Thanks [@viu-release-bot](https://github.com/apps/viu-release-bot)! - chore(sdk): sync generated types with upstream Emporix API specs
8
+
9
+ Updated services: quote
10
+
11
+ ## 4.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#402](https://github.com/viuteam/emporix-sdk/pull/402) [`fbd96d3`](https://github.com/viuteam/emporix-sdk/commit/fbd96d37877324e99a4ea000dcbc93b1cce55a4f) Thanks [@amnael1](https://github.com/amnael1)! - feat(sdk): add search index export and import
16
+
17
+ `client.search.exportIndexes(selections)` packs the configuration of the selected search indexes, and `client.search.importIndexes(pkg)` creates or updates each of them, typically on another tenant, resolving to one result per index with the build job's id when one started. The import is not atomic: indexes before a failing one stay written. `upsertIndex` no longer needs `metadata.version` on an update; when sent, it still guards against a stale write with `409`.
18
+
3
19
  ## 4.5.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1244,7 +1244,7 @@ var HttpClient = class {
1244
1244
  };
1245
1245
 
1246
1246
  // package.json
1247
- var version = "4.5.0";
1247
+ var version = "4.6.1";
1248
1248
 
1249
1249
  // src/version.ts
1250
1250
  var SDK_VERSION = version;
@@ -8576,8 +8576,9 @@ var SearchService = class {
8576
8576
  * index is `ready` and its fields are unchanged; `name` and `description`
8577
8577
  * still change then. Track the job with {@link getJob}.
8578
8578
  *
8579
- * An update needs the stored `metadata.version` (`400` without it). `409`
8580
- * means a job for this index is already running, or the version is stale.
8579
+ * `metadata.version` is optional on an update too. When sent, it is an
8580
+ * optimistic lock: a stale one answers `409`, as does a job that is already
8581
+ * running for this index.
8581
8582
  */
8582
8583
  async upsertIndex(type, id, input, auth2 = SERVICE29) {
8583
8584
  return this.ctx.http.request({
@@ -8598,6 +8599,41 @@ var SearchService = class {
8598
8599
  auth: auth2
8599
8600
  });
8600
8601
  }
8602
+ /**
8603
+ * Export the configuration of the selected indexes as one package, to be
8604
+ * imported on another tenant with {@link importIndexes}. The decoded `data`
8605
+ * holds `id`, `type`, `fields` and the optional `name` and `description` of
8606
+ * each index, not its `status` or `metadata`. `404` when a selected index does
8607
+ * not exist, `400` for an empty selection.
8608
+ */
8609
+ async exportIndexes(selections, auth2 = SERVICE29) {
8610
+ return this.ctx.http.request({
8611
+ method: "POST",
8612
+ path: `${this.base()}/search/indexes/export`,
8613
+ auth: auth2,
8614
+ body: selections,
8615
+ idempotent: true
8616
+ // pure read over POST — safe to replay on 5xx/429
8617
+ });
8618
+ }
8619
+ /**
8620
+ * Create or update every index in a package from {@link exportIndexes}, with
8621
+ * the same checks as {@link upsertIndex}. Resolves to one result per index,
8622
+ * in package order; `jobId` and `jobType` are absent for a ready index whose
8623
+ * fields did not change.
8624
+ *
8625
+ * Not atomic: when an index fails, the ones before it stay created or updated
8626
+ * and the call throws that index's error — `400` for an unreadable package or
8627
+ * an invalid field, `409` for a running job or a stale `metadata.version`.
8628
+ */
8629
+ async importIndexes(pkg, auth2 = SERVICE29) {
8630
+ return this.ctx.http.request({
8631
+ method: "POST",
8632
+ path: `${this.base()}/search/indexes/import`,
8633
+ auth: auth2,
8634
+ body: pkg
8635
+ });
8636
+ }
8601
8637
  /** List index jobs of the tenant. */
8602
8638
  async listJobs(opts = {}, auth2 = SERVICE29) {
8603
8639
  const { query, page } = pageQuery(opts);