@workos-inc/node 12.4.0 → 12.4.2

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.
@@ -2782,6 +2782,15 @@ let _josePromise;
2782
2782
  function getJose() {
2783
2783
  return _josePromise ??= Promise.resolve().then(() => require("./webapi-rpGT44g1.cjs"));
2784
2784
  }
2785
+ /**
2786
+ * Whether a jose error means the presented token is invalid, as opposed to
2787
+ * a failure to verify it at all. Network errors, JWKS timeouts and crypto
2788
+ * failures propagate so they surface as errors rather than as rejected tokens.
2789
+ */
2790
+ function isJwtValidationError(e) {
2791
+ if (!(e instanceof Error) || !("code" in e) || typeof e.code !== "string") return false;
2792
+ return e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_") || e.code === "ERR_JWKS_NO_MATCHING_KEY" || e.code === "ERR_JWKS_MULTIPLE_MATCHING_KEYS" || e.code === "ERR_JOSE_NOT_SUPPORTED";
2793
+ }
2785
2794
  // src/agents/serializers/agent-instance-session.serializer.ts
2786
2795
  function deserializeAgentInstanceSession(session) {
2787
2796
  return {
@@ -3228,7 +3237,7 @@ var Agents = class {
3228
3237
  if (payload.exp * 1e3 <= Date.now()) return null;
3229
3238
  return deserializeAgentAccessTokenClaims(payload);
3230
3239
  } catch (e) {
3231
- if (e instanceof Error && "code" in e && typeof e.code === "string" && (e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_"))) return null;
3240
+ if (isJwtValidationError(e)) return null;
3232
3241
  throw e;
3233
3242
  }
3234
3243
  }
@@ -6048,9 +6057,10 @@ var AuditLogs = class {
6048
6057
  *
6049
6058
  * This API supports idempotency which guarantees that performing the same operation multiple times will have the same result as if the operation were performed only once. This is handy in situations where you may need to retry a request due to a failure or prevent accidental duplicate requests from creating more than one resource.
6050
6059
  *
6051
- * To achieve idempotency, you can add `Idempotency-Key` request header to a Create Event request with a unique string as the value. Each subsequent request matching this unique string will return the same response. We suggest using [v4 UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) for idempotency keys to avoid collisions.
6060
+ * To achieve idempotency, you can add `Idempotency-Key` request header to a Create Event request with a unique string as the value. We suggest using [v4 UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) for idempotency keys to avoid collisions.
6052
6061
  *
6053
- * Idempotency keys expire after 24 hours. The API will generate a new response if you submit a request with an expired key.
6062
+ * WorkOS uses the idempotency key and event data together to detect duplicates.
6063
+ * When retrying an event, reuse its original key and send the same event data.
6054
6064
  * @param payload - Object containing organizationId, event.
6055
6065
  * @returns {Promise<void>}
6056
6066
  * @throws {BadRequestException} 400
@@ -7130,20 +7140,10 @@ var UserManagement = class UserManagement {
7130
7140
  const { payload } = await jwtVerify(accessToken, jwks, this.issuer ? { issuer: this.issuer } : void 0);
7131
7141
  return payload;
7132
7142
  } catch (e) {
7133
- if (UserManagement.isJwtValidationError(e)) return null;
7143
+ if (isJwtValidationError(e)) return null;
7134
7144
  throw e;
7135
7145
  }
7136
7146
  }
7137
- /**
7138
- * Whether a jose error means the presented token is invalid, as opposed to
7139
- * a failure to verify it at all. Network errors, JWKS timeouts and crypto
7140
- * failures propagate so they surface as errors rather than as rejected
7141
- * tokens.
7142
- */
7143
- static isJwtValidationError(e) {
7144
- if (!(e instanceof Error) || !("code" in e) || typeof e.code !== "string") return false;
7145
- return e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_") || e.code === "ERR_JWKS_NO_MATCHING_KEY" || e.code === "ERR_JWKS_MULTIPLE_MATCHING_KEYS" || e.code === "ERR_JOSE_NOT_SUPPORTED" || e.code === "ERR_JOSE_ALG_NOT_ALLOWED";
7146
- }
7147
7147
  async prepareAuthenticationResponse({ authenticationResponse, session }) {
7148
7148
  if (session?.sealSession) {
7149
7149
  if (!this.workos.key) throw new Error("Session sealing requires server-side usage with an API key. Public clients should store tokens directly (e.g., secure storage on mobile, keychain on desktop).");
@@ -10159,7 +10159,7 @@ var Vault = class {
10159
10159
  }
10160
10160
  };
10161
10161
  // package.json
10162
- var version = "12.4.0";
10162
+ var version = "12.4.2";
10163
10163
  // src/workos.ts
10164
10164
  const DEFAULT_HOSTNAME = "api.workos.com";
10165
10165
  const HEADER_AUTHORIZATION = "Authorization";
@@ -10536,6 +10536,7 @@ let ConnectionType = /* @__PURE__ */ function(ConnectionType) {
10536
10536
  ConnectionType["GenericSAML"] = "GenericSAML";
10537
10537
  ConnectionType["GitHubOAuth"] = "GitHubOAuth";
10538
10538
  ConnectionType["GoogleOAuth"] = "GoogleOAuth";
10539
+ ConnectionType["GoogleOIDC"] = "GoogleOIDC";
10539
10540
  ConnectionType["GoogleSAML"] = "GoogleSAML";
10540
10541
  ConnectionType["JumpCloudSAML"] = "JumpCloudSAML";
10541
10542
  ConnectionType["KeycloakSAML"] = "KeycloakSAML";
@@ -10775,4 +10776,4 @@ Object.defineProperty(exports, "serializeRevokeSessionOptions", {
10775
10776
  }
10776
10777
  });
10777
10778
 
10778
- //# sourceMappingURL=factory-CnNO67Ux.cjs.map
10779
+ //# sourceMappingURL=factory-SLaWXuFo.cjs.map