@viu/emporix-sdk 2.36.1 → 2.37.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.
@@ -314,6 +314,32 @@ type UpdateEmail = {
314
314
  */
315
315
  token?: string;
316
316
  };
317
+ type ValidateTokenResponse = {
318
+ /**
319
+ * Type of the token. Usually it's `Bearer`.
320
+ */
321
+ token_type?: string;
322
+ /**
323
+ * Specifies the token's expiration time, represented in seconds.
324
+ */
325
+ expires_in?: number;
326
+ /**
327
+ * A list of scopes assigned to the user.
328
+ */
329
+ scope?: string;
330
+ /**
331
+ * Identifier of the user session.
332
+ */
333
+ sessionId?: string;
334
+ /**
335
+ * Customer email used to login (generate the token).
336
+ */
337
+ email?: string;
338
+ /**
339
+ * Legal Entity ID.
340
+ */
341
+ legalEntityId?: string;
342
+ };
317
343
 
318
344
  /**
319
345
  * Caller-owned customer session. Maps the Emporix `CustomerToken` wire shape to
@@ -351,6 +377,12 @@ type AddressUpdateInput = AddressUpdateDto;
351
377
  type ChangeEmailInput = ChangeEmailRequestDto;
352
378
  type ConfirmEmailChangeInput = UpdateEmail;
353
379
  type ResendActivationInput = RefreshToken;
380
+ /**
381
+ * What `validateToken` reports about a customer token: `scope` is the
382
+ * space-separated scope list, plus `sessionId`, `email`, `legalEntityId` and
383
+ * `expires_in`. Every field is optional upstream.
384
+ */
385
+ type CustomerTokenValidation = ValidateTokenResponse;
354
386
  /** Customer signup, session, profile and addresses. */
355
387
  declare class CustomerService {
356
388
  private readonly ctx;
@@ -420,6 +452,18 @@ declare class CustomerService {
420
452
  }, auth?: AuthContext): Promise<CustomerSession>;
421
453
  /** Returns the authenticated customer. Requires customer/raw auth. */
422
454
  me(auth?: AuthContext): Promise<Customer>;
455
+ /**
456
+ * Validates a customer token and returns what the tenant knows about it —
457
+ * `scope`, `sessionId`, `email`, `legalEntityId`, `expires_in`
458
+ * (`GET /validateauthtoken`). Requires customer/raw auth.
459
+ *
460
+ * An invalid or expired token answers `401`, which surfaces as
461
+ * {@link EmporixAuthError} rather than a falsy result: this is a check, not a
462
+ * predicate. Reach for it when you hold a token from elsewhere — an SSO
463
+ * exchange, a Managed Dashboard host — and need its scopes before deciding
464
+ * what to render, instead of discovering them from a failed call.
465
+ */
466
+ validateToken(auth?: AuthContext): Promise<CustomerTokenValidation>;
423
467
  /** Updates the authenticated customer. Requires customer/raw auth. */
424
468
  update(patch: CustomerUpdateInput, auth?: AuthContext): Promise<Customer>;
425
469
  /** Changes the password. Requires customer/raw auth. */
@@ -451,4 +495,4 @@ declare class CustomerService {
451
495
  };
452
496
  }
453
497
 
454
- export { type Address, type AddressCreateInput, type AddressUpdateInput, type ChangeEmailInput, type ConfirmEmailChangeInput, type Customer, CustomerService, type CustomerSession, type CustomerSignupInput, type CustomerUpdateInput, type PasswordChangeInput, type PasswordResetConfirmInput, type PasswordResetRequestInput, type ResendActivationInput };
498
+ export { type Address, type AddressCreateInput, type AddressUpdateInput, type ChangeEmailInput, type ConfirmEmailChangeInput, type Customer, CustomerService, type CustomerSession, type CustomerSignupInput, type CustomerTokenValidation, type CustomerUpdateInput, type PasswordChangeInput, type PasswordResetConfirmInput, type PasswordResetRequestInput, type ResendActivationInput };
package/dist/customer.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CustomerService } from './chunk-PRN3T6TY.js';
1
+ export { CustomerService } from './chunk-UA4BM6OP.js';
2
2
  import './chunk-3BDDYX3V.js';
3
3
  import './chunk-UWGGF4MC.js';
4
4
  //# sourceMappingURL=customer.js.map
package/dist/index.cjs CHANGED
@@ -995,7 +995,7 @@ var HttpClient = class {
995
995
  };
996
996
 
997
997
  // package.json
998
- var version = "2.36.1";
998
+ var version = "2.37.0";
999
999
 
1000
1000
  // src/version.ts
1001
1001
  var SDK_VERSION = version;
@@ -1212,6 +1212,24 @@ var CustomerService = class {
1212
1212
  auth: requireCustomer(auth2)
1213
1213
  });
1214
1214
  }
1215
+ /**
1216
+ * Validates a customer token and returns what the tenant knows about it —
1217
+ * `scope`, `sessionId`, `email`, `legalEntityId`, `expires_in`
1218
+ * (`GET /validateauthtoken`). Requires customer/raw auth.
1219
+ *
1220
+ * An invalid or expired token answers `401`, which surfaces as
1221
+ * {@link EmporixAuthError} rather than a falsy result: this is a check, not a
1222
+ * predicate. Reach for it when you hold a token from elsewhere — an SSO
1223
+ * exchange, a Managed Dashboard host — and need its scopes before deciding
1224
+ * what to render, instead of discovering them from a failed call.
1225
+ */
1226
+ async validateToken(auth2) {
1227
+ return this.ctx.http.request({
1228
+ method: "GET",
1229
+ path: `/customer/${this.ctx.tenant}/validateauthtoken`,
1230
+ auth: requireCustomer(auth2)
1231
+ });
1232
+ }
1215
1233
  /** Updates the authenticated customer. Requires customer/raw auth. */
1216
1234
  async update(patch, auth2) {
1217
1235
  return this.ctx.http.request({
@@ -4142,6 +4160,17 @@ var IamService = class {
4142
4160
  path: `${this.base()}/users/${userId}/groups`,
4143
4161
  auth: auth2
4144
4162
  }),
4163
+ /**
4164
+ * Reads one of a user's groups (`GET /users/{userId}/groups/{groupId}`).
4165
+ * The collection read above returns the same shape per entry; this exists
4166
+ * because Emporix exposes the item separately and a caller holding both ids
4167
+ * should not have to page the collection to resolve one group.
4168
+ */
4169
+ getGroup: async (userId, groupId, auth2) => this.ctx.http.request({
4170
+ method: "GET",
4171
+ path: `${this.base()}/users/${encodeURIComponent(userId)}/groups/${encodeURIComponent(groupId)}`,
4172
+ auth: auth2
4173
+ }),
4145
4174
  getScopes: async (userId, auth2) => this.ctx.http.request({
4146
4175
  method: "GET",
4147
4176
  path: `${this.base()}/users/${userId}/scopes`,