@workos-inc/node 12.2.0 → 12.4.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.
@@ -1,4 +1,4 @@
1
- //#region src/common/crypto/crypto-provider.ts
1
+ // src/common/crypto/crypto-provider.ts
2
2
  /**
3
3
  * Interface encapsulating the various crypto computations used by the library,
4
4
  * allowing pluggable underlying crypto implementations.
@@ -6,8 +6,7 @@
6
6
  var CryptoProvider = class {
7
7
  encoder = new TextEncoder();
8
8
  };
9
- //#endregion
10
- //#region src/common/crypto/subtle-crypto-provider.ts
9
+ // src/common/crypto/subtle-crypto-provider.ts
11
10
  /**
12
11
  * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
13
12
  *
@@ -220,8 +219,7 @@ var HttpClientError = class extends Error {
220
219
  this.response = response;
221
220
  }
222
221
  };
223
- //#endregion
224
- //#region src/common/exceptions/parse-error.ts
222
+ // src/common/exceptions/parse-error.ts
225
223
  var ParseError = class extends Error {
226
224
  name = "ParseError";
227
225
  status = 500;
@@ -237,8 +235,7 @@ var ParseError = class extends Error {
237
235
  this.rawHeaders = rawHeaders;
238
236
  }
239
237
  };
240
- //#endregion
241
- //#region src/common/net/fetch-client.ts
238
+ // src/common/net/fetch-client.ts
242
239
  const DEFAULT_FETCH_TIMEOUT = 6e4;
243
240
  var FetchHttpClient = class FetchHttpClient extends HttpClient {
244
241
  baseURL;
@@ -256,41 +253,42 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
256
253
  }
257
254
  async get(path, options) {
258
255
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
259
- return await this.fetchRequestWithRetry(resourceURL, "GET", null, options.headers, options.maxRetries);
256
+ return await this.fetchRequestWithRetry(resourceURL, "GET", null, options.headers, options.maxRetries, options.signal);
260
257
  }
261
258
  async post(path, entity, options) {
262
259
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
263
260
  return await this.fetchRequestWithRetry(resourceURL, "POST", HttpClient.getBody(entity), {
264
261
  ...HttpClient.getContentTypeHeader(entity),
265
262
  ...options.headers
266
- }, options.maxRetries);
263
+ }, options.maxRetries, options.signal);
267
264
  }
268
265
  async put(path, entity, options) {
269
266
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
270
267
  return await this.fetchRequestWithRetry(resourceURL, "PUT", HttpClient.getBody(entity), {
271
268
  ...HttpClient.getContentTypeHeader(entity),
272
269
  ...options.headers
273
- }, options.maxRetries);
270
+ }, options.maxRetries, options.signal);
274
271
  }
275
272
  async patch(path, entity, options) {
276
273
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
277
274
  return await this.fetchRequestWithRetry(resourceURL, "PATCH", HttpClient.getBody(entity), {
278
275
  ...HttpClient.getContentTypeHeader(entity),
279
276
  ...options.headers
280
- }, options.maxRetries);
277
+ }, options.maxRetries, options.signal);
281
278
  }
282
279
  async delete(path, options) {
283
280
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
284
- return await this.fetchRequestWithRetry(resourceURL, "DELETE", null, options.headers, options.maxRetries);
281
+ return await this.fetchRequestWithRetry(resourceURL, "DELETE", null, options.headers, options.maxRetries, options.signal);
285
282
  }
286
283
  async deleteWithBody(path, entity, options) {
287
284
  const resourceURL = HttpClient.getResourceURL(this.baseURL, path, options.params);
288
285
  return await this.fetchRequestWithRetry(resourceURL, "DELETE", HttpClient.getBody(entity), {
289
286
  ...HttpClient.getContentTypeHeader(entity),
290
287
  ...options.headers
291
- }, options.maxRetries);
288
+ }, options.maxRetries, options.signal);
292
289
  }
293
- async fetchRequest(url, method, body, headers) {
290
+ async fetchRequest(url, method, body, headers, signal) {
291
+ signal?.throwIfAborted();
294
292
  const requestBody = body || (method === "POST" || method === "PUT" || method === "PATCH" ? "" : void 0);
295
293
  const { "User-Agent": userAgent } = this.options?.headers || {};
296
294
  const timeout = this.options?.timeout ?? DEFAULT_FETCH_TIMEOUT;
@@ -298,7 +296,13 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
298
296
  const timeoutId = setTimeout(() => {
299
297
  abortController.abort();
300
298
  }, timeout);
301
- const timeoutError = (responseHeaders) => new HttpClientError({
299
+ const abortRequest = () => abortController.abort();
300
+ signal?.addEventListener("abort", abortRequest, { once: true });
301
+ const release = () => {
302
+ clearTimeout(timeoutId);
303
+ signal?.removeEventListener("abort", abortRequest);
304
+ };
305
+ const abortError = (responseHeaders) => signal?.aborted ? signal.reason : new HttpClientError({
302
306
  message: `Request timeout after ${timeout}ms`,
303
307
  response: {
304
308
  status: 408,
@@ -307,6 +311,7 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
307
311
  }
308
312
  });
309
313
  let res;
314
+ let redirected = false;
310
315
  try {
311
316
  res = await this._fetchFn(url, {
312
317
  method,
@@ -318,12 +323,27 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
318
323
  "User-Agent": (userAgent || "workos-node").toString()
319
324
  },
320
325
  body: requestBody,
321
- signal: abortController.signal
326
+ signal: abortController.signal,
327
+ redirect: "manual"
322
328
  });
329
+ if (res.status >= 300 && res.status < 400 || res.type === "opaqueredirect") {
330
+ clearTimeout(timeoutId);
331
+ redirected = true;
332
+ const location = res.headers.get("Location");
333
+ const message = `WorkOS API responded with ${res.type === "opaqueredirect" ? "an opaque redirect" : `a redirect (${res.status}${location ? ` to ${location}` : ""})`}. Redirects are not followed; check the apiHostname, port and https options.`;
334
+ throw new HttpClientError({
335
+ message,
336
+ response: {
337
+ status: res.status,
338
+ headers: res.headers,
339
+ data: { message }
340
+ }
341
+ });
342
+ }
323
343
  if (!res.ok) {
324
344
  const requestID = res.headers.get("X-Request-ID") ?? "";
325
345
  const rawBody = await res.text();
326
- clearTimeout(timeoutId);
346
+ release();
327
347
  let responseJson;
328
348
  try {
329
349
  responseJson = JSON.parse(rawBody);
@@ -351,37 +371,41 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
351
371
  try {
352
372
  return await response.text();
353
373
  } catch (error) {
354
- throw abortController.signal.aborted ? timeoutError(response.headers) : error;
374
+ throw abortController.signal.aborted ? abortError(response.headers) : error;
355
375
  } finally {
356
- clearTimeout(timeoutId);
376
+ release();
357
377
  }
358
378
  })();
359
379
  rawBody.catch(() => void 0);
360
380
  return new FetchHttpClientResponse(res, rawBody);
361
381
  } catch (error) {
362
- clearTimeout(timeoutId);
363
- if (abortController.signal.aborted) throw timeoutError(res?.headers);
382
+ release();
383
+ if (abortController.signal.aborted) throw abortError(res?.headers);
364
384
  throw error;
385
+ } finally {
386
+ if (redirected) abortController.abort();
365
387
  }
366
388
  }
367
- async fetchRequestWithRetry(url, method, body, headers, maxRetries) {
389
+ async fetchRequestWithRetry(url, method, body, headers, maxRetries, signal) {
368
390
  const maxRetryAttempts = maxRetries ?? this.MAX_RETRY_ATTEMPTS;
369
391
  const requestHeaders = FetchHttpClient.withIdempotencyKey(method, headers, maxRetryAttempts);
370
392
  let response;
371
393
  let retryAttempts = 1;
372
394
  const makeRequest = async () => {
373
395
  let requestError = null;
396
+ let failed = false;
374
397
  try {
375
- response = await this.fetchRequest(url, method, body, requestHeaders);
398
+ response = await this.fetchRequest(url, method, body, requestHeaders, signal);
376
399
  } catch (e) {
377
400
  requestError = e;
401
+ failed = true;
378
402
  }
379
- if (this.shouldRetryRequest(requestError, retryAttempts, maxRetryAttempts)) {
403
+ if (!signal?.aborted && this.shouldRetryRequest(requestError, retryAttempts, maxRetryAttempts)) {
380
404
  retryAttempts++;
381
405
  await this.sleep(retryAttempts, FetchHttpClient.getRetryAfterMs(requestError));
382
406
  return makeRequest();
383
407
  }
384
- if (requestError != null) throw requestError;
408
+ if (failed) throw requestError;
385
409
  return response;
386
410
  };
387
411
  return makeRequest();
@@ -453,8 +477,7 @@ var FetchHttpClientResponse = class FetchHttpClientResponse extends HttpClientRe
453
477
  return headersObj;
454
478
  }
455
479
  };
456
- //#endregion
457
- //#region src/common/crypto/decode-payload.ts
480
+ // src/common/crypto/decode-payload.ts
458
481
  function isBinaryPayload(payload) {
459
482
  return ArrayBuffer.isView(payload) || Object.prototype.toString.call(payload) === "[object ArrayBuffer]";
460
483
  }
@@ -466,8 +489,7 @@ function decodePayloadToString(payload) {
466
489
  }
467
490
  return JSON.stringify(payload);
468
491
  }
469
- //#endregion
470
- //#region src/common/exceptions/api-key-required.exception.ts
492
+ // src/common/exceptions/api-key-required.exception.ts
471
493
  var ApiKeyRequiredException = class extends Error {
472
494
  status = 403;
473
495
  name = "ApiKeyRequiredException";
@@ -477,8 +499,7 @@ var ApiKeyRequiredException = class extends Error {
477
499
  this.path = path;
478
500
  }
479
501
  };
480
- //#endregion
481
- //#region src/common/exceptions/generic-server.exception.ts
502
+ // src/common/exceptions/generic-server.exception.ts
482
503
  var GenericServerException = class extends Error {
483
504
  status;
484
505
  rawData;
@@ -495,8 +516,7 @@ var GenericServerException = class extends Error {
495
516
  this.code = rawData.code;
496
517
  }
497
518
  };
498
- //#endregion
499
- //#region src/common/exceptions/authentication.exception.ts
519
+ // src/common/exceptions/authentication.exception.ts
500
520
  const AUTHENTICATION_ERROR_CODES = /* @__PURE__ */ new Set([
501
521
  "email_verification_required",
502
522
  "organization_selection_required",
@@ -533,8 +553,7 @@ var AuthenticationException = class extends GenericServerException {
533
553
  this.radarChallengeId = rawData.radar_challenge_id;
534
554
  }
535
555
  };
536
- //#endregion
537
- //#region src/common/exceptions/bad-request.exception.ts
556
+ // src/common/exceptions/bad-request.exception.ts
538
557
  var BadRequestException = class extends Error {
539
558
  status = 400;
540
559
  name = "BadRequestException";
@@ -550,8 +569,7 @@ var BadRequestException = class extends Error {
550
569
  if (errors) this.errors = errors;
551
570
  }
552
571
  };
553
- //#endregion
554
- //#region src/common/exceptions/conflict.exception.ts
572
+ // src/common/exceptions/conflict.exception.ts
555
573
  var ConflictException = class extends Error {
556
574
  status = 409;
557
575
  name = "ConflictException";
@@ -566,15 +584,13 @@ var ConflictException = class extends Error {
566
584
  this.code = code;
567
585
  }
568
586
  };
569
- //#endregion
570
- //#region src/common/exceptions/no-api-key-provided.exception.ts
587
+ // src/common/exceptions/no-api-key-provided.exception.ts
571
588
  var NoApiKeyProvidedException = class extends Error {
572
589
  status = 500;
573
590
  name = "NoApiKeyProvidedException";
574
591
  message = "Missing API key. Pass it to the constructor (new WorkOS(\"sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU\")) or define it in the WORKOS_API_KEY environment variable.";
575
592
  };
576
- //#endregion
577
- //#region src/common/exceptions/not-found.exception.ts
593
+ // src/common/exceptions/not-found.exception.ts
578
594
  var NotFoundException = class extends Error {
579
595
  status = 404;
580
596
  name = "NotFoundException";
@@ -588,8 +604,7 @@ var NotFoundException = class extends Error {
588
604
  this.requestID = requestID;
589
605
  }
590
606
  };
591
- //#endregion
592
- //#region src/common/exceptions/oauth.exception.ts
607
+ // src/common/exceptions/oauth.exception.ts
593
608
  var OauthException = class extends Error {
594
609
  status;
595
610
  requestID;
@@ -609,8 +624,7 @@ var OauthException = class extends Error {
609
624
  else this.message = `An error has occurred.`;
610
625
  }
611
626
  };
612
- //#endregion
613
- //#region src/common/exceptions/rate-limit-exceeded.exception.ts
627
+ // src/common/exceptions/rate-limit-exceeded.exception.ts
614
628
  var RateLimitExceededException = class extends GenericServerException {
615
629
  retryAfter;
616
630
  name = "RateLimitExceededException";
@@ -619,16 +633,14 @@ var RateLimitExceededException = class extends GenericServerException {
619
633
  this.retryAfter = retryAfter;
620
634
  }
621
635
  };
622
- //#endregion
623
- //#region src/common/exceptions/signature-verification.exception.ts
636
+ // src/common/exceptions/signature-verification.exception.ts
624
637
  var SignatureVerificationException = class extends Error {
625
638
  name = "SignatureVerificationException";
626
639
  constructor(message) {
627
640
  super(message || "Signature verification failed.");
628
641
  }
629
642
  };
630
- //#endregion
631
- //#region src/common/exceptions/unauthorized.exception.ts
643
+ // src/common/exceptions/unauthorized.exception.ts
632
644
  var UnauthorizedException = class extends Error {
633
645
  requestID;
634
646
  status = 401;
@@ -640,8 +652,7 @@ var UnauthorizedException = class extends Error {
640
652
  this.message = `Could not authorize the request. Maybe your API key is invalid?`;
641
653
  }
642
654
  };
643
- //#endregion
644
- //#region src/common/exceptions/unprocessable-entity.exception.ts
655
+ // src/common/exceptions/unprocessable-entity.exception.ts
645
656
  var UnprocessableEntityException = class extends Error {
646
657
  status = 422;
647
658
  name = "UnprocessableEntityException";
@@ -661,8 +672,7 @@ var UnprocessableEntityException = class extends Error {
661
672
  }
662
673
  }
663
674
  };
664
- //#endregion
665
- //#region src/common/crypto/signature-provider.ts
675
+ // src/common/crypto/signature-provider.ts
666
676
  var SignatureProvider = class {
667
677
  cryptoProvider;
668
678
  constructor(cryptoProvider) {
@@ -690,8 +700,7 @@ var SignatureProvider = class {
690
700
  return await this.cryptoProvider.computeHMACSignatureAsync(signedPayload, secret);
691
701
  }
692
702
  };
693
- //#endregion
694
- //#region src/common/utils/unreachable.ts
703
+ // src/common/utils/unreachable.ts
695
704
  /**
696
705
  * Indicates that code is unreachable.
697
706
  *
@@ -704,8 +713,7 @@ var SignatureProvider = class {
704
713
  const unreachable = (condition, message = `Entered unreachable code. Received '${condition}'.`) => {
705
714
  throw new TypeError(message);
706
715
  };
707
- //#endregion
708
- //#region src/organization-domains/serializers/organization-domain.serializer.ts
716
+ // src/organization-domains/serializers/organization-domain.serializer.ts
709
717
  const deserializeOrganizationDomain = (organizationDomain) => ({
710
718
  object: organizationDomain.object,
711
719
  id: organizationDomain.id,
@@ -718,8 +726,7 @@ const deserializeOrganizationDomain = (organizationDomain) => ({
718
726
  createdAt: new Date(organizationDomain.created_at),
719
727
  updatedAt: new Date(organizationDomain.updated_at)
720
728
  });
721
- //#endregion
722
- //#region src/organizations/serializers/organization.serializer.ts
729
+ // src/organizations/serializers/organization.serializer.ts
723
730
  const deserializeOrganization = (organization) => ({
724
731
  object: organization.object,
725
732
  id: organization.id,
@@ -732,8 +739,7 @@ const deserializeOrganization = (organization) => ({
732
739
  externalId: organization.external_id ?? null,
733
740
  metadata: organization.metadata ?? {}
734
741
  });
735
- //#endregion
736
- //#region src/user-management/serializers/authenticate-with-code-options.serializer.ts
742
+ // src/user-management/serializers/authenticate-with-code-options.serializer.ts
737
743
  const serializeAuthenticateWithCodeOptions = (options) => ({
738
744
  grant_type: "authorization_code",
739
745
  client_id: options.clientId,
@@ -745,8 +751,7 @@ const serializeAuthenticateWithCodeOptions = (options) => ({
745
751
  user_agent: options.userAgent,
746
752
  signals_id: options.signalsId
747
753
  });
748
- //#endregion
749
- //#region src/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.ts
754
+ // src/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.ts
750
755
  const serializeAuthenticateWithCodeAndVerifierOptions = (options) => ({
751
756
  grant_type: "authorization_code",
752
757
  client_id: options.clientId,
@@ -757,8 +762,7 @@ const serializeAuthenticateWithCodeAndVerifierOptions = (options) => ({
757
762
  user_agent: options.userAgent,
758
763
  signals_id: options.signalsId
759
764
  });
760
- //#endregion
761
- //#region src/user-management/serializers/authenticate-with-magic-auth-options.serializer.ts
765
+ // src/user-management/serializers/authenticate-with-magic-auth-options.serializer.ts
762
766
  const serializeAuthenticateWithMagicAuthOptions = (options) => ({
763
767
  grant_type: "urn:workos:oauth:grant-type:magic-auth:code",
764
768
  client_id: options.clientId,
@@ -772,8 +776,7 @@ const serializeAuthenticateWithMagicAuthOptions = (options) => ({
772
776
  radar_auth_attempt_id: options.radarAuthAttemptId,
773
777
  signals_id: options.signalsId
774
778
  });
775
- //#endregion
776
- //#region src/user-management/serializers/authenticate-with-radar-email-challenge-options.serializer.ts
779
+ // src/user-management/serializers/authenticate-with-radar-email-challenge-options.serializer.ts
777
780
  const serializeAuthenticateWithRadarEmailChallengeOptions = (options) => ({
778
781
  grant_type: "urn:workos:oauth:grant-type:radar-email-challenge:code",
779
782
  client_id: options.clientId,
@@ -784,8 +787,7 @@ const serializeAuthenticateWithRadarEmailChallengeOptions = (options) => ({
784
787
  ip_address: options.ipAddress,
785
788
  user_agent: options.userAgent
786
789
  });
787
- //#endregion
788
- //#region src/user-management/serializers/authenticate-with-radar-sms-challenge-options.serializer.ts
790
+ // src/user-management/serializers/authenticate-with-radar-sms-challenge-options.serializer.ts
789
791
  const serializeAuthenticateWithRadarSmsChallengeOptions = (options) => ({
790
792
  grant_type: "urn:workos:oauth:grant-type:radar-sms-challenge:code",
791
793
  client_id: options.clientId,
@@ -797,8 +799,7 @@ const serializeAuthenticateWithRadarSmsChallengeOptions = (options) => ({
797
799
  ip_address: options.ipAddress,
798
800
  user_agent: options.userAgent
799
801
  });
800
- //#endregion
801
- //#region src/user-management/serializers/authenticate-with-password-options.serializer.ts
802
+ // src/user-management/serializers/authenticate-with-password-options.serializer.ts
802
803
  const serializeAuthenticateWithPasswordOptions = (options) => ({
803
804
  grant_type: "password",
804
805
  client_id: options.clientId,
@@ -811,8 +812,7 @@ const serializeAuthenticateWithPasswordOptions = (options) => ({
811
812
  radar_auth_attempt_id: options.radarAuthAttemptId,
812
813
  signals_id: options.signalsId
813
814
  });
814
- //#endregion
815
- //#region src/user-management/serializers/authenticate-with-refresh-token.options.serializer.ts
815
+ // src/user-management/serializers/authenticate-with-refresh-token.options.serializer.ts
816
816
  const serializeAuthenticateWithRefreshTokenOptions = (options) => ({
817
817
  grant_type: "refresh_token",
818
818
  client_id: options.clientId,
@@ -822,8 +822,7 @@ const serializeAuthenticateWithRefreshTokenOptions = (options) => ({
822
822
  ip_address: options.ipAddress,
823
823
  user_agent: options.userAgent
824
824
  });
825
- //#endregion
826
- //#region src/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.ts
825
+ // src/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.ts
827
826
  const serializeAuthenticateWithRefreshTokenPublicClientOptions = (options) => ({
828
827
  grant_type: "refresh_token",
829
828
  client_id: options.clientId,
@@ -832,8 +831,7 @@ const serializeAuthenticateWithRefreshTokenPublicClientOptions = (options) => ({
832
831
  ip_address: options.ipAddress,
833
832
  user_agent: options.userAgent
834
833
  });
835
- //#endregion
836
- //#region src/user-management/serializers/authenticate-with-totp-options.serializer.ts
834
+ // src/user-management/serializers/authenticate-with-totp-options.serializer.ts
837
835
  const serializeAuthenticateWithTotpOptions = (options) => ({
838
836
  grant_type: "urn:workos:oauth:grant-type:mfa-totp",
839
837
  client_id: options.clientId,
@@ -844,8 +842,7 @@ const serializeAuthenticateWithTotpOptions = (options) => ({
844
842
  ip_address: options.ipAddress,
845
843
  user_agent: options.userAgent
846
844
  });
847
- //#endregion
848
- //#region src/user-management/serializers/authentication-event.serializer.ts
845
+ // src/user-management/serializers/authentication-event.serializer.ts
849
846
  const deserializeAuthenticationEventSso = (sso) => ({
850
847
  connectionId: sso.connection_id ?? null,
851
848
  organizationId: sso.organization_id ?? null,
@@ -861,11 +858,9 @@ const deserializeAuthenticationEvent = (authenticationEvent) => ({
861
858
  userAgent: authenticationEvent.user_agent,
862
859
  userId: authenticationEvent.user_id
863
860
  });
864
- //#endregion
865
- //#region src/multi-factor-auth/serializers/sms.serializer.ts
861
+ // src/multi-factor-auth/serializers/sms.serializer.ts
866
862
  const deserializeSms = (sms) => ({ phoneNumber: sms.phone_number });
867
- //#endregion
868
- //#region src/multi-factor-auth/serializers/totp.serializer.ts
863
+ // src/multi-factor-auth/serializers/totp.serializer.ts
869
864
  const deserializeTotp = (totp) => {
870
865
  return {
871
866
  issuer: totp.issuer,
@@ -881,8 +876,7 @@ const deserializeTotpWithSecrets = (totp) => {
881
876
  uri: totp.uri
882
877
  };
883
878
  };
884
- //#endregion
885
- //#region src/user-management/serializers/authentication-factor.serializer.ts
879
+ // src/user-management/serializers/authentication-factor.serializer.ts
886
880
  const deserializeFactor$1 = (factor) => ({
887
881
  object: factor.object,
888
882
  id: factor.id,
@@ -902,16 +896,14 @@ const deserializeFactorWithSecrets$1 = (factor) => ({
902
896
  totp: deserializeTotpWithSecrets(factor.totp),
903
897
  userId: factor.user_id
904
898
  });
905
- //#endregion
906
- //#region src/user-management/serializers/oauth-tokens.serializer.ts
899
+ // src/user-management/serializers/oauth-tokens.serializer.ts
907
900
  const deserializeOauthTokens = (oauthTokens) => oauthTokens ? {
908
901
  accessToken: oauthTokens.access_token,
909
902
  refreshToken: oauthTokens.refresh_token,
910
903
  expiresAt: oauthTokens.expires_at,
911
904
  scopes: oauthTokens.scopes
912
905
  } : void 0;
913
- //#endregion
914
- //#region src/user-management/serializers/user.serializer.ts
906
+ // src/user-management/serializers/user.serializer.ts
915
907
  const deserializeUser = (user) => ({
916
908
  object: user.object,
917
909
  id: user.id,
@@ -928,8 +920,7 @@ const deserializeUser = (user) => ({
928
920
  externalId: user.external_id ?? null,
929
921
  metadata: user.metadata ?? {}
930
922
  });
931
- //#endregion
932
- //#region src/user-management/serializers/authentication-response.serializer.ts
923
+ // src/user-management/serializers/authentication-response.serializer.ts
933
924
  const deserializeAuthenticationResponse = (authenticationResponse) => {
934
925
  const { user, organization_id, access_token, refresh_token, authentication_method, impersonator, oauth_tokens, ...rest } = authenticationResponse;
935
926
  return {
@@ -943,8 +934,54 @@ const deserializeAuthenticationResponse = (authenticationResponse) => {
943
934
  ...rest
944
935
  };
945
936
  };
946
- //#endregion
947
- //#region src/user-management/serializers/create-magic-auth-options.serializer.ts
937
+ // src/connect/serializers/connect-application-redirect-uri.serializer.ts
938
+ const deserializeConnectApplicationRedirectUri = (response) => ({
939
+ uri: response.uri,
940
+ default: response.default
941
+ });
942
+ // src/connect/serializers/connect-application.serializer.ts
943
+ const deserializeConnectApplication = (response) => {
944
+ switch (response.application_type) {
945
+ case "oauth": return {
946
+ object: response.object,
947
+ id: response.id,
948
+ clientId: response.client_id,
949
+ description: response.description,
950
+ name: response.name,
951
+ scopes: response.scopes,
952
+ createdAt: new Date(response.created_at),
953
+ updatedAt: new Date(response.updated_at),
954
+ applicationType: "oauth",
955
+ redirectUris: response.redirect_uris.map(deserializeConnectApplicationRedirectUri),
956
+ usesPkce: response.uses_pkce,
957
+ isFirstParty: response.is_first_party,
958
+ wasDynamicallyRegistered: response.was_dynamically_registered,
959
+ organizationId: response.organization_id
960
+ };
961
+ case "m2m": return {
962
+ object: response.object,
963
+ id: response.id,
964
+ clientId: response.client_id,
965
+ description: response.description,
966
+ name: response.name,
967
+ scopes: response.scopes,
968
+ createdAt: new Date(response.created_at),
969
+ updatedAt: new Date(response.updated_at),
970
+ applicationType: "m2m",
971
+ organizationId: response.organization_id
972
+ };
973
+ default: throw new Error(`Unknown application_type: ${response.application_type}`);
974
+ }
975
+ };
976
+ // src/user-management/serializers/authorized-connect-application.serializer.ts
977
+ const deserializeAuthorizedConnectApplication = (response) => ({
978
+ object: response.object,
979
+ id: response.id,
980
+ grantedScopes: response.granted_scopes,
981
+ oauthResource: response.oauth_resource,
982
+ application: deserializeConnectApplication(response.application)
983
+ });
984
+ // src/user-management/serializers/create-magic-auth-options.serializer.ts
948
985
  const serializeCreateMagicAuthOptions = (options) => ({
949
986
  email: options.email,
950
987
  invitation_token: options.invitationToken,
@@ -953,11 +990,9 @@ const serializeCreateMagicAuthOptions = (options) => ({
953
990
  radar_auth_attempt_id: options.radarAuthAttemptId,
954
991
  signals_id: options.signalsId
955
992
  });
956
- //#endregion
957
- //#region src/user-management/serializers/create-password-reset-options.serializer.ts
993
+ // src/user-management/serializers/create-password-reset-options.serializer.ts
958
994
  const serializeCreatePasswordResetOptions = (options) => ({ email: options.email });
959
- //#endregion
960
- //#region src/user-management/serializers/create-user-api-key-options.serializer.ts
995
+ // src/user-management/serializers/create-user-api-key-options.serializer.ts
961
996
  function serializeCreateUserApiKeyOptions(options) {
962
997
  return {
963
998
  name: options.name,
@@ -966,8 +1001,7 @@ function serializeCreateUserApiKeyOptions(options) {
966
1001
  expires_at: options.expiresAt?.toISOString()
967
1002
  };
968
1003
  }
969
- //#endregion
970
- //#region src/user-management/serializers/email-verification.serializer.ts
1004
+ // src/user-management/serializers/email-verification.serializer.ts
971
1005
  const deserializeEmailVerification = (emailVerification) => ({
972
1006
  object: emailVerification.object,
973
1007
  id: emailVerification.id,
@@ -987,16 +1021,14 @@ const deserializeEmailVerificationEvent = (emailVerification) => ({
987
1021
  createdAt: new Date(emailVerification.created_at),
988
1022
  updatedAt: new Date(emailVerification.updated_at)
989
1023
  });
990
- //#endregion
991
- //#region src/user-management/serializers/enroll-auth-factor-options.serializer.ts
1024
+ // src/user-management/serializers/enroll-auth-factor-options.serializer.ts
992
1025
  const serializeEnrollAuthFactorOptions = (options) => ({
993
1026
  type: options.type,
994
1027
  totp_issuer: options.totpIssuer,
995
1028
  totp_user: options.totpUser,
996
1029
  totp_secret: options.totpSecret
997
1030
  });
998
- //#endregion
999
- //#region src/user-management/serializers/invitation.serializer.ts
1031
+ // src/user-management/serializers/invitation.serializer.ts
1000
1032
  const deserializeInvitation = (invitation) => ({
1001
1033
  object: invitation.object,
1002
1034
  id: invitation.id,
@@ -1029,11 +1061,9 @@ const deserializeInvitationEvent = (invitation) => ({
1029
1061
  createdAt: new Date(invitation.created_at),
1030
1062
  updatedAt: new Date(invitation.updated_at)
1031
1063
  });
1032
- //#endregion
1033
- //#region src/user-management/serializers/list-sessions-options.serializer.ts
1064
+ // src/user-management/serializers/list-sessions-options.serializer.ts
1034
1065
  const serializeListSessionsOptions = (options) => ({ ...options });
1035
- //#endregion
1036
- //#region src/user-management/serializers/list-user-api-keys-options.serializer.ts
1066
+ // src/user-management/serializers/list-user-api-keys-options.serializer.ts
1037
1067
  function serializeListUserApiKeysOptions(options) {
1038
1068
  return {
1039
1069
  limit: options.limit,
@@ -1043,8 +1073,7 @@ function serializeListUserApiKeysOptions(options) {
1043
1073
  organization_id: options.organizationId
1044
1074
  };
1045
1075
  }
1046
- //#endregion
1047
- //#region src/user-management/serializers/magic-auth.serializer.ts
1076
+ // src/user-management/serializers/magic-auth.serializer.ts
1048
1077
  const deserializeMagicAuth = (magicAuth) => ({
1049
1078
  object: magicAuth.object,
1050
1079
  id: magicAuth.id,
@@ -1064,8 +1093,7 @@ const deserializeMagicAuthEvent = (magicAuth) => ({
1064
1093
  createdAt: new Date(magicAuth.created_at),
1065
1094
  updatedAt: new Date(magicAuth.updated_at)
1066
1095
  });
1067
- //#endregion
1068
- //#region src/user-management/serializers/password-reset.serializer.ts
1096
+ // src/user-management/serializers/password-reset.serializer.ts
1069
1097
  const deserializePasswordReset = (passwordReset) => ({
1070
1098
  object: passwordReset.object,
1071
1099
  id: passwordReset.id,
@@ -1084,14 +1112,12 @@ const deserializePasswordResetEvent = (passwordReset) => ({
1084
1112
  expiresAt: new Date(passwordReset.expires_at),
1085
1113
  createdAt: new Date(passwordReset.created_at)
1086
1114
  });
1087
- //#endregion
1088
- //#region src/user-management/serializers/reset-password-options.serializer.ts
1115
+ // src/user-management/serializers/reset-password-options.serializer.ts
1089
1116
  const serializeResetPasswordOptions = (options) => ({
1090
1117
  token: options.token,
1091
1118
  new_password: options.newPassword
1092
1119
  });
1093
- //#endregion
1094
- //#region src/user-management/serializers/session.serializer.ts
1120
+ // src/user-management/serializers/session.serializer.ts
1095
1121
  const deserializeSession = (session) => ({
1096
1122
  object: "session",
1097
1123
  id: session.id,
@@ -1107,8 +1133,7 @@ const deserializeSession = (session) => ({
1107
1133
  createdAt: new Date(session.created_at),
1108
1134
  updatedAt: new Date(session.updated_at)
1109
1135
  });
1110
- //#endregion
1111
- //#region src/user-management/serializers/create-user-options.serializer.ts
1136
+ // src/user-management/serializers/create-user-options.serializer.ts
1112
1137
  const serializeCreateUserOptions = (options) => ({
1113
1138
  email: options.email,
1114
1139
  password: options.password,
@@ -1124,8 +1149,7 @@ const serializeCreateUserOptions = (options) => ({
1124
1149
  user_agent: options.userAgent,
1125
1150
  signals_id: options.signalsId
1126
1151
  });
1127
- //#endregion
1128
- //#region src/user-management/serializers/send-radar-sms-challenge-options.serializer.ts
1152
+ // src/user-management/serializers/send-radar-sms-challenge-options.serializer.ts
1129
1153
  const serializeSendRadarSmsChallengeOptions = (options) => ({
1130
1154
  user_id: options.userId,
1131
1155
  pending_authentication_token: options.pendingAuthenticationToken,
@@ -1133,8 +1157,7 @@ const serializeSendRadarSmsChallengeOptions = (options) => ({
1133
1157
  ip_address: options.ipAddress,
1134
1158
  user_agent: options.userAgent
1135
1159
  });
1136
- //#endregion
1137
- //#region src/user-management/serializers/update-user-options.serializer.ts
1160
+ // src/user-management/serializers/update-user-options.serializer.ts
1138
1161
  const serializeUpdateUserOptions = (options) => ({
1139
1162
  email: options.email,
1140
1163
  email_verified: options.emailVerified,
@@ -1148,8 +1171,7 @@ const serializeUpdateUserOptions = (options) => ({
1148
1171
  locale: options.locale,
1149
1172
  metadata: options.metadata
1150
1173
  });
1151
- //#endregion
1152
- //#region src/user-management/serializers/user-api-key.serializer.ts
1174
+ // src/user-management/serializers/user-api-key.serializer.ts
1153
1175
  function deserializeUserApiKey(apiKey) {
1154
1176
  return {
1155
1177
  object: apiKey.object,
@@ -1168,24 +1190,21 @@ function deserializeUserApiKey(apiKey) {
1168
1190
  updatedAt: new Date(apiKey.updated_at)
1169
1191
  };
1170
1192
  }
1171
- //#endregion
1172
- //#region src/user-management/serializers/user-api-key-with-value.serializer.ts
1193
+ // src/user-management/serializers/user-api-key-with-value.serializer.ts
1173
1194
  function deserializeUserApiKeyWithValue(apiKey) {
1174
1195
  return {
1175
1196
  ...deserializeUserApiKey(apiKey),
1176
1197
  value: apiKey.value
1177
1198
  };
1178
1199
  }
1179
- //#endregion
1180
- //#region src/user-management/serializers/waitlist.serializer.ts
1200
+ // src/user-management/serializers/waitlist.serializer.ts
1181
1201
  const deserializeWaitlist = (waitlist) => ({
1182
1202
  object: waitlist.object,
1183
1203
  id: waitlist.id,
1184
1204
  createdAt: new Date(waitlist.created_at),
1185
1205
  updatedAt: new Date(waitlist.updated_at)
1186
1206
  });
1187
- //#endregion
1188
- //#region src/user-management/serializers/waitlist-entry.serializer.ts
1207
+ // src/user-management/serializers/waitlist-entry.serializer.ts
1189
1208
  const deserializeWaitlistEntry = (waitlistEntry) => ({
1190
1209
  object: waitlistEntry.object,
1191
1210
  id: waitlistEntry.id,
@@ -1197,8 +1216,7 @@ const deserializeWaitlistEntry = (waitlistEntry) => ({
1197
1216
  createdAt: new Date(waitlistEntry.created_at),
1198
1217
  updatedAt: new Date(waitlistEntry.updated_at)
1199
1218
  });
1200
- //#endregion
1201
- //#region src/user-management/serializers/waitlist-user-event.serializer.ts
1219
+ // src/user-management/serializers/waitlist-user-event.serializer.ts
1202
1220
  const deserializeWaitlistUserEvent = (data) => ({
1203
1221
  object: data.object,
1204
1222
  id: data.id,
@@ -1210,8 +1228,7 @@ const deserializeWaitlistUserEvent = (data) => ({
1210
1228
  createdAt: new Date(data.created_at),
1211
1229
  updatedAt: new Date(data.updated_at)
1212
1230
  });
1213
- //#endregion
1214
- //#region src/user-management/serializers/organization-membership.serializer.ts
1231
+ // src/user-management/serializers/organization-membership.serializer.ts
1215
1232
  const deserializeOrganizationMembership = (organizationMembership) => ({
1216
1233
  object: organizationMembership.object,
1217
1234
  id: organizationMembership.id,
@@ -1238,8 +1255,7 @@ const deserializeAuthorizationOrganizationMembership = (organizationMembership)
1238
1255
  updatedAt: new Date(organizationMembership.updated_at),
1239
1256
  customAttributes: organizationMembership.custom_attributes ?? {}
1240
1257
  });
1241
- //#endregion
1242
- //#region src/actions/serializers/action.serializer.ts
1258
+ // src/actions/serializers/action.serializer.ts
1243
1259
  const deserializeUserData = (userData) => {
1244
1260
  return {
1245
1261
  object: userData.object,
@@ -1275,8 +1291,7 @@ const deserializeAction = (actionPayload) => {
1275
1291
  };
1276
1292
  }
1277
1293
  };
1278
- //#endregion
1279
- //#region src/actions/actions.ts
1294
+ // src/actions/actions.ts
1280
1295
  var Actions = class {
1281
1296
  signatureProvider;
1282
1297
  constructor(cryptoProvider) {
@@ -1322,8 +1337,7 @@ var Actions = class {
1322
1337
  return deserializeAction(parsed);
1323
1338
  }
1324
1339
  };
1325
- //#endregion
1326
- //#region src/common/utils/pagination.ts
1340
+ // src/common/utils/pagination.ts
1327
1341
  var AutoPaginatable = class {
1328
1342
  list;
1329
1343
  apiCall;
@@ -1364,8 +1378,7 @@ var AutoPaginatable = class {
1364
1378
  return results;
1365
1379
  }
1366
1380
  };
1367
- //#endregion
1368
- //#region src/agents/serializers/agent-blueprint.serializer.ts
1381
+ // src/agents/serializers/agent-blueprint.serializer.ts
1369
1382
  function deserializeAgentBlueprint(blueprint) {
1370
1383
  return {
1371
1384
  object: blueprint.object,
@@ -1418,8 +1431,7 @@ function serializeUpdateAgentBlueprintOptions(options) {
1418
1431
  } }
1419
1432
  };
1420
1433
  }
1421
- //#endregion
1422
- //#region src/agents/serializers/agent-event.serializer.ts
1434
+ // src/agents/serializers/agent-event.serializer.ts
1423
1435
  const deserializeAgentBlueprintEvent = (data) => ({
1424
1436
  ...deserializeAgentBlueprint(data),
1425
1437
  invocableAs: { instanceTypes: data.invocable_as.instance_types }
@@ -1510,8 +1522,7 @@ const deserializeAgentRegistrationOrganizationSwitchedEvent = (data) => ({
1510
1522
  toOrganizationId: data.to_organization_id
1511
1523
  });
1512
1524
  const deserializeAgentRegistrationLifecycleEvent = (data) => ({ agentRegistrationId: data.agent_registration_id });
1513
- //#endregion
1514
- //#region src/agents/serializers/agent-instance.serializer.ts
1525
+ // src/agents/serializers/agent-instance.serializer.ts
1515
1526
  function deserializeAgentInstance(instance) {
1516
1527
  return {
1517
1528
  object: instance.object,
@@ -1534,20 +1545,17 @@ function serializeListAgentInstancesOptions(options) {
1534
1545
  order: options.order
1535
1546
  };
1536
1547
  }
1537
- //#endregion
1538
- //#region src/directory-sync/serializers/directory-metadata-user.serializer.ts
1548
+ // src/directory-sync/serializers/directory-metadata-user.serializer.ts
1539
1549
  const deserializeDirectoryMetadataUser = (response) => ({
1540
1550
  active: response.active,
1541
1551
  inactive: response.inactive
1542
1552
  });
1543
- //#endregion
1544
- //#region src/directory-sync/serializers/directory-metadata.serializer.ts
1553
+ // src/directory-sync/serializers/directory-metadata.serializer.ts
1545
1554
  const deserializeDirectoryMetadata = (response) => ({
1546
1555
  users: deserializeDirectoryMetadataUser(response.users),
1547
1556
  groups: response.groups
1548
1557
  });
1549
- //#endregion
1550
- //#region src/directory-sync/serializers/directory.serializer.ts
1558
+ // src/directory-sync/serializers/directory.serializer.ts
1551
1559
  const deserializeDirectoryState = (value) => {
1552
1560
  if (value === "linked") return "active";
1553
1561
  if (value === "unlinked") return "inactive";
@@ -1566,8 +1574,7 @@ const deserializeDirectory = (response) => ({
1566
1574
  createdAt: new Date(response.created_at),
1567
1575
  updatedAt: new Date(response.updated_at)
1568
1576
  });
1569
- //#endregion
1570
- //#region src/directory-sync/serializers/directory-group.serializer.ts
1577
+ // src/directory-sync/serializers/directory-group.serializer.ts
1571
1578
  const deserializeDirectoryGroup = (response) => ({
1572
1579
  object: response.object,
1573
1580
  id: response.id,
@@ -1579,8 +1586,7 @@ const deserializeDirectoryGroup = (response) => ({
1579
1586
  createdAt: new Date(response.created_at),
1580
1587
  updatedAt: new Date(response.updated_at)
1581
1588
  });
1582
- //#endregion
1583
- //#region src/directory-sync/serializers/directory-user.serializer.ts
1589
+ // src/directory-sync/serializers/directory-user.serializer.ts
1584
1590
  const deserializeDirectoryUser = (directoryUser) => ({
1585
1591
  object: directoryUser.object,
1586
1592
  id: directoryUser.id,
@@ -1622,8 +1628,7 @@ const deserializeUpdatedEventDirectoryUser = (directoryUser) => ({
1622
1628
  updatedAt: new Date(directoryUser.updated_at),
1623
1629
  previousAttributes: directoryUser.previous_attributes
1624
1630
  });
1625
- //#endregion
1626
- //#region src/directory-sync/serializers/event-directory.serializer.ts
1631
+ // src/directory-sync/serializers/event-directory.serializer.ts
1627
1632
  const deserializeEventDirectory = (directory) => ({
1628
1633
  object: directory.object,
1629
1634
  id: directory.id,
@@ -1650,8 +1655,7 @@ const deserializeUpdatedEventDirectoryGroup = (directoryGroup) => ({
1650
1655
  ...deserializeDirectoryGroup(directoryGroup),
1651
1656
  previousAttributes: directoryGroup.previous_attributes
1652
1657
  });
1653
- //#endregion
1654
- //#region src/directory-sync/serializers/directory-token.serializer.ts
1658
+ // src/directory-sync/serializers/directory-token.serializer.ts
1655
1659
  const deserializeDirectoryToken = (token) => ({
1656
1660
  object: token.object,
1657
1661
  id: token.id,
@@ -1660,20 +1664,17 @@ const deserializeDirectoryToken = (token) => ({
1660
1664
  tokenSuffix: token.token_suffix,
1661
1665
  createdAt: new Date(token.created_at)
1662
1666
  });
1663
- //#endregion
1664
- //#region src/organizations/serializers/create-organization-options.serializer.ts
1667
+ // src/organizations/serializers/create-organization-options.serializer.ts
1665
1668
  const serializeCreateOrganizationOptions = (options) => ({
1666
1669
  name: options.name,
1667
1670
  domain_data: options.domainData,
1668
1671
  external_id: options.externalId,
1669
1672
  metadata: options.metadata
1670
1673
  });
1671
- //#endregion
1672
- //#region src/organizations/serializers/it-contact-options.serializer.ts
1674
+ // src/organizations/serializers/it-contact-options.serializer.ts
1673
1675
  const serializeCreateItContactOptions = (options) => ({ email: options.email });
1674
1676
  const serializeInviteItContactOptions = (options) => ({ intents: options.intents });
1675
- //#endregion
1676
- //#region src/organizations/serializers/it-contact.serializer.ts
1677
+ // src/organizations/serializers/it-contact.serializer.ts
1677
1678
  const deserializeItContact = (itContact) => ({
1678
1679
  object: itContact.object,
1679
1680
  id: itContact.id,
@@ -1681,8 +1682,7 @@ const deserializeItContact = (itContact) => ({
1681
1682
  createdAt: new Date(itContact.created_at),
1682
1683
  updatedAt: new Date(itContact.updated_at)
1683
1684
  });
1684
- //#endregion
1685
- //#region src/organizations/serializers/update-organization-options.serializer.ts
1685
+ // src/organizations/serializers/update-organization-options.serializer.ts
1686
1686
  const serializeUpdateOrganizationOptions = (options) => ({
1687
1687
  name: options.name,
1688
1688
  domain_data: options.domainData,
@@ -1690,8 +1690,13 @@ const serializeUpdateOrganizationOptions = (options) => ({
1690
1690
  external_id: options.externalId,
1691
1691
  metadata: options.metadata
1692
1692
  });
1693
- //#endregion
1694
- //#region src/sso/serializers/connection.serializer.ts
1693
+ // src/sso/serializers/authorize-logout.serializer.ts
1694
+ const serializeAuthorizeLogoutOptions = (options) => ({ profile_id: options.profileId });
1695
+ const deserializeAuthorizeLogout = (response) => ({
1696
+ logoutToken: response.logout_token,
1697
+ logoutUrl: response.logout_url
1698
+ });
1699
+ // src/sso/serializers/connection.serializer.ts
1695
1700
  const deserializeConnection = (connection) => ({
1696
1701
  object: connection.object,
1697
1702
  id: connection.id,
@@ -1703,8 +1708,7 @@ const deserializeConnection = (connection) => ({
1703
1708
  createdAt: new Date(connection.created_at),
1704
1709
  updatedAt: new Date(connection.updated_at)
1705
1710
  });
1706
- //#endregion
1707
- //#region src/sso/serializers/connection-event.serializer.ts
1711
+ // src/sso/serializers/connection-event.serializer.ts
1708
1712
  const deserializeConnectionEventConnection = (connection) => ({
1709
1713
  id: connection.id,
1710
1714
  ...connection.organization_id !== void 0 && { organizationId: connection.organization_id }
@@ -1726,19 +1730,18 @@ const deserializeConnectionSamlCertificateRenewedEvent = (data) => ({
1726
1730
  },
1727
1731
  renewedAt: new Date(data.renewed_at)
1728
1732
  });
1729
- //#endregion
1730
- //#region src/sso/serializers/list-connections-options.serializer.ts
1733
+ // src/sso/serializers/list-connections-options.serializer.ts
1731
1734
  const serializeListConnectionsOptions = (options) => ({
1732
1735
  connection_type: options.connectionType,
1733
1736
  domain: options.domain,
1734
1737
  organization_id: options.organizationId,
1738
+ state: options.state,
1735
1739
  limit: options.limit,
1736
1740
  before: options.before,
1737
1741
  after: options.after,
1738
1742
  order: options.order
1739
1743
  });
1740
- //#endregion
1741
- //#region src/sso/serializers/profile.serializer.ts
1744
+ // src/sso/serializers/profile.serializer.ts
1742
1745
  const deserializeProfile = (profile) => ({
1743
1746
  object: profile.object,
1744
1747
  id: profile.id,
@@ -1756,15 +1759,13 @@ const deserializeProfile = (profile) => ({
1756
1759
  ...profile.custom_attributes !== void 0 && { customAttributes: profile.custom_attributes },
1757
1760
  rawAttributes: profile.raw_attributes
1758
1761
  });
1759
- //#endregion
1760
- //#region src/sso/serializers/profile-and-token.serializer.ts
1762
+ // src/sso/serializers/profile-and-token.serializer.ts
1761
1763
  const deserializeProfileAndToken = (profileAndToken) => ({
1762
1764
  accessToken: profileAndToken.access_token,
1763
1765
  profile: deserializeProfile(profileAndToken.profile),
1764
1766
  oauthTokens: deserializeOauthTokens(profileAndToken.oauth_tokens)
1765
1767
  });
1766
- //#endregion
1767
- //#region src/user-management/serializers/role.serializer.ts
1768
+ // src/user-management/serializers/role.serializer.ts
1768
1769
  const deserializeRoleEvent = (role) => ({
1769
1770
  object: role.object,
1770
1771
  slug: role.slug,
@@ -1773,8 +1774,7 @@ const deserializeRoleEvent = (role) => ({
1773
1774
  createdAt: new Date(role.created_at),
1774
1775
  updatedAt: new Date(role.updated_at)
1775
1776
  });
1776
- //#endregion
1777
- //#region src/user-management/serializers/authentication-radar-risk-event-serializer.ts
1777
+ // src/user-management/serializers/authentication-radar-risk-event-serializer.ts
1778
1778
  const deserializeAuthenticationRadarRiskDetectedEvent = (authenticationRadarRiskDetectedEvent) => ({
1779
1779
  authMethod: authenticationRadarRiskDetectedEvent.auth_method,
1780
1780
  action: authenticationRadarRiskDetectedEvent.action,
@@ -1785,8 +1785,7 @@ const deserializeAuthenticationRadarRiskDetectedEvent = (authenticationRadarRisk
1785
1785
  userId: authenticationRadarRiskDetectedEvent.user_id,
1786
1786
  email: authenticationRadarRiskDetectedEvent.email
1787
1787
  });
1788
- //#endregion
1789
- //#region src/api-keys/serializers/api-key.serializer.ts
1788
+ // src/api-keys/serializers/api-key.serializer.ts
1790
1789
  function deserializeApiKey(apiKey) {
1791
1790
  return {
1792
1791
  object: apiKey.object,
@@ -1805,8 +1804,7 @@ function deserializeApiKey(apiKey) {
1805
1804
  updatedAt: new Date(apiKey.updated_at)
1806
1805
  };
1807
1806
  }
1808
- //#endregion
1809
- //#region src/authorization/serializers/organization-role.serializer.ts
1807
+ // src/authorization/serializers/organization-role.serializer.ts
1810
1808
  const deserializeRole = (role) => ({
1811
1809
  object: role.object,
1812
1810
  id: role.id,
@@ -1842,8 +1840,7 @@ const deserializeOrganizationRoleEvent = (event) => ({
1842
1840
  createdAt: new Date(event.created_at),
1843
1841
  updatedAt: new Date(event.updated_at)
1844
1842
  });
1845
- //#endregion
1846
- //#region src/authorization/serializers/permission.serializer.ts
1843
+ // src/authorization/serializers/permission.serializer.ts
1847
1844
  const deserializePermission = (permission) => ({
1848
1845
  object: permission.object,
1849
1846
  id: permission.id,
@@ -1855,8 +1852,7 @@ const deserializePermission = (permission) => ({
1855
1852
  createdAt: new Date(permission.created_at),
1856
1853
  updatedAt: new Date(permission.updated_at)
1857
1854
  });
1858
- //#endregion
1859
- //#region src/feature-flags/serializers/feature-flag.serializer.ts
1855
+ // src/feature-flags/serializers/feature-flag.serializer.ts
1860
1856
  const deserializeFeatureFlag = (featureFlag) => ({
1861
1857
  object: featureFlag.object,
1862
1858
  id: featureFlag.id,
@@ -1869,17 +1865,97 @@ const deserializeFeatureFlag = (featureFlag) => ({
1869
1865
  createdAt: new Date(featureFlag.created_at),
1870
1866
  updatedAt: new Date(featureFlag.updated_at)
1871
1867
  });
1872
- //#endregion
1873
- //#region src/groups/serializers/create-group.serializer.ts
1868
+ // src/feature-flags/serializers/flag-rule.serializer.ts
1869
+ const deserializeFlagRule = (rule) => ({
1870
+ object: rule.object,
1871
+ id: rule.id,
1872
+ flagId: rule.flag_id,
1873
+ flagSlug: rule.flag_slug,
1874
+ environmentId: rule.environment_id,
1875
+ targetType: rule.target_type,
1876
+ position: rule.position,
1877
+ valueType: rule.value_type,
1878
+ value: rule.value,
1879
+ createdAt: new Date(rule.created_at),
1880
+ updatedAt: new Date(rule.updated_at)
1881
+ });
1882
+ // src/feature-flags/serializers/flag-target.serializer.ts
1883
+ const deserializeTargetFields = (target) => ({
1884
+ object: target.object,
1885
+ id: target.id,
1886
+ flagId: target.flag_id,
1887
+ flagSlug: target.flag_slug,
1888
+ environmentId: target.environment_id,
1889
+ targetType: target.target_type,
1890
+ targetId: target.target_id,
1891
+ createdAt: new Date(target.created_at),
1892
+ updatedAt: new Date(target.updated_at)
1893
+ });
1894
+ const deserializeFlagTarget = (target) => ({
1895
+ ...deserializeTargetFields(target),
1896
+ ruleId: target.rule_id
1897
+ });
1898
+ const deserializeFlagTargetResource = (target) => "rule_id" in target ? deserializeFlagTarget(target) : {
1899
+ ...deserializeTargetFields(target),
1900
+ valueType: target.value_type,
1901
+ value: target.value
1902
+ };
1903
+ // src/common/serializers/feature-flag-event.serializer.ts
1904
+ const deserializeFeatureFlagOwner = (owner) => owner === null ? null : {
1905
+ email: owner.email,
1906
+ firstName: owner.first_name,
1907
+ lastName: owner.last_name
1908
+ };
1909
+ const deserializeFeatureFlagEventData = (flag) => ({
1910
+ object: flag.object,
1911
+ id: flag.id,
1912
+ environmentId: flag.environment_id,
1913
+ slug: flag.slug,
1914
+ name: flag.name,
1915
+ description: flag.description,
1916
+ owner: deserializeFeatureFlagOwner(flag.owner),
1917
+ tags: flag.tags,
1918
+ enabled: flag.enabled,
1919
+ defaultValue: flag.default_value,
1920
+ createdAt: new Date(flag.created_at),
1921
+ updatedAt: new Date(flag.updated_at)
1922
+ });
1923
+ const deserializeFeatureFlagRuleContext = (context) => ({
1924
+ clientId: context.client_id,
1925
+ ...context.actor === void 0 ? {} : { actor: context.actor }
1926
+ });
1927
+ const deserializeFeatureFlagRuleUpdatedContext = (context) => {
1928
+ const previous = context.previous_attributes;
1929
+ const data = previous?.data;
1930
+ return {
1931
+ ...deserializeFeatureFlagRuleContext(context),
1932
+ ...previous === void 0 ? {} : { previousAttributes: { ...data === void 0 ? {} : { data: data.value === void 0 ? {} : { value: data.value } } } }
1933
+ };
1934
+ };
1935
+ const deserializeFeatureFlagUpdatedContext = (context) => {
1936
+ const previous = context.previous_attributes;
1937
+ const data = previous?.data;
1938
+ return {
1939
+ clientId: context.client_id,
1940
+ actor: context.actor,
1941
+ ...previous === void 0 ? {} : { previousAttributes: { ...data === void 0 ? {} : { data: {
1942
+ ...data.name === void 0 ? {} : { name: data.name },
1943
+ ...data.description === void 0 ? {} : { description: data.description },
1944
+ ...data.tags === void 0 ? {} : { tags: data.tags },
1945
+ ...data.owner === void 0 ? {} : { owner: deserializeFeatureFlagOwner(data.owner) },
1946
+ ...data.enabled === void 0 ? {} : { enabled: data.enabled },
1947
+ ...data.default_value === void 0 ? {} : { defaultValue: data.default_value }
1948
+ } } } }
1949
+ };
1950
+ };
1951
+ // src/groups/serializers/create-group.serializer.ts
1874
1952
  const serializeCreateGroup = (model) => ({
1875
1953
  name: model.name,
1876
1954
  description: model.description ?? null
1877
1955
  });
1878
- //#endregion
1879
- //#region src/groups/serializers/create-group-membership.serializer.ts
1956
+ // src/groups/serializers/create-group-membership.serializer.ts
1880
1957
  const serializeCreateGroupMembership = (model) => ({ organization_membership_id: model.organizationMembershipId });
1881
- //#endregion
1882
- //#region src/groups/serializers/group.serializer.ts
1958
+ // src/groups/serializers/group.serializer.ts
1883
1959
  const deserializeGroup = (response) => ({
1884
1960
  object: response.object,
1885
1961
  id: response.id,
@@ -1889,14 +1965,12 @@ const deserializeGroup = (response) => ({
1889
1965
  createdAt: new Date(response.created_at),
1890
1966
  updatedAt: new Date(response.updated_at)
1891
1967
  });
1892
- //#endregion
1893
- //#region src/groups/serializers/update-group.serializer.ts
1968
+ // src/groups/serializers/update-group.serializer.ts
1894
1969
  const serializeUpdateGroup = (model) => ({
1895
1970
  name: model.name,
1896
1971
  description: model.description ?? null
1897
1972
  });
1898
- //#endregion
1899
- //#region src/vault/serializers/vault-event.serializer.ts
1973
+ // src/vault/serializers/vault-event.serializer.ts
1900
1974
  const deserializeVaultActor = (actor) => ({
1901
1975
  actorId: actor.actor_id,
1902
1976
  actorSource: actor.actor_source,
@@ -1961,14 +2035,12 @@ const deserializeVaultByokKeyDeletedEvent = (data) => ({
1961
2035
  organizationId: data.organization_id,
1962
2036
  keyProvider: data.key_provider
1963
2037
  });
1964
- //#endregion
1965
- //#region src/organization-domains/serializers/organization-domain-verification-failed.serializer.ts
2038
+ // src/organization-domains/serializers/organization-domain-verification-failed.serializer.ts
1966
2039
  const deserializeOrganizationDomainVerificationFailed = (organizationDomainVerificationFailed) => ({
1967
2040
  reason: organizationDomainVerificationFailed.reason,
1968
2041
  organizationDomain: deserializeOrganizationDomain(organizationDomainVerificationFailed.organization_domain)
1969
2042
  });
1970
- //#endregion
1971
- //#region src/actions/serializers/action-event.serializer.ts
2043
+ // src/actions/serializers/action-event.serializer.ts
1972
2044
  const deserializeActionAuthenticationDeniedEvent = (data) => ({
1973
2045
  actionEndpointId: data.action_endpoint_id,
1974
2046
  actionExecutionId: data.action_execution_id,
@@ -1990,30 +2062,26 @@ const deserializeActionUserRegistrationDeniedEvent = (data) => ({
1990
2062
  ipAddress: data.ip_address,
1991
2063
  userAgent: data.user_agent
1992
2064
  });
1993
- //#endregion
1994
- //#region src/api-keys/serializers/api-key-event.serializer.ts
2065
+ // src/api-keys/serializers/api-key-event.serializer.ts
1995
2066
  function deserializeApiKeyUpdatedEvent(data) {
1996
2067
  return {
1997
2068
  ...deserializeApiKey(data),
1998
2069
  previousAttributes: { expiresAt: data.previous_attributes.expires_at != null ? new Date(data.previous_attributes.expires_at) : null }
1999
2070
  };
2000
2071
  }
2001
- //#endregion
2002
- //#region src/radar/serializers/radar-event.serializer.ts
2072
+ // src/radar/serializers/radar-event.serializer.ts
2003
2073
  const deserializeRadarChallengeCreatedEvent = (data) => ({
2004
2074
  type: data.type,
2005
2075
  radarChallengeId: data.radar_challenge_id,
2006
2076
  userId: data.user_id,
2007
2077
  email: data.email
2008
2078
  });
2009
- //#endregion
2010
- //#region src/common/serializers/resource-export-event.serializer.ts
2079
+ // src/common/serializers/resource-export-event.serializer.ts
2011
2080
  const deserializeResourceExportEvent = (data) => ({
2012
2081
  id: data.id,
2013
2082
  resourceType: data.resource_type
2014
2083
  });
2015
- //#endregion
2016
- //#region src/common/serializers/event.serializer.ts
2084
+ // src/common/serializers/event.serializer.ts
2017
2085
  const deserializePipesConnectedAccount = (connectedAccount) => ({
2018
2086
  object: connectedAccount.object,
2019
2087
  id: connectedAccount.id,
@@ -2058,7 +2126,8 @@ const deserializeEvent = (event) => {
2058
2126
  return {
2059
2127
  ...eventBase,
2060
2128
  event: unknownEvent.event,
2061
- data: unknownEvent.data
2129
+ data: unknownEvent.data,
2130
+ context: unknownEvent.context
2062
2131
  };
2063
2132
  };
2064
2133
  function deserializeKnownEvent(event, eventBase) {
@@ -2289,6 +2358,45 @@ function deserializeKnownEvent(event, eventBase) {
2289
2358
  event: event.event,
2290
2359
  data: deserializeApiKey(event.data)
2291
2360
  };
2361
+ case "feature_flags.flag.created":
2362
+ case "feature_flags.flag.deleted": return {
2363
+ ...eventBase,
2364
+ event: event.event,
2365
+ data: deserializeFeatureFlagEventData(event.data),
2366
+ context: {
2367
+ clientId: event.context.client_id,
2368
+ actor: event.context.actor
2369
+ }
2370
+ };
2371
+ case "feature_flags.flag.updated": return {
2372
+ ...eventBase,
2373
+ event: event.event,
2374
+ data: deserializeFeatureFlagEventData(event.data),
2375
+ context: deserializeFeatureFlagUpdatedContext(event.context)
2376
+ };
2377
+ case "feature_flags.flag_rule.created":
2378
+ case "feature_flags.flag_rule.deleted": return {
2379
+ ...eventBase,
2380
+ event: event.event,
2381
+ data: deserializeFlagRule(event.data),
2382
+ context: deserializeFeatureFlagRuleContext(event.context)
2383
+ };
2384
+ case "feature_flags.flag_rule.updated": return {
2385
+ ...eventBase,
2386
+ event: event.event,
2387
+ data: deserializeFlagRule(event.data),
2388
+ context: deserializeFeatureFlagRuleUpdatedContext(event.context)
2389
+ };
2390
+ case "feature_flags.flag_target.created":
2391
+ case "feature_flags.flag_target.deleted": return {
2392
+ ...eventBase,
2393
+ event: event.event,
2394
+ data: deserializeFlagTargetResource(event.data),
2395
+ context: {
2396
+ clientId: event.context.client_id,
2397
+ actor: event.context.actor
2398
+ }
2399
+ };
2292
2400
  case "flag.created":
2293
2401
  case "flag.updated":
2294
2402
  case "flag.deleted":
@@ -2457,23 +2565,20 @@ function deserializeKnownEvent(event, eventBase) {
2457
2565
  default: return;
2458
2566
  }
2459
2567
  }
2460
- //#endregion
2461
- //#region src/common/serializers/list.serializer.ts
2568
+ // src/common/serializers/list.serializer.ts
2462
2569
  const deserializeList = (list, deserializer) => ({
2463
2570
  object: "list",
2464
2571
  data: list.data.map(deserializer),
2465
2572
  listMetadata: list.list_metadata
2466
2573
  });
2467
- //#endregion
2468
- //#region src/common/serializers/pagination-options.serializer.ts
2574
+ // src/common/serializers/pagination-options.serializer.ts
2469
2575
  const serializePaginationOptions = (options) => ({
2470
2576
  ...options.limit !== void 0 && { limit: options.limit },
2471
2577
  ...options.after && { after: options.after },
2472
2578
  ...options.before && { before: options.before },
2473
2579
  ...options.order && { order: options.order }
2474
2580
  });
2475
- //#endregion
2476
- //#region src/common/utils/fetch-and-deserialize.ts
2581
+ // src/common/utils/fetch-and-deserialize.ts
2477
2582
  const setDefaultOptions = (options) => {
2478
2583
  return {
2479
2584
  ...options,
@@ -2487,8 +2592,7 @@ const fetchAndDeserialize = async (workos, endpoint, deserializeFn, options, req
2487
2592
  });
2488
2593
  return deserializeList(data, deserializeFn);
2489
2594
  };
2490
- //#endregion
2491
- //#region src/webhooks/serializers/webhook-endpoint.serializer.ts
2595
+ // src/webhooks/serializers/webhook-endpoint.serializer.ts
2492
2596
  const deserializeWebhookEndpoint = (response) => ({
2493
2597
  object: response.object,
2494
2598
  id: response.id,
@@ -2499,21 +2603,18 @@ const deserializeWebhookEndpoint = (response) => ({
2499
2603
  createdAt: new Date(response.created_at),
2500
2604
  updatedAt: new Date(response.updated_at)
2501
2605
  });
2502
- //#endregion
2503
- //#region src/webhooks/serializers/create-webhook-endpoint.serializer.ts
2606
+ // src/webhooks/serializers/create-webhook-endpoint.serializer.ts
2504
2607
  const serializeCreateWebhookEndpoint = (model) => ({
2505
2608
  endpoint_url: model.endpointUrl,
2506
2609
  events: model.events
2507
2610
  });
2508
- //#endregion
2509
- //#region src/webhooks/serializers/update-webhook-endpoint.serializer.ts
2611
+ // src/webhooks/serializers/update-webhook-endpoint.serializer.ts
2510
2612
  const serializeUpdateWebhookEndpoint = (model) => ({
2511
2613
  endpoint_url: model.endpointUrl,
2512
2614
  status: model.status,
2513
2615
  events: model.events
2514
2616
  });
2515
- //#endregion
2516
- //#region src/webhooks/webhooks.ts
2617
+ // src/webhooks/webhooks.ts
2517
2618
  var Webhooks = class {
2518
2619
  workos;
2519
2620
  constructor(workos) {
@@ -2615,8 +2716,7 @@ var Webhooks = class {
2615
2716
  return JSON.parse(decodePayloadToString(payload));
2616
2717
  }
2617
2718
  };
2618
- //#endregion
2619
- //#region src/pkce/pkce.ts
2719
+ // src/pkce/pkce.ts
2620
2720
  /**
2621
2721
  * PKCE (Proof Key for Code Exchange) utilities for OAuth 2.0 public clients.
2622
2722
  *
@@ -2665,8 +2765,7 @@ var PKCE = class {
2665
2765
  return btoa(String.fromCharCode(...buffer)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
2666
2766
  }
2667
2767
  };
2668
- //#endregion
2669
- //#region src/utils/jose.ts
2768
+ // src/utils/jose.ts
2670
2769
  let _josePromise;
2671
2770
  /**
2672
2771
  * Dynamically imports the jose library using import() to support Node.js 20.0-20.18.
@@ -2681,10 +2780,9 @@ let _josePromise;
2681
2780
  * @returns Promise that resolves to the jose module
2682
2781
  */
2683
2782
  function getJose() {
2684
- return _josePromise ??= Promise.resolve().then(() => require("./webapi-MD5xmNba.cjs"));
2783
+ return _josePromise ??= Promise.resolve().then(() => require("./webapi-rpGT44g1.cjs"));
2685
2784
  }
2686
- //#endregion
2687
- //#region src/agents/serializers/agent-instance-session.serializer.ts
2785
+ // src/agents/serializers/agent-instance-session.serializer.ts
2688
2786
  function deserializeAgentInstanceSession(session) {
2689
2787
  return {
2690
2788
  object: session.object,
@@ -2707,8 +2805,7 @@ function serializeListAgentInstanceSessionsOptions(options) {
2707
2805
  order: options.order
2708
2806
  };
2709
2807
  }
2710
- //#endregion
2711
- //#region src/agents/serializers/agent-registration.serializer.ts
2808
+ // src/agents/serializers/agent-registration.serializer.ts
2712
2809
  function deserializeAgentRegistration(registration) {
2713
2810
  return {
2714
2811
  id: registration.id,
@@ -2739,8 +2836,7 @@ function deserializeAgentRegistration(registration) {
2739
2836
  updatedAt: new Date(registration.updated_at)
2740
2837
  };
2741
2838
  }
2742
- //#endregion
2743
- //#region src/agents/serializers/agent-token.serializer.ts
2839
+ // src/agents/serializers/agent-token.serializer.ts
2744
2840
  function deserializeAgentToken(token) {
2745
2841
  return {
2746
2842
  accessToken: token.access_token,
@@ -2778,8 +2874,7 @@ function serializeMintAgentTokenOptions(options) {
2778
2874
  };
2779
2875
  }
2780
2876
  }
2781
- //#endregion
2782
- //#region src/agents/serializers/claim-attempt.serializer.ts
2877
+ // src/agents/serializers/claim-attempt.serializer.ts
2783
2878
  function serializeLinkClaimAttemptToExternalUserOptions(options) {
2784
2879
  return {
2785
2880
  type: "link_external_user",
@@ -2799,8 +2894,7 @@ function deserializeClaimAttemptResponse(response) {
2799
2894
  organizations: response.organizations
2800
2895
  };
2801
2896
  }
2802
- //#endregion
2803
- //#region src/agents/serializers/validate-agent-credential.serializer.ts
2897
+ // src/agents/serializers/validate-agent-credential.serializer.ts
2804
2898
  function serializeValidateAgentCredentialOptions(options) {
2805
2899
  return {
2806
2900
  type: options.type,
@@ -2835,8 +2929,7 @@ function deserializeAgentAccessTokenClaims(payload) {
2835
2929
  issuedAt: payload.iat
2836
2930
  };
2837
2931
  }
2838
- //#endregion
2839
- //#region src/agents/agents.ts
2932
+ // src/agents/agents.ts
2840
2933
  /**
2841
2934
  * A decoded JWT payload is only an agent credential if it carries every claim
2842
2935
  * the SDK guarantees. A token signed by the same JWKS for another purpose
@@ -3147,16 +3240,15 @@ var Agents = class {
3147
3240
  return this._jwks;
3148
3241
  }
3149
3242
  };
3150
- //#endregion
3151
- //#region src/api-keys/serializers/create-organization-api-key-options.serializer.ts
3243
+ // src/api-keys/serializers/create-organization-api-key-options.serializer.ts
3152
3244
  function serializeCreateOrganizationApiKeyOptions(options) {
3153
3245
  return {
3154
3246
  name: options.name,
3155
- permissions: options.permissions
3247
+ permissions: options.permissions,
3248
+ expires_at: options.expiresAt?.toISOString()
3156
3249
  };
3157
3250
  }
3158
- //#endregion
3159
- //#region src/api-keys/serializers/created-api-key.serializer.ts
3251
+ // src/api-keys/serializers/created-api-key.serializer.ts
3160
3252
  function deserializeCreatedApiKey(apiKey) {
3161
3253
  return {
3162
3254
  object: apiKey.object,
@@ -3172,16 +3264,14 @@ function deserializeCreatedApiKey(apiKey) {
3172
3264
  updatedAt: new Date(apiKey.updated_at)
3173
3265
  };
3174
3266
  }
3175
- //#endregion
3176
- //#region src/api-keys/serializers/validate-api-key.serializer.ts
3267
+ // src/api-keys/serializers/validate-api-key.serializer.ts
3177
3268
  function deserializeValidateApiKeyResponse(response) {
3178
3269
  return {
3179
3270
  apiKey: response.api_key ? deserializeApiKey(response.api_key) : null,
3180
3271
  ...typeof response.agent_registration_id === "undefined" ? void 0 : { agentRegistrationId: response.agent_registration_id }
3181
3272
  };
3182
3273
  }
3183
- //#endregion
3184
- //#region src/api-keys/api-keys.ts
3274
+ // src/api-keys/api-keys.ts
3185
3275
  var ApiKeys = class {
3186
3276
  workos;
3187
3277
  constructor(workos) {
@@ -3241,7 +3331,7 @@ var ApiKeys = class {
3241
3331
  * @example
3242
3332
  * "org_01EHZNVPK3SFK441A1RGBFSHRT"
3243
3333
  *
3244
- * @param options - Object containing name.
3334
+ * @param options - Object containing name, permissions, and expiresAt.
3245
3335
  * @returns {Promise<ApiKeyWithValue>}
3246
3336
  * @throws {NotFoundException} 404
3247
3337
  * @throws {UnprocessableEntityException} 422
@@ -3252,11 +3342,9 @@ var ApiKeys = class {
3252
3342
  return deserializeCreatedApiKey(data);
3253
3343
  }
3254
3344
  };
3255
- //#endregion
3256
- //#region src/connect/serializers/external-auth-complete-response.serializer.ts
3345
+ // src/connect/serializers/external-auth-complete-response.serializer.ts
3257
3346
  const deserializeExternalAuthCompleteResponse = (response) => ({ redirectUri: response.redirect_uri });
3258
- //#endregion
3259
- //#region src/connect/serializers/token-exchange-response.serializer.ts
3347
+ // src/connect/serializers/token-exchange-response.serializer.ts
3260
3348
  const deserializeTokenExchangeResponse = (response) => ({
3261
3349
  accessToken: response.access_token,
3262
3350
  issuedTokenType: response.issued_token_type,
@@ -3264,49 +3352,7 @@ const deserializeTokenExchangeResponse = (response) => ({
3264
3352
  expiresIn: response.expires_in,
3265
3353
  ...response.scope !== void 0 && { scope: response.scope }
3266
3354
  });
3267
- //#endregion
3268
- //#region src/connect/serializers/connect-application-redirect-uri.serializer.ts
3269
- const deserializeConnectApplicationRedirectUri = (response) => ({
3270
- uri: response.uri,
3271
- default: response.default
3272
- });
3273
- //#endregion
3274
- //#region src/connect/serializers/connect-application.serializer.ts
3275
- const deserializeConnectApplication = (response) => {
3276
- switch (response.application_type) {
3277
- case "oauth": return {
3278
- object: response.object,
3279
- id: response.id,
3280
- clientId: response.client_id,
3281
- description: response.description,
3282
- name: response.name,
3283
- scopes: response.scopes,
3284
- createdAt: new Date(response.created_at),
3285
- updatedAt: new Date(response.updated_at),
3286
- applicationType: "oauth",
3287
- redirectUris: response.redirect_uris.map(deserializeConnectApplicationRedirectUri),
3288
- usesPkce: response.uses_pkce,
3289
- isFirstParty: response.is_first_party,
3290
- wasDynamicallyRegistered: response.was_dynamically_registered,
3291
- organizationId: response.organization_id
3292
- };
3293
- case "m2m": return {
3294
- object: response.object,
3295
- id: response.id,
3296
- clientId: response.client_id,
3297
- description: response.description,
3298
- name: response.name,
3299
- scopes: response.scopes,
3300
- createdAt: new Date(response.created_at),
3301
- updatedAt: new Date(response.updated_at),
3302
- applicationType: "m2m",
3303
- organizationId: response.organization_id
3304
- };
3305
- default: throw new Error(`Unknown application_type: ${response.application_type}`);
3306
- }
3307
- };
3308
- //#endregion
3309
- //#region src/connect/serializers/application-credentials-list-item.serializer.ts
3355
+ // src/connect/serializers/application-credentials-list-item.serializer.ts
3310
3356
  const deserializeApplicationCredentialsListItem = (response) => ({
3311
3357
  object: response.object,
3312
3358
  id: response.id,
@@ -3315,8 +3361,7 @@ const deserializeApplicationCredentialsListItem = (response) => ({
3315
3361
  createdAt: new Date(response.created_at),
3316
3362
  updatedAt: new Date(response.updated_at)
3317
3363
  });
3318
- //#endregion
3319
- //#region src/connect/serializers/new-connect-application-secret.serializer.ts
3364
+ // src/connect/serializers/new-connect-application-secret.serializer.ts
3320
3365
  const deserializeNewConnectApplicationSecret = (response) => ({
3321
3366
  object: response.object,
3322
3367
  id: response.id,
@@ -3326,8 +3371,7 @@ const deserializeNewConnectApplicationSecret = (response) => ({
3326
3371
  updatedAt: new Date(response.updated_at),
3327
3372
  secret: response.secret
3328
3373
  });
3329
- //#endregion
3330
- //#region src/connect/serializers/user-object.serializer.ts
3374
+ // src/connect/serializers/user-object.serializer.ts
3331
3375
  const serializeUserObject = (model) => ({
3332
3376
  id: model.id,
3333
3377
  email: model.email,
@@ -3335,35 +3379,30 @@ const serializeUserObject = (model) => ({
3335
3379
  last_name: model.lastName,
3336
3380
  metadata: model.metadata
3337
3381
  });
3338
- //#endregion
3339
- //#region src/connect/serializers/user-consent-option-choice.serializer.ts
3382
+ // src/connect/serializers/user-consent-option-choice.serializer.ts
3340
3383
  const serializeUserConsentOptionChoice = (model) => ({
3341
3384
  value: model.value,
3342
3385
  label: model.label
3343
3386
  });
3344
- //#endregion
3345
- //#region src/connect/serializers/user-consent-option.serializer.ts
3387
+ // src/connect/serializers/user-consent-option.serializer.ts
3346
3388
  const serializeUserConsentOption = (model) => ({
3347
3389
  claim: model.claim,
3348
3390
  type: model.type,
3349
3391
  label: model.label,
3350
3392
  choices: model.choices.map(serializeUserConsentOptionChoice)
3351
3393
  });
3352
- //#endregion
3353
- //#region src/connect/serializers/user-management-login-request.serializer.ts
3394
+ // src/connect/serializers/user-management-login-request.serializer.ts
3354
3395
  const serializeUserManagementLoginRequest = (model) => ({
3355
3396
  external_auth_id: model.externalAuthId,
3356
3397
  user: serializeUserObject(model.user),
3357
3398
  user_consent_options: model.userConsentOptions != null ? model.userConsentOptions.map(serializeUserConsentOption) : void 0
3358
3399
  });
3359
- //#endregion
3360
- //#region src/connect/serializers/redirect-uri-input.serializer.ts
3400
+ // src/connect/serializers/redirect-uri-input.serializer.ts
3361
3401
  const serializeRedirectUriInput = (model) => ({
3362
3402
  uri: model.uri,
3363
3403
  default: model.default ?? null
3364
3404
  });
3365
- //#endregion
3366
- //#region src/connect/serializers/create-oauth-application.serializer.ts
3405
+ // src/connect/serializers/create-oauth-application.serializer.ts
3367
3406
  const serializeCreateOAuthApplication = (model) => ({
3368
3407
  name: model.name,
3369
3408
  application_type: model.applicationType,
@@ -3374,8 +3413,7 @@ const serializeCreateOAuthApplication = (model) => ({
3374
3413
  is_first_party: model.isFirstParty,
3375
3414
  organization_id: model.organizationId ?? null
3376
3415
  });
3377
- //#endregion
3378
- //#region src/connect/serializers/create-m2m-application.serializer.ts
3416
+ // src/connect/serializers/create-m2m-application.serializer.ts
3379
3417
  const serializeCreateM2MApplication = (model) => ({
3380
3418
  name: model.name,
3381
3419
  application_type: model.applicationType,
@@ -3383,19 +3421,16 @@ const serializeCreateM2MApplication = (model) => ({
3383
3421
  scopes: model.scopes ?? null,
3384
3422
  organization_id: model.organizationId
3385
3423
  });
3386
- //#endregion
3387
- //#region src/connect/serializers/update-oauth-application.serializer.ts
3424
+ // src/connect/serializers/update-oauth-application.serializer.ts
3388
3425
  const serializeUpdateOAuthApplication = (model) => ({
3389
3426
  name: model.name,
3390
3427
  description: model.description ?? null,
3391
3428
  scopes: model.scopes ?? null,
3392
3429
  redirect_uris: model.redirectUris != null ? model.redirectUris.map(serializeRedirectUriInput) : null
3393
3430
  });
3394
- //#endregion
3395
- //#region src/connect/serializers/create-application-secret.serializer.ts
3431
+ // src/connect/serializers/create-application-secret.serializer.ts
3396
3432
  const serializeCreateApplicationSecret = (_model) => ({});
3397
- //#endregion
3398
- //#region src/connect/connect.ts
3433
+ // src/connect/connect.ts
3399
3434
  const serializeListApplicationsOptions = (options) => {
3400
3435
  const wire = {
3401
3436
  limit: options.limit,
@@ -3680,8 +3715,7 @@ var Connect = class {
3680
3715
  await this.workos.delete(`/connect/client_secrets/${encodeURIComponent(id)}`);
3681
3716
  }
3682
3717
  };
3683
- //#endregion
3684
- //#region src/directory-sync/directory-sync.ts
3718
+ // src/directory-sync/directory-sync.ts
3685
3719
  const serializeListDirectoriesOptions = (options) => {
3686
3720
  const wire = {
3687
3721
  limit: options.limit,
@@ -3693,6 +3727,18 @@ const serializeListDirectoriesOptions = (options) => {
3693
3727
  if (options.search !== void 0) wire.search = options.search;
3694
3728
  return wire;
3695
3729
  };
3730
+ const serializeListUsersInDirectoryOptions = (options) => {
3731
+ const wire = {
3732
+ limit: options.limit,
3733
+ before: options.before,
3734
+ after: options.after,
3735
+ order: options.order,
3736
+ group: options.group,
3737
+ email: options.email
3738
+ };
3739
+ if (options.idpId !== void 0) wire.idp_id = options.idpId;
3740
+ return wire;
3741
+ };
3696
3742
  var DirectorySync = class {
3697
3743
  workos;
3698
3744
  constructor(workos) {
@@ -3749,6 +3795,7 @@ var DirectorySync = class {
3749
3795
  * @throws {AuthorizationException} 403
3750
3796
  * @throws {NotFoundException} 404
3751
3797
  * @throws {UnprocessableEntityException} 422
3798
+ * @deprecated Use {@link DirectorySync.listDirectoryGroups} instead.
3752
3799
  */
3753
3800
  async listGroups(options) {
3754
3801
  const paginationOptions = options;
@@ -3764,6 +3811,7 @@ var DirectorySync = class {
3764
3811
  * @returns {Promise<DirectoryGroup>}
3765
3812
  * @throws {AuthorizationException} 403
3766
3813
  * @throws {NotFoundException} 404
3814
+ * @deprecated Use {@link DirectorySync.getDirectoryGroup} instead.
3767
3815
  */
3768
3816
  async getGroup(options) {
3769
3817
  const { id } = options;
@@ -3780,6 +3828,7 @@ var DirectorySync = class {
3780
3828
  * @throws {NotFoundException} 404
3781
3829
  * @throws {UnprocessableEntityException} 422
3782
3830
  * @throws {RateLimitExceededException} 429
3831
+ * @deprecated Use {@link DirectorySync.listDirectoryUsers} instead.
3783
3832
  */
3784
3833
  async listUsers(options) {
3785
3834
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/directory_users", deserializeDirectoryUserWithGroups, options), (params) => fetchAndDeserialize(this.workos, "/directory_users", deserializeDirectoryUserWithGroups, params), options);
@@ -3794,15 +3843,94 @@ var DirectorySync = class {
3794
3843
  * @returns {Promise<DirectoryUserWithGroups<TCustomAttributes>>}
3795
3844
  * @throws {AuthorizationException} 403
3796
3845
  * @throws {NotFoundException} 404
3846
+ * @deprecated Use {@link DirectorySync.getDirectoryUser} instead.
3797
3847
  */
3798
3848
  async getUser(options) {
3799
3849
  const { id } = options;
3800
3850
  const { data } = await this.workos.get(`/directory_users/${encodeURIComponent(id)}`);
3801
3851
  return deserializeDirectoryUserWithGroups(data);
3802
3852
  }
3853
+ /**
3854
+ * List Users for a Directory
3855
+ *
3856
+ * Get a list of the Directory Users in a Directory, optionally filtered to the members of a Directory Group.
3857
+ * @param options - Pagination and filter options.
3858
+ * @param options.directoryId - Unique identifier of the Directory.
3859
+ * @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
3860
+ * @param options.group - Filter Directory Users to the members of this Directory Group.
3861
+ * @example "directory_group_01E64QTDNS0EGJ0FMCVY9BWGZT"
3862
+ * @param options.idpId - Filter Directory Users by the identity provider's unique identifier.
3863
+ * @example "2836"
3864
+ * @param options.email - Filter Directory Users by their primary email address.
3865
+ * @example "jane.doe@example.com"
3866
+ * @returns {Promise<AutoPaginatable<DirectoryUser<TCustomAttributes>, PaginationOptions>>}
3867
+ * @throws {AuthorizationException} 403
3868
+ * @throws {NotFoundException} 404
3869
+ * @throws {UnprocessableEntityException} 422
3870
+ */
3871
+ async listDirectoryUsers(options) {
3872
+ const { directoryId, ...rest } = options;
3873
+ const endpoint = `/directories/${encodeURIComponent(directoryId)}/users`;
3874
+ const wire = serializeListUsersInDirectoryOptions(rest);
3875
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeDirectoryUser, wire), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeDirectoryUser, params), wire);
3876
+ }
3877
+ /**
3878
+ * Get a User for a Directory
3879
+ *
3880
+ * Get the details of a Directory User in a Directory.
3881
+ * @param options - The request options.
3882
+ * @param options.directoryId - Unique identifier of the Directory.
3883
+ * @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
3884
+ * @param options.userId - Unique identifier for the Directory User.
3885
+ * @example "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"
3886
+ * @returns {Promise<DirectoryUser<TCustomAttributes>>}
3887
+ * @throws {AuthorizationException} 403
3888
+ * @throws {NotFoundException} 404
3889
+ */
3890
+ async getDirectoryUser(options) {
3891
+ const { directoryId, userId } = options;
3892
+ const { data } = await this.workos.get(`/directories/${encodeURIComponent(directoryId)}/users/${encodeURIComponent(userId)}`);
3893
+ return deserializeDirectoryUser(data);
3894
+ }
3895
+ /**
3896
+ * List Groups for a Directory
3897
+ *
3898
+ * Get a list of the Directory Groups in a Directory, optionally filtered to the groups a Directory User belongs to.
3899
+ * @param options - Pagination and filter options.
3900
+ * @param options.directoryId - Unique identifier of the Directory.
3901
+ * @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
3902
+ * @param options.user - Filter Directory Groups to those this Directory User belongs to.
3903
+ * @example "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"
3904
+ * @returns {Promise<AutoPaginatable<DirectoryGroup, PaginationOptions>>}
3905
+ * @throws {AuthorizationException} 403
3906
+ * @throws {NotFoundException} 404
3907
+ * @throws {UnprocessableEntityException} 422
3908
+ */
3909
+ async listDirectoryGroups(options) {
3910
+ const { directoryId, ...wire } = options;
3911
+ const endpoint = `/directories/${encodeURIComponent(directoryId)}/groups`;
3912
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeDirectoryGroup, wire), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeDirectoryGroup, params), wire);
3913
+ }
3914
+ /**
3915
+ * Get a Group for a Directory
3916
+ *
3917
+ * Get the details of a Directory Group in a Directory.
3918
+ * @param options - The request options.
3919
+ * @param options.directoryId - Unique identifier of the Directory.
3920
+ * @example "directory_01ECAZ4NV9QMV47GW873HDCX74"
3921
+ * @param options.groupId - Unique identifier for the Directory Group.
3922
+ * @example "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z"
3923
+ * @returns {Promise<DirectoryGroup>}
3924
+ * @throws {AuthorizationException} 403
3925
+ * @throws {NotFoundException} 404
3926
+ */
3927
+ async getDirectoryGroup(options) {
3928
+ const { directoryId, groupId } = options;
3929
+ const { data } = await this.workos.get(`/directories/${encodeURIComponent(directoryId)}/groups/${encodeURIComponent(groupId)}`);
3930
+ return deserializeDirectoryGroup(data);
3931
+ }
3803
3932
  };
3804
- //#endregion
3805
- //#region src/events/serializers/list-event-options.serializer.ts
3933
+ // src/events/serializers/list-event-options.serializer.ts
3806
3934
  const serializeListEventOptions = (options) => ({
3807
3935
  events: options.events,
3808
3936
  organization_id: options.organizationId,
@@ -3811,8 +3939,7 @@ const serializeListEventOptions = (options) => ({
3811
3939
  limit: options.limit,
3812
3940
  after: options.after
3813
3941
  });
3814
- //#endregion
3815
- //#region src/events/events.ts
3942
+ // src/events/events.ts
3816
3943
  var Events = class {
3817
3944
  workos;
3818
3945
  constructor(workos) {
@@ -3832,8 +3959,7 @@ var Events = class {
3832
3959
  return deserializeList(data, deserializeEvent);
3833
3960
  }
3834
3961
  };
3835
- //#endregion
3836
- //#region src/common/utils/encode-path-parameter.ts
3962
+ // src/common/utils/encode-path-parameter.ts
3837
3963
  /**
3838
3964
  * Encode a caller-supplied identifier for safe interpolation into a single URL
3839
3965
  * path segment.
@@ -3869,8 +3995,7 @@ function encodePathParameter(value) {
3869
3995
  if (encoded === "." || encoded === "..") throw new TypeError("Invalid path parameter: a path parameter must not be \".\" or \"..\".");
3870
3996
  return encoded;
3871
3997
  }
3872
- //#endregion
3873
- //#region src/organizations/organizations.ts
3998
+ // src/organizations/organizations.ts
3874
3999
  var Organizations = class {
3875
4000
  workos;
3876
4001
  constructor(workos) {
@@ -4048,14 +4173,12 @@ var Organizations = class {
4048
4173
  await this.workos.post(`/organizations/${encodePathParameter(organizationId)}/it_contacts/${encodePathParameter(contactId)}/revoke`, {});
4049
4174
  }
4050
4175
  };
4051
- //#endregion
4052
- //#region src/organization-domains/serializers/create-organization-domain-options.serializer.ts
4176
+ // src/organization-domains/serializers/create-organization-domain-options.serializer.ts
4053
4177
  const serializeCreateOrganizationDomainOptions = (options) => ({
4054
4178
  domain: options.domain,
4055
4179
  organization_id: options.organizationId
4056
4180
  });
4057
- //#endregion
4058
- //#region src/organization-domains/organization-domains.ts
4181
+ // src/organization-domains/organization-domains.ts
4059
4182
  var OrganizationDomains = class {
4060
4183
  workos;
4061
4184
  constructor(workos) {
@@ -4121,8 +4244,7 @@ var OrganizationDomains = class {
4121
4244
  await this.workos.delete(`/organization_domains/${encodePathParameter(id)}`);
4122
4245
  }
4123
4246
  };
4124
- //#endregion
4125
- //#region src/passwordless/serializers/passwordless-session.serializer.ts
4247
+ // src/passwordless/serializers/passwordless-session.serializer.ts
4126
4248
  const deserializePasswordlessSession = (passwordlessSession) => ({
4127
4249
  id: passwordlessSession.id,
4128
4250
  email: passwordlessSession.email,
@@ -4130,8 +4252,7 @@ const deserializePasswordlessSession = (passwordlessSession) => ({
4130
4252
  link: passwordlessSession.link,
4131
4253
  object: passwordlessSession.object
4132
4254
  });
4133
- //#endregion
4134
- //#region src/passwordless/passwordless.ts
4255
+ // src/passwordless/passwordless.ts
4135
4256
  var Passwordless = class {
4136
4257
  workos;
4137
4258
  constructor(workos) {
@@ -4150,15 +4271,13 @@ var Passwordless = class {
4150
4271
  return data;
4151
4272
  }
4152
4273
  };
4153
- //#endregion
4154
- //#region src/pipes/serializers/data-integration-credential.serializer.ts
4274
+ // src/pipes/serializers/data-integration-credential.serializer.ts
4155
4275
  const deserializeDataIntegrationCredential = (response) => ({
4156
4276
  type: response.type,
4157
4277
  clientId: response.client_id ?? null,
4158
4278
  redactedClientSecret: response.redacted_client_secret ?? null
4159
4279
  });
4160
- //#endregion
4161
- //#region src/pipes/serializers/data-integration-installation.serializer.ts
4280
+ // src/pipes/serializers/data-integration-installation.serializer.ts
4162
4281
  const deserializeDataIntegrationInstallation = (response) => ({
4163
4282
  id: response.id,
4164
4283
  connectionRole: response.connection_role,
@@ -4168,8 +4287,7 @@ const deserializeDataIntegrationInstallation = (response) => ({
4168
4287
  organizationId: response.organization_id ?? null,
4169
4288
  apiKeyLast4: response.api_key_last_4 ?? null
4170
4289
  });
4171
- //#endregion
4172
- //#region src/pipes/serializers/data-integration-custom-provider.serializer.ts
4290
+ // src/pipes/serializers/data-integration-custom-provider.serializer.ts
4173
4291
  const deserializeDataIntegrationCustomProvider = (response) => ({
4174
4292
  name: response.name,
4175
4293
  authorizationUrl: response.authorization_url ?? null,
@@ -4183,8 +4301,7 @@ const deserializeDataIntegrationCustomProvider = (response) => ({
4183
4301
  tokenBodyContentType: response.token_body_content_type,
4184
4302
  authenticateVia: response.authenticate_via
4185
4303
  });
4186
- //#endregion
4187
- //#region src/pipes/serializers/data-integration.serializer.ts
4304
+ // src/pipes/serializers/data-integration.serializer.ts
4188
4305
  const deserializeDataIntegration = (response) => ({
4189
4306
  object: response.object,
4190
4307
  id: response.id,
@@ -4204,14 +4321,12 @@ const deserializeDataIntegration = (response) => ({
4204
4321
  createdAt: new Date(response.created_at),
4205
4322
  updatedAt: new Date(response.updated_at)
4206
4323
  });
4207
- //#endregion
4208
- //#region src/pipes/serializers/connected-account-warning.serializer.ts
4324
+ // src/pipes/serializers/connected-account-warning.serializer.ts
4209
4325
  const deserializeConnectedAccountWarning = (response) => ({
4210
4326
  code: response.code,
4211
4327
  message: response.message
4212
4328
  });
4213
- //#endregion
4214
- //#region src/pipes/serializers/connected-account.serializer.ts
4329
+ // src/pipes/serializers/connected-account.serializer.ts
4215
4330
  const deserializeConnectedAccount = (response) => ({
4216
4331
  object: response.object,
4217
4332
  id: response.id,
@@ -4233,18 +4348,15 @@ const deserializeConnectedAccount = (response) => ({
4233
4348
  updatedAt: new Date(response.updated_at),
4234
4349
  warnings: response.warnings != null ? response.warnings.map(deserializeConnectedAccountWarning) : void 0
4235
4350
  });
4236
- //#endregion
4237
- //#region src/pipes/serializers/data-integration-finish-connection-response.serializer.ts
4351
+ // src/pipes/serializers/data-integration-finish-connection-response.serializer.ts
4238
4352
  const deserializeDataIntegrationFinishConnectionResponse = (response) => ({ connectedAccount: deserializeConnectedAccount(response.connected_account) });
4239
- //#endregion
4240
- //#region src/pipes/serializers/data-integration-authorize-url-response.serializer.ts
4353
+ // src/pipes/serializers/data-integration-authorize-url-response.serializer.ts
4241
4354
  const deserializeDataIntegrationAuthorizeUrlResponse = (response) => ({
4242
4355
  url: response.url,
4243
4356
  state: response.state ?? "",
4244
4357
  completion: response.completion
4245
4358
  });
4246
- //#endregion
4247
- //#region src/pipes/serializers/data-integration-vended-credential.serializer.ts
4359
+ // src/pipes/serializers/data-integration-vended-credential.serializer.ts
4248
4360
  const deserializeDataIntegrationVendedCredential = (response) => {
4249
4361
  switch (response.auth_method) {
4250
4362
  case "oauth": return {
@@ -4276,8 +4388,7 @@ const deserializeDataIntegrationVendedCredential = (response) => {
4276
4388
  default: throw new Error("Unknown auth_method: " + String(response.auth_method));
4277
4389
  }
4278
4390
  };
4279
- //#endregion
4280
- //#region src/pipes/serializers/data-integration-credentials-response.serializer.ts
4391
+ // src/pipes/serializers/data-integration-credentials-response.serializer.ts
4281
4392
  const deserializeDataIntegrationCredentialsResponse = (response) => {
4282
4393
  switch (response.active) {
4283
4394
  case true: return {
@@ -4291,8 +4402,7 @@ const deserializeDataIntegrationCredentialsResponse = (response) => {
4291
4402
  default: throw new Error("Unknown active: " + String(response.active));
4292
4403
  }
4293
4404
  };
4294
- //#endregion
4295
- //#region src/pipes/serializers/data-integration-access-token-response-access-token.serializer.ts
4405
+ // src/pipes/serializers/data-integration-access-token-response-access-token.serializer.ts
4296
4406
  const deserializeDataIntegrationAccessTokenResponseAccessToken = (response) => ({
4297
4407
  object: response.object,
4298
4408
  accessToken: response.access_token,
@@ -4300,8 +4410,7 @@ const deserializeDataIntegrationAccessTokenResponseAccessToken = (response) => (
4300
4410
  scopes: response.scopes,
4301
4411
  missingScopes: response.missing_scopes
4302
4412
  });
4303
- //#endregion
4304
- //#region src/pipes/serializers/data-integration-access-token-response.serializer.ts
4413
+ // src/pipes/serializers/data-integration-access-token-response.serializer.ts
4305
4414
  const deserializeDataIntegrationAccessTokenResponse = (response) => {
4306
4415
  switch (response.active) {
4307
4416
  case true: return {
@@ -4315,8 +4424,7 @@ const deserializeDataIntegrationAccessTokenResponse = (response) => {
4315
4424
  default: throw new Error("Unknown active: " + String(response.active));
4316
4425
  }
4317
4426
  };
4318
- //#endregion
4319
- //#region src/pipes/serializers/data-integrations-list-response-data-connected-account.serializer.ts
4427
+ // src/pipes/serializers/data-integrations-list-response-data-connected-account.serializer.ts
4320
4428
  const deserializeDataIntegrationsListResponseDataConnectedAccount = (response) => ({
4321
4429
  object: response.object,
4322
4430
  id: response.id,
@@ -4339,8 +4447,7 @@ const deserializeDataIntegrationsListResponseDataConnectedAccount = (response) =
4339
4447
  warnings: response.warnings != null ? response.warnings.map(deserializeConnectedAccountWarning) : void 0,
4340
4448
  userlandUserId: response.userland_user_id ?? null
4341
4449
  });
4342
- //#endregion
4343
- //#region src/pipes/serializers/data-integrations-list-response-data.serializer.ts
4450
+ // src/pipes/serializers/data-integrations-list-response-data.serializer.ts
4344
4451
  const deserializeDataIntegrationsListResponseData = (response) => ({
4345
4452
  object: response.object,
4346
4453
  id: response.id,
@@ -4358,28 +4465,24 @@ const deserializeDataIntegrationsListResponseData = (response) => ({
4358
4465
  connectedAccount: response.connected_account != null ? deserializeDataIntegrationsListResponseDataConnectedAccount(response.connected_account) : null,
4359
4466
  connectedAccounts: response.connected_accounts != null ? response.connected_accounts.map(deserializeDataIntegrationsListResponseDataConnectedAccount) : void 0
4360
4467
  });
4361
- //#endregion
4362
- //#region src/pipes/serializers/data-integrations-list-response.serializer.ts
4468
+ // src/pipes/serializers/data-integrations-list-response.serializer.ts
4363
4469
  const deserializeDataIntegrationsListResponse = (response) => ({
4364
4470
  object: response.object,
4365
4471
  data: response.data.map(deserializeDataIntegrationsListResponseData)
4366
4472
  });
4367
- //#endregion
4368
- //#region src/pipes/serializers/data-integration-credentials-input.serializer.ts
4473
+ // src/pipes/serializers/data-integration-credentials-input.serializer.ts
4369
4474
  const serializeDataIntegrationCredentialsInput = (model) => ({
4370
4475
  type: model.type,
4371
4476
  client_id: model.clientId,
4372
4477
  client_secret: model.clientSecret
4373
4478
  });
4374
- //#endregion
4375
- //#region src/pipes/serializers/api-key-installation.serializer.ts
4479
+ // src/pipes/serializers/api-key-installation.serializer.ts
4376
4480
  const serializeApiKeyInstallation = (model) => ({
4377
4481
  secret: model.secret,
4378
4482
  user_id: model.userId,
4379
4483
  organization_id: model.organizationId
4380
4484
  });
4381
- //#endregion
4382
- //#region src/pipes/serializers/custom-provider-definition.serializer.ts
4485
+ // src/pipes/serializers/custom-provider-definition.serializer.ts
4383
4486
  const serializeCustomProviderDefinition = (model) => ({
4384
4487
  name: model.name,
4385
4488
  authorization_url: model.authorizationUrl,
@@ -4393,8 +4496,7 @@ const serializeCustomProviderDefinition = (model) => ({
4393
4496
  token_body_content_type: model.tokenBodyContentType,
4394
4497
  authenticate_via: model.authenticateVia
4395
4498
  });
4396
- //#endregion
4397
- //#region src/pipes/serializers/create-data-integration.serializer.ts
4499
+ // src/pipes/serializers/create-data-integration.serializer.ts
4398
4500
  const serializeCreateDataIntegration = (model) => ({
4399
4501
  provider: model.provider,
4400
4502
  ownership: model.ownership,
@@ -4407,15 +4509,13 @@ const serializeCreateDataIntegration = (model) => ({
4407
4509
  api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4408
4510
  custom_provider: model.customProvider != null ? serializeCustomProviderDefinition(model.customProvider) : void 0
4409
4511
  });
4410
- //#endregion
4411
- //#region src/pipes/serializers/data-integrations-finish-connection-request.serializer.ts
4512
+ // src/pipes/serializers/data-integrations-finish-connection-request.serializer.ts
4412
4513
  const serializeDataIntegrationsFinishConnectionRequest = (model) => ({
4413
4514
  connect_code: model.connectCode,
4414
4515
  code_verifier: model.codeVerifier,
4415
4516
  state: model.state
4416
4517
  });
4417
- //#endregion
4418
- //#region src/pipes/serializers/update-custom-provider-definition.serializer.ts
4518
+ // src/pipes/serializers/update-custom-provider-definition.serializer.ts
4419
4519
  const serializeUpdateCustomProviderDefinition = (model) => ({
4420
4520
  name: model.name,
4421
4521
  authorization_url: model.authorizationUrl,
@@ -4429,8 +4529,7 @@ const serializeUpdateCustomProviderDefinition = (model) => ({
4429
4529
  token_body_content_type: model.tokenBodyContentType,
4430
4530
  authenticate_via: model.authenticateVia
4431
4531
  });
4432
- //#endregion
4433
- //#region src/pipes/serializers/update-data-integration.serializer.ts
4532
+ // src/pipes/serializers/update-data-integration.serializer.ts
4434
4533
  const serializeUpdateDataIntegration = (model) => ({
4435
4534
  description: model.description,
4436
4535
  enabled: model.enabled,
@@ -4439,8 +4538,7 @@ const serializeUpdateDataIntegration = (model) => ({
4439
4538
  api_key: model.apiKey != null ? serializeApiKeyInstallation(model.apiKey) : void 0,
4440
4539
  custom_provider: model.customProvider != null ? serializeUpdateCustomProviderDefinition(model.customProvider) : void 0
4441
4540
  });
4442
- //#endregion
4443
- //#region src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
4541
+ // src/pipes/serializers/data-integrations-create-api-key-connection-request.serializer.ts
4444
4542
  const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
4445
4543
  account_display_name: model.accountDisplayName,
4446
4544
  account_identifier: model.accountIdentifier,
@@ -4450,8 +4548,7 @@ const serializeDataIntegrationsCreateApiKeyConnectionRequest = (model) => ({
4450
4548
  secret: model.secret,
4451
4549
  connection_intent: model.connectionIntent
4452
4550
  });
4453
- //#endregion
4454
- //#region src/pipes/serializers/data-integrations-get-data-integration-authorize-url-request.serializer.ts
4551
+ // src/pipes/serializers/data-integrations-get-data-integration-authorize-url-request.serializer.ts
4455
4552
  const serializeDataIntegrationsGetDataIntegrationAuthorizeUrlRequest = (model) => ({
4456
4553
  account_display_name: model.accountDisplayName,
4457
4554
  user_id: model.userId,
@@ -4464,8 +4561,7 @@ const serializeDataIntegrationsGetDataIntegrationAuthorizeUrlRequest = (model) =
4464
4561
  connection_intent: model.connectionIntent,
4465
4562
  connected_account_id: model.connectedAccountId
4466
4563
  });
4467
- //#endregion
4468
- //#region src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
4564
+ // src/pipes/serializers/data-integrations-create-client-credentials-connection-request.serializer.ts
4469
4565
  const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model) => ({
4470
4566
  account_display_name: model.accountDisplayName,
4471
4567
  account_identifier: model.accountIdentifier,
@@ -4477,8 +4573,7 @@ const serializeDataIntegrationsCreateClientCredentialsConnectionRequest = (model
4477
4573
  config: model.config,
4478
4574
  connection_intent: model.connectionIntent
4479
4575
  });
4480
- //#endregion
4481
- //#region src/pipes/serializers/data-integrations-vend-credentials-request.serializer.ts
4576
+ // src/pipes/serializers/data-integrations-vend-credentials-request.serializer.ts
4482
4577
  const serializeDataIntegrationsVendCredentialsRequest = (model) => ({
4483
4578
  user_id: model.userId,
4484
4579
  organization_id: model.organizationId,
@@ -4486,8 +4581,7 @@ const serializeDataIntegrationsVendCredentialsRequest = (model) => ({
4486
4581
  connection_owner: model.connectionOwner,
4487
4582
  supports_multiple_connections: model.supportsMultipleConnections
4488
4583
  });
4489
- //#endregion
4490
- //#region src/pipes/serializers/data-integrations-get-user-token-request.serializer.ts
4584
+ // src/pipes/serializers/data-integrations-get-user-token-request.serializer.ts
4491
4585
  const serializeDataIntegrationsGetUserTokenRequest = (model) => ({
4492
4586
  user_id: model.userId,
4493
4587
  organization_id: model.organizationId,
@@ -4495,8 +4589,7 @@ const serializeDataIntegrationsGetUserTokenRequest = (model) => ({
4495
4589
  connection_owner: model.connectionOwner,
4496
4590
  supports_multiple_connections: model.supportsMultipleConnections
4497
4591
  });
4498
- //#endregion
4499
- //#region src/pipes/serializers/create-organization-connected-account.serializer.ts
4592
+ // src/pipes/serializers/create-organization-connected-account.serializer.ts
4500
4593
  const serializeCreateOrganizationConnectedAccount = (model) => ({
4501
4594
  account_display_name: model.accountDisplayName,
4502
4595
  account_identifier: model.accountIdentifier,
@@ -4508,8 +4601,7 @@ const serializeCreateOrganizationConnectedAccount = (model) => ({
4508
4601
  user_id: model.userId,
4509
4602
  connection_intent: model.connectionIntent
4510
4603
  });
4511
- //#endregion
4512
- //#region src/pipes/serializers/organization-connected-account.serializer.ts
4604
+ // src/pipes/serializers/organization-connected-account.serializer.ts
4513
4605
  const serializeOrganizationConnectedAccount = (model) => ({
4514
4606
  account_display_name: model.accountDisplayName,
4515
4607
  account_identifier: model.accountIdentifier,
@@ -4520,8 +4612,7 @@ const serializeOrganizationConnectedAccount = (model) => ({
4520
4612
  state: model.state,
4521
4613
  user_id: model.userId
4522
4614
  });
4523
- //#endregion
4524
- //#region src/pipes/serializers/create-connected-account.serializer.ts
4615
+ // src/pipes/serializers/create-connected-account.serializer.ts
4525
4616
  const serializeCreateConnectedAccount = (model) => ({
4526
4617
  account_display_name: model.accountDisplayName,
4527
4618
  account_identifier: model.accountIdentifier,
@@ -4532,8 +4623,7 @@ const serializeCreateConnectedAccount = (model) => ({
4532
4623
  state: model.state,
4533
4624
  connection_intent: model.connectionIntent
4534
4625
  });
4535
- //#endregion
4536
- //#region src/pipes/serializers/connected-account-input.serializer.ts
4626
+ // src/pipes/serializers/connected-account-input.serializer.ts
4537
4627
  const serializeConnectedAccountInput = (model) => ({
4538
4628
  account_display_name: model.accountDisplayName,
4539
4629
  account_identifier: model.accountIdentifier,
@@ -4543,8 +4633,7 @@ const serializeConnectedAccountInput = (model) => ({
4543
4633
  scopes: model.scopes,
4544
4634
  state: model.state
4545
4635
  });
4546
- //#endregion
4547
- //#region src/pipes/serializers/data-integrations-upsert-api-key-request.serializer.ts
4636
+ // src/pipes/serializers/data-integrations-upsert-api-key-request.serializer.ts
4548
4637
  const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
4549
4638
  account_display_name: model.accountDisplayName,
4550
4639
  account_identifier: model.accountIdentifier,
@@ -4555,8 +4644,7 @@ const serializeDataIntegrationsUpsertApiKeyRequest = (model) => ({
4555
4644
  connection_owner: model.connectionOwner,
4556
4645
  secret: model.secret
4557
4646
  });
4558
- //#endregion
4559
- //#region src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
4647
+ // src/pipes/serializers/data-integrations-upsert-client-credentials-request.serializer.ts
4560
4648
  const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
4561
4649
  account_display_name: model.accountDisplayName,
4562
4650
  account_identifier: model.accountIdentifier,
@@ -4569,8 +4657,7 @@ const serializeDataIntegrationsUpsertClientCredentialsRequest = (model) => ({
4569
4657
  client_secret: model.clientSecret,
4570
4658
  config: model.config
4571
4659
  });
4572
- //#endregion
4573
- //#region src/pipes/pipes.ts
4660
+ // src/pipes/pipes.ts
4574
4661
  var Pipes = class {
4575
4662
  workos;
4576
4663
  constructor(workos) {
@@ -5306,8 +5393,7 @@ var Pipes = class {
5306
5393
  return deserializeDataIntegrationsListResponse(data);
5307
5394
  }
5308
5395
  };
5309
- //#endregion
5310
- //#region src/radar/serializers/radar-standalone-response.serializer.ts
5396
+ // src/radar/serializers/radar-standalone-response.serializer.ts
5311
5397
  const deserializeRadarStandaloneResponse = (response) => ({
5312
5398
  verdict: response.verdict,
5313
5399
  reason: response.reason,
@@ -5315,11 +5401,9 @@ const deserializeRadarStandaloneResponse = (response) => ({
5315
5401
  control: response.control,
5316
5402
  blocklistType: response.blocklist_type
5317
5403
  });
5318
- //#endregion
5319
- //#region src/radar/serializers/radar-list-entry-already-present-response.serializer.ts
5404
+ // src/radar/serializers/radar-list-entry-already-present-response.serializer.ts
5320
5405
  const deserializeRadarListEntryAlreadyPresentResponse = (response) => ({ message: response.message });
5321
- //#endregion
5322
- //#region src/radar/serializers/radar-standalone-assess-request.serializer.ts
5406
+ // src/radar/serializers/radar-standalone-assess-request.serializer.ts
5323
5407
  const serializeRadarStandaloneAssessRequest = (model) => ({
5324
5408
  ip_address: model.ipAddress,
5325
5409
  user_agent: model.userAgent,
@@ -5327,20 +5411,16 @@ const serializeRadarStandaloneAssessRequest = (model) => ({
5327
5411
  auth_method: model.authMethod,
5328
5412
  action: model.action
5329
5413
  });
5330
- //#endregion
5331
- //#region src/radar/serializers/radar-standalone-update-radar-attempt-request.serializer.ts
5414
+ // src/radar/serializers/radar-standalone-update-radar-attempt-request.serializer.ts
5332
5415
  const serializeRadarStandaloneUpdateRadarAttemptRequest = (model) => ({
5333
5416
  challenge_status: model.challengeStatus,
5334
5417
  attempt_status: model.attemptStatus
5335
5418
  });
5336
- //#endregion
5337
- //#region src/radar/serializers/radar-standalone-update-radar-list-request.serializer.ts
5419
+ // src/radar/serializers/radar-standalone-update-radar-list-request.serializer.ts
5338
5420
  const serializeRadarStandaloneUpdateRadarListRequest = (model) => ({ entry: model.entry });
5339
- //#endregion
5340
- //#region src/radar/serializers/radar-standalone-delete-radar-list-entry-request.serializer.ts
5421
+ // src/radar/serializers/radar-standalone-delete-radar-list-entry-request.serializer.ts
5341
5422
  const serializeRadarStandaloneDeleteRadarListEntryRequest = (model) => ({ entry: model.entry });
5342
- //#endregion
5343
- //#region src/radar/radar.ts
5423
+ // src/radar/radar.ts
5344
5424
  var Radar = class {
5345
5425
  workos;
5346
5426
  constructor(workos) {
@@ -5428,8 +5508,7 @@ var Radar = class {
5428
5508
  await this.workos.deleteWithBody(`/radar/lists/${encodeURIComponent(type)}/${encodeURIComponent(action)}`, serializeRadarStandaloneDeleteRadarListEntryRequest(payload));
5429
5509
  }
5430
5510
  };
5431
- //#endregion
5432
- //#region src/admin-portal/admin-portal.ts
5511
+ // src/admin-portal/admin-portal.ts
5433
5512
  var AdminPortal = class {
5434
5513
  workos;
5435
5514
  constructor(workos) {
@@ -5439,14 +5518,16 @@ var AdminPortal = class {
5439
5518
  * Generate a Portal Link
5440
5519
  *
5441
5520
  * Generate a Portal Link scoped to an Organization.
5442
- * @param payload - Object containing organization.
5521
+ * @param payload - Object containing organization. Pass `externalUserId`
5522
+ * for every admin you may later need to deprovision; only links generated
5523
+ * with one can be revoked via `revokeLink`.
5443
5524
  * @returns {Promise<{ link: string; }>}
5444
5525
  * @throws {BadRequestException} 400
5445
5526
  * @throws 403 response from the API.
5446
5527
  * @throws {NotFoundException} 404
5447
5528
  * @throws {UnprocessableEntityException} 422
5448
5529
  */
5449
- async generateLink({ intent, organization, returnUrl, successUrl, intentOptions, itContactEmails }) {
5530
+ async generateLink({ intent, organization, returnUrl, successUrl, intentOptions, itContactEmails, externalUserId }) {
5450
5531
  const { data } = await this.workos.post("/portal/generate_link", {
5451
5532
  intent,
5452
5533
  organization,
@@ -5456,13 +5537,33 @@ var AdminPortal = class {
5456
5537
  bookmark_slug: intentOptions.sso.bookmarkSlug,
5457
5538
  provider_type: intentOptions.sso.providerType
5458
5539
  } } : void 0,
5459
- it_contact_emails: itContactEmails
5540
+ it_contact_emails: itContactEmails,
5541
+ external_user_id: externalUserId
5460
5542
  });
5461
5543
  return data;
5462
5544
  }
5545
+ /**
5546
+ * Revoke Portal Links
5547
+ *
5548
+ * Revokes every Portal Link generated for the given organization with the
5549
+ * given `externalUserId`, and immediately ends any Admin Portal sessions that
5550
+ * were started from those links. Use this when an admin is deprovisioned from
5551
+ * your application: unopened links stop working, and their already-open
5552
+ * portal sessions are ended. Only links that were generated with an
5553
+ * `externalUserId` can be revoked, so pass one to `generateLink` for every
5554
+ * admin you may later need to deprovision.
5555
+ * @param payload - Object containing organization and externalUserId.
5556
+ * @throws {NotFoundException} 404
5557
+ * @throws {UnprocessableEntityException} 422
5558
+ */
5559
+ async revokeLink({ organization, externalUserId }) {
5560
+ await this.workos.post("/portal/revoke_link", {
5561
+ organization,
5562
+ external_user_id: externalUserId
5563
+ });
5564
+ }
5463
5565
  };
5464
- //#endregion
5465
- //#region src/common/utils/query-string.ts
5566
+ // src/common/utils/query-string.ts
5466
5567
  /**
5467
5568
  * Converts options to a query string.
5468
5569
  * - Arrays: scope=read&scope=write (repeat format)
@@ -5492,8 +5593,7 @@ function toQueryString(options) {
5492
5593
  function encodeRFC1738(str) {
5493
5594
  return encodeURIComponent(str).replace(/%20/g, "+").replace(/[!'*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
5494
5595
  }
5495
- //#endregion
5496
- //#region src/sso/sso.ts
5596
+ // src/sso/sso.ts
5497
5597
  var SSO = class {
5498
5598
  workos;
5499
5599
  constructor(workos) {
@@ -5654,9 +5754,21 @@ var SSO = class {
5654
5754
  const { data } = await this.workos.get("/sso/profile", { accessToken });
5655
5755
  return deserializeProfile(data);
5656
5756
  }
5757
+ /**
5758
+ * Logout Authorize
5759
+ *
5760
+ * Generate a logout token and URL for RP-initiated Single Logout. Redirect the user to `logoutUrl` to sign them out of the identity provider.
5761
+ * @param options - The profile to log out.
5762
+ * @returns {Promise<AuthorizeLogout>}
5763
+ * @throws {BadRequestException} 400
5764
+ * @throws {NotFoundException} 404
5765
+ */
5766
+ async authorizeLogout(options) {
5767
+ const { data } = await this.workos.post("/sso/logout/authorize", serializeAuthorizeLogoutOptions(options));
5768
+ return deserializeAuthorizeLogout(data);
5769
+ }
5657
5770
  };
5658
- //#endregion
5659
- //#region src/multi-factor-auth/serializers/challenge.serializer.ts
5771
+ // src/multi-factor-auth/serializers/challenge.serializer.ts
5660
5772
  const deserializeChallenge = (challenge) => ({
5661
5773
  object: challenge.object,
5662
5774
  id: challenge.id,
@@ -5666,8 +5778,7 @@ const deserializeChallenge = (challenge) => ({
5666
5778
  code: challenge.code,
5667
5779
  authenticationFactorId: challenge.authentication_factor_id
5668
5780
  });
5669
- //#endregion
5670
- //#region src/multi-factor-auth/serializers/factor.serializer.ts
5781
+ // src/multi-factor-auth/serializers/factor.serializer.ts
5671
5782
  const deserializeFactor = (factor) => ({
5672
5783
  object: factor.object,
5673
5784
  id: factor.id,
@@ -5686,14 +5797,12 @@ const deserializeFactorWithSecrets = (factor) => ({
5686
5797
  ...factor.sms ? { sms: deserializeSms(factor.sms) } : {},
5687
5798
  ...factor.totp ? { totp: deserializeTotpWithSecrets(factor.totp) } : {}
5688
5799
  });
5689
- //#endregion
5690
- //#region src/multi-factor-auth/serializers/verify-response.serializer.ts
5800
+ // src/multi-factor-auth/serializers/verify-response.serializer.ts
5691
5801
  const deserializeVerifyResponse = (verifyResponse) => ({
5692
5802
  challenge: deserializeChallenge(verifyResponse.challenge),
5693
5803
  valid: verifyResponse.valid
5694
5804
  });
5695
- //#endregion
5696
- //#region src/multi-factor-auth/multi-factor-auth.ts
5805
+ // src/multi-factor-auth/multi-factor-auth.ts
5697
5806
  var MultiFactorAuth = class {
5698
5807
  workos;
5699
5808
  constructor(workos) {
@@ -5809,8 +5918,7 @@ var MultiFactorAuth = class {
5809
5918
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/auth_factors`, deserializeFactor$1, restOfOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/auth_factors`, deserializeFactor$1, params), restOfOptions);
5810
5919
  }
5811
5920
  };
5812
- //#endregion
5813
- //#region src/audit-logs/serializers/audit-log-export.serializer.ts
5921
+ // src/audit-logs/serializers/audit-log-export.serializer.ts
5814
5922
  const deserializeAuditLogExport = (auditLogExport) => ({
5815
5923
  object: auditLogExport.object,
5816
5924
  id: auditLogExport.id,
@@ -5819,8 +5927,7 @@ const deserializeAuditLogExport = (auditLogExport) => ({
5819
5927
  createdAt: new Date(auditLogExport.created_at),
5820
5928
  updatedAt: new Date(auditLogExport.updated_at)
5821
5929
  });
5822
- //#endregion
5823
- //#region src/audit-logs/serializers/audit-log-export-options.serializer.ts
5930
+ // src/audit-logs/serializers/audit-log-export-options.serializer.ts
5824
5931
  const serializeAuditLogExportOptions = (options) => ({
5825
5932
  actions: options.actions,
5826
5933
  actor_names: options.actorNames,
@@ -5830,8 +5937,7 @@ const serializeAuditLogExportOptions = (options) => ({
5830
5937
  range_start: options.rangeStart.toISOString(),
5831
5938
  targets: options.targets
5832
5939
  });
5833
- //#endregion
5834
- //#region src/audit-logs/serializers/create-audit-log-event-options.serializer.ts
5940
+ // src/audit-logs/serializers/create-audit-log-event-options.serializer.ts
5835
5941
  const serializeCreateAuditLogEventOptions = (event) => ({
5836
5942
  action: event.action,
5837
5943
  version: event.version,
@@ -5844,8 +5950,7 @@ const serializeCreateAuditLogEventOptions = (event) => ({
5844
5950
  },
5845
5951
  metadata: event.metadata
5846
5952
  });
5847
- //#endregion
5848
- //#region src/audit-logs/serializers/create-audit-log-schema-options.serializer.ts
5953
+ // src/audit-logs/serializers/create-audit-log-schema-options.serializer.ts
5849
5954
  function serializeMetadata(metadata) {
5850
5955
  if (!metadata) return {};
5851
5956
  const serializedMetadata = {};
@@ -5873,8 +5978,7 @@ const serializeCreateAuditLogSchemaOptions = (schema) => ({
5873
5978
  properties: serializeMetadata(schema.metadata)
5874
5979
  } : void 0
5875
5980
  });
5876
- //#endregion
5877
- //#region src/audit-logs/serializers/create-audit-log-schema.serializer.ts
5981
+ // src/audit-logs/serializers/create-audit-log-schema.serializer.ts
5878
5982
  function deserializeMetadata(metadata) {
5879
5983
  if (!metadata || !metadata.properties) return {};
5880
5984
  const deserializedMetadata = {};
@@ -5894,14 +5998,11 @@ const deserializeAuditLogSchema = (auditLogSchema) => ({
5894
5998
  metadata: auditLogSchema.metadata ? deserializeMetadata(auditLogSchema.metadata) : void 0,
5895
5999
  createdAt: new Date(auditLogSchema.created_at)
5896
6000
  });
5897
- //#endregion
5898
- //#region src/audit-logs/serializers/audit-logs-retention.serializer.ts
6001
+ // src/audit-logs/serializers/audit-logs-retention.serializer.ts
5899
6002
  const deserializeAuditLogsRetention = (response) => ({ retentionPeriodInDays: response.retention_period_in_days ?? null });
5900
- //#endregion
5901
- //#region src/audit-logs/serializers/update-audit-logs-retention.serializer.ts
6003
+ // src/audit-logs/serializers/update-audit-logs-retention.serializer.ts
5902
6004
  const serializeUpdateAuditLogsRetention = (model) => ({ retention_period: model.retentionPeriod });
5903
- //#endregion
5904
- //#region src/audit-logs/audit-logs.ts
6005
+ // src/audit-logs/audit-logs.ts
5905
6006
  var AuditLogs = class {
5906
6007
  workos;
5907
6008
  constructor(workos) {
@@ -6012,8 +6113,7 @@ var AuditLogs = class {
6012
6113
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeAuditLogSchema, options), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeAuditLogSchema, params), options);
6013
6114
  }
6014
6115
  };
6015
- //#endregion
6016
- //#region node_modules/uint8array-extras/index.js
6116
+ // node_modules/uint8array-extras/index.js
6017
6117
  const objectToString = Object.prototype.toString;
6018
6118
  const uint8ArrayStringified = "[object Uint8Array]";
6019
6119
  function isType(value, typeConstructor, typeStringified) {
@@ -6061,8 +6161,7 @@ function uint8ArrayToHex(array) {
6061
6161
  for (let index = 0; index < array.length; index++) hexString += byteToHexLookupTable[array[index]];
6062
6162
  return hexString;
6063
6163
  }
6064
- //#endregion
6065
- //#region node_modules/iron-webcrypto/index.js
6164
+ // node_modules/iron-webcrypto/index.js
6066
6165
  function losslessJsonStringify(data) {
6067
6166
  try {
6068
6167
  if (isJson(data)) {
@@ -6274,8 +6373,7 @@ async function unseal(sealed, password, options) {
6274
6373
  }, b64ToU8(encryptedB64));
6275
6374
  return (options.decode || jsonParse)(decryptedString);
6276
6375
  }
6277
- //#endregion
6278
- //#region src/common/crypto/seal.ts
6376
+ // src/common/crypto/seal.ts
6279
6377
  const VERSION_DELIMITER = "~";
6280
6378
  const CURRENT_MAJOR_VERSION = 2;
6281
6379
  function parseSeal(seal) {
@@ -6312,8 +6410,7 @@ async function unsealData(encryptedData, { password }) {
6312
6410
  else if (tokenVersion !== null) return data.persistent ?? data;
6313
6411
  return data;
6314
6412
  }
6315
- //#endregion
6316
- //#region src/user-management/serializers/session-cookie-data.serializer.ts
6413
+ // src/user-management/serializers/session-cookie-data.serializer.ts
6317
6414
  const toDate = (value) => value instanceof Date ? value : new Date(value);
6318
6415
  const deserializeSessionCookieData = (data) => {
6319
6416
  if (!data.user) return data;
@@ -6327,8 +6424,7 @@ const deserializeSessionCookieData = (data) => {
6327
6424
  }
6328
6425
  };
6329
6426
  };
6330
- //#endregion
6331
- //#region src/common/utils/env.ts
6427
+ // src/common/utils/env.ts
6332
6428
  let detectedRuntime = null;
6333
6429
  /**
6334
6430
  * Detect the current runtime environment.
@@ -6374,19 +6470,16 @@ function getEnvironmentVariable(key) {
6374
6470
  function getEnv(key, defaultValue) {
6375
6471
  return getEnvironmentVariable(key) ?? defaultValue;
6376
6472
  }
6377
- //#endregion
6378
- //#region src/user-management/interfaces/authenticate-with-session-cookie.interface.ts
6473
+ // src/user-management/interfaces/authenticate-with-session-cookie.interface.ts
6379
6474
  let AuthenticateWithSessionCookieFailureReason = /* @__PURE__ */ function(AuthenticateWithSessionCookieFailureReason) {
6380
6475
  AuthenticateWithSessionCookieFailureReason["INVALID_JWT"] = "invalid_jwt";
6381
6476
  AuthenticateWithSessionCookieFailureReason["INVALID_SESSION_COOKIE"] = "invalid_session_cookie";
6382
6477
  AuthenticateWithSessionCookieFailureReason["NO_SESSION_COOKIE_PROVIDED"] = "no_session_cookie_provided";
6383
6478
  return AuthenticateWithSessionCookieFailureReason;
6384
6479
  }({});
6385
- //#endregion
6386
- //#region src/user-management/interfaces/revoke-session-options.interface.ts
6480
+ // src/user-management/interfaces/revoke-session-options.interface.ts
6387
6481
  const serializeRevokeSessionOptions = (options) => ({ session_id: options.sessionId });
6388
- //#endregion
6389
- //#region src/user-management/serializers/authenticate-with-email-verification.serializer.ts
6482
+ // src/user-management/serializers/authenticate-with-email-verification.serializer.ts
6390
6483
  const serializeAuthenticateWithEmailVerificationOptions = (options) => ({
6391
6484
  grant_type: "urn:workos:oauth:grant-type:email-verification:code",
6392
6485
  client_id: options.clientId,
@@ -6396,8 +6489,7 @@ const serializeAuthenticateWithEmailVerificationOptions = (options) => ({
6396
6489
  ip_address: options.ipAddress,
6397
6490
  user_agent: options.userAgent
6398
6491
  });
6399
- //#endregion
6400
- //#region src/user-management/serializers/authenticate-with-organization-selection-options.serializer.ts
6492
+ // src/user-management/serializers/authenticate-with-organization-selection-options.serializer.ts
6401
6493
  const serializeAuthenticateWithOrganizationSelectionOptions = (options) => ({
6402
6494
  grant_type: "urn:workos:oauth:grant-type:organization-selection",
6403
6495
  client_id: options.clientId,
@@ -6407,16 +6499,14 @@ const serializeAuthenticateWithOrganizationSelectionOptions = (options) => ({
6407
6499
  ip_address: options.ipAddress,
6408
6500
  user_agent: options.userAgent
6409
6501
  });
6410
- //#endregion
6411
- //#region src/user-management/serializers/create-organization-membership-options.serializer.ts
6502
+ // src/user-management/serializers/create-organization-membership-options.serializer.ts
6412
6503
  const serializeCreateOrganizationMembershipOptions = (options) => ({
6413
6504
  organization_id: options.organizationId,
6414
6505
  user_id: options.userId,
6415
6506
  role_slug: options.roleSlug,
6416
6507
  role_slugs: options.roleSlugs
6417
6508
  });
6418
- //#endregion
6419
- //#region src/user-management/serializers/identity.serializer.ts
6509
+ // src/user-management/serializers/identity.serializer.ts
6420
6510
  const normalizeProvider = (provider) => {
6421
6511
  if (provider === "GithubOAuth") return "GitHubOAuth";
6422
6512
  return provider;
@@ -6430,8 +6520,7 @@ const deserializeIdentities = (identities) => {
6430
6520
  };
6431
6521
  });
6432
6522
  };
6433
- //#endregion
6434
- //#region src/user-management/serializers/list-invitations-options.serializer.ts
6523
+ // src/user-management/serializers/list-invitations-options.serializer.ts
6435
6524
  const serializeListInvitationsOptions = (options) => ({
6436
6525
  email: options.email,
6437
6526
  organization_id: options.organizationId,
@@ -6440,8 +6529,7 @@ const serializeListInvitationsOptions = (options) => ({
6440
6529
  after: options.after,
6441
6530
  order: options.order
6442
6531
  });
6443
- //#endregion
6444
- //#region src/user-management/serializers/list-organization-memberships-options.serializer.ts
6532
+ // src/user-management/serializers/list-organization-memberships-options.serializer.ts
6445
6533
  const serializeListOrganizationMembershipsOptions = (options) => ({
6446
6534
  user_id: options.userId,
6447
6535
  organization_id: options.organizationId,
@@ -6451,8 +6539,7 @@ const serializeListOrganizationMembershipsOptions = (options) => ({
6451
6539
  after: options.after,
6452
6540
  order: options.order
6453
6541
  });
6454
- //#endregion
6455
- //#region src/user-management/serializers/list-users-options.serializer.ts
6542
+ // src/user-management/serializers/list-users-options.serializer.ts
6456
6543
  const serializeListUsersOptions = (options) => ({
6457
6544
  email: options.email,
6458
6545
  organization_id: options.organizationId,
@@ -6461,11 +6548,9 @@ const serializeListUsersOptions = (options) => ({
6461
6548
  after: options.after,
6462
6549
  order: options.order
6463
6550
  });
6464
- //#endregion
6465
- //#region src/user-management/serializers/resend-invitation-options.serializer.ts
6551
+ // src/user-management/serializers/resend-invitation-options.serializer.ts
6466
6552
  const serializeResendInvitationOptions = (options) => ({ locale: options.locale });
6467
- //#endregion
6468
- //#region src/user-management/interfaces/refresh-and-seal-session-data.interface.ts
6553
+ // src/user-management/interfaces/refresh-and-seal-session-data.interface.ts
6469
6554
  let RefreshSessionFailureReason = /* @__PURE__ */ function(RefreshSessionFailureReason) {
6470
6555
  RefreshSessionFailureReason["INVALID_SESSION_COOKIE"] = "invalid_session_cookie";
6471
6556
  RefreshSessionFailureReason["NO_SESSION_COOKIE_PROVIDED"] = "no_session_cookie_provided";
@@ -6478,8 +6563,7 @@ let RefreshSessionFailureReason = /* @__PURE__ */ function(RefreshSessionFailure
6478
6563
  RefreshSessionFailureReason["NETWORK_ERROR"] = "network_error";
6479
6564
  return RefreshSessionFailureReason;
6480
6565
  }({});
6481
- //#endregion
6482
- //#region src/user-management/serializers/send-invitation-options.serializer.ts
6566
+ // src/user-management/serializers/send-invitation-options.serializer.ts
6483
6567
  const serializeSendInvitationOptions = (options) => ({
6484
6568
  email: options.email,
6485
6569
  organization_id: options.organizationId,
@@ -6488,21 +6572,18 @@ const serializeSendInvitationOptions = (options) => ({
6488
6572
  role_slug: options.roleSlug,
6489
6573
  locale: options.locale
6490
6574
  });
6491
- //#endregion
6492
- //#region src/user-management/serializers/update-organization-membership-options.serializer.ts
6575
+ // src/user-management/serializers/update-organization-membership-options.serializer.ts
6493
6576
  const serializeUpdateOrganizationMembershipOptions = (options) => ({
6494
6577
  role_slug: options.roleSlug,
6495
6578
  role_slugs: options.roleSlugs
6496
6579
  });
6497
- //#endregion
6498
- //#region src/user-management/serializers/create-waitlist-entry-options.serializer.ts
6580
+ // src/user-management/serializers/create-waitlist-entry-options.serializer.ts
6499
6581
  const serializeCreateWaitlistEntryOptions = (options) => ({
6500
6582
  email: options.email,
6501
6583
  additional_fields: options.additionalFields,
6502
6584
  send_confirmation_email: options.sendConfirmationEmail
6503
6585
  });
6504
- //#endregion
6505
- //#region src/user-management/serializers/list-waitlist-entries-options.serializer.ts
6586
+ // src/user-management/serializers/list-waitlist-entries-options.serializer.ts
6506
6587
  const serializeListWaitlistEntriesOptions = (options) => ({
6507
6588
  state: options.state,
6508
6589
  email: options.email,
@@ -6511,8 +6592,7 @@ const serializeListWaitlistEntriesOptions = (options) => ({
6511
6592
  after: options.after,
6512
6593
  order: options.order
6513
6594
  });
6514
- //#endregion
6515
- //#region src/user-management/session.ts
6595
+ // src/user-management/session.ts
6516
6596
  var CookieSession = class {
6517
6597
  userManagement;
6518
6598
  cookiePassword;
@@ -6620,16 +6700,20 @@ var CookieSession = class {
6620
6700
  /**
6621
6701
  * Gets the URL to redirect the user to for logging out.
6622
6702
  *
6703
+ * Works for sessions whose access token has expired. The sealed cookie is
6704
+ * already authenticated by its encryption, so the session ID is read from
6705
+ * the access token without verifying it.
6706
+ *
6623
6707
  * @returns The URL to redirect the user to for logging out.
6624
6708
  */
6625
6709
  async getLogoutUrl({ returnTo } = {}) {
6626
- const authenticationResponse = await this.authenticate();
6627
- if (!authenticationResponse.authenticated) {
6628
- const { reason } = authenticationResponse;
6629
- throw new Error(`Failed to extract session ID for logout URL: ${reason}`);
6630
- }
6710
+ if (!this.sessionData) throw new Error(`Failed to extract session ID for logout URL: no_session_cookie_provided`);
6711
+ const { accessToken } = await unsealData(this.sessionData, { password: this.cookiePassword });
6712
+ if (!accessToken) throw new Error(`Failed to extract session ID for logout URL: invalid_session_cookie`);
6713
+ const { decodeJwt } = await getJose();
6714
+ const { sid: sessionId } = decodeJwt(accessToken);
6631
6715
  return this.userManagement.getLogoutUrl({
6632
- sessionId: authenticationResponse.sessionId,
6716
+ sessionId,
6633
6717
  returnTo
6634
6718
  });
6635
6719
  }
@@ -6690,8 +6774,7 @@ function getErrorStatus(error) {
6690
6774
  function isNetworkError(error) {
6691
6775
  return error instanceof TypeError || error instanceof Error && error.cause instanceof TypeError;
6692
6776
  }
6693
- //#endregion
6694
- //#region src/user-management/user-management.ts
6777
+ // src/user-management/user-management.ts
6695
6778
  var UserManagement = class UserManagement {
6696
6779
  workos;
6697
6780
  _jwks;
@@ -7216,6 +7299,32 @@ var UserManagement = class UserManagement {
7216
7299
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/sessions`, deserializeSession, options ? serializeListSessionsOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/sessions`, deserializeSession, params), options ? serializeListSessionsOptions(options) : void 0);
7217
7300
  }
7218
7301
  /**
7302
+ * List authorized applications
7303
+ *
7304
+ * Get a list of Connect applications that the user has authorized.
7305
+ * @param userId - The ID of the user.
7306
+ * @param options - Pagination options.
7307
+ * @returns {Promise<AutoPaginatable<AuthorizedConnectApplication>>}
7308
+ * @throws {NotFoundException} 404
7309
+ * @throws {UnprocessableEntityException} 422
7310
+ */
7311
+ async listAuthorizedApplications(userId, options) {
7312
+ const path = `/user_management/users/${encodePathParameter(userId)}/authorized_applications`;
7313
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, path, deserializeAuthorizedConnectApplication, options), (params) => fetchAndDeserialize(this.workos, path, deserializeAuthorizedConnectApplication, params), options);
7314
+ }
7315
+ /**
7316
+ * Delete an authorized application
7317
+ *
7318
+ * Removes a user's authorization without deleting the Connect application.
7319
+ * @param userId - The ID of the user.
7320
+ * @param applicationId - The ID or client ID of the application.
7321
+ * @returns {Promise<void>}
7322
+ * @throws {NotFoundException} 404
7323
+ */
7324
+ async deleteAuthorizedApplication(userId, applicationId) {
7325
+ await this.workos.delete(`/user_management/users/${encodePathParameter(userId)}/authorized_applications/${encodePathParameter(applicationId)}`);
7326
+ }
7327
+ /**
7219
7328
  * Delete a user
7220
7329
  *
7221
7330
  * Permanently deletes a user in the current environment. It cannot be undone.
@@ -7674,8 +7783,21 @@ var UserManagement = class UserManagement {
7674
7783
  return `${this.workos.baseURL}/sso/jwks/${clientId}`;
7675
7784
  }
7676
7785
  };
7677
- //#endregion
7678
- //#region src/feature-flags/event-emitter.ts
7786
+ // src/feature-flags/create-rule-with-targets-error.ts
7787
+ /** A rule was created, but adding one of its targets failed. */
7788
+ var CreateRuleWithTargetsError = class extends Error {
7789
+ rule;
7790
+ targets;
7791
+ failedTargetId;
7792
+ name = "CreateRuleWithTargetsError";
7793
+ constructor(rule, targets, failedTargetId, cause) {
7794
+ super("The rule was created, but adding a target failed.", { cause });
7795
+ this.rule = rule;
7796
+ this.targets = targets;
7797
+ this.failedTargetId = failedTargetId;
7798
+ }
7799
+ };
7800
+ // src/feature-flags/event-emitter.ts
7679
7801
  /**
7680
7802
  * Minimal, runtime-agnostic, typed event emitter.
7681
7803
  *
@@ -7749,8 +7871,7 @@ var EventEmitter = class {
7749
7871
  else this.handlers.delete(event);
7750
7872
  }
7751
7873
  };
7752
- //#endregion
7753
- //#region src/feature-flags/in-memory-store.ts
7874
+ // src/feature-flags/in-memory-store.ts
7754
7875
  var InMemoryStore = class {
7755
7876
  flags = {};
7756
7877
  swap(newFlags) {
@@ -7766,8 +7887,7 @@ var InMemoryStore = class {
7766
7887
  return Object.keys(this.flags).length;
7767
7888
  }
7768
7889
  };
7769
- //#endregion
7770
- //#region src/feature-flags/evaluator.ts
7890
+ // src/feature-flags/evaluator.ts
7771
7891
  const TARGET_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
7772
7892
  const TARGET_ID_PATTERN = /^[A-Za-z0-9._:-]{1,255}$/;
7773
7893
  const LEGACY_KEY_TO_TARGET_TYPE = /* @__PURE__ */ new Map([["userId", "user"], ["organizationId", "organization"]]);
@@ -7856,8 +7976,7 @@ var Evaluator = class {
7856
7976
  return normalized;
7857
7977
  }
7858
7978
  };
7859
- //#endregion
7860
- //#region src/feature-flags/payload.ts
7979
+ // src/feature-flags/payload.ts
7861
7980
  function isRecord(value) {
7862
7981
  return typeof value === "object" && value !== null && !Array.isArray(value);
7863
7982
  }
@@ -7885,8 +8004,7 @@ function parseFlagPollResponse(response) {
7885
8004
  flags: Object.fromEntries(entries)
7886
8005
  };
7887
8006
  }
7888
- //#endregion
7889
- //#region src/feature-flags/runtime-client.ts
8007
+ // src/feature-flags/runtime-client.ts
7890
8008
  const DEFAULT_POLLING_INTERVAL_MS = 3e4;
7891
8009
  const MIN_POLLING_INTERVAL_MS = 5e3;
7892
8010
  const MIN_DELAY_MS = 1e3;
@@ -8026,26 +8144,18 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
8026
8144
  async fetchWithTimeout() {
8027
8145
  this.pollAbortController = new AbortController();
8028
8146
  const { signal } = this.pollAbortController;
8029
- let timeoutId;
8030
- const fetchPromise = this.workos.get("/sdk/feature-flags?payload_version=2").then(({ data }) => data);
8031
- const timeoutPromise = new Promise((_, reject) => {
8032
- timeoutId = setTimeout(() => {
8033
- this.pollAbortController?.abort();
8034
- reject(/* @__PURE__ */ new Error("Request timed out"));
8035
- }, this.requestTimeoutMs);
8036
- });
8147
+ const timeoutId = setTimeout(() => {
8148
+ this.pollAbortController?.abort(/* @__PURE__ */ new Error("Request timed out"));
8149
+ }, this.requestTimeoutMs);
8150
+ const fetchPromise = this.workos.get("/sdk/feature-flags?payload_version=2", { signal }).then(({ data }) => data);
8037
8151
  const abortPromise = new Promise((_, reject) => {
8038
8152
  if (signal.aborted) {
8039
- reject(/* @__PURE__ */ new Error("Poll aborted"));
8153
+ reject(signal.reason);
8040
8154
  return;
8041
8155
  }
8042
- signal.addEventListener("abort", () => reject(/* @__PURE__ */ new Error("Poll aborted")), { once: true });
8156
+ signal.addEventListener("abort", () => reject(signal.reason), { once: true });
8043
8157
  });
8044
- return Promise.race([
8045
- fetchPromise,
8046
- timeoutPromise,
8047
- abortPromise
8048
- ]).finally(() => {
8158
+ return Promise.race([fetchPromise, abortPromise]).finally(() => {
8049
8159
  clearTimeout(timeoutId);
8050
8160
  });
8051
8161
  }
@@ -8093,13 +8203,99 @@ var FeatureFlagsRuntimeClient = class extends EventEmitter {
8093
8203
  return signature(a) !== signature(b);
8094
8204
  }
8095
8205
  };
8096
- //#endregion
8097
- //#region src/feature-flags/feature-flags.ts
8206
+ // src/feature-flags/feature-flags.ts
8098
8207
  var FeatureFlags = class {
8099
8208
  workos;
8100
8209
  constructor(workos) {
8101
8210
  this.workos = workos;
8102
8211
  }
8212
+ /** Append an empty rule to a flag. Duplicate target type/value pairs return 409. */
8213
+ async createFlagRule(options) {
8214
+ const { data } = await this.workos.post("/flag_rules", {
8215
+ flag_slug: options.flagSlug,
8216
+ target_type: options.targetType,
8217
+ value: options.value
8218
+ });
8219
+ return deserializeFlagRule(data);
8220
+ }
8221
+ /** List a flag's rules in evaluation order. */
8222
+ async listFlagRules(options) {
8223
+ const fetchPage = async ({ limit, before, after }) => {
8224
+ const { data } = await this.workos.get("/flag_rules", { query: {
8225
+ flag_slug: options.flagSlug,
8226
+ limit,
8227
+ before,
8228
+ after
8229
+ } });
8230
+ return deserializeList(data, deserializeFlagRule);
8231
+ };
8232
+ return new AutoPaginatable(await fetchPage(options), fetchPage, options);
8233
+ }
8234
+ /** Get a rule in the current environment. */
8235
+ async getFlagRule(id) {
8236
+ const { data } = await this.workos.get(`/flag_rules/${encodePathParameter(id)}`);
8237
+ return deserializeFlagRule(data);
8238
+ }
8239
+ /** Delete a rule and all its target memberships. */
8240
+ async deleteFlagRule(id) {
8241
+ await this.workos.delete(`/flag_rules/${encodePathParameter(id)}`);
8242
+ }
8243
+ /** Add a membership to a rule. The rule supplies the target type and value. */
8244
+ async createFlagTarget(options) {
8245
+ const { data } = await this.workos.post("/flag_targets", {
8246
+ rule_id: options.ruleId,
8247
+ target_id: options.targetId
8248
+ });
8249
+ return deserializeFlagTarget(data);
8250
+ }
8251
+ /** Get a membership, or a legacy target while the compatibility contract is enabled. */
8252
+ async getFlagTarget(id) {
8253
+ const { data } = await this.workos.get(`/flag_targets/${encodePathParameter(id)}`);
8254
+ return deserializeFlagTargetResource(data);
8255
+ }
8256
+ /** List targets with combined filters; the team's contract selects their shape. */
8257
+ async listFlagTargets(options = {}) {
8258
+ const fetchPage = async ({ limit, before, after }) => {
8259
+ const { data } = await this.workos.get("/flag_targets", { query: {
8260
+ rule_id: options.ruleId,
8261
+ flag_slug: options.flagSlug,
8262
+ target_type: options.targetType,
8263
+ target_id: options.targetId,
8264
+ order: options.order ?? "desc",
8265
+ limit,
8266
+ before,
8267
+ after
8268
+ } });
8269
+ return deserializeList(data, deserializeFlagTargetResource);
8270
+ };
8271
+ return new AutoPaginatable(await fetchPage(options), fetchPage, options);
8272
+ }
8273
+ /** Delete a membership by its flag_target ID, not the targeted entity's ID. */
8274
+ async deleteFlagTarget(id) {
8275
+ await this.workos.delete(`/flag_targets/${encodePathParameter(id)}`);
8276
+ }
8277
+ /**
8278
+ * Create a rule, then add its targets sequentially in input order.
8279
+ * This is not atomic: on failure, the rule and completed memberships remain.
8280
+ * A CreateRuleWithTargetsError exposes the rule, confirmed targets, failed
8281
+ * target ID, and original error. No later targets are attempted.
8282
+ */
8283
+ async createRuleWithTargets(options) {
8284
+ const rule = await this.createFlagRule(options);
8285
+ const targets = [];
8286
+ for (const targetId of options.targetIds) try {
8287
+ targets.push(await this.createFlagTarget({
8288
+ ruleId: rule.id,
8289
+ targetId
8290
+ }));
8291
+ } catch (cause) {
8292
+ throw new CreateRuleWithTargetsError(rule, targets, targetId, cause);
8293
+ }
8294
+ return {
8295
+ rule,
8296
+ targets
8297
+ };
8298
+ }
8103
8299
  /**
8104
8300
  * List feature flags
8105
8301
  *
@@ -8164,6 +8360,9 @@ var FeatureFlags = class {
8164
8360
  /**
8165
8361
  * Add a feature flag target
8166
8362
  *
8363
+ * @deprecated For rule-based targeting, use createFlagRule and createFlagTarget.
8364
+ * This compatibility helper remains supported.
8365
+ *
8167
8366
  * Enables a feature flag for a specific target in the current environment. Currently, supported targets include users and organizations.
8168
8367
  * @params options - Object containing slug and targetId.
8169
8368
  * @returns {Promise<void>}
@@ -8178,6 +8377,9 @@ var FeatureFlags = class {
8178
8377
  /**
8179
8378
  * Remove a feature flag target
8180
8379
  *
8380
+ * @deprecated For rule-based targeting, use deleteFlagTarget with a membership ID.
8381
+ * This compatibility helper remains supported.
8382
+ *
8181
8383
  * Removes a target from the feature flag's target list in the current environment. Currently, supported targets include users and organizations.
8182
8384
  * @params options - Object containing slug and targetId.
8183
8385
  * @returns {Promise<void>}
@@ -8216,8 +8418,7 @@ var FeatureFlags = class {
8216
8418
  return new FeatureFlagsRuntimeClient(this.workos, options);
8217
8419
  }
8218
8420
  };
8219
- //#endregion
8220
- //#region src/groups/groups.ts
8421
+ // src/groups/groups.ts
8221
8422
  var Groups = class {
8222
8423
  workos;
8223
8424
  constructor(workos) {
@@ -8379,18 +8580,15 @@ var Groups = class {
8379
8580
  await this.workos.delete(`/organizations/${encodeURIComponent(organizationId)}/groups/${encodeURIComponent(groupId)}/organization-memberships/${encodeURIComponent(organizationMembershipId)}`);
8380
8581
  }
8381
8582
  };
8382
- //#endregion
8383
- //#region src/widgets/serializers/widget-session-token-response.serializer.ts
8583
+ // src/widgets/serializers/widget-session-token-response.serializer.ts
8384
8584
  const deserializeWidgetSessionTokenResponse = (response) => ({ token: response.token });
8385
- //#endregion
8386
- //#region src/widgets/serializers/widget-session-token.serializer.ts
8585
+ // src/widgets/serializers/widget-session-token.serializer.ts
8387
8586
  const serializeGetTokenOptions = (model) => ({
8388
8587
  organization_id: model.organizationId,
8389
8588
  user_id: model.userId,
8390
8589
  scopes: model.scopes
8391
8590
  });
8392
- //#endregion
8393
- //#region src/widgets/widgets.ts
8591
+ // src/widgets/widgets.ts
8394
8592
  var Widgets = class {
8395
8593
  workos;
8396
8594
  constructor(workos) {
@@ -8412,8 +8610,7 @@ var Widgets = class {
8412
8610
  return deserializeWidgetSessionTokenResponse(data);
8413
8611
  }
8414
8612
  };
8415
- //#endregion
8416
- //#region src/authorization/serializers/environment-role.serializer.ts
8613
+ // src/authorization/serializers/environment-role.serializer.ts
8417
8614
  const deserializeEnvironmentRole = (role) => ({
8418
8615
  object: role.object,
8419
8616
  id: role.id,
@@ -8426,50 +8623,43 @@ const deserializeEnvironmentRole = (role) => ({
8426
8623
  createdAt: new Date(role.created_at),
8427
8624
  updatedAt: new Date(role.updated_at)
8428
8625
  });
8429
- //#endregion
8430
- //#region src/authorization/serializers/create-environment-role-options.serializer.ts
8626
+ // src/authorization/serializers/create-environment-role-options.serializer.ts
8431
8627
  const serializeCreateEnvironmentRoleOptions = (options) => ({
8432
8628
  slug: options.slug,
8433
8629
  name: options.name,
8434
8630
  description: options.description,
8435
8631
  resource_type_slug: options.resourceTypeSlug
8436
8632
  });
8437
- //#endregion
8438
- //#region src/authorization/serializers/update-environment-role-options.serializer.ts
8633
+ // src/authorization/serializers/update-environment-role-options.serializer.ts
8439
8634
  const serializeUpdateEnvironmentRoleOptions = (options) => ({
8440
8635
  name: options.name,
8441
8636
  description: options.description
8442
8637
  });
8443
- //#endregion
8444
- //#region src/authorization/serializers/create-organization-role-options.serializer.ts
8638
+ // src/authorization/serializers/create-organization-role-options.serializer.ts
8445
8639
  const serializeCreateOrganizationRoleOptions = (options) => ({
8446
8640
  slug: options.slug,
8447
8641
  name: options.name,
8448
8642
  description: options.description,
8449
8643
  resource_type_slug: options.resourceTypeSlug
8450
8644
  });
8451
- //#endregion
8452
- //#region src/authorization/serializers/update-organization-role-options.serializer.ts
8645
+ // src/authorization/serializers/update-organization-role-options.serializer.ts
8453
8646
  const serializeUpdateOrganizationRoleOptions = (options) => ({
8454
8647
  name: options.name,
8455
8648
  description: options.description
8456
8649
  });
8457
- //#endregion
8458
- //#region src/authorization/serializers/create-permission-options.serializer.ts
8650
+ // src/authorization/serializers/create-permission-options.serializer.ts
8459
8651
  const serializeCreatePermissionOptions = (options) => ({
8460
8652
  slug: options.slug,
8461
8653
  name: options.name,
8462
8654
  description: options.description,
8463
8655
  resource_type_slug: options.resourceTypeSlug
8464
8656
  });
8465
- //#endregion
8466
- //#region src/authorization/serializers/update-permission-options.serializer.ts
8657
+ // src/authorization/serializers/update-permission-options.serializer.ts
8467
8658
  const serializeUpdatePermissionOptions = (options) => ({
8468
8659
  name: options.name,
8469
8660
  description: options.description
8470
8661
  });
8471
- //#endregion
8472
- //#region src/authorization/serializers/authorization-resource.serializer.ts
8662
+ // src/authorization/serializers/authorization-resource.serializer.ts
8473
8663
  const deserializeAuthorizationResource = (resource) => ({
8474
8664
  object: resource.object,
8475
8665
  id: resource.id,
@@ -8482,8 +8672,7 @@ const deserializeAuthorizationResource = (resource) => ({
8482
8672
  createdAt: new Date(resource.created_at),
8483
8673
  updatedAt: new Date(resource.updated_at)
8484
8674
  });
8485
- //#endregion
8486
- //#region src/authorization/serializers/create-authorization-resource-options.serializer.ts
8675
+ // src/authorization/serializers/create-authorization-resource-options.serializer.ts
8487
8676
  const serializeCreateResourceOptions = (options) => ({
8488
8677
  organization_id: options.organizationId,
8489
8678
  resource_type_slug: options.resourceTypeSlug,
@@ -8496,20 +8685,17 @@ const serializeCreateResourceOptions = (options) => ({
8496
8685
  parent_resource_type_slug: options.parentResourceTypeSlug
8497
8686
  }
8498
8687
  });
8499
- //#endregion
8500
- //#region src/authorization/serializers/update-authorization-resource-options.serializer.ts
8688
+ // src/authorization/serializers/update-authorization-resource-options.serializer.ts
8501
8689
  const serializeUpdateResourceOptions = (options) => ({
8502
8690
  ...options.name !== void 0 && { name: options.name },
8503
8691
  ...options.description !== void 0 && { description: options.description }
8504
8692
  });
8505
- //#endregion
8506
- //#region src/authorization/serializers/update-authorization-resource-by-external-id-options.serializer.ts
8693
+ // src/authorization/serializers/update-authorization-resource-by-external-id-options.serializer.ts
8507
8694
  const serializeUpdateResourceByExternalIdOptions = (options) => ({
8508
8695
  ...options.name !== void 0 && { name: options.name },
8509
8696
  ...options.description !== void 0 && { description: options.description }
8510
8697
  });
8511
- //#endregion
8512
- //#region src/authorization/serializers/list-authorization-resources-options.serializer.ts
8698
+ // src/authorization/serializers/list-authorization-resources-options.serializer.ts
8513
8699
  const serializeListAuthorizationResourcesOptions = (options) => ({
8514
8700
  ...options.organizationId && { organization_id: options.organizationId },
8515
8701
  ...options.resourceTypeSlug && { resource_type_slug: options.resourceTypeSlug },
@@ -8518,8 +8704,7 @@ const serializeListAuthorizationResourcesOptions = (options) => ({
8518
8704
  ...options.parentExternalId && { parent_external_id: options.parentExternalId },
8519
8705
  ...serializePaginationOptions(options)
8520
8706
  });
8521
- //#endregion
8522
- //#region src/authorization/serializers/authorization-check-options.serializer.ts
8707
+ // src/authorization/serializers/authorization-check-options.serializer.ts
8523
8708
  const serializeAuthorizationCheckOptions = (options) => ({
8524
8709
  permission_slug: options.permissionSlug,
8525
8710
  ..."resourceId" in options && { resource_id: options.resourceId },
@@ -8528,8 +8713,7 @@ const serializeAuthorizationCheckOptions = (options) => ({
8528
8713
  resource_type_slug: options.resourceTypeSlug
8529
8714
  }
8530
8715
  });
8531
- //#endregion
8532
- //#region src/authorization/serializers/list-resources-for-membership-options.serializer.ts
8716
+ // src/authorization/serializers/list-resources-for-membership-options.serializer.ts
8533
8717
  const serializeListResourcesForMembershipOptions = (options) => ({
8534
8718
  permission_slug: options.permissionSlug,
8535
8719
  ...serializePaginationOptions(options),
@@ -8539,15 +8723,13 @@ const serializeListResourcesForMembershipOptions = (options) => ({
8539
8723
  parent_resource_external_id: options.parentResourceExternalId
8540
8724
  }
8541
8725
  });
8542
- //#endregion
8543
- //#region src/authorization/serializers/list-memberships-for-resource-options.serializer.ts
8726
+ // src/authorization/serializers/list-memberships-for-resource-options.serializer.ts
8544
8727
  const serializeListMembershipsForResourceOptions = (options) => ({
8545
8728
  permission_slug: options.permissionSlug,
8546
8729
  ...options.assignment && { assignment: options.assignment },
8547
8730
  ...serializePaginationOptions(options)
8548
8731
  });
8549
- //#endregion
8550
- //#region src/authorization/serializers/role-assignment.serializer.ts
8732
+ // src/authorization/serializers/role-assignment.serializer.ts
8551
8733
  const deserializeRoleAssignment = (response) => ({
8552
8734
  object: response.object,
8553
8735
  id: response.id,
@@ -8565,22 +8747,19 @@ const deserializeRoleAssignment = (response) => ({
8565
8747
  createdAt: new Date(response.created_at),
8566
8748
  updatedAt: new Date(response.updated_at)
8567
8749
  });
8568
- //#endregion
8569
- //#region src/authorization/serializers/list-role-assignments-options.serializer.ts
8750
+ // src/authorization/serializers/list-role-assignments-options.serializer.ts
8570
8751
  const serializeListRoleAssignmentsOptions = (options) => ({
8571
8752
  ...options.resourceId && { resource_id: options.resourceId },
8572
8753
  ...options.resourceExternalId && { resource_external_id: options.resourceExternalId },
8573
8754
  ...options.resourceTypeSlug && { resource_type_slug: options.resourceTypeSlug },
8574
8755
  ...serializePaginationOptions(options)
8575
8756
  });
8576
- //#endregion
8577
- //#region src/authorization/serializers/list-role-assignments-for-resource-options.serializer.ts
8757
+ // src/authorization/serializers/list-role-assignments-for-resource-options.serializer.ts
8578
8758
  const serializeListRoleAssignmentsForResourceOptions = (options) => ({
8579
8759
  ...options.roleSlug && { role_slug: options.roleSlug },
8580
8760
  ...serializePaginationOptions(options)
8581
8761
  });
8582
- //#endregion
8583
- //#region src/authorization/serializers/assign-role-options.serializer.ts
8762
+ // src/authorization/serializers/assign-role-options.serializer.ts
8584
8763
  const serializeAssignRoleOptions = (options) => ({
8585
8764
  role_slug: options.roleSlug,
8586
8765
  ..."resourceId" in options && { resource_id: options.resourceId },
@@ -8589,8 +8768,7 @@ const serializeAssignRoleOptions = (options) => ({
8589
8768
  resource_type_slug: options.resourceTypeSlug
8590
8769
  }
8591
8770
  });
8592
- //#endregion
8593
- //#region src/authorization/serializers/remove-role-options.serializer.ts
8771
+ // src/authorization/serializers/remove-role-options.serializer.ts
8594
8772
  const serializeRemoveRoleOptions = (options) => ({
8595
8773
  role_slug: options.roleSlug,
8596
8774
  ..."resourceId" in options && { resource_id: options.resourceId },
@@ -8599,8 +8777,7 @@ const serializeRemoveRoleOptions = (options) => ({
8599
8777
  resource_type_slug: options.resourceTypeSlug
8600
8778
  }
8601
8779
  });
8602
- //#endregion
8603
- //#region src/authorization/serializers/group-role-assignment.serializer.ts
8780
+ // src/authorization/serializers/group-role-assignment.serializer.ts
8604
8781
  const deserializeGroupRoleAssignment = (response) => ({
8605
8782
  object: response.object,
8606
8783
  id: response.id,
@@ -8614,8 +8791,7 @@ const deserializeGroupRoleAssignment = (response) => ({
8614
8791
  createdAt: new Date(response.created_at),
8615
8792
  updatedAt: new Date(response.updated_at)
8616
8793
  });
8617
- //#endregion
8618
- //#region src/authorization/serializers/create-group-role-assignment-options.serializer.ts
8794
+ // src/authorization/serializers/create-group-role-assignment-options.serializer.ts
8619
8795
  const serializeCreateGroupRoleAssignmentOptions = (options) => ({
8620
8796
  role_slug: options.roleSlug,
8621
8797
  ..."resourceId" in options && { resource_id: options.resourceId },
@@ -8624,8 +8800,7 @@ const serializeCreateGroupRoleAssignmentOptions = (options) => ({
8624
8800
  resource_type_slug: options.resourceTypeSlug
8625
8801
  }
8626
8802
  });
8627
- //#endregion
8628
- //#region src/authorization/serializers/remove-group-role-assignments-options.serializer.ts
8803
+ // src/authorization/serializers/remove-group-role-assignments-options.serializer.ts
8629
8804
  const serializeRemoveGroupRoleAssignmentsOptions = (options) => ({
8630
8805
  role_slug: options.roleSlug,
8631
8806
  ..."resourceId" in options && { resource_id: options.resourceId },
@@ -8634,8 +8809,7 @@ const serializeRemoveGroupRoleAssignmentsOptions = (options) => ({
8634
8809
  resource_type_slug: options.resourceTypeSlug
8635
8810
  }
8636
8811
  });
8637
- //#endregion
8638
- //#region src/authorization/serializers/replace-group-role-assignments-options.serializer.ts
8812
+ // src/authorization/serializers/replace-group-role-assignments-options.serializer.ts
8639
8813
  const serializeEntry = (entry) => ({
8640
8814
  role_slug: entry.roleSlug,
8641
8815
  ..."resourceId" in entry && { resource_id: entry.resourceId },
@@ -8645,11 +8819,9 @@ const serializeEntry = (entry) => ({
8645
8819
  }
8646
8820
  });
8647
8821
  const serializeReplaceGroupRoleAssignmentsOptions = (options) => ({ role_assignments: options.roleAssignments.map(serializeEntry) });
8648
- //#endregion
8649
- //#region src/authorization/serializers/list-effective-permissions-options.serializer.ts
8822
+ // src/authorization/serializers/list-effective-permissions-options.serializer.ts
8650
8823
  const serializeListEffectivePermissionsOptions = (options) => ({ ...serializePaginationOptions(options) });
8651
- //#endregion
8652
- //#region src/authorization/authorization.ts
8824
+ // src/authorization/authorization.ts
8653
8825
  var Authorization = class {
8654
8826
  workos;
8655
8827
  constructor(workos) {
@@ -9551,8 +9723,7 @@ var Authorization = class {
9551
9723
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializePermission, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializePermission, params), serializedOptions);
9552
9724
  }
9553
9725
  };
9554
- //#endregion
9555
- //#region src/common/utils/leb128.ts
9726
+ // src/common/utils/leb128.ts
9556
9727
  /**
9557
9728
  * LEB128 (Little Endian Base 128) encoding for unsigned 32-bit integers.
9558
9729
  * Variable-length encoding: each byte stores 7 bits of data, bit 7 is continuation flag.
@@ -9621,28 +9792,24 @@ function validateOffset(data, offset) {
9621
9792
  function hasContinuationBit(byte) {
9622
9793
  return (byte & CONTINUATION_BIT) !== 0;
9623
9794
  }
9624
- //#endregion
9625
- //#region src/vault/serializers/create-data-key-response.serializer.ts
9795
+ // src/vault/serializers/create-data-key-response.serializer.ts
9626
9796
  const deserializeCreateDataKeyResponse = (response) => ({
9627
9797
  context: response.context,
9628
9798
  dataKey: response.data_key,
9629
9799
  encryptedKeys: response.encrypted_keys,
9630
9800
  id: response.id
9631
9801
  });
9632
- //#endregion
9633
- //#region src/vault/serializers/decrypt-response.serializer.ts
9802
+ // src/vault/serializers/decrypt-response.serializer.ts
9634
9803
  const deserializeDecryptResponse = (response) => ({
9635
9804
  dataKey: response.data_key,
9636
9805
  id: response.id
9637
9806
  });
9638
- //#endregion
9639
- //#region src/vault/serializers/actor.serializer.ts
9807
+ // src/vault/serializers/actor.serializer.ts
9640
9808
  const deserializeActor = (response) => ({
9641
9809
  id: response.id,
9642
9810
  name: response.name
9643
9811
  });
9644
- //#endregion
9645
- //#region src/vault/serializers/object-metadata.serializer.ts
9812
+ // src/vault/serializers/object-metadata.serializer.ts
9646
9813
  const deserializeObjectMetadata = (response) => ({
9647
9814
  context: response.context,
9648
9815
  environmentId: response.environment_id,
@@ -9652,23 +9819,20 @@ const deserializeObjectMetadata = (response) => ({
9652
9819
  updatedBy: deserializeActor(response.updated_by),
9653
9820
  versionId: response.version_id ?? null
9654
9821
  });
9655
- //#endregion
9656
- //#region src/vault/serializers/vault-object.serializer.ts
9822
+ // src/vault/serializers/vault-object.serializer.ts
9657
9823
  const deserializeVaultObject = (response) => ({
9658
9824
  id: response.id,
9659
9825
  metadata: deserializeObjectMetadata(response.metadata),
9660
9826
  name: response.name,
9661
9827
  value: response.value
9662
9828
  });
9663
- //#endregion
9664
- //#region src/vault/serializers/object-without-value.serializer.ts
9829
+ // src/vault/serializers/object-without-value.serializer.ts
9665
9830
  const deserializeObjectWithoutValue = (response) => ({
9666
9831
  id: response.id,
9667
9832
  metadata: deserializeObjectMetadata(response.metadata),
9668
9833
  name: response.name
9669
9834
  });
9670
- //#endregion
9671
- //#region src/vault/serializers/object-version.serializer.ts
9835
+ // src/vault/serializers/object-version.serializer.ts
9672
9836
  const deserializeObjectVersion = (response) => ({
9673
9837
  createdAt: new Date(response.created_at),
9674
9838
  currentVersion: response.current_version,
@@ -9676,52 +9840,43 @@ const deserializeObjectVersion = (response) => ({
9676
9840
  id: response.id,
9677
9841
  size: response.size ?? 0
9678
9842
  });
9679
- //#endregion
9680
- //#region src/vault/serializers/list-metadata.serializer.ts
9843
+ // src/vault/serializers/list-metadata.serializer.ts
9681
9844
  const deserializeListMetadata = (response) => ({
9682
9845
  after: response.after ?? null,
9683
9846
  before: response.before ?? null
9684
9847
  });
9685
- //#endregion
9686
- //#region src/vault/serializers/version-list-response.serializer.ts
9848
+ // src/vault/serializers/version-list-response.serializer.ts
9687
9849
  const deserializeVersionListResponse = (response) => ({
9688
9850
  data: response.data.map(deserializeObjectVersion),
9689
9851
  listMetadata: deserializeListMetadata(response.list_metadata)
9690
9852
  });
9691
- //#endregion
9692
- //#region src/vault/serializers/object-summary.serializer.ts
9853
+ // src/vault/serializers/object-summary.serializer.ts
9693
9854
  const deserializeObjectSummary = (response) => ({
9694
9855
  id: response.id,
9695
9856
  name: response.name,
9696
9857
  updatedAt: response.updated_at != null ? new Date(response.updated_at) : null
9697
9858
  });
9698
- //#endregion
9699
- //#region src/vault/serializers/create-data-key-request.serializer.ts
9859
+ // src/vault/serializers/create-data-key-request.serializer.ts
9700
9860
  const serializeCreateDataKeyRequest = (model) => ({ context: model.context });
9701
- //#endregion
9702
- //#region src/vault/serializers/decrypt-request.serializer.ts
9861
+ // src/vault/serializers/decrypt-request.serializer.ts
9703
9862
  const serializeDecryptRequest = (model) => ({ keys: model.keys });
9704
- //#endregion
9705
- //#region src/vault/serializers/rekey-request.serializer.ts
9863
+ // src/vault/serializers/rekey-request.serializer.ts
9706
9864
  const serializeRekeyRequest = (model) => ({
9707
9865
  context: model.context,
9708
9866
  encrypted_keys: model.encryptedKeys
9709
9867
  });
9710
- //#endregion
9711
- //#region src/vault/serializers/create-object-request.serializer.ts
9868
+ // src/vault/serializers/create-object-request.serializer.ts
9712
9869
  const serializeCreateObjectRequest = (model) => ({
9713
9870
  key_context: model.keyContext,
9714
9871
  name: model.name,
9715
9872
  value: model.value
9716
9873
  });
9717
- //#endregion
9718
- //#region src/vault/serializers/update-object-request.serializer.ts
9874
+ // src/vault/serializers/update-object-request.serializer.ts
9719
9875
  const serializeUpdateObjectRequest = (model) => ({
9720
9876
  value: model.value,
9721
9877
  version_check: model.versionCheck ?? null
9722
9878
  });
9723
- //#endregion
9724
- //#region src/common/utils/base64.ts
9879
+ // src/common/utils/base64.ts
9725
9880
  /**
9726
9881
  * Cross-runtime compatible base64 encoding/decoding utilities
9727
9882
  * that work in both Node.js and browser environments
@@ -9749,8 +9904,7 @@ function uint8ArrayToBase64(bytes) {
9749
9904
  } else if (typeof Buffer !== "undefined") return Buffer.from(bytes).toString("base64");
9750
9905
  else throw new Error("No base64 encoding implementation available");
9751
9906
  }
9752
- //#endregion
9753
- //#region src/vault/vault.ts
9907
+ // src/vault/vault.ts
9754
9908
  const serializeListObjectsOptions = (options) => {
9755
9909
  const wire = {
9756
9910
  limit: options.limit,
@@ -10004,11 +10158,9 @@ var Vault = class {
10004
10158
  return uint8ArrayToBase64(resultArray);
10005
10159
  }
10006
10160
  };
10007
- //#endregion
10008
- //#region package.json
10009
- var version = "12.2.0";
10010
- //#endregion
10011
- //#region src/workos.ts
10161
+ // package.json
10162
+ var version = "12.4.0";
10163
+ // src/workos.ts
10012
10164
  const DEFAULT_HOSTNAME = "api.workos.com";
10013
10165
  const HEADER_AUTHORIZATION = "Authorization";
10014
10166
  const HEADER_IDEMPOTENCY_KEY = "Idempotency-Key";
@@ -10110,7 +10262,7 @@ var WorkOS = class {
10110
10262
  timeout: options.timeout,
10111
10263
  maxRetries: options.maxRetries,
10112
10264
  headers
10113
- });
10265
+ }, options.fetchFn);
10114
10266
  }
10115
10267
  get version() {
10116
10268
  return version;
@@ -10154,9 +10306,11 @@ var WorkOS = class {
10154
10306
  res = await this.client.get(path, {
10155
10307
  params: options.query,
10156
10308
  headers: requestHeaders,
10157
- maxRetries: options.maxRetries
10309
+ maxRetries: options.maxRetries,
10310
+ signal: options.signal
10158
10311
  });
10159
10312
  } catch (error) {
10313
+ options.signal?.throwIfAborted();
10160
10314
  this.handleHttpError({
10161
10315
  path,
10162
10316
  error
@@ -10297,8 +10451,7 @@ var WorkOS = class {
10297
10451
  }
10298
10452
  }
10299
10453
  };
10300
- //#endregion
10301
- //#region src/audit-logs/interfaces/update-audit-logs-retention-retention-period.interface.ts
10454
+ // src/audit-logs/interfaces/update-audit-logs-retention-retention-period.interface.ts
10302
10455
  const UpdateAuditLogsRetentionRetentionPeriod = {
10303
10456
  Value1Month: "1_MONTH",
10304
10457
  Value2Months: "2_MONTHS",
@@ -10322,8 +10475,7 @@ const UpdateAuditLogsRetentionRetentionPeriod = {
10322
10475
  Value9Years: "9_YEARS",
10323
10476
  Value10Years: "10_YEARS"
10324
10477
  };
10325
- //#endregion
10326
- //#region src/common/interfaces/generate-link-intent.interface.ts
10478
+ // src/common/interfaces/generate-link-intent.interface.ts
10327
10479
  const GenerateLinkIntent = {
10328
10480
  SSO: "sso",
10329
10481
  DSync: "dsync",
@@ -10333,22 +10485,19 @@ const GenerateLinkIntent = {
10333
10485
  CertificateRenewal: "certificate_renewal",
10334
10486
  BringYourOwnKey: "bring_your_own_key"
10335
10487
  };
10336
- //#endregion
10337
- //#region src/directory-sync/interfaces/directory-user-with-groups-state.interface.ts
10488
+ // src/directory-sync/interfaces/directory-user-with-groups-state.interface.ts
10338
10489
  const DirectoryUserWithGroupsState = {
10339
10490
  Active: "active",
10340
10491
  Suspended: "suspended",
10341
10492
  Inactive: "inactive"
10342
10493
  };
10343
- //#endregion
10344
- //#region src/organizations/interfaces/domain-data.interface.ts
10494
+ // src/organizations/interfaces/domain-data.interface.ts
10345
10495
  let DomainDataState = /* @__PURE__ */ function(DomainDataState) {
10346
10496
  DomainDataState["Verified"] = "verified";
10347
10497
  DomainDataState["Pending"] = "pending";
10348
10498
  return DomainDataState;
10349
10499
  }({});
10350
- //#endregion
10351
- //#region src/organizations/interfaces/it-contact-options.interface.ts
10500
+ // src/organizations/interfaces/it-contact-options.interface.ts
10352
10501
  const ItContactIntent = {
10353
10502
  SSO: "sso",
10354
10503
  DirectorySync: "directory_sync",
@@ -10356,8 +10505,7 @@ const ItContactIntent = {
10356
10505
  DomainVerification: "domain_verification",
10357
10506
  BringYourOwnKey: "bring_your_own_key"
10358
10507
  };
10359
- //#endregion
10360
- //#region src/organization-domains/interfaces/organization-domain.interface.ts
10508
+ // src/organization-domains/interfaces/organization-domain.interface.ts
10361
10509
  let OrganizationDomainState = /* @__PURE__ */ function(OrganizationDomainState) {
10362
10510
  OrganizationDomainState["Verified"] = "verified";
10363
10511
  OrganizationDomainState["Pending"] = "pending";
@@ -10370,8 +10518,7 @@ let OrganizationDomainVerificationStrategy = /* @__PURE__ */ function(Organizati
10370
10518
  OrganizationDomainVerificationStrategy["Manual"] = "manual";
10371
10519
  return OrganizationDomainVerificationStrategy;
10372
10520
  }({});
10373
- //#endregion
10374
- //#region src/sso/interfaces/connection-type.enum.ts
10521
+ // src/sso/interfaces/connection-type.enum.ts
10375
10522
  let ConnectionType = /* @__PURE__ */ function(ConnectionType) {
10376
10523
  ConnectionType["ADFSSAML"] = "ADFSSAML";
10377
10524
  ConnectionType["AdpOidc"] = "AdpOidc";
@@ -10413,12 +10560,10 @@ let ConnectionType = /* @__PURE__ */ function(ConnectionType) {
10413
10560
  ConnectionType["VMwareSAML"] = "VMwareSAML";
10414
10561
  return ConnectionType;
10415
10562
  }({});
10416
- //#endregion
10417
- //#region src/factory.ts
10563
+ // src/factory.ts
10418
10564
  function createWorkOS(options) {
10419
10565
  return new WorkOS(options);
10420
10566
  }
10421
- //#endregion
10422
10567
  Object.defineProperty(exports, "Actions", {
10423
10568
  enumerable: true,
10424
10569
  get: function() {
@@ -10473,6 +10618,12 @@ Object.defineProperty(exports, "CookieSession", {
10473
10618
  return CookieSession;
10474
10619
  }
10475
10620
  });
10621
+ Object.defineProperty(exports, "CreateRuleWithTargetsError", {
10622
+ enumerable: true,
10623
+ get: function() {
10624
+ return CreateRuleWithTargetsError;
10625
+ }
10626
+ });
10476
10627
  Object.defineProperty(exports, "DirectoryUserWithGroupsState", {
10477
10628
  enumerable: true,
10478
10629
  get: function() {
@@ -10624,4 +10775,4 @@ Object.defineProperty(exports, "serializeRevokeSessionOptions", {
10624
10775
  }
10625
10776
  });
10626
10777
 
10627
- //# sourceMappingURL=factory-CEEOW8zX.cjs.map
10778
+ //# sourceMappingURL=factory-CnNO67Ux.cjs.map