@workos-inc/node 10.12.0 → 10.14.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.
@@ -122,9 +122,32 @@ var HttpClient = class HttpClient {
122
122
  this.MAX_RETRY_ATTEMPTS = options?.maxRetries ?? 3;
123
123
  }
124
124
  static getResourceURL(baseURL, path, params) {
125
+ HttpClient.assertNoDotSegments(path);
125
126
  const queryString = HttpClient.getQueryString(params);
126
127
  return new URL([path, queryString].filter(Boolean).join("?"), baseURL).toString();
127
128
  }
129
+ /**
130
+ * Reject request paths that contain a single-dot or double-dot segment.
131
+ *
132
+ * SDK path templates never contain such segments themselves, but a
133
+ * caller-supplied identifier interpolated with bare `encodeURIComponent`
134
+ * (the form the generated modules use) passes `.` and `..` through
135
+ * unchanged, and the WHATWG `URL` parser then collapses them, retargeting
136
+ * the request to a different endpoint (for example
137
+ * `/organizations/../api_keys` resolves to `/api_keys`). The parser also
138
+ * treats the percent-encoded forms (`%2e`, case-insensitive) as dots, so
139
+ * those are matched as well. Encoded values never trip this check because
140
+ * `encodeURIComponent` turns `%` into `%25` and `/` into `%2F`, keeping
141
+ * each identifier inside its own segment. Fail closed before any request
142
+ * is built.
143
+ */
144
+ static assertNoDotSegments(path) {
145
+ const pathOnly = path.split(/[?#]/, 1)[0];
146
+ for (const segment of pathOnly.split("/")) {
147
+ const normalized = segment.replace(/%2e/gi, ".");
148
+ if (normalized === "." || normalized === "..") throw new TypeError(`Invalid request path "${path}": a path segment must not be "." or "..".`);
149
+ }
150
+ }
128
151
  static getQueryString(queryObj) {
129
152
  if (!queryObj) return void 0;
130
153
  const sanitizedQueryObj = {};
@@ -273,10 +296,19 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
273
296
  const timeout = this.options?.timeout ?? DEFAULT_FETCH_TIMEOUT;
274
297
  const abortController = new AbortController();
275
298
  const timeoutId = setTimeout(() => {
276
- abortController?.abort();
299
+ abortController.abort();
277
300
  }, timeout);
301
+ const timeoutError = (responseHeaders) => new HttpClientError({
302
+ message: `Request timeout after ${timeout}ms`,
303
+ response: {
304
+ status: 408,
305
+ headers: responseHeaders ?? new Headers(),
306
+ data: { error: "Request timeout" }
307
+ }
308
+ });
309
+ let res;
278
310
  try {
279
- const res = await this._fetchFn(url, {
311
+ res = await this._fetchFn(url, {
280
312
  method,
281
313
  headers: {
282
314
  Accept: "application/json, text/plain, */*",
@@ -286,12 +318,12 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
286
318
  "User-Agent": (userAgent || "workos-node").toString()
287
319
  },
288
320
  body: requestBody,
289
- signal: abortController?.signal
321
+ signal: abortController.signal
290
322
  });
291
- if (timeoutId) clearTimeout(timeoutId);
292
323
  if (!res.ok) {
293
324
  const requestID = res.headers.get("X-Request-ID") ?? "";
294
325
  const rawBody = await res.text();
326
+ clearTimeout(timeoutId);
295
327
  let responseJson;
296
328
  try {
297
329
  responseJson = JSON.parse(rawBody);
@@ -314,17 +346,21 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
314
346
  }
315
347
  });
316
348
  }
317
- return new FetchHttpClientResponse(res);
318
- } catch (error) {
319
- if (timeoutId) clearTimeout(timeoutId);
320
- if (error instanceof Error && error.name === "AbortError") throw new HttpClientError({
321
- message: `Request timeout after ${timeout}ms`,
322
- response: {
323
- status: 408,
324
- headers: new Headers(),
325
- data: { error: "Request timeout" }
349
+ const response = res;
350
+ const rawBody = (async () => {
351
+ try {
352
+ return await response.text();
353
+ } catch (error) {
354
+ throw abortController.signal.aborted ? timeoutError(response.headers) : error;
355
+ } finally {
356
+ clearTimeout(timeoutId);
326
357
  }
327
- });
358
+ })();
359
+ rawBody.catch(() => void 0);
360
+ return new FetchHttpClientResponse(res, rawBody);
361
+ } catch (error) {
362
+ clearTimeout(timeoutId);
363
+ if (abortController.signal.aborted) throw timeoutError(res?.headers);
328
364
  throw error;
329
365
  }
330
366
  }
@@ -384,16 +420,18 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
384
420
  };
385
421
  var FetchHttpClientResponse = class FetchHttpClientResponse extends HttpClientResponse {
386
422
  _res;
387
- constructor(res) {
423
+ _rawBody;
424
+ constructor(res, rawBody) {
388
425
  super(res.status, FetchHttpClientResponse._transformHeadersToObject(res.headers));
389
426
  this._res = res;
427
+ this._rawBody = rawBody;
390
428
  }
391
429
  getRawResponse() {
392
430
  return this._res;
393
431
  }
394
432
  async toJSON() {
433
+ const rawBody = await this._rawBody;
395
434
  if (!this._res.headers.get("content-type")?.includes("application/json")) return null;
396
- const rawBody = await this._res.text();
397
435
  try {
398
436
  return JSON.parse(rawBody);
399
437
  } catch (error) {
@@ -1137,6 +1175,27 @@ function deserializeUserApiKeyWithValue(apiKey) {
1137
1175
  };
1138
1176
  }
1139
1177
  //#endregion
1178
+ //#region src/user-management/serializers/waitlist.serializer.ts
1179
+ const deserializeWaitlist = (waitlist) => ({
1180
+ object: waitlist.object,
1181
+ id: waitlist.id,
1182
+ createdAt: waitlist.created_at,
1183
+ updatedAt: waitlist.updated_at
1184
+ });
1185
+ //#endregion
1186
+ //#region src/user-management/serializers/waitlist-entry.serializer.ts
1187
+ const deserializeWaitlistEntry = (waitlistEntry) => ({
1188
+ object: waitlistEntry.object,
1189
+ id: waitlistEntry.id,
1190
+ email: waitlistEntry.email,
1191
+ state: waitlistEntry.state,
1192
+ approvedAt: waitlistEntry.approved_at,
1193
+ additionalFields: waitlistEntry.additional_fields,
1194
+ waitlistId: waitlistEntry.waitlist_id ?? null,
1195
+ createdAt: waitlistEntry.created_at,
1196
+ updatedAt: waitlistEntry.updated_at
1197
+ });
1198
+ //#endregion
1140
1199
  //#region src/user-management/serializers/organization-membership.serializer.ts
1141
1200
  const deserializeOrganizationMembership = (organizationMembership) => ({
1142
1201
  object: organizationMembership.object,
@@ -2182,7 +2241,109 @@ let _josePromise;
2182
2241
  * @returns Promise that resolves to the jose module
2183
2242
  */
2184
2243
  function getJose() {
2185
- return _josePromise ??= import("./webapi-BlhUk1KL.mjs");
2244
+ return _josePromise ??= import("./webapi-C2FQ2NNL.mjs");
2245
+ }
2246
+ //#endregion
2247
+ //#region src/agents/serializers/agent-blueprint.serializer.ts
2248
+ function deserializeAgentBlueprint(blueprint) {
2249
+ return {
2250
+ object: blueprint.object,
2251
+ id: blueprint.id,
2252
+ name: blueprint.name,
2253
+ description: blueprint.description,
2254
+ permissions: blueprint.permissions,
2255
+ invocableBy: {
2256
+ roleSlugs: blueprint.invocable_by.role_slugs,
2257
+ organizationIds: blueprint.invocable_by.organization_ids
2258
+ },
2259
+ sessionSettings: {
2260
+ maxAgeSeconds: blueprint.session_settings.max_age_seconds,
2261
+ accessTokenTtlSeconds: blueprint.session_settings.access_token_ttl_seconds,
2262
+ refreshTokenTtlSeconds: blueprint.session_settings.refresh_token_ttl_seconds
2263
+ },
2264
+ createdAt: blueprint.created_at,
2265
+ updatedAt: blueprint.updated_at
2266
+ };
2267
+ }
2268
+ function serializeCreateAgentBlueprintOptions(options) {
2269
+ return {
2270
+ name: options.name,
2271
+ ...options.description !== void 0 && { description: options.description },
2272
+ ...options.permissions !== void 0 && { permissions: options.permissions },
2273
+ ...options.invocableBy !== void 0 && { invocable_by: {
2274
+ ...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
2275
+ ...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
2276
+ } },
2277
+ session_settings: {
2278
+ max_age_seconds: options.sessionSettings.maxAgeSeconds,
2279
+ access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds,
2280
+ refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds
2281
+ }
2282
+ };
2283
+ }
2284
+ function serializeUpdateAgentBlueprintOptions(options) {
2285
+ return {
2286
+ ...options.name !== void 0 && { name: options.name },
2287
+ ...options.description !== void 0 && { description: options.description },
2288
+ ...options.permissions !== void 0 && { permissions: options.permissions },
2289
+ ...options.invocableBy !== void 0 && { invocable_by: {
2290
+ ...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
2291
+ ...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
2292
+ } },
2293
+ ...options.sessionSettings !== void 0 && { session_settings: {
2294
+ ...options.sessionSettings.maxAgeSeconds !== void 0 && { max_age_seconds: options.sessionSettings.maxAgeSeconds },
2295
+ ...options.sessionSettings.accessTokenTtlSeconds !== void 0 && { access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds },
2296
+ ...options.sessionSettings.refreshTokenTtlSeconds !== void 0 && { refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds }
2297
+ } }
2298
+ };
2299
+ }
2300
+ //#endregion
2301
+ //#region src/agents/serializers/agent-instance-session.serializer.ts
2302
+ function deserializeAgentInstanceSession(session) {
2303
+ return {
2304
+ object: session.object,
2305
+ id: session.id,
2306
+ agentInstanceId: session.agent_instance_id,
2307
+ status: session.status,
2308
+ expiresAt: session.expires_at,
2309
+ revokedAt: session.revoked_at,
2310
+ createdAt: session.created_at,
2311
+ updatedAt: session.updated_at
2312
+ };
2313
+ }
2314
+ function serializeListAgentInstanceSessionsOptions(options) {
2315
+ return {
2316
+ agent_blueprint_id: options.agentBlueprintId,
2317
+ agent_instance_id: options.agentInstanceId,
2318
+ limit: options.limit,
2319
+ before: options.before,
2320
+ after: options.after,
2321
+ order: options.order
2322
+ };
2323
+ }
2324
+ //#endregion
2325
+ //#region src/agents/serializers/agent-instance.serializer.ts
2326
+ function deserializeAgentInstance(instance) {
2327
+ return {
2328
+ object: instance.object,
2329
+ id: instance.id,
2330
+ agentBlueprintId: instance.agent_blueprint_id,
2331
+ organizationId: instance.organization_id,
2332
+ organizationMembershipId: instance.organization_membership_id,
2333
+ type: instance.type,
2334
+ createdAt: instance.created_at,
2335
+ updatedAt: instance.updated_at
2336
+ };
2337
+ }
2338
+ function serializeListAgentInstancesOptions(options) {
2339
+ return {
2340
+ organization_id: options.organizationId,
2341
+ agent_blueprint_id: options.agentBlueprintId,
2342
+ limit: options.limit,
2343
+ before: options.before,
2344
+ after: options.after,
2345
+ order: options.order
2346
+ };
2186
2347
  }
2187
2348
  //#endregion
2188
2349
  //#region src/agents/serializers/agent-registration.serializer.ts
@@ -2216,6 +2377,45 @@ function deserializeAgentRegistration(registration) {
2216
2377
  };
2217
2378
  }
2218
2379
  //#endregion
2380
+ //#region src/agents/serializers/agent-token.serializer.ts
2381
+ function deserializeAgentToken(token) {
2382
+ return {
2383
+ accessToken: token.access_token,
2384
+ tokenType: token.token_type,
2385
+ expiresIn: token.expires_in,
2386
+ refreshToken: token.refresh_token,
2387
+ agentInstanceId: token.agent_instance_id,
2388
+ newInstance: token.new_instance,
2389
+ agentInstanceSessionId: token.agent_instance_session_id,
2390
+ permissions: token.permissions
2391
+ };
2392
+ }
2393
+ function serializeMintAgentTokenOptions(options) {
2394
+ const intent = options.intent !== void 0 ? { intent: options.intent } : {};
2395
+ switch (options.type) {
2396
+ case "user_delegated": return {
2397
+ type: "user_delegated",
2398
+ user_access_token: options.userAccessToken,
2399
+ ...intent
2400
+ };
2401
+ case "autonomous": return {
2402
+ type: "autonomous",
2403
+ organization_id: options.organizationId,
2404
+ ...intent
2405
+ };
2406
+ case "agent_delegated": return {
2407
+ type: "agent_delegated",
2408
+ agent_access_token: options.agentAccessToken,
2409
+ ...intent
2410
+ };
2411
+ case "refresh": return {
2412
+ type: "refresh",
2413
+ refresh_token: options.refreshToken,
2414
+ ...intent
2415
+ };
2416
+ }
2417
+ }
2418
+ //#endregion
2219
2419
  //#region src/agents/serializers/claim-attempt.serializer.ts
2220
2420
  function serializeLinkClaimAttemptToExternalUserOptions(options) {
2221
2421
  return {
@@ -2290,6 +2490,186 @@ var Agents = class {
2290
2490
  this.workos = workos;
2291
2491
  }
2292
2492
  /**
2493
+ * Create an agent blueprint
2494
+ *
2495
+ * Creates an agent blueprint: the template describing what an agent may do
2496
+ * (its permission ceiling), who may invoke it, and the lifetimes of its
2497
+ * sessions.
2498
+ *
2499
+ * @param options - Configuration for the new agent blueprint.
2500
+ * @returns {Promise<AgentBlueprint>}
2501
+ * @throws {BadRequestException} 400
2502
+ * @throws {ConflictException} 409 - Name already in use.
2503
+ * @throws {UnprocessableEntityException} 422 - Permission, role, or organization not found.
2504
+ */
2505
+ async createBlueprint(options) {
2506
+ const { data } = await this.workos.post("/agents/blueprints", serializeCreateAgentBlueprintOptions(options));
2507
+ return deserializeAgentBlueprint(data);
2508
+ }
2509
+ /**
2510
+ * List agent blueprints
2511
+ *
2512
+ * Lists the agent blueprints in the current environment.
2513
+ *
2514
+ * @param options - Pagination options.
2515
+ * @returns {Promise<AutoPaginatable<AgentBlueprint, ListAgentBlueprintsOptions>>}
2516
+ */
2517
+ async listBlueprints(options) {
2518
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/agents/blueprints", deserializeAgentBlueprint, options), (params) => fetchAndDeserialize(this.workos, "/agents/blueprints", deserializeAgentBlueprint, params), options);
2519
+ }
2520
+ /**
2521
+ * Get an agent blueprint
2522
+ *
2523
+ * Retrieves an agent blueprint by ID.
2524
+ * @param agentBlueprintId - Unique identifier of the agent blueprint.
2525
+ *
2526
+ * @example
2527
+ * "agent_blueprint_01EHWNCE74X7JSDV0X3SZ3KJNY"
2528
+ *
2529
+ * @returns {Promise<AgentBlueprint>}
2530
+ * @throws {NotFoundException} 404
2531
+ */
2532
+ async getBlueprint(agentBlueprintId) {
2533
+ const { data } = await this.workos.get(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`);
2534
+ return deserializeAgentBlueprint(data);
2535
+ }
2536
+ /**
2537
+ * Update an agent blueprint
2538
+ *
2539
+ * Updates an agent blueprint. Omitted fields are left unchanged; provided
2540
+ * lists replace the existing configuration.
2541
+ *
2542
+ * @param options - Object containing the agent blueprint ID and the fields to update.
2543
+ * @returns {Promise<AgentBlueprint>}
2544
+ * @throws {BadRequestException} 400
2545
+ * @throws {NotFoundException} 404
2546
+ * @throws {ConflictException} 409 - Name already in use.
2547
+ * @throws {UnprocessableEntityException} 422 - Permission, role, or organization not found.
2548
+ */
2549
+ async updateBlueprint(options) {
2550
+ const { agentBlueprintId, ...payload } = options;
2551
+ const { data } = await this.workos.patch(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`, serializeUpdateAgentBlueprintOptions(payload));
2552
+ return deserializeAgentBlueprint(data);
2553
+ }
2554
+ /**
2555
+ * Delete an agent blueprint
2556
+ *
2557
+ * Deletes an agent blueprint by ID.
2558
+ * @param agentBlueprintId - Unique identifier of the agent blueprint.
2559
+ *
2560
+ * @example
2561
+ * "agent_blueprint_01EHWNCE74X7JSDV0X3SZ3KJNY"
2562
+ *
2563
+ * @returns {Promise<void>}
2564
+ * @throws {NotFoundException} 404
2565
+ */
2566
+ async deleteBlueprint(agentBlueprintId) {
2567
+ await this.workos.delete(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`);
2568
+ }
2569
+ /**
2570
+ * Mint an agent token
2571
+ *
2572
+ * Mints tokens for an agent session from a blueprint. Supports
2573
+ * user-delegated, autonomous, and agent-delegated mints, as well as
2574
+ * refreshing an existing session with a refresh token.
2575
+ *
2576
+ * @param options - Object containing the agent blueprint ID, the mint type, and its credentials.
2577
+ * @returns {Promise<AgentToken>}
2578
+ * @throws {BadRequestException} 400
2579
+ * @throws {NotFoundException} 404
2580
+ */
2581
+ async mintToken(options) {
2582
+ const { data } = await this.workos.post(`/agents/blueprints/${encodeURIComponent(options.agentBlueprintId)}/tokens`, serializeMintAgentTokenOptions(options));
2583
+ return deserializeAgentToken(data);
2584
+ }
2585
+ /**
2586
+ * List agent instances
2587
+ *
2588
+ * Lists the agent instances in the current environment, optionally filtered
2589
+ * by organization or agent blueprint.
2590
+ *
2591
+ * @param options - Pagination and filter options.
2592
+ * @returns {Promise<AutoPaginatable<AgentInstance, SerializedListAgentInstancesOptions>>}
2593
+ */
2594
+ async listInstances(options) {
2595
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/agents/instances", deserializeAgentInstance, options ? serializeListAgentInstancesOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, "/agents/instances", deserializeAgentInstance, params), options ? serializeListAgentInstancesOptions(options) : void 0);
2596
+ }
2597
+ /**
2598
+ * Get an agent instance
2599
+ *
2600
+ * Retrieves an agent instance by ID.
2601
+ * @param agentInstanceId - Unique identifier of the agent instance.
2602
+ *
2603
+ * @example
2604
+ * "agent_instance_01EHWNCE74X7JSDV0X3SZ3KJNY"
2605
+ *
2606
+ * @returns {Promise<AgentInstance>}
2607
+ * @throws {NotFoundException} 404
2608
+ */
2609
+ async getInstance(agentInstanceId) {
2610
+ const { data } = await this.workos.get(`/agents/instances/${encodeURIComponent(agentInstanceId)}`);
2611
+ return deserializeAgentInstance(data);
2612
+ }
2613
+ /**
2614
+ * Delete an agent instance
2615
+ *
2616
+ * Deletes an agent instance by ID.
2617
+ * @param agentInstanceId - Unique identifier of the agent instance.
2618
+ *
2619
+ * @example
2620
+ * "agent_instance_01EHWNCE74X7JSDV0X3SZ3KJNY"
2621
+ *
2622
+ * @returns {Promise<void>}
2623
+ * @throws {NotFoundException} 404
2624
+ */
2625
+ async deleteInstance(agentInstanceId) {
2626
+ await this.workos.delete(`/agents/instances/${encodeURIComponent(agentInstanceId)}`);
2627
+ }
2628
+ /**
2629
+ * List agent instance sessions
2630
+ *
2631
+ * Lists the agent instance sessions in the current environment, optionally
2632
+ * filtered by agent blueprint or agent instance.
2633
+ *
2634
+ * @param options - Pagination and filter options.
2635
+ * @returns {Promise<AutoPaginatable<AgentInstanceSession, SerializedListAgentInstanceSessionsOptions>>}
2636
+ */
2637
+ async listInstanceSessions(options) {
2638
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/agents/sessions", deserializeAgentInstanceSession, options ? serializeListAgentInstanceSessionsOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, "/agents/sessions", deserializeAgentInstanceSession, params), options ? serializeListAgentInstanceSessionsOptions(options) : void 0);
2639
+ }
2640
+ /**
2641
+ * Get an agent instance session
2642
+ *
2643
+ * Retrieves an agent instance session by ID.
2644
+ * @param agentInstanceSessionId - Unique identifier of the agent instance session.
2645
+ *
2646
+ * @example
2647
+ * "agent_instance_session_01EHWNCE74X7JSDV0X3SZ3KJNY"
2648
+ *
2649
+ * @returns {Promise<AgentInstanceSession>}
2650
+ * @throws {NotFoundException} 404
2651
+ */
2652
+ async getInstanceSession(agentInstanceSessionId) {
2653
+ const { data } = await this.workos.get(`/agents/sessions/${encodeURIComponent(agentInstanceSessionId)}`);
2654
+ return deserializeAgentInstanceSession(data);
2655
+ }
2656
+ /**
2657
+ * Revoke an agent instance session
2658
+ *
2659
+ * Revokes an agent instance session by ID, invalidating its tokens.
2660
+ * @param agentInstanceSessionId - Unique identifier of the agent instance session.
2661
+ *
2662
+ * @example
2663
+ * "agent_instance_session_01EHWNCE74X7JSDV0X3SZ3KJNY"
2664
+ *
2665
+ * @returns {Promise<AgentInstanceSession>}
2666
+ * @throws {NotFoundException} 404
2667
+ */
2668
+ async revokeInstanceSession(agentInstanceSessionId) {
2669
+ const { data } = await this.workos.post(`/agents/sessions/${encodeURIComponent(agentInstanceSessionId)}/revoke`, {});
2670
+ return deserializeAgentInstanceSession(data);
2671
+ }
2672
+ /**
2293
2673
  * Link a claim attempt to an external user
2294
2674
  *
2295
2675
  * Link an external user to a claim attempt and retrieve the code needed
@@ -2469,7 +2849,7 @@ var ApiKeys = class {
2469
2849
  * @throws {NotFoundException} 404
2470
2850
  */
2471
2851
  async deleteApiKey(id) {
2472
- await this.workos.delete(`/api_keys/${id}`);
2852
+ await this.workos.delete(`/api_keys/${encodeURIComponent(id)}`);
2473
2853
  }
2474
2854
  /**
2475
2855
  * List API keys for an organization
@@ -2486,7 +2866,7 @@ var ApiKeys = class {
2486
2866
  */
2487
2867
  async listOrganizationApiKeys(options) {
2488
2868
  const { organizationId, ...paginationOptions } = options;
2489
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/organizations/${organizationId}/api_keys`, deserializeApiKey, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/organizations/${organizationId}/api_keys`, deserializeApiKey, params), paginationOptions);
2869
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/organizations/${encodeURIComponent(organizationId)}/api_keys`, deserializeApiKey, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/organizations/${encodeURIComponent(organizationId)}/api_keys`, deserializeApiKey, params), paginationOptions);
2490
2870
  }
2491
2871
  /**
2492
2872
  * Create an API key for an organization
@@ -2504,7 +2884,7 @@ var ApiKeys = class {
2504
2884
  */
2505
2885
  async createOrganizationApiKey(options, requestOptions = {}) {
2506
2886
  const { organizationId } = options;
2507
- const { data } = await this.workos.post(`/organizations/${organizationId}/api_keys`, serializeCreateOrganizationApiKeyOptions(options), requestOptions);
2887
+ const { data } = await this.workos.post(`/organizations/${encodeURIComponent(organizationId)}/api_keys`, serializeCreateOrganizationApiKeyOptions(options), requestOptions);
2508
2888
  return deserializeCreatedApiKey(data);
2509
2889
  }
2510
2890
  };
@@ -2861,6 +3241,43 @@ var Connect = class {
2861
3241
  }
2862
3242
  };
2863
3243
  //#endregion
3244
+ //#region src/common/utils/encode-path-parameter.ts
3245
+ /**
3246
+ * Encode a caller-supplied identifier for safe interpolation into a single URL
3247
+ * path segment.
3248
+ *
3249
+ * SDK path templates interpolate caller-supplied identifiers (user IDs,
3250
+ * invitation tokens, MFA factor IDs, organization IDs, external IDs, role and
3251
+ * permission slugs, ...) into the request path. Without encoding, a value such
3252
+ * as `../../user_management/users/user_01ABC` would be resolved by the WHATWG
3253
+ * `URL` parser (see `HttpClient.getResourceURL`) into a different API path,
3254
+ * letting an attacker who influences one identifier retarget the request to an
3255
+ * arbitrary same-verb endpoint. `encodeURIComponent` neutralizes this by
3256
+ * percent-encoding the path/query/fragment metacharacters (`/`, `?`, `#`, ...)
3257
+ * that enable the injection, keeping one parameter mapped to exactly one path
3258
+ * segment.
3259
+ *
3260
+ * `encodeURIComponent` alone is not sufficient for the two dot-only segments
3261
+ * `.` and `..`: it leaves them unchanged, and the WHATWG `URL` parser then
3262
+ * removes them as relative path segments (even when a value like `..` is a
3263
+ * single segment, a template such as `/feature-flags/${slug}/enable` supplies
3264
+ * the trailing segment, so `..` still climbs and retargets the request).
3265
+ * Percent-encoding the dots does not help because the parser also treats the
3266
+ * `%2e` forms as dot segments. A `.` or `..` is never a valid WorkOS
3267
+ * identifier, so we fail closed and throw rather than emit an ambiguous path.
3268
+ *
3269
+ * The one deviation from `encodeURIComponent` is that a literal `:` is kept
3270
+ * unescaped. Colons are valid path-segment characters (RFC 3986 `pchar`) and
3271
+ * are used by WorkOS RBAC slugs (e.g. `users:read`); an interpolated value is
3272
+ * always preceded by a `/`-delimited segment, so a `:` can never be read as a
3273
+ * URL scheme. Preserving it keeps the wire format identical for existing slugs.
3274
+ */
3275
+ function encodePathParameter(value) {
3276
+ const encoded = encodeURIComponent(value).replace(/%3A/gi, ":");
3277
+ if (encoded === "." || encoded === "..") throw new TypeError("Invalid path parameter: a path parameter must not be \".\" or \"..\".");
3278
+ return encoded;
3279
+ }
3280
+ //#endregion
2864
3281
  //#region src/directory-sync/directory-sync.ts
2865
3282
  var DirectorySync = class {
2866
3283
  workos;
@@ -2893,7 +3310,7 @@ var DirectorySync = class {
2893
3310
  * @throws {NotFoundException} 404
2894
3311
  */
2895
3312
  async getDirectory(id) {
2896
- const { data } = await this.workos.get(`/directories/${id}`);
3313
+ const { data } = await this.workos.get(`/directories/${encodePathParameter(id)}`);
2897
3314
  return deserializeDirectory(data);
2898
3315
  }
2899
3316
  /**
@@ -2909,7 +3326,7 @@ var DirectorySync = class {
2909
3326
  * @throws 403 response from the API.
2910
3327
  */
2911
3328
  async deleteDirectory(id) {
2912
- await this.workos.delete(`/directories/${id}`);
3329
+ await this.workos.delete(`/directories/${encodePathParameter(id)}`);
2913
3330
  }
2914
3331
  /**
2915
3332
  * List Directory Groups
@@ -2951,7 +3368,7 @@ var DirectorySync = class {
2951
3368
  * @throws {NotFoundException} 404
2952
3369
  */
2953
3370
  async getUser(user) {
2954
- const { data } = await this.workos.get(`/directory_users/${user}`);
3371
+ const { data } = await this.workos.get(`/directory_users/${encodePathParameter(user)}`);
2955
3372
  return deserializeDirectoryUserWithGroups(data);
2956
3373
  }
2957
3374
  /**
@@ -2967,7 +3384,7 @@ var DirectorySync = class {
2967
3384
  * @throws {NotFoundException} 404
2968
3385
  */
2969
3386
  async getGroup(group) {
2970
- const { data } = await this.workos.get(`/directory_groups/${group}`);
3387
+ const { data } = await this.workos.get(`/directory_groups/${encodePathParameter(group)}`);
2971
3388
  return deserializeDirectoryGroup(data);
2972
3389
  }
2973
3390
  };
@@ -3048,7 +3465,7 @@ var Organizations = class {
3048
3465
  * @throws 403 response from the API.
3049
3466
  */
3050
3467
  async deleteOrganization(id) {
3051
- await this.workos.delete(`/organizations/${id}`);
3468
+ await this.workos.delete(`/organizations/${encodePathParameter(id)}`);
3052
3469
  }
3053
3470
  /**
3054
3471
  * Get an Organization
@@ -3063,7 +3480,7 @@ var Organizations = class {
3063
3480
  * @throws {NotFoundException} 404
3064
3481
  */
3065
3482
  async getOrganization(id) {
3066
- const { data } = await this.workos.get(`/organizations/${id}`);
3483
+ const { data } = await this.workos.get(`/organizations/${encodePathParameter(id)}`);
3067
3484
  return deserializeOrganization(data);
3068
3485
  }
3069
3486
  /**
@@ -3079,7 +3496,7 @@ var Organizations = class {
3079
3496
  * @throws {NotFoundException} 404
3080
3497
  */
3081
3498
  async getOrganizationByExternalId(externalId) {
3082
- const { data } = await this.workos.get(`/organizations/external_id/${externalId}`);
3499
+ const { data } = await this.workos.get(`/organizations/external_id/${encodePathParameter(externalId)}`);
3083
3500
  return deserializeOrganization(data);
3084
3501
  }
3085
3502
  /**
@@ -3096,7 +3513,7 @@ var Organizations = class {
3096
3513
  */
3097
3514
  async updateOrganization(options) {
3098
3515
  const { organization: organizationId, ...payload } = options;
3099
- const { data } = await this.workos.put(`/organizations/${organizationId}`, serializeUpdateOrganizationOptions(payload));
3516
+ const { data } = await this.workos.put(`/organizations/${encodePathParameter(organizationId)}`, serializeUpdateOrganizationOptions(payload));
3100
3517
  return deserializeOrganization(data);
3101
3518
  }
3102
3519
  /**
@@ -3110,7 +3527,7 @@ var Organizations = class {
3110
3527
  */
3111
3528
  async listItContacts(options) {
3112
3529
  const { organizationId } = options;
3113
- const { data } = await this.workos.get(`/organizations/${organizationId}/it_contacts`);
3530
+ const { data } = await this.workos.get(`/organizations/${encodePathParameter(organizationId)}/it_contacts`);
3114
3531
  return {
3115
3532
  object: data.object,
3116
3533
  data: data.data.map(deserializeItContact),
@@ -3135,7 +3552,7 @@ var Organizations = class {
3135
3552
  */
3136
3553
  async createItContact(options) {
3137
3554
  const { organizationId, ...payload } = options;
3138
- const { data } = await this.workos.post(`/organizations/${organizationId}/it_contacts`, serializeCreateItContactOptions(payload));
3555
+ const { data } = await this.workos.post(`/organizations/${encodePathParameter(organizationId)}/it_contacts`, serializeCreateItContactOptions(payload));
3139
3556
  return deserializeItContact(data);
3140
3557
  }
3141
3558
  /**
@@ -3150,7 +3567,7 @@ var Organizations = class {
3150
3567
  */
3151
3568
  async deleteItContact(options) {
3152
3569
  const { organizationId, contactId } = options;
3153
- await this.workos.delete(`/organizations/${organizationId}/it_contacts/${contactId}`);
3570
+ await this.workos.delete(`/organizations/${encodePathParameter(organizationId)}/it_contacts/${encodePathParameter(contactId)}`);
3154
3571
  }
3155
3572
  /**
3156
3573
  * Invite an IT Contact
@@ -3166,7 +3583,7 @@ var Organizations = class {
3166
3583
  */
3167
3584
  async inviteItContact(options) {
3168
3585
  const { organizationId, contactId, ...payload } = options;
3169
- await this.workos.post(`/organizations/${organizationId}/it_contacts/${contactId}/invite`, serializeInviteItContactOptions(payload));
3586
+ await this.workos.post(`/organizations/${encodePathParameter(organizationId)}/it_contacts/${encodePathParameter(contactId)}/invite`, serializeInviteItContactOptions(payload));
3170
3587
  }
3171
3588
  /**
3172
3589
  * Revoke an IT Contact's invitation
@@ -3179,7 +3596,7 @@ var Organizations = class {
3179
3596
  */
3180
3597
  async revokeItContact(options) {
3181
3598
  const { organizationId, contactId } = options;
3182
- await this.workos.post(`/organizations/${organizationId}/it_contacts/${contactId}/revoke`, {});
3599
+ await this.workos.post(`/organizations/${encodePathParameter(organizationId)}/it_contacts/${encodePathParameter(contactId)}/revoke`, {});
3183
3600
  }
3184
3601
  };
3185
3602
  //#endregion
@@ -3208,7 +3625,7 @@ var OrganizationDomains = class {
3208
3625
  * @throws {NotFoundException} 404
3209
3626
  */
3210
3627
  async getOrganizationDomain(id) {
3211
- const { data } = await this.workos.get(`/organization_domains/${id}`);
3628
+ const { data } = await this.workos.get(`/organization_domains/${encodePathParameter(id)}`);
3212
3629
  return deserializeOrganizationDomain(data);
3213
3630
  }
3214
3631
  /**
@@ -3224,7 +3641,7 @@ var OrganizationDomains = class {
3224
3641
  * @throws {BadRequestException} 400
3225
3642
  */
3226
3643
  async verifyOrganizationDomain(id) {
3227
- const { data } = await this.workos.post(`/organization_domains/${id}/verify`, {});
3644
+ const { data } = await this.workos.post(`/organization_domains/${encodePathParameter(id)}/verify`, {});
3228
3645
  return deserializeOrganizationDomain(data);
3229
3646
  }
3230
3647
  /**
@@ -3252,7 +3669,7 @@ var OrganizationDomains = class {
3252
3669
  * @throws {NotFoundException} 404
3253
3670
  */
3254
3671
  async deleteOrganizationDomain(id) {
3255
- await this.workos.delete(`/organization_domains/${id}`);
3672
+ await this.workos.delete(`/organization_domains/${encodePathParameter(id)}`);
3256
3673
  }
3257
3674
  };
3258
3675
  //#endregion
@@ -3280,7 +3697,7 @@ var Passwordless = class {
3280
3697
  return deserializePasswordlessSession(data);
3281
3698
  }
3282
3699
  async sendSession(sessionId) {
3283
- const { data } = await this.workos.post(`/passwordless/sessions/${sessionId}/send`, {});
3700
+ const { data } = await this.workos.post(`/passwordless/sessions/${encodePathParameter(sessionId)}/send`, {});
3284
3701
  return data;
3285
3702
  }
3286
3703
  };
@@ -4042,7 +4459,7 @@ var SSO = class {
4042
4459
  * @throws {NotFoundException} 404
4043
4460
  */
4044
4461
  async deleteConnection(id) {
4045
- await this.workos.delete(`/connections/${id}`);
4462
+ await this.workos.delete(`/connections/${encodePathParameter(id)}`);
4046
4463
  }
4047
4464
  getAuthorizationUrl(options) {
4048
4465
  const { codeChallenge, codeChallengeMethod, connection, clientId, domainHint, loginHint, organization, provider, providerQueryParams, providerScopes, redirectUri, state } = options;
@@ -4128,7 +4545,7 @@ var SSO = class {
4128
4545
  * @throws {NotFoundException} 404
4129
4546
  */
4130
4547
  async getConnection(id) {
4131
- const { data } = await this.workos.get(`/connections/${id}`);
4548
+ const { data } = await this.workos.get(`/connections/${encodePathParameter(id)}`);
4132
4549
  return deserializeConnection(data);
4133
4550
  }
4134
4551
  /**
@@ -4229,7 +4646,7 @@ var MultiFactorAuth = class {
4229
4646
  * @throws {NotFoundException} 404
4230
4647
  */
4231
4648
  async deleteFactor(id) {
4232
- await this.workos.delete(`/auth/factors/${id}`);
4649
+ await this.workos.delete(`/auth/factors/${encodePathParameter(id)}`);
4233
4650
  }
4234
4651
  /**
4235
4652
  * Get Factor
@@ -4244,7 +4661,7 @@ var MultiFactorAuth = class {
4244
4661
  * @throws {NotFoundException} 404
4245
4662
  */
4246
4663
  async getFactor(id) {
4247
- const { data } = await this.workos.get(`/auth/factors/${id}`);
4664
+ const { data } = await this.workos.get(`/auth/factors/${encodePathParameter(id)}`);
4248
4665
  return deserializeFactor(data);
4249
4666
  }
4250
4667
  /**
@@ -4281,7 +4698,7 @@ var MultiFactorAuth = class {
4281
4698
  * @throws {UnprocessableEntityException} 422
4282
4699
  */
4283
4700
  async challengeFactor(options) {
4284
- const { data } = await this.workos.post(`/auth/factors/${options.authenticationFactorId}/challenge`, { sms_template: "smsTemplate" in options ? options.smsTemplate : void 0 });
4701
+ const { data } = await this.workos.post(`/auth/factors/${encodePathParameter(options.authenticationFactorId)}/challenge`, { sms_template: "smsTemplate" in options ? options.smsTemplate : void 0 });
4285
4702
  return deserializeChallenge(data);
4286
4703
  }
4287
4704
  /**
@@ -4295,7 +4712,7 @@ var MultiFactorAuth = class {
4295
4712
  * @throws {UnprocessableEntityException} 422
4296
4713
  */
4297
4714
  async verifyChallenge(options) {
4298
- const { data } = await this.workos.post(`/auth/challenges/${options.authenticationChallengeId}/verify`, { code: options.code });
4715
+ const { data } = await this.workos.post(`/auth/challenges/${encodePathParameter(options.authenticationChallengeId)}/verify`, { code: options.code });
4299
4716
  return deserializeVerifyResponse(data);
4300
4717
  }
4301
4718
  /**
@@ -4307,7 +4724,7 @@ var MultiFactorAuth = class {
4307
4724
  * @throws {UnprocessableEntityException} 422
4308
4725
  */
4309
4726
  async createUserAuthFactor(payload) {
4310
- const { data } = await this.workos.post(`/user_management/users/${payload.userId}/auth_factors`, serializeEnrollAuthFactorOptions(payload));
4727
+ const { data } = await this.workos.post(`/user_management/users/${encodePathParameter(payload.userId)}/auth_factors`, serializeEnrollAuthFactorOptions(payload));
4311
4728
  return {
4312
4729
  authenticationFactor: deserializeFactorWithSecrets$1(data.authentication_factor),
4313
4730
  authenticationChallenge: deserializeChallenge(data.authentication_challenge)
@@ -4323,7 +4740,7 @@ var MultiFactorAuth = class {
4323
4740
  */
4324
4741
  async listUserAuthFactors(options) {
4325
4742
  const { userId, ...restOfOptions } = options;
4326
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${userId}/auth_factors`, deserializeFactor$1, restOfOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${userId}/auth_factors`, deserializeFactor$1, params), restOfOptions);
4743
+ 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);
4327
4744
  }
4328
4745
  };
4329
4746
  //#endregion
@@ -4412,6 +4829,12 @@ const deserializeAuditLogSchema = (auditLogSchema) => ({
4412
4829
  createdAt: auditLogSchema.created_at
4413
4830
  });
4414
4831
  //#endregion
4832
+ //#region src/audit-logs/serializers/audit-logs-retention.serializer.ts
4833
+ const deserializeAuditLogsRetention = (response) => ({ retentionPeriodInDays: response.retention_period_in_days ?? null });
4834
+ //#endregion
4835
+ //#region src/audit-logs/serializers/update-audit-logs-retention.serializer.ts
4836
+ const serializeUpdateAuditLogsRetention = (model) => ({ retention_period: model.retentionPeriod });
4837
+ //#endregion
4415
4838
  //#region src/audit-logs/audit-logs.ts
4416
4839
  var AuditLogs = class {
4417
4840
  workos;
@@ -4419,6 +4842,39 @@ var AuditLogs = class {
4419
4842
  this.workos = workos;
4420
4843
  }
4421
4844
  /**
4845
+ * Get Retention
4846
+ *
4847
+ * Get the configured event retention period for the given Organization.
4848
+ * @param options - The request options.
4849
+ * @param options.id - Unique identifier of the Organization.
4850
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4851
+ * @returns {Promise<AuditLogsRetention>}
4852
+ * @throws {NotFoundException} 404
4853
+ */
4854
+ async getOrganizationAuditLogsRetention(options) {
4855
+ const { id } = options;
4856
+ const { data } = await this.workos.get(`/organizations/${encodeURIComponent(id)}/audit_logs_retention`);
4857
+ return deserializeAuditLogsRetention(data);
4858
+ }
4859
+ /**
4860
+ * Set Retention
4861
+ *
4862
+ * Set the event retention period for the given Organization.
4863
+ * @param options - Object containing retentionPeriod.
4864
+ * @param options.id - Unique identifier of the Organization.
4865
+ * @example "org_01EHZNVPK3SFK441A1RGBFSHRT"
4866
+ * @param options.retentionPeriod - The period Audit Log events will be retained. Valid values are `1_MONTH` through `11_MONTHS` in one-month increments and `1_YEAR` through `10_YEARS` in one-year increments.
4867
+ * @example "1_MONTH"
4868
+ * @returns {Promise<AuditLogsRetention>}
4869
+ * @throws {NotFoundException} 404
4870
+ * @throws {UnprocessableEntityException} 422
4871
+ */
4872
+ async updateOrganizationAuditLogsRetention(options) {
4873
+ const { id, ...payload } = options;
4874
+ const { data } = await this.workos.put(`/organizations/${encodeURIComponent(id)}/audit_logs_retention`, serializeUpdateAuditLogsRetention(payload));
4875
+ return deserializeAuditLogsRetention(data);
4876
+ }
4877
+ /**
4422
4878
  * Create Event
4423
4879
  *
4424
4880
  * Create an Audit Log Event.
@@ -4470,7 +4926,7 @@ var AuditLogs = class {
4470
4926
  * @throws {NotFoundException} 404
4471
4927
  */
4472
4928
  async getExport(auditLogExportId) {
4473
- const { data } = await this.workos.get(`/audit_logs/exports/${auditLogExportId}`);
4929
+ const { data } = await this.workos.get(`/audit_logs/exports/${encodePathParameter(auditLogExportId)}`);
4474
4930
  return deserializeAuditLogExport(data);
4475
4931
  }
4476
4932
  /**
@@ -4482,11 +4938,11 @@ var AuditLogs = class {
4482
4938
  * @throws {UnprocessableEntityException} 422
4483
4939
  */
4484
4940
  async createSchema(schema, options = {}) {
4485
- const { data } = await this.workos.post(`/audit_logs/actions/${schema.action}/schemas`, serializeCreateAuditLogSchemaOptions(schema), options);
4941
+ const { data } = await this.workos.post(`/audit_logs/actions/${encodePathParameter(schema.action)}/schemas`, serializeCreateAuditLogSchemaOptions(schema), options);
4486
4942
  return deserializeAuditLogSchema(data);
4487
4943
  }
4488
4944
  async listSchemas(action, options) {
4489
- const endpoint = `/audit_logs/actions/${action}/schemas`;
4945
+ const endpoint = `/audit_logs/actions/${encodePathParameter(action)}/schemas`;
4490
4946
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeAuditLogSchema, options), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeAuditLogSchema, params), options);
4491
4947
  }
4492
4948
  };
@@ -4958,6 +5414,23 @@ const serializeUpdateOrganizationMembershipOptions = (options) => ({
4958
5414
  role_slugs: options.roleSlugs
4959
5415
  });
4960
5416
  //#endregion
5417
+ //#region src/user-management/serializers/create-waitlist-entry-options.serializer.ts
5418
+ const serializeCreateWaitlistEntryOptions = (options) => ({
5419
+ email: options.email,
5420
+ additional_fields: options.additionalFields,
5421
+ send_confirmation_email: options.sendConfirmationEmail
5422
+ });
5423
+ //#endregion
5424
+ //#region src/user-management/serializers/list-waitlist-entries-options.serializer.ts
5425
+ const serializeListWaitlistEntriesOptions = (options) => ({
5426
+ state: options.state,
5427
+ email: options.email,
5428
+ limit: options.limit,
5429
+ before: options.before,
5430
+ after: options.after,
5431
+ order: options.order
5432
+ });
5433
+ //#endregion
4961
5434
  //#region src/user-management/session.ts
4962
5435
  var CookieSession = class {
4963
5436
  userManagement;
@@ -5048,8 +5521,8 @@ var CookieSession = class {
5048
5521
  permissions,
5049
5522
  entitlements,
5050
5523
  featureFlags,
5051
- user: session.user,
5052
- impersonator: session.impersonator
5524
+ user: authenticationResponse.user,
5525
+ impersonator: authenticationResponse.impersonator
5053
5526
  };
5054
5527
  } catch (error) {
5055
5528
  const terminalReason = classifyTerminalRefreshError(error);
@@ -5083,8 +5556,9 @@ var CookieSession = class {
5083
5556
  const { jwtVerify } = await getJose();
5084
5557
  const jwks = await this.userManagement.getJWKS();
5085
5558
  if (!jwks) throw new Error("Missing client ID. Did you provide it when initializing WorkOS?");
5559
+ const { issuer } = this.userManagement;
5086
5560
  try {
5087
- await jwtVerify(accessToken, jwks);
5561
+ await jwtVerify(accessToken, jwks, issuer ? { issuer } : void 0);
5088
5562
  return true;
5089
5563
  } catch (e) {
5090
5564
  if (e instanceof Error && "code" in e && typeof e.code === "string" && (e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_"))) return false;
@@ -5154,10 +5628,11 @@ var UserManagement = class {
5154
5628
  workos;
5155
5629
  _jwks;
5156
5630
  clientId;
5631
+ issuer;
5157
5632
  constructor(workos) {
5158
5633
  this.workos = workos;
5159
- const { clientId } = workos.options;
5160
- this.clientId = clientId;
5634
+ this.clientId = workos.clientId;
5635
+ this.issuer = workos.options.issuer;
5161
5636
  }
5162
5637
  /**
5163
5638
  * Resolve clientId from method options or fall back to constructor-provided value.
@@ -5194,7 +5669,7 @@ var UserManagement = class {
5194
5669
  * @throws {NotFoundException} 404
5195
5670
  */
5196
5671
  async getUser(userId) {
5197
- const { data } = await this.workos.get(`/user_management/users/${userId}`);
5672
+ const { data } = await this.workos.get(`/user_management/users/${encodePathParameter(userId)}`);
5198
5673
  return deserializeUser(data);
5199
5674
  }
5200
5675
  /**
@@ -5210,7 +5685,7 @@ var UserManagement = class {
5210
5685
  * @throws {NotFoundException} 404
5211
5686
  */
5212
5687
  async getUserByExternalId(externalId) {
5213
- const { data } = await this.workos.get(`/user_management/users/external_id/${externalId}`);
5688
+ const { data } = await this.workos.get(`/user_management/users/external_id/${encodePathParameter(externalId)}`);
5214
5689
  return deserializeUser(data);
5215
5690
  }
5216
5691
  /**
@@ -5459,7 +5934,7 @@ var UserManagement = class {
5459
5934
  const { jwtVerify } = await getJose();
5460
5935
  if (!jwks) throw new Error("Must provide clientId to initialize JWKS");
5461
5936
  try {
5462
- await jwtVerify(accessToken, jwks);
5937
+ await jwtVerify(accessToken, jwks, this.issuer ? { issuer: this.issuer } : void 0);
5463
5938
  return true;
5464
5939
  } catch (e) {
5465
5940
  if (e instanceof Error && "code" in e && typeof e.code === "string" && (e.code.startsWith("ERR_JWT_") || e.code.startsWith("ERR_JWS_"))) return false;
@@ -5504,7 +5979,7 @@ var UserManagement = class {
5504
5979
  * @throws {NotFoundException} 404
5505
5980
  */
5506
5981
  async getEmailVerification(emailVerificationId) {
5507
- const { data } = await this.workos.get(`/user_management/email_verification/${emailVerificationId}`);
5982
+ const { data } = await this.workos.get(`/user_management/email_verification/${encodePathParameter(emailVerificationId)}`);
5508
5983
  return deserializeEmailVerification(data);
5509
5984
  }
5510
5985
  /**
@@ -5517,7 +5992,7 @@ var UserManagement = class {
5517
5992
  * @throws {RateLimitExceededException} 429
5518
5993
  */
5519
5994
  async sendVerificationEmail({ userId }) {
5520
- const { data } = await this.workos.post(`/user_management/users/${userId}/email_verification/send`, {});
5995
+ const { data } = await this.workos.post(`/user_management/users/${encodePathParameter(userId)}/email_verification/send`, {});
5521
5996
  return { user: deserializeUser(data.user) };
5522
5997
  }
5523
5998
  /**
@@ -5528,7 +6003,7 @@ var UserManagement = class {
5528
6003
  * @throws {NotFoundException} 404
5529
6004
  */
5530
6005
  async getMagicAuth(magicAuthId) {
5531
- const { data } = await this.workos.get(`/user_management/magic_auth/${magicAuthId}`);
6006
+ const { data } = await this.workos.get(`/user_management/magic_auth/${encodePathParameter(magicAuthId)}`);
5532
6007
  return deserializeMagicAuth(data);
5533
6008
  }
5534
6009
  /**
@@ -5560,7 +6035,7 @@ var UserManagement = class {
5560
6035
  * @throws {UnprocessableEntityException} 422
5561
6036
  */
5562
6037
  async verifyEmail({ code, userId }) {
5563
- const { data } = await this.workos.post(`/user_management/users/${userId}/email_verification/confirm`, { code });
6038
+ const { data } = await this.workos.post(`/user_management/users/${encodePathParameter(userId)}/email_verification/confirm`, { code });
5564
6039
  return { user: deserializeUser(data.user) };
5565
6040
  }
5566
6041
  /**
@@ -5571,7 +6046,7 @@ var UserManagement = class {
5571
6046
  * @throws {NotFoundException} 404
5572
6047
  */
5573
6048
  async getPasswordReset(passwordResetId) {
5574
- const { data } = await this.workos.get(`/user_management/password_reset/${passwordResetId}`);
6049
+ const { data } = await this.workos.get(`/user_management/password_reset/${encodePathParameter(passwordResetId)}`);
5575
6050
  return deserializePasswordReset(data);
5576
6051
  }
5577
6052
  async createPasswordReset(options) {
@@ -5605,7 +6080,7 @@ var UserManagement = class {
5605
6080
  * @throws {UnprocessableEntityException} 422
5606
6081
  */
5607
6082
  async updateUser(payload) {
5608
- const { data } = await this.workos.put(`/user_management/users/${payload.userId}`, serializeUpdateUserOptions(payload));
6083
+ const { data } = await this.workos.put(`/user_management/users/${encodePathParameter(payload.userId)}`, serializeUpdateUserOptions(payload));
5609
6084
  return deserializeUser(data);
5610
6085
  }
5611
6086
  /**
@@ -5618,7 +6093,7 @@ var UserManagement = class {
5618
6093
  * @throws {UnprocessableEntityException} 422
5619
6094
  */
5620
6095
  async listSessions(userId, options) {
5621
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${userId}/sessions`, deserializeSession, options ? serializeListSessionsOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${userId}/sessions`, deserializeSession, params), options ? serializeListSessionsOptions(options) : void 0);
6096
+ 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);
5622
6097
  }
5623
6098
  /**
5624
6099
  * Delete a user
@@ -5628,7 +6103,7 @@ var UserManagement = class {
5628
6103
  * @throws {NotFoundException} 404
5629
6104
  */
5630
6105
  async deleteUser(userId) {
5631
- await this.workos.delete(`/user_management/users/${userId}`);
6106
+ await this.workos.delete(`/user_management/users/${encodePathParameter(userId)}`);
5632
6107
  }
5633
6108
  /**
5634
6109
  * List API keys for a user
@@ -5641,7 +6116,7 @@ var UserManagement = class {
5641
6116
  */
5642
6117
  async listUserApiKeys(userId, options) {
5643
6118
  const serializedOptions = options ? serializeListUserApiKeysOptions(options) : void 0;
5644
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${userId}/api_keys`, deserializeUserApiKey, serializedOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${userId}/api_keys`, deserializeUserApiKey, params), serializedOptions);
6119
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/api_keys`, deserializeUserApiKey, serializedOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/api_keys`, deserializeUserApiKey, params), serializedOptions);
5645
6120
  }
5646
6121
  /**
5647
6122
  * Create an API key for a user
@@ -5655,7 +6130,7 @@ var UserManagement = class {
5655
6130
  * @throws {UnprocessableEntityException} 422
5656
6131
  */
5657
6132
  async createUserApiKey(userId, options, requestOptions = {}) {
5658
- const { data } = await this.workos.post(`/user_management/users/${userId}/api_keys`, serializeCreateUserApiKeyOptions(options), requestOptions);
6133
+ const { data } = await this.workos.post(`/user_management/users/${encodePathParameter(userId)}/api_keys`, serializeCreateUserApiKeyOptions(options), requestOptions);
5659
6134
  return deserializeUserApiKeyWithValue(data);
5660
6135
  }
5661
6136
  /**
@@ -5667,7 +6142,7 @@ var UserManagement = class {
5667
6142
  */
5668
6143
  async getUserIdentities(userId) {
5669
6144
  if (!userId) throw new TypeError(`Incomplete arguments. Need to specify 'userId'.`);
5670
- const { data } = await this.workos.get(`/user_management/users/${userId}/identities`);
6145
+ const { data } = await this.workos.get(`/user_management/users/${encodePathParameter(userId)}/identities`);
5671
6146
  return deserializeIdentities(data);
5672
6147
  }
5673
6148
  /**
@@ -5678,7 +6153,7 @@ var UserManagement = class {
5678
6153
  * @throws {NotFoundException} 404
5679
6154
  */
5680
6155
  async getOrganizationMembership(organizationMembershipId) {
5681
- const { data } = await this.workos.get(`/user_management/organization_memberships/${organizationMembershipId}`);
6156
+ const { data } = await this.workos.get(`/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}`);
5682
6157
  return deserializeOrganizationMembership(data);
5683
6158
  }
5684
6159
  /**
@@ -5721,7 +6196,7 @@ var UserManagement = class {
5721
6196
  * @throws {UnprocessableEntityException} 422
5722
6197
  */
5723
6198
  async updateOrganizationMembership(organizationMembershipId, options) {
5724
- const { data } = await this.workos.put(`/user_management/organization_memberships/${organizationMembershipId}`, serializeUpdateOrganizationMembershipOptions(options));
6199
+ const { data } = await this.workos.put(`/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}`, serializeUpdateOrganizationMembershipOptions(options));
5725
6200
  return deserializeOrganizationMembership(data);
5726
6201
  }
5727
6202
  /**
@@ -5732,7 +6207,7 @@ var UserManagement = class {
5732
6207
  * @throws {NotFoundException} 404
5733
6208
  */
5734
6209
  async deleteOrganizationMembership(organizationMembershipId) {
5735
- await this.workos.delete(`/user_management/organization_memberships/${organizationMembershipId}`);
6210
+ await this.workos.delete(`/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}`);
5736
6211
  }
5737
6212
  /**
5738
6213
  * Deactivate an organization membership
@@ -5749,7 +6224,7 @@ var UserManagement = class {
5749
6224
  * @throws {UnprocessableEntityException} 422
5750
6225
  */
5751
6226
  async deactivateOrganizationMembership(organizationMembershipId) {
5752
- const { data } = await this.workos.put(`/user_management/organization_memberships/${organizationMembershipId}/deactivate`, {});
6227
+ const { data } = await this.workos.put(`/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}/deactivate`, {});
5753
6228
  return deserializeOrganizationMembership(data);
5754
6229
  }
5755
6230
  /**
@@ -5767,16 +6242,16 @@ var UserManagement = class {
5767
6242
  * @throws {UnprocessableEntityException} 422
5768
6243
  */
5769
6244
  async reactivateOrganizationMembership(organizationMembershipId) {
5770
- const { data } = await this.workos.put(`/user_management/organization_memberships/${organizationMembershipId}/reactivate`, {});
6245
+ const { data } = await this.workos.put(`/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}/reactivate`, {});
5771
6246
  return deserializeOrganizationMembership(data);
5772
6247
  }
5773
6248
  async listGroupsForOrganizationMembership(options) {
5774
6249
  const { organizationMembershipId, ...paginationOptions } = options;
5775
- const endpoint = `/user_management/organization_memberships/${organizationMembershipId}/groups`;
6250
+ const endpoint = `/user_management/organization_memberships/${encodePathParameter(organizationMembershipId)}/groups`;
5776
6251
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeGroup, paginationOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeGroup, params), paginationOptions);
5777
6252
  }
5778
6253
  async getInvitation(invitationId) {
5779
- const { data } = await this.workos.get(`/user_management/invitations/${invitationId}`);
6254
+ const { data } = await this.workos.get(`/user_management/invitations/${encodePathParameter(invitationId)}`);
5780
6255
  return deserializeInvitation(data);
5781
6256
  }
5782
6257
  /**
@@ -5787,7 +6262,7 @@ var UserManagement = class {
5787
6262
  * @throws {NotFoundException} 404
5788
6263
  */
5789
6264
  async findInvitationByToken(invitationToken) {
5790
- const { data } = await this.workos.get(`/user_management/invitations/by_token/${invitationToken}`);
6265
+ const { data } = await this.workos.get(`/user_management/invitations/by_token/${encodePathParameter(invitationToken)}`);
5791
6266
  return deserializeInvitation(data);
5792
6267
  }
5793
6268
  /**
@@ -5824,7 +6299,7 @@ var UserManagement = class {
5824
6299
  * @throws {NotFoundException} 404
5825
6300
  */
5826
6301
  async acceptInvitation(invitationId) {
5827
- const { data } = await this.workos.post(`/user_management/invitations/${invitationId}/accept`, null);
6302
+ const { data } = await this.workos.post(`/user_management/invitations/${encodePathParameter(invitationId)}/accept`, null);
5828
6303
  return deserializeInvitation(data);
5829
6304
  }
5830
6305
  /**
@@ -5835,7 +6310,7 @@ var UserManagement = class {
5835
6310
  * @throws {BadRequestException} 400
5836
6311
  */
5837
6312
  async revokeInvitation(invitationId) {
5838
- const { data } = await this.workos.post(`/user_management/invitations/${invitationId}/revoke`, null);
6313
+ const { data } = await this.workos.post(`/user_management/invitations/${encodePathParameter(invitationId)}/revoke`, null);
5839
6314
  return deserializeInvitation(data);
5840
6315
  }
5841
6316
  /**
@@ -5849,10 +6324,102 @@ var UserManagement = class {
5849
6324
  * @throws {UnprocessableEntityException} 422
5850
6325
  */
5851
6326
  async resendInvitation(invitationId, options) {
5852
- const { data } = await this.workos.post(`/user_management/invitations/${invitationId}/resend`, options ? serializeResendInvitationOptions(options) : {});
6327
+ const { data } = await this.workos.post(`/user_management/invitations/${encodePathParameter(invitationId)}/resend`, options ? serializeResendInvitationOptions(options) : {});
5853
6328
  return deserializeInvitation(data);
5854
6329
  }
5855
6330
  /**
6331
+ * List waitlists
6332
+ *
6333
+ * Get a list of the waitlists in the environment. All waitlists are
6334
+ * returned in a single response — this endpoint is not paginated.
6335
+ * @returns {Promise<List<Waitlist>>}
6336
+ */
6337
+ async listWaitlists() {
6338
+ const { data } = await this.workos.get("/user_management/waitlists");
6339
+ return deserializeList(data, deserializeWaitlist);
6340
+ }
6341
+ /**
6342
+ * Get a waitlist
6343
+ *
6344
+ * Get the details of an existing waitlist. The literal id `default`
6345
+ * is accepted and resolves to the environment's default waitlist.
6346
+ * @returns {Promise<Waitlist>}
6347
+ * @throws {NotFoundException} 404
6348
+ */
6349
+ async getWaitlist(waitlistId) {
6350
+ const { data } = await this.workos.get(`/user_management/waitlists/${encodePathParameter(waitlistId)}`);
6351
+ return deserializeWaitlist(data);
6352
+ }
6353
+ /**
6354
+ * List waitlist entries
6355
+ *
6356
+ * Get a list of the entries on a waitlist matching the criteria specified.
6357
+ * The literal id `default` is accepted and resolves to the environment's
6358
+ * default waitlist.
6359
+ * @param waitlistId - The unique ID of the waitlist.
6360
+ * @param options - Pagination and filter options.
6361
+ * @returns {Promise<AutoPaginatable<WaitlistEntry, SerializedListWaitlistEntriesOptions>>}
6362
+ * @throws {NotFoundException} 404
6363
+ * @throws {UnprocessableEntityException} 422
6364
+ */
6365
+ async listWaitlistEntries(waitlistId, options) {
6366
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/waitlists/${encodePathParameter(waitlistId)}/entries`, deserializeWaitlistEntry, options ? serializeListWaitlistEntriesOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, `/user_management/waitlists/${encodePathParameter(waitlistId)}/entries`, deserializeWaitlistEntry, params), options ? serializeListWaitlistEntriesOptions(options) : void 0);
6367
+ }
6368
+ /**
6369
+ * Create a waitlist entry
6370
+ *
6371
+ * Add an email address to a waitlist. Adding an email address that is
6372
+ * already on the waitlist returns the existing entry unchanged. The
6373
+ * literal id `default` is accepted and resolves to the environment's
6374
+ * default waitlist.
6375
+ * @param waitlistId - The unique ID of the waitlist.
6376
+ * @param payload - Object containing email and optional fields.
6377
+ * @returns {Promise<WaitlistEntry>}
6378
+ * @throws {NotFoundException} 404
6379
+ * @throws {UnprocessableEntityException} 422
6380
+ */
6381
+ async createWaitlistEntry(waitlistId, payload) {
6382
+ const { data } = await this.workos.post(`/user_management/waitlists/${encodePathParameter(waitlistId)}/entries`, serializeCreateWaitlistEntryOptions(payload));
6383
+ return deserializeWaitlistEntry(data);
6384
+ }
6385
+ /**
6386
+ * Approve a waitlist entry
6387
+ *
6388
+ * Approve a waitlist entry, create an invitation for its email address,
6389
+ * and send the invitation email.
6390
+ * @returns {Promise<WaitlistEntry>}
6391
+ * @throws {NotFoundException} 404
6392
+ * @throws {UnprocessableEntityException} 422
6393
+ */
6394
+ async approveWaitlistEntry(waitlistEntryId) {
6395
+ const { data } = await this.workos.post(`/user_management/waitlist_entries/${encodePathParameter(waitlistEntryId)}/approve`, null);
6396
+ return deserializeWaitlistEntry(data);
6397
+ }
6398
+ /**
6399
+ * Deny a waitlist entry
6400
+ *
6401
+ * Deny a pending waitlist entry.
6402
+ * @returns {Promise<WaitlistEntry>}
6403
+ * @throws {NotFoundException} 404
6404
+ * @throws {UnprocessableEntityException} 422
6405
+ */
6406
+ async denyWaitlistEntry(waitlistEntryId) {
6407
+ const { data } = await this.workos.post(`/user_management/waitlist_entries/${encodePathParameter(waitlistEntryId)}/deny`, null);
6408
+ return deserializeWaitlistEntry(data);
6409
+ }
6410
+ /**
6411
+ * Delete a waitlist entry
6412
+ *
6413
+ * Remove the entry from the waitlist. Its email address can join again
6414
+ * unless a user with that email now exists in the environment. Deleting
6415
+ * the entry does not revoke an invitation created by approving it.
6416
+ * @returns {Promise<void>}
6417
+ * @throws {NotFoundException} 404
6418
+ */
6419
+ async deleteWaitlistEntry(waitlistEntryId) {
6420
+ await this.workos.delete(`/user_management/waitlist_entries/${encodePathParameter(waitlistEntryId)}`);
6421
+ }
6422
+ /**
5856
6423
  * Revoke Session
5857
6424
  *
5858
6425
  * Revoke a [user session](https://workos.com/docs/reference/authkit/session).
@@ -6393,7 +6960,7 @@ var FeatureFlags = class {
6393
6960
  * @throws {NotFoundException} 404
6394
6961
  */
6395
6962
  async getFeatureFlag(slug) {
6396
- const { data } = await this.workos.get(`/feature-flags/${slug}`);
6963
+ const { data } = await this.workos.get(`/feature-flags/${encodePathParameter(slug)}`);
6397
6964
  return deserializeFeatureFlag(data);
6398
6965
  }
6399
6966
  /**
@@ -6409,7 +6976,7 @@ var FeatureFlags = class {
6409
6976
  * @throws {NotFoundException} 404
6410
6977
  */
6411
6978
  async enableFeatureFlag(slug) {
6412
- const { data } = await this.workos.put(`/feature-flags/${slug}/enable`, {});
6979
+ const { data } = await this.workos.put(`/feature-flags/${encodePathParameter(slug)}/enable`, {});
6413
6980
  return deserializeFeatureFlag(data);
6414
6981
  }
6415
6982
  /**
@@ -6425,7 +6992,7 @@ var FeatureFlags = class {
6425
6992
  * @throws {NotFoundException} 404
6426
6993
  */
6427
6994
  async disableFeatureFlag(slug) {
6428
- const { data } = await this.workos.put(`/feature-flags/${slug}/disable`, {});
6995
+ const { data } = await this.workos.put(`/feature-flags/${encodePathParameter(slug)}/disable`, {});
6429
6996
  return deserializeFeatureFlag(data);
6430
6997
  }
6431
6998
  /**
@@ -6440,7 +7007,7 @@ var FeatureFlags = class {
6440
7007
  */
6441
7008
  async addFlagTarget(options) {
6442
7009
  const { slug, targetId } = options;
6443
- await this.workos.post(`/feature-flags/${slug}/targets/${targetId}`, {});
7010
+ await this.workos.post(`/feature-flags/${encodePathParameter(slug)}/targets/${encodePathParameter(targetId)}`, {});
6444
7011
  }
6445
7012
  /**
6446
7013
  * Remove a feature flag target
@@ -6454,7 +7021,7 @@ var FeatureFlags = class {
6454
7021
  */
6455
7022
  async removeFlagTarget(options) {
6456
7023
  const { slug, targetId } = options;
6457
- await this.workos.delete(`/feature-flags/${slug}/targets/${targetId}`);
7024
+ await this.workos.delete(`/feature-flags/${encodePathParameter(slug)}/targets/${encodePathParameter(targetId)}`);
6458
7025
  }
6459
7026
  /**
6460
7027
  * List enabled feature flags for an organization
@@ -6466,7 +7033,7 @@ var FeatureFlags = class {
6466
7033
  */
6467
7034
  async listOrganizationFeatureFlags(options) {
6468
7035
  const { organizationId, ...paginationOptions } = options;
6469
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/organizations/${organizationId}/feature-flags`, deserializeFeatureFlag, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/organizations/${organizationId}/feature-flags`, deserializeFeatureFlag, params), paginationOptions);
7036
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/organizations/${encodePathParameter(organizationId)}/feature-flags`, deserializeFeatureFlag, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/organizations/${encodePathParameter(organizationId)}/feature-flags`, deserializeFeatureFlag, params), paginationOptions);
6470
7037
  }
6471
7038
  /**
6472
7039
  * List enabled feature flags for a user
@@ -6477,7 +7044,7 @@ var FeatureFlags = class {
6477
7044
  */
6478
7045
  async listUserFeatureFlags(options) {
6479
7046
  const { userId, ...paginationOptions } = options;
6480
- return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${userId}/feature-flags`, deserializeFeatureFlag, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${userId}/feature-flags`, deserializeFeatureFlag, params), paginationOptions);
7047
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/feature-flags`, deserializeFeatureFlag, paginationOptions), (params) => fetchAndDeserialize(this.workos, `/user_management/users/${encodePathParameter(userId)}/feature-flags`, deserializeFeatureFlag, params), paginationOptions);
6481
7048
  }
6482
7049
  createRuntimeClient(options) {
6483
7050
  return new FeatureFlagsRuntimeClient(this.workos, options);
@@ -6966,7 +7533,7 @@ var Authorization = class {
6966
7533
  * @throws {NotFoundException} 404
6967
7534
  */
6968
7535
  async getEnvironmentRole(slug) {
6969
- const { data } = await this.workos.get(`/authorization/roles/${slug}`);
7536
+ const { data } = await this.workos.get(`/authorization/roles/${encodePathParameter(slug)}`);
6970
7537
  return deserializeEnvironmentRole(data);
6971
7538
  }
6972
7539
  /**
@@ -6986,7 +7553,7 @@ var Authorization = class {
6986
7553
  * @throws {UnprocessableEntityException} 422
6987
7554
  */
6988
7555
  async updateEnvironmentRole(slug, options) {
6989
- const { data } = await this.workos.patch(`/authorization/roles/${slug}`, serializeUpdateEnvironmentRoleOptions(options));
7556
+ const { data } = await this.workos.patch(`/authorization/roles/${encodePathParameter(slug)}`, serializeUpdateEnvironmentRoleOptions(options));
6990
7557
  return deserializeEnvironmentRole(data);
6991
7558
  }
6992
7559
  /**
@@ -7006,7 +7573,7 @@ var Authorization = class {
7006
7573
  * @throws {UnprocessableEntityException} 422
7007
7574
  */
7008
7575
  async setEnvironmentRolePermissions(slug, options) {
7009
- const { data } = await this.workos.put(`/authorization/roles/${slug}/permissions`, { permissions: options.permissions });
7576
+ const { data } = await this.workos.put(`/authorization/roles/${encodePathParameter(slug)}/permissions`, { permissions: options.permissions });
7010
7577
  return deserializeEnvironmentRole(data);
7011
7578
  }
7012
7579
  /**
@@ -7026,7 +7593,7 @@ var Authorization = class {
7026
7593
  * @throws {UnprocessableEntityException} 422
7027
7594
  */
7028
7595
  async addEnvironmentRolePermission(slug, options) {
7029
- const { data } = await this.workos.post(`/authorization/roles/${slug}/permissions`, { slug: options.permissionSlug });
7596
+ const { data } = await this.workos.post(`/authorization/roles/${encodePathParameter(slug)}/permissions`, { slug: options.permissionSlug });
7030
7597
  return deserializeEnvironmentRole(data);
7031
7598
  }
7032
7599
  /**
@@ -7047,7 +7614,7 @@ var Authorization = class {
7047
7614
  * @throws {UnprocessableEntityException} 422
7048
7615
  */
7049
7616
  async createOrganizationRole(organizationId, options) {
7050
- const { data } = await this.workos.post(`/authorization/organizations/${organizationId}/roles`, serializeCreateOrganizationRoleOptions(options));
7617
+ const { data } = await this.workos.post(`/authorization/organizations/${encodePathParameter(organizationId)}/roles`, serializeCreateOrganizationRoleOptions(options));
7051
7618
  return deserializeOrganizationRole(data);
7052
7619
  }
7053
7620
  /**
@@ -7064,7 +7631,7 @@ var Authorization = class {
7064
7631
  * @throws {NotFoundException} 404
7065
7632
  */
7066
7633
  async listOrganizationRoles(organizationId) {
7067
- const { data } = await this.workos.get(`/authorization/organizations/${organizationId}/roles`);
7634
+ const { data } = await this.workos.get(`/authorization/organizations/${encodePathParameter(organizationId)}/roles`);
7068
7635
  return {
7069
7636
  object: "list",
7070
7637
  data: data.data.map(deserializeRole)
@@ -7089,7 +7656,7 @@ var Authorization = class {
7089
7656
  * @throws {NotFoundException} 404
7090
7657
  */
7091
7658
  async getOrganizationRole(organizationId, slug) {
7092
- const { data } = await this.workos.get(`/authorization/organizations/${organizationId}/roles/${slug}`);
7659
+ const { data } = await this.workos.get(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}`);
7093
7660
  return deserializeRole(data);
7094
7661
  }
7095
7662
  /**
@@ -7114,7 +7681,7 @@ var Authorization = class {
7114
7681
  * @throws {UnprocessableEntityException} 422
7115
7682
  */
7116
7683
  async updateOrganizationRole(organizationId, slug, options) {
7117
- const { data } = await this.workos.patch(`/authorization/organizations/${organizationId}/roles/${slug}`, serializeUpdateOrganizationRoleOptions(options));
7684
+ const { data } = await this.workos.patch(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}`, serializeUpdateOrganizationRoleOptions(options));
7118
7685
  return deserializeOrganizationRole(data);
7119
7686
  }
7120
7687
  /**
@@ -7138,7 +7705,7 @@ var Authorization = class {
7138
7705
  * @throws {ConflictException} 409
7139
7706
  */
7140
7707
  async deleteOrganizationRole(organizationId, slug) {
7141
- await this.workos.delete(`/authorization/organizations/${organizationId}/roles/${slug}`);
7708
+ await this.workos.delete(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}`);
7142
7709
  }
7143
7710
  /**
7144
7711
  * Set permissions for a custom role
@@ -7161,7 +7728,7 @@ var Authorization = class {
7161
7728
  * @throws {UnprocessableEntityException} 422
7162
7729
  */
7163
7730
  async setOrganizationRolePermissions(organizationId, slug, options) {
7164
- const { data } = await this.workos.put(`/authorization/organizations/${organizationId}/roles/${slug}/permissions`, { permissions: options.permissions });
7731
+ const { data } = await this.workos.put(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}/permissions`, { permissions: options.permissions });
7165
7732
  return deserializeOrganizationRole(data);
7166
7733
  }
7167
7734
  /**
@@ -7186,7 +7753,7 @@ var Authorization = class {
7186
7753
  * @throws {UnprocessableEntityException} 422
7187
7754
  */
7188
7755
  async addOrganizationRolePermission(organizationId, slug, options) {
7189
- const { data } = await this.workos.post(`/authorization/organizations/${organizationId}/roles/${slug}/permissions`, { slug: options.permissionSlug });
7756
+ const { data } = await this.workos.post(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}/permissions`, { slug: options.permissionSlug });
7190
7757
  return deserializeOrganizationRole(data);
7191
7758
  }
7192
7759
  /**
@@ -7213,7 +7780,7 @@ var Authorization = class {
7213
7780
  * @throws {NotFoundException} 404
7214
7781
  */
7215
7782
  async removeOrganizationRolePermission(organizationId, slug, options) {
7216
- await this.workos.delete(`/authorization/organizations/${organizationId}/roles/${slug}/permissions/${options.permissionSlug}`);
7783
+ await this.workos.delete(`/authorization/organizations/${encodePathParameter(organizationId)}/roles/${encodePathParameter(slug)}/permissions/${encodePathParameter(options.permissionSlug)}`);
7217
7784
  }
7218
7785
  /**
7219
7786
  * Create a permission
@@ -7254,7 +7821,7 @@ var Authorization = class {
7254
7821
  * @throws {NotFoundException} 404
7255
7822
  */
7256
7823
  async getPermission(slug) {
7257
- const { data } = await this.workos.get(`/authorization/permissions/${slug}`);
7824
+ const { data } = await this.workos.get(`/authorization/permissions/${encodePathParameter(slug)}`);
7258
7825
  return deserializePermission(data);
7259
7826
  }
7260
7827
  /**
@@ -7273,7 +7840,7 @@ var Authorization = class {
7273
7840
  * @throws {UnprocessableEntityException} 422
7274
7841
  */
7275
7842
  async updatePermission(slug, options) {
7276
- const { data } = await this.workos.patch(`/authorization/permissions/${slug}`, serializeUpdatePermissionOptions(options));
7843
+ const { data } = await this.workos.patch(`/authorization/permissions/${encodePathParameter(slug)}`, serializeUpdatePermissionOptions(options));
7277
7844
  return deserializePermission(data);
7278
7845
  }
7279
7846
  /**
@@ -7290,7 +7857,7 @@ var Authorization = class {
7290
7857
  * @throws {NotFoundException} 404
7291
7858
  */
7292
7859
  async deletePermission(slug) {
7293
- await this.workos.delete(`/authorization/permissions/${slug}`);
7860
+ await this.workos.delete(`/authorization/permissions/${encodePathParameter(slug)}`);
7294
7861
  }
7295
7862
  /**
7296
7863
  * Get a resource
@@ -7307,7 +7874,7 @@ var Authorization = class {
7307
7874
  * @throws {UnprocessableEntityException} 422
7308
7875
  */
7309
7876
  async getResource(resourceId) {
7310
- const { data } = await this.workos.get(`/authorization/resources/${resourceId}`);
7877
+ const { data } = await this.workos.get(`/authorization/resources/${encodePathParameter(resourceId)}`);
7311
7878
  return deserializeAuthorizationResource(data);
7312
7879
  }
7313
7880
  /**
@@ -7339,7 +7906,7 @@ var Authorization = class {
7339
7906
  * @throws {UnprocessableEntityException} 422
7340
7907
  */
7341
7908
  async updateResource(options) {
7342
- const { data } = await this.workos.patch(`/authorization/resources/${options.resourceId}`, serializeUpdateResourceOptions(options));
7909
+ const { data } = await this.workos.patch(`/authorization/resources/${encodePathParameter(options.resourceId)}`, serializeUpdateResourceOptions(options));
7343
7910
  return deserializeAuthorizationResource(data);
7344
7911
  }
7345
7912
  /**
@@ -7358,7 +7925,7 @@ var Authorization = class {
7358
7925
  async deleteResource(options) {
7359
7926
  const { resourceId, cascadeDelete } = options;
7360
7927
  const query = cascadeDelete !== void 0 ? { cascade_delete: cascadeDelete.toString() } : void 0;
7361
- await this.workos.delete(`/authorization/resources/${resourceId}`, query);
7928
+ await this.workos.delete(`/authorization/resources/${encodePathParameter(resourceId)}`, query);
7362
7929
  }
7363
7930
  /**
7364
7931
  * List resources
@@ -7398,7 +7965,7 @@ var Authorization = class {
7398
7965
  */
7399
7966
  async getResourceByExternalId(options) {
7400
7967
  const { organizationId, resourceTypeSlug, externalId } = options;
7401
- const { data } = await this.workos.get(`/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}`);
7968
+ const { data } = await this.workos.get(`/authorization/organizations/${encodePathParameter(organizationId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}`);
7402
7969
  return deserializeAuthorizationResource(data);
7403
7970
  }
7404
7971
  /**
@@ -7430,7 +7997,7 @@ var Authorization = class {
7430
7997
  */
7431
7998
  async updateResourceByExternalId(options) {
7432
7999
  const { organizationId, resourceTypeSlug, externalId } = options;
7433
- const { data } = await this.workos.patch(`/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}`, serializeUpdateResourceByExternalIdOptions(options));
8000
+ const { data } = await this.workos.patch(`/authorization/organizations/${encodePathParameter(organizationId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}`, serializeUpdateResourceByExternalIdOptions(options));
7434
8001
  return deserializeAuthorizationResource(data);
7435
8002
  }
7436
8003
  /**
@@ -7462,7 +8029,7 @@ var Authorization = class {
7462
8029
  async deleteResourceByExternalId(options) {
7463
8030
  const { organizationId, resourceTypeSlug, externalId, cascadeDelete } = options;
7464
8031
  const query = cascadeDelete !== void 0 ? { cascade_delete: cascadeDelete.toString() } : void 0;
7465
- await this.workos.delete(`/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}`, query);
8032
+ await this.workos.delete(`/authorization/organizations/${encodePathParameter(organizationId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}`, query);
7466
8033
  }
7467
8034
  /**
7468
8035
  * Check authorization
@@ -7475,7 +8042,7 @@ var Authorization = class {
7475
8042
  * @throws {UnprocessableEntityException} 422
7476
8043
  */
7477
8044
  async check(options) {
7478
- const { data } = await this.workos.post(`/authorization/organization_memberships/${options.organizationMembershipId}/check`, serializeAuthorizationCheckOptions(options));
8045
+ const { data } = await this.workos.post(`/authorization/organization_memberships/${encodePathParameter(options.organizationMembershipId)}/check`, serializeAuthorizationCheckOptions(options));
7479
8046
  return data;
7480
8047
  }
7481
8048
  /**
@@ -7494,7 +8061,7 @@ var Authorization = class {
7494
8061
  */
7495
8062
  async listRoleAssignments(options) {
7496
8063
  const { organizationMembershipId, ...queryOptions } = options;
7497
- const endpoint = `/authorization/organization_memberships/${organizationMembershipId}/role_assignments`;
8064
+ const endpoint = `/authorization/organization_memberships/${encodePathParameter(organizationMembershipId)}/role_assignments`;
7498
8065
  const serializedOptions = serializeListRoleAssignmentsOptions(queryOptions);
7499
8066
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
7500
8067
  }
@@ -7514,7 +8081,7 @@ var Authorization = class {
7514
8081
  */
7515
8082
  async listRoleAssignmentsForResource(options) {
7516
8083
  const { resourceId, ...queryOptions } = options;
7517
- const endpoint = `/authorization/resources/${resourceId}/role_assignments`;
8084
+ const endpoint = `/authorization/resources/${encodePathParameter(resourceId)}/role_assignments`;
7518
8085
  const serializedOptions = serializeListRoleAssignmentsForResourceOptions(queryOptions);
7519
8086
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
7520
8087
  }
@@ -7544,7 +8111,7 @@ var Authorization = class {
7544
8111
  */
7545
8112
  async listResourceRoleAssignments(options) {
7546
8113
  const { organizationId, resourceTypeSlug, externalId, ...queryOptions } = options;
7547
- const endpoint = `/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}/role_assignments`;
8114
+ const endpoint = `/authorization/organizations/${encodePathParameter(organizationId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}/role_assignments`;
7548
8115
  const serializedOptions = serializeListRoleAssignmentsForResourceOptions(queryOptions);
7549
8116
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeRoleAssignment, params), serializedOptions);
7550
8117
  }
@@ -7559,7 +8126,7 @@ var Authorization = class {
7559
8126
  * @throws {UnprocessableEntityException} 422
7560
8127
  */
7561
8128
  async assignRole(options) {
7562
- const { data } = await this.workos.post(`/authorization/organization_memberships/${options.organizationMembershipId}/role_assignments`, serializeAssignRoleOptions(options));
8129
+ const { data } = await this.workos.post(`/authorization/organization_memberships/${encodePathParameter(options.organizationMembershipId)}/role_assignments`, serializeAssignRoleOptions(options));
7563
8130
  return deserializeRoleAssignment(data);
7564
8131
  }
7565
8132
  /**
@@ -7573,7 +8140,7 @@ var Authorization = class {
7573
8140
  * @throws {UnprocessableEntityException} 422
7574
8141
  */
7575
8142
  async removeRole(options) {
7576
- await this.workos.deleteWithBody(`/authorization/organization_memberships/${options.organizationMembershipId}/role_assignments`, serializeRemoveRoleOptions(options));
8143
+ await this.workos.deleteWithBody(`/authorization/organization_memberships/${encodePathParameter(options.organizationMembershipId)}/role_assignments`, serializeRemoveRoleOptions(options));
7577
8144
  }
7578
8145
  /**
7579
8146
  * Remove a role assignment by ID
@@ -7594,7 +8161,7 @@ var Authorization = class {
7594
8161
  * @throws {NotFoundException} 404
7595
8162
  */
7596
8163
  async removeRoleAssignment(options) {
7597
- await this.workos.delete(`/authorization/organization_memberships/${options.organizationMembershipId}/role_assignments/${options.roleAssignmentId}`);
8164
+ await this.workos.delete(`/authorization/organization_memberships/${encodePathParameter(options.organizationMembershipId)}/role_assignments/${encodePathParameter(options.roleAssignmentId)}`);
7598
8165
  }
7599
8166
  /**
7600
8167
  * List role assignments for a group
@@ -7612,7 +8179,7 @@ var Authorization = class {
7612
8179
  */
7613
8180
  async listGroupRoleAssignments(options) {
7614
8181
  const { groupId, ...paginationOptions } = options;
7615
- const endpoint = `/authorization/groups/${groupId}/role_assignments`;
8182
+ const endpoint = `/authorization/groups/${encodePathParameter(groupId)}/role_assignments`;
7616
8183
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeGroupRoleAssignment, paginationOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeGroupRoleAssignment, params), paginationOptions);
7617
8184
  }
7618
8185
  /**
@@ -7635,7 +8202,7 @@ var Authorization = class {
7635
8202
  * @throws {NotFoundException} 404
7636
8203
  */
7637
8204
  async getGroupRoleAssignment(options) {
7638
- const { data } = await this.workos.get(`/authorization/groups/${options.groupId}/role_assignments/${options.roleAssignmentId}`);
8205
+ const { data } = await this.workos.get(`/authorization/groups/${encodePathParameter(options.groupId)}/role_assignments/${encodePathParameter(options.roleAssignmentId)}`);
7639
8206
  return deserializeGroupRoleAssignment(data);
7640
8207
  }
7641
8208
  /**
@@ -7650,7 +8217,7 @@ var Authorization = class {
7650
8217
  * @throws {UnprocessableEntityException} 422
7651
8218
  */
7652
8219
  async createGroupRoleAssignment(options) {
7653
- const { data } = await this.workos.post(`/authorization/groups/${options.groupId}/role_assignments`, serializeCreateGroupRoleAssignmentOptions(options));
8220
+ const { data } = await this.workos.post(`/authorization/groups/${encodePathParameter(options.groupId)}/role_assignments`, serializeCreateGroupRoleAssignmentOptions(options));
7654
8221
  return deserializeGroupRoleAssignment(data);
7655
8222
  }
7656
8223
  /**
@@ -7673,7 +8240,7 @@ var Authorization = class {
7673
8240
  * @throws {NotFoundException} 404
7674
8241
  */
7675
8242
  async removeGroupRoleAssignment(options) {
7676
- await this.workos.delete(`/authorization/groups/${options.groupId}/role_assignments/${options.roleAssignmentId}`);
8243
+ await this.workos.delete(`/authorization/groups/${encodePathParameter(options.groupId)}/role_assignments/${encodePathParameter(options.roleAssignmentId)}`);
7677
8244
  }
7678
8245
  /**
7679
8246
  * Remove group role assignments by criteria
@@ -7686,7 +8253,7 @@ var Authorization = class {
7686
8253
  * @throws {UnprocessableEntityException} 422
7687
8254
  */
7688
8255
  async removeGroupRoleAssignments(options) {
7689
- await this.workos.deleteWithBody(`/authorization/groups/${options.groupId}/role_assignments`, serializeRemoveGroupRoleAssignmentsOptions(options));
8256
+ await this.workos.deleteWithBody(`/authorization/groups/${encodePathParameter(options.groupId)}/role_assignments`, serializeRemoveGroupRoleAssignmentsOptions(options));
7690
8257
  }
7691
8258
  /**
7692
8259
  * Replace role assignments for a group
@@ -7699,7 +8266,7 @@ var Authorization = class {
7699
8266
  * @throws {UnprocessableEntityException} 422
7700
8267
  */
7701
8268
  async replaceGroupRoleAssignments(options) {
7702
- const { data } = await this.workos.put(`/authorization/groups/${options.groupId}/role_assignments`, serializeReplaceGroupRoleAssignmentsOptions(options));
8269
+ const { data } = await this.workos.put(`/authorization/groups/${encodePathParameter(options.groupId)}/role_assignments`, serializeReplaceGroupRoleAssignmentsOptions(options));
7703
8270
  return deserializeList(data, deserializeGroupRoleAssignment);
7704
8271
  }
7705
8272
  /**
@@ -7722,7 +8289,7 @@ var Authorization = class {
7722
8289
  */
7723
8290
  async listResourcesForMembership(options) {
7724
8291
  const { organizationMembershipId } = options;
7725
- const endpoint = `/authorization/organization_memberships/${organizationMembershipId}/resources`;
8292
+ const endpoint = `/authorization/organization_memberships/${encodePathParameter(organizationMembershipId)}/resources`;
7726
8293
  const serializedOptions = serializeListResourcesForMembershipOptions(options);
7727
8294
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationResource, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationResource, params), serializedOptions);
7728
8295
  }
@@ -7739,7 +8306,7 @@ var Authorization = class {
7739
8306
  */
7740
8307
  async listMembershipsForResource(options) {
7741
8308
  const { resourceId } = options;
7742
- const endpoint = `/authorization/resources/${resourceId}/organization_memberships`;
8309
+ const endpoint = `/authorization/resources/${encodePathParameter(resourceId)}/organization_memberships`;
7743
8310
  const serializedOptions = serializeListMembershipsForResourceOptions(options);
7744
8311
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationOrganizationMembership, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationOrganizationMembership, params), serializedOptions);
7745
8312
  }
@@ -7771,7 +8338,7 @@ var Authorization = class {
7771
8338
  */
7772
8339
  async listMembershipsForResourceByExternalId(options) {
7773
8340
  const { organizationId, resourceTypeSlug, externalId } = options;
7774
- const endpoint = `/authorization/organizations/${organizationId}/resources/${resourceTypeSlug}/${externalId}/organization_memberships`;
8341
+ const endpoint = `/authorization/organizations/${encodePathParameter(organizationId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}/organization_memberships`;
7775
8342
  const serializedOptions = serializeListMembershipsForResourceOptions(options);
7776
8343
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationOrganizationMembership, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializeAuthorizationOrganizationMembership, params), serializedOptions);
7777
8344
  }
@@ -7797,7 +8364,7 @@ var Authorization = class {
7797
8364
  */
7798
8365
  async listEffectivePermissions(options) {
7799
8366
  const { organizationMembershipId, resourceId } = options;
7800
- const endpoint = `/authorization/resources/${resourceId}/organization_memberships/${organizationMembershipId}/permissions`;
8367
+ const endpoint = `/authorization/resources/${encodePathParameter(resourceId)}/organization_memberships/${encodePathParameter(organizationMembershipId)}/permissions`;
7801
8368
  const serializedOptions = serializeListEffectivePermissionsOptions(options);
7802
8369
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializePermission, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializePermission, params), serializedOptions);
7803
8370
  }
@@ -7813,7 +8380,7 @@ var Authorization = class {
7813
8380
  */
7814
8381
  async listEffectivePermissionsByExternalId(options) {
7815
8382
  const { organizationMembershipId, resourceTypeSlug, externalId } = options;
7816
- const endpoint = `/authorization/organization_memberships/${organizationMembershipId}/resources/${resourceTypeSlug}/${externalId}/permissions`;
8383
+ const endpoint = `/authorization/organization_memberships/${encodePathParameter(organizationMembershipId)}/resources/${encodePathParameter(resourceTypeSlug)}/${encodePathParameter(externalId)}/permissions`;
7817
8384
  const serializedOptions = serializeListEffectivePermissionsOptions(options);
7818
8385
  return new AutoPaginatable(await fetchAndDeserialize(this.workos, endpoint, deserializePermission, serializedOptions), (params) => fetchAndDeserialize(this.workos, endpoint, deserializePermission, params), serializedOptions);
7819
8386
  }
@@ -7829,6 +8396,8 @@ const CONTINUATION_BIT = 128;
7829
8396
  const DATA_BITS_MASK = 127;
7830
8397
  const DATA_BITS_PER_BYTE = 7;
7831
8398
  const MAX_BYTES_FOR_UINT32 = 5;
8399
+ const FINAL_BYTE_SHIFT = 28;
8400
+ const FINAL_BYTE_MAX_DATA = 15;
7832
8401
  /**
7833
8402
  * Encodes an unsigned 32-bit integer into LEB128 format.
7834
8403
  *
@@ -7864,6 +8433,7 @@ function decodeUInt32(data, offset = 0) {
7864
8433
  const byte = data[index++];
7865
8434
  bytesRead++;
7866
8435
  if (bytesRead > MAX_BYTES_FOR_UINT32) throw new Error("LEB128 sequence exceeds maximum length for uint32");
8436
+ if (shift === FINAL_BYTE_SHIFT && (byte & DATA_BITS_MASK) > FINAL_BYTE_MAX_DATA) throw new Error("LEB128 sequence exceeds uint32 range");
7867
8437
  result |= (byte & DATA_BITS_MASK) << shift;
7868
8438
  if (!hasContinuationBit(byte)) return {
7869
8439
  value: result >>> 0,
@@ -8270,7 +8840,7 @@ var Vault = class {
8270
8840
  };
8271
8841
  //#endregion
8272
8842
  //#region package.json
8273
- var version = "10.12.0";
8843
+ var version = "10.14.0";
8274
8844
  //#endregion
8275
8845
  //#region src/workos.ts
8276
8846
  const DEFAULT_HOSTNAME = "api.workos.com";
@@ -8406,7 +8976,7 @@ var WorkOS = class {
8406
8976
  });
8407
8977
  throw error;
8408
8978
  }
8409
- return { data: await res.toJSON() };
8979
+ return { data: await this.readResponseJSON(path, res) };
8410
8980
  }
8411
8981
  async get(path, options = {}) {
8412
8982
  if (!options.skipApiKeyCheck) this.requireApiKey(path);
@@ -8427,7 +8997,7 @@ var WorkOS = class {
8427
8997
  });
8428
8998
  throw error;
8429
8999
  }
8430
- return { data: await res.toJSON() };
9000
+ return { data: await this.readResponseJSON(path, res) };
8431
9001
  }
8432
9002
  async put(path, entity, options = {}) {
8433
9003
  if (!options.skipApiKeyCheck) this.requireApiKey(path);
@@ -8447,7 +9017,7 @@ var WorkOS = class {
8447
9017
  });
8448
9018
  throw error;
8449
9019
  }
8450
- return { data: await res.toJSON() };
9020
+ return { data: await this.readResponseJSON(path, res) };
8451
9021
  }
8452
9022
  async patch(path, entity, options = {}) {
8453
9023
  if (!options.skipApiKeyCheck) this.requireApiKey(path);
@@ -8467,7 +9037,7 @@ var WorkOS = class {
8467
9037
  });
8468
9038
  throw error;
8469
9039
  }
8470
- return { data: await res.toJSON() };
9040
+ return { data: await this.readResponseJSON(path, res) };
8471
9041
  }
8472
9042
  async delete(path, query) {
8473
9043
  this.requireApiKey(path);
@@ -8493,6 +9063,24 @@ var WorkOS = class {
8493
9063
  throw error;
8494
9064
  }
8495
9065
  }
9066
+ /**
9067
+ * Consume a successful response body. The request deadline covers the body,
9068
+ * so a stall while it is still streaming surfaces from the transport as a
9069
+ * 408 `HttpClientError` and is translated like a timeout before the headers.
9070
+ * Everything else (a `ParseError` for malformed JSON, a network failure
9071
+ * mid-body) propagates unchanged.
9072
+ */
9073
+ async readResponseJSON(path, response) {
9074
+ try {
9075
+ return await response.toJSON();
9076
+ } catch (error) {
9077
+ if (error instanceof HttpClientError) this.handleHttpError({
9078
+ path,
9079
+ error
9080
+ });
9081
+ throw error;
9082
+ }
9083
+ }
8496
9084
  emitWarning(warning) {
8497
9085
  console.warn(`WorkOS: ${warning}`);
8498
9086
  }
@@ -8542,6 +9130,31 @@ var WorkOS = class {
8542
9130
  }
8543
9131
  };
8544
9132
  //#endregion
9133
+ //#region src/audit-logs/interfaces/update-audit-logs-retention-retention-period.interface.ts
9134
+ const UpdateAuditLogsRetentionRetentionPeriod = {
9135
+ Value1Month: "1_MONTH",
9136
+ Value2Months: "2_MONTHS",
9137
+ Value3Months: "3_MONTHS",
9138
+ Value4Months: "4_MONTHS",
9139
+ Value5Months: "5_MONTHS",
9140
+ Value6Months: "6_MONTHS",
9141
+ Value7Months: "7_MONTHS",
9142
+ Value8Months: "8_MONTHS",
9143
+ Value9Months: "9_MONTHS",
9144
+ Value10Months: "10_MONTHS",
9145
+ Value11Months: "11_MONTHS",
9146
+ Value1Year: "1_YEAR",
9147
+ Value2Years: "2_YEARS",
9148
+ Value3Years: "3_YEARS",
9149
+ Value4Years: "4_YEARS",
9150
+ Value5Years: "5_YEARS",
9151
+ Value6Years: "6_YEARS",
9152
+ Value7Years: "7_YEARS",
9153
+ Value8Years: "8_YEARS",
9154
+ Value9Years: "9_YEARS",
9155
+ Value10Years: "10_YEARS"
9156
+ };
9157
+ //#endregion
8545
9158
  //#region src/common/interfaces/generate-link-intent.interface.ts
8546
9159
  const GenerateLinkIntent = {
8547
9160
  SSO: "sso",
@@ -8630,6 +9243,6 @@ function createWorkOS(options) {
8630
9243
  return new WorkOS(options);
8631
9244
  }
8632
9245
  //#endregion
8633
- export { ApiKeyRequiredException as A, NotFoundException as C, AuthenticationException as D, BadRequestException as E, SubtleCryptoProvider as M, isAuthenticationErrorData as O, OauthException as S, ConflictException as T, Actions as _, ItContactIntent as a, SignatureVerificationException as b, WorkOS as c, RefreshSessionFailureReason as d, serializeRevokeSessionOptions as f, AutoPaginatable as g, Webhooks as h, OrganizationDomainVerificationStrategy as i, FetchHttpClient as j, GenericServerException as k, FeatureFlagsRuntimeClient as l, PKCE as m, ConnectionType as n, DomainDataState as o, AuthenticateWithSessionCookieFailureReason as p, OrganizationDomainState as r, GenerateLinkIntent as s, createWorkOS as t, CookieSession as u, UnprocessableEntityException as v, NoApiKeyProvidedException as w, RateLimitExceededException as x, UnauthorizedException as y };
9246
+ export { GenericServerException as A, OauthException as C, BadRequestException as D, ConflictException as E, FetchHttpClient as M, SubtleCryptoProvider as N, AuthenticationException as O, RateLimitExceededException as S, NoApiKeyProvidedException as T, AutoPaginatable as _, ItContactIntent as a, UnauthorizedException as b, UpdateAuditLogsRetentionRetentionPeriod as c, CookieSession as d, RefreshSessionFailureReason as f, Webhooks as g, PKCE as h, OrganizationDomainVerificationStrategy as i, ApiKeyRequiredException as j, isAuthenticationErrorData as k, WorkOS as l, AuthenticateWithSessionCookieFailureReason as m, ConnectionType as n, DomainDataState as o, serializeRevokeSessionOptions as p, OrganizationDomainState as r, GenerateLinkIntent as s, createWorkOS as t, FeatureFlagsRuntimeClient as u, Actions as v, NotFoundException as w, SignatureVerificationException as x, UnprocessableEntityException as y };
8634
9247
 
8635
- //# sourceMappingURL=factory-AQv-AfDk.mjs.map
9248
+ //# sourceMappingURL=factory-Dqju-gCl.mjs.map