@viu/emporix-sdk 3.4.1 → 3.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.
package/dist/index.d.cts CHANGED
@@ -3765,6 +3765,10 @@ type AgentTrigger = {
3765
3765
  */
3766
3766
  events: string;
3767
3767
  filter?: CommerceEventTriggerFilter;
3768
+ /**
3769
+ * Optional IAM scopes used to obtain an Emporix token when the agent runs from a Commerce Event. When omitted or empty, the agent does not receive `emporix-token`. Each value must be a scope the caller is allowed to grant.
3770
+ */
3771
+ eventScopes?: Array<string>;
3768
3772
  };
3769
3773
  };
3770
3774
  /**
@@ -8810,7 +8814,7 @@ type IndexPublicConfiguration = {
8810
8814
  */
8811
8815
  type IndexConfiguration = IndexPublicConfiguration & {
8812
8816
  /**
8813
- * API key used for write purposes.
8817
+ * API key used for write purposes. For `BATTERY_INCLUDED`, this key is validated before the configuration is created or updated.
8814
8818
  */
8815
8819
  writeKey?: string;
8816
8820
  /**
@@ -8876,12 +8880,21 @@ interface ListReindexJobsOptions {
8876
8880
  pageSize?: number;
8877
8881
  /** Raw Emporix `q` filter string. */
8878
8882
  q?: string;
8883
+ /** Emporix sort syntax, e.g. `"metadata.createdAt:desc"`. */
8884
+ sort?: string;
8879
8885
  /** Ask for `X-Total-Count` — becomes a request header, not a query parameter. */
8880
8886
  totalCount?: boolean;
8881
8887
  }
8882
8888
  /**
8883
8889
  * Emporix Indexing Service (`/indexing/{tenant}/…`): search-index provider
8884
8890
  * configurations and reindex. Server-side; defaults to the service token.
8891
+ *
8892
+ * On the `BATTERY_INCLUDED` provider every write validates the stored
8893
+ * `indexName`/`writeKey` against the search backend *before* it takes effect:
8894
+ * invalid credentials fail with `400` and when that validation is itself
8895
+ * unreachable the call fails with `502`. Either way nothing is written — so a
8896
+ * `400` from these methods can mean the credentials are wrong rather than the
8897
+ * request body.
8885
8898
  */
8886
8899
  declare class IndexingService {
8887
8900
  private readonly ctx;
@@ -8892,9 +8905,9 @@ declare class IndexingService {
8892
8905
  listConfigurations(auth?: AuthContext): Promise<IndexConfig[]>;
8893
8906
  /** Get a configuration by provider name. */
8894
8907
  getConfiguration(provider: string, auth?: AuthContext): Promise<IndexConfig>;
8895
- /** Create a configuration. */
8908
+ /** Create a configuration. Nothing is stored if credential validation fails. */
8896
8909
  createConfiguration(input: IndexConfig, auth?: AuthContext): Promise<IndexConfigCreated>;
8897
- /** Update a configuration by provider name. */
8910
+ /** Update a configuration. Left unchanged if credential validation fails. */
8898
8911
  updateConfiguration(provider: string, input: IndexConfig, auth?: AuthContext): Promise<void>;
8899
8912
  /** Delete a configuration by provider name. */
8900
8913
  deleteConfiguration(provider: string, auth?: AuthContext): Promise<void>;
@@ -8907,6 +8920,9 @@ declare class IndexingService {
8907
8920
  * given `entityType`; set `rag: true` to also rebuild the RAG vector index
8908
8921
  * (PRODUCT only). Resolves to the created job (`201`) or, when a job for that
8909
8922
  * `entityType` is already `IN_PROGRESS`, that running job (`200`).
8923
+ *
8924
+ * On `BATTERY_INCLUDED` with `entityType: "PRODUCT"` the stored credentials
8925
+ * are validated first; no job is created on the `400`/`502` cases above.
8910
8926
  */
8911
8927
  createReindexJob(input: ReindexJobInput, auth?: AuthContext): Promise<ReindexJob>;
8912
8928
  /** List reindex jobs (paginated). */
@@ -8914,7 +8930,8 @@ declare class IndexingService {
8914
8930
  /** Fetch one reindex job by id. */
8915
8931
  getReindexJob(reindexJobId: string, auth?: AuthContext): Promise<ReindexJob>;
8916
8932
  /**
8917
- * Trigger a reindex.
8933
+ * Trigger a reindex. On `BATTERY_INCLUDED` the same credential validation
8934
+ * runs first, so this can fail with `400`/`502` before any job starts.
8918
8935
  * @deprecated since 2026-06-18, removal 2026-12-01 — use {@link createReindexJob}
8919
8936
  * (`createReindexJob({ entityType: "PRODUCT" })`), which returns a trackable job.
8920
8937
  */
package/dist/index.d.ts CHANGED
@@ -3765,6 +3765,10 @@ type AgentTrigger = {
3765
3765
  */
3766
3766
  events: string;
3767
3767
  filter?: CommerceEventTriggerFilter;
3768
+ /**
3769
+ * Optional IAM scopes used to obtain an Emporix token when the agent runs from a Commerce Event. When omitted or empty, the agent does not receive `emporix-token`. Each value must be a scope the caller is allowed to grant.
3770
+ */
3771
+ eventScopes?: Array<string>;
3768
3772
  };
3769
3773
  };
3770
3774
  /**
@@ -8810,7 +8814,7 @@ type IndexPublicConfiguration = {
8810
8814
  */
8811
8815
  type IndexConfiguration = IndexPublicConfiguration & {
8812
8816
  /**
8813
- * API key used for write purposes.
8817
+ * API key used for write purposes. For `BATTERY_INCLUDED`, this key is validated before the configuration is created or updated.
8814
8818
  */
8815
8819
  writeKey?: string;
8816
8820
  /**
@@ -8876,12 +8880,21 @@ interface ListReindexJobsOptions {
8876
8880
  pageSize?: number;
8877
8881
  /** Raw Emporix `q` filter string. */
8878
8882
  q?: string;
8883
+ /** Emporix sort syntax, e.g. `"metadata.createdAt:desc"`. */
8884
+ sort?: string;
8879
8885
  /** Ask for `X-Total-Count` — becomes a request header, not a query parameter. */
8880
8886
  totalCount?: boolean;
8881
8887
  }
8882
8888
  /**
8883
8889
  * Emporix Indexing Service (`/indexing/{tenant}/…`): search-index provider
8884
8890
  * configurations and reindex. Server-side; defaults to the service token.
8891
+ *
8892
+ * On the `BATTERY_INCLUDED` provider every write validates the stored
8893
+ * `indexName`/`writeKey` against the search backend *before* it takes effect:
8894
+ * invalid credentials fail with `400` and when that validation is itself
8895
+ * unreachable the call fails with `502`. Either way nothing is written — so a
8896
+ * `400` from these methods can mean the credentials are wrong rather than the
8897
+ * request body.
8885
8898
  */
8886
8899
  declare class IndexingService {
8887
8900
  private readonly ctx;
@@ -8892,9 +8905,9 @@ declare class IndexingService {
8892
8905
  listConfigurations(auth?: AuthContext): Promise<IndexConfig[]>;
8893
8906
  /** Get a configuration by provider name. */
8894
8907
  getConfiguration(provider: string, auth?: AuthContext): Promise<IndexConfig>;
8895
- /** Create a configuration. */
8908
+ /** Create a configuration. Nothing is stored if credential validation fails. */
8896
8909
  createConfiguration(input: IndexConfig, auth?: AuthContext): Promise<IndexConfigCreated>;
8897
- /** Update a configuration by provider name. */
8910
+ /** Update a configuration. Left unchanged if credential validation fails. */
8898
8911
  updateConfiguration(provider: string, input: IndexConfig, auth?: AuthContext): Promise<void>;
8899
8912
  /** Delete a configuration by provider name. */
8900
8913
  deleteConfiguration(provider: string, auth?: AuthContext): Promise<void>;
@@ -8907,6 +8920,9 @@ declare class IndexingService {
8907
8920
  * given `entityType`; set `rag: true` to also rebuild the RAG vector index
8908
8921
  * (PRODUCT only). Resolves to the created job (`201`) or, when a job for that
8909
8922
  * `entityType` is already `IN_PROGRESS`, that running job (`200`).
8923
+ *
8924
+ * On `BATTERY_INCLUDED` with `entityType: "PRODUCT"` the stored credentials
8925
+ * are validated first; no job is created on the `400`/`502` cases above.
8910
8926
  */
8911
8927
  createReindexJob(input: ReindexJobInput, auth?: AuthContext): Promise<ReindexJob>;
8912
8928
  /** List reindex jobs (paginated). */
@@ -8914,7 +8930,8 @@ declare class IndexingService {
8914
8930
  /** Fetch one reindex job by id. */
8915
8931
  getReindexJob(reindexJobId: string, auth?: AuthContext): Promise<ReindexJob>;
8916
8932
  /**
8917
- * Trigger a reindex.
8933
+ * Trigger a reindex. On `BATTERY_INCLUDED` the same credential validation
8934
+ * runs first, so this can fail with `400`/`502` before any job starts.
8918
8935
  * @deprecated since 2026-06-18, removal 2026-12-01 — use {@link createReindexJob}
8919
8936
  * (`createReindexJob({ entityType: "PRODUCT" })`), which returns a trackable job.
8920
8937
  */
package/dist/index.js CHANGED
@@ -945,7 +945,7 @@ var HttpClient = class {
945
945
  };
946
946
 
947
947
  // package.json
948
- var version = "3.4.1";
948
+ var version = "3.5.0";
949
949
 
950
950
  // src/version.ts
951
951
  var SDK_VERSION = version;
@@ -4144,7 +4144,7 @@ var IndexingService = class {
4144
4144
  auth: auth2
4145
4145
  });
4146
4146
  }
4147
- /** Create a configuration. */
4147
+ /** Create a configuration. Nothing is stored if credential validation fails. */
4148
4148
  async createConfiguration(input, auth2 = SERVICE21) {
4149
4149
  return this.ctx.http.request({
4150
4150
  method: "POST",
@@ -4153,7 +4153,7 @@ var IndexingService = class {
4153
4153
  body: input
4154
4154
  });
4155
4155
  }
4156
- /** Update a configuration by provider name. */
4156
+ /** Update a configuration. Left unchanged if credential validation fails. */
4157
4157
  async updateConfiguration(provider, input, auth2 = SERVICE21) {
4158
4158
  await this.ctx.http.request({
4159
4159
  method: "PUT",
@@ -4187,6 +4187,9 @@ var IndexingService = class {
4187
4187
  * given `entityType`; set `rag: true` to also rebuild the RAG vector index
4188
4188
  * (PRODUCT only). Resolves to the created job (`201`) or, when a job for that
4189
4189
  * `entityType` is already `IN_PROGRESS`, that running job (`200`).
4190
+ *
4191
+ * On `BATTERY_INCLUDED` with `entityType: "PRODUCT"` the stored credentials
4192
+ * are validated first; no job is created on the `400`/`502` cases above.
4190
4193
  */
4191
4194
  async createReindexJob(input, auth2 = SERVICE21) {
4192
4195
  return this.ctx.http.request({
@@ -4202,6 +4205,7 @@ var IndexingService = class {
4202
4205
  const pageSize = opts.pageSize ?? 50;
4203
4206
  const query = { pageNumber, pageSize };
4204
4207
  if (opts.q !== void 0) query.q = opts.q;
4208
+ if (opts.sort !== void 0) query.sort = opts.sort;
4205
4209
  return requestPage(
4206
4210
  this.ctx.http,
4207
4211
  {
@@ -4226,7 +4230,8 @@ var IndexingService = class {
4226
4230
  });
4227
4231
  }
4228
4232
  /**
4229
- * Trigger a reindex.
4233
+ * Trigger a reindex. On `BATTERY_INCLUDED` the same credential validation
4234
+ * runs first, so this can fail with `400`/`502` before any job starts.
4230
4235
  * @deprecated since 2026-06-18, removal 2026-12-01 — use {@link createReindexJob}
4231
4236
  * (`createReindexJob({ entityType: "PRODUCT" })`), which returns a trackable job.
4232
4237
  */