@workos-inc/node 10.11.0 → 10.13.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.
@@ -321,7 +321,7 @@ var FetchHttpClient = class FetchHttpClient extends HttpClient {
321
321
  message: `Request timeout after ${timeout}ms`,
322
322
  response: {
323
323
  status: 408,
324
- headers: {},
324
+ headers: new Headers(),
325
325
  data: { error: "Request timeout" }
326
326
  }
327
327
  });
@@ -610,10 +610,11 @@ var UnprocessableEntityException = class extends Error {
610
610
  message = "Unprocessable entity";
611
611
  code;
612
612
  requestID;
613
- constructor({ code, errors, message, requestID }) {
613
+ constructor({ code, error, errors, message, requestID }) {
614
614
  super();
615
615
  this.requestID = requestID;
616
616
  if (message) this.message = message;
617
+ else if (error) this.message = `Error: ${error}`;
617
618
  if (code) this.code = code;
618
619
  if (errors) {
619
620
  const requirement = errors.length === 1 ? "requirement" : "requirements";
@@ -1136,6 +1137,27 @@ function deserializeUserApiKeyWithValue(apiKey) {
1136
1137
  };
1137
1138
  }
1138
1139
  //#endregion
1140
+ //#region src/user-management/serializers/waitlist.serializer.ts
1141
+ const deserializeWaitlist = (waitlist) => ({
1142
+ object: waitlist.object,
1143
+ id: waitlist.id,
1144
+ createdAt: waitlist.created_at,
1145
+ updatedAt: waitlist.updated_at
1146
+ });
1147
+ //#endregion
1148
+ //#region src/user-management/serializers/waitlist-entry.serializer.ts
1149
+ const deserializeWaitlistEntry = (waitlistEntry) => ({
1150
+ object: waitlistEntry.object,
1151
+ id: waitlistEntry.id,
1152
+ email: waitlistEntry.email,
1153
+ state: waitlistEntry.state,
1154
+ approvedAt: waitlistEntry.approved_at,
1155
+ additionalFields: waitlistEntry.additional_fields,
1156
+ waitlistId: waitlistEntry.waitlist_id ?? null,
1157
+ createdAt: waitlistEntry.created_at,
1158
+ updatedAt: waitlistEntry.updated_at
1159
+ });
1160
+ //#endregion
1139
1161
  //#region src/user-management/serializers/organization-membership.serializer.ts
1140
1162
  const deserializeOrganizationMembership = (organizationMembership) => ({
1141
1163
  object: organizationMembership.object,
@@ -1411,6 +1433,19 @@ const serializeCreateOrganizationOptions = (options) => ({
1411
1433
  metadata: options.metadata
1412
1434
  });
1413
1435
  //#endregion
1436
+ //#region src/organizations/serializers/it-contact-options.serializer.ts
1437
+ const serializeCreateItContactOptions = (options) => ({ email: options.email });
1438
+ const serializeInviteItContactOptions = (options) => ({ intents: options.intents });
1439
+ //#endregion
1440
+ //#region src/organizations/serializers/it-contact.serializer.ts
1441
+ const deserializeItContact = (itContact) => ({
1442
+ object: itContact.object,
1443
+ id: itContact.id,
1444
+ email: itContact.email,
1445
+ createdAt: itContact.created_at,
1446
+ updatedAt: itContact.updated_at
1447
+ });
1448
+ //#endregion
1414
1449
  //#region src/organizations/serializers/update-organization-options.serializer.ts
1415
1450
  const serializeUpdateOrganizationOptions = (options) => ({
1416
1451
  name: options.name,
@@ -1659,6 +1694,30 @@ const deserializeOrganizationDomainVerificationFailed = (organizationDomainVerif
1659
1694
  });
1660
1695
  //#endregion
1661
1696
  //#region src/common/serializers/event.serializer.ts
1697
+ const deserializePipesConnectedAccount = (connectedAccount) => ({
1698
+ object: connectedAccount.object,
1699
+ id: connectedAccount.id,
1700
+ dataIntegrationId: connectedAccount.data_integration_id,
1701
+ providerSlug: connectedAccount.provider_slug,
1702
+ userId: connectedAccount.user_id,
1703
+ organizationId: connectedAccount.organization_id,
1704
+ scopes: connectedAccount.scopes,
1705
+ state: connectedAccount.state,
1706
+ createdAt: connectedAccount.created_at,
1707
+ updatedAt: connectedAccount.updated_at
1708
+ });
1709
+ const deserializePipesConnectionFailed = (connectionFailed) => ({
1710
+ object: connectionFailed.object,
1711
+ dataIntegrationId: connectionFailed.data_integration_id,
1712
+ providerSlug: connectionFailed.provider_slug,
1713
+ userId: connectionFailed.user_id,
1714
+ organizationId: connectionFailed.organization_id,
1715
+ errorCode: connectionFailed.error_code,
1716
+ errorReason: connectionFailed.error_reason,
1717
+ providerError: connectionFailed.provider_error,
1718
+ providerErrorDescription: connectionFailed.provider_error_description,
1719
+ createdAt: connectionFailed.created_at
1720
+ });
1662
1721
  const deserializeEvent = (event) => {
1663
1722
  const eventBase = {
1664
1723
  id: event.id,
@@ -1851,6 +1910,18 @@ const deserializeEvent = (event) => {
1851
1910
  organizationMembershipId: event.data.organization_membership_id
1852
1911
  }
1853
1912
  };
1913
+ case "pipes.connected_account.connected":
1914
+ case "pipes.connected_account.disconnected":
1915
+ case "pipes.connected_account.reauthorization_needed": return {
1916
+ ...eventBase,
1917
+ event: event.event,
1918
+ data: deserializePipesConnectedAccount(event.data)
1919
+ };
1920
+ case "pipes.connected_account.connection_failed": return {
1921
+ ...eventBase,
1922
+ event: event.event,
1923
+ data: deserializePipesConnectionFailed(event.data)
1924
+ };
1854
1925
  case "vault.data.created": return {
1855
1926
  ...eventBase,
1856
1927
  event: event.event,
@@ -2135,6 +2206,108 @@ function getJose() {
2135
2206
  return _josePromise ??= Promise.resolve().then(() => require("./webapi-D3QZrB15.cjs"));
2136
2207
  }
2137
2208
  //#endregion
2209
+ //#region src/agents/serializers/agent-blueprint.serializer.ts
2210
+ function deserializeAgentBlueprint(blueprint) {
2211
+ return {
2212
+ object: blueprint.object,
2213
+ id: blueprint.id,
2214
+ name: blueprint.name,
2215
+ description: blueprint.description,
2216
+ permissions: blueprint.permissions,
2217
+ invocableBy: {
2218
+ roleSlugs: blueprint.invocable_by.role_slugs,
2219
+ organizationIds: blueprint.invocable_by.organization_ids
2220
+ },
2221
+ sessionSettings: {
2222
+ maxAgeSeconds: blueprint.session_settings.max_age_seconds,
2223
+ accessTokenTtlSeconds: blueprint.session_settings.access_token_ttl_seconds,
2224
+ refreshTokenTtlSeconds: blueprint.session_settings.refresh_token_ttl_seconds
2225
+ },
2226
+ createdAt: blueprint.created_at,
2227
+ updatedAt: blueprint.updated_at
2228
+ };
2229
+ }
2230
+ function serializeCreateAgentBlueprintOptions(options) {
2231
+ return {
2232
+ name: options.name,
2233
+ ...options.description !== void 0 && { description: options.description },
2234
+ ...options.permissions !== void 0 && { permissions: options.permissions },
2235
+ ...options.invocableBy !== void 0 && { invocable_by: {
2236
+ ...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
2237
+ ...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
2238
+ } },
2239
+ session_settings: {
2240
+ max_age_seconds: options.sessionSettings.maxAgeSeconds,
2241
+ access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds,
2242
+ refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds
2243
+ }
2244
+ };
2245
+ }
2246
+ function serializeUpdateAgentBlueprintOptions(options) {
2247
+ return {
2248
+ ...options.name !== void 0 && { name: options.name },
2249
+ ...options.description !== void 0 && { description: options.description },
2250
+ ...options.permissions !== void 0 && { permissions: options.permissions },
2251
+ ...options.invocableBy !== void 0 && { invocable_by: {
2252
+ ...options.invocableBy.roleSlugs !== void 0 && { role_slugs: options.invocableBy.roleSlugs },
2253
+ ...options.invocableBy.organizationIds !== void 0 && { organization_ids: options.invocableBy.organizationIds }
2254
+ } },
2255
+ ...options.sessionSettings !== void 0 && { session_settings: {
2256
+ ...options.sessionSettings.maxAgeSeconds !== void 0 && { max_age_seconds: options.sessionSettings.maxAgeSeconds },
2257
+ ...options.sessionSettings.accessTokenTtlSeconds !== void 0 && { access_token_ttl_seconds: options.sessionSettings.accessTokenTtlSeconds },
2258
+ ...options.sessionSettings.refreshTokenTtlSeconds !== void 0 && { refresh_token_ttl_seconds: options.sessionSettings.refreshTokenTtlSeconds }
2259
+ } }
2260
+ };
2261
+ }
2262
+ //#endregion
2263
+ //#region src/agents/serializers/agent-instance-session.serializer.ts
2264
+ function deserializeAgentInstanceSession(session) {
2265
+ return {
2266
+ object: session.object,
2267
+ id: session.id,
2268
+ agentInstanceId: session.agent_instance_id,
2269
+ status: session.status,
2270
+ expiresAt: session.expires_at,
2271
+ revokedAt: session.revoked_at,
2272
+ createdAt: session.created_at,
2273
+ updatedAt: session.updated_at
2274
+ };
2275
+ }
2276
+ function serializeListAgentInstanceSessionsOptions(options) {
2277
+ return {
2278
+ agent_blueprint_id: options.agentBlueprintId,
2279
+ agent_instance_id: options.agentInstanceId,
2280
+ limit: options.limit,
2281
+ before: options.before,
2282
+ after: options.after,
2283
+ order: options.order
2284
+ };
2285
+ }
2286
+ //#endregion
2287
+ //#region src/agents/serializers/agent-instance.serializer.ts
2288
+ function deserializeAgentInstance(instance) {
2289
+ return {
2290
+ object: instance.object,
2291
+ id: instance.id,
2292
+ agentBlueprintId: instance.agent_blueprint_id,
2293
+ organizationId: instance.organization_id,
2294
+ organizationMembershipId: instance.organization_membership_id,
2295
+ type: instance.type,
2296
+ createdAt: instance.created_at,
2297
+ updatedAt: instance.updated_at
2298
+ };
2299
+ }
2300
+ function serializeListAgentInstancesOptions(options) {
2301
+ return {
2302
+ organization_id: options.organizationId,
2303
+ agent_blueprint_id: options.agentBlueprintId,
2304
+ limit: options.limit,
2305
+ before: options.before,
2306
+ after: options.after,
2307
+ order: options.order
2308
+ };
2309
+ }
2310
+ //#endregion
2138
2311
  //#region src/agents/serializers/agent-registration.serializer.ts
2139
2312
  function deserializeAgentRegistration(registration) {
2140
2313
  return {
@@ -2166,6 +2339,45 @@ function deserializeAgentRegistration(registration) {
2166
2339
  };
2167
2340
  }
2168
2341
  //#endregion
2342
+ //#region src/agents/serializers/agent-token.serializer.ts
2343
+ function deserializeAgentToken(token) {
2344
+ return {
2345
+ accessToken: token.access_token,
2346
+ tokenType: token.token_type,
2347
+ expiresIn: token.expires_in,
2348
+ refreshToken: token.refresh_token,
2349
+ agentInstanceId: token.agent_instance_id,
2350
+ newInstance: token.new_instance,
2351
+ agentInstanceSessionId: token.agent_instance_session_id,
2352
+ permissions: token.permissions
2353
+ };
2354
+ }
2355
+ function serializeMintAgentTokenOptions(options) {
2356
+ const intent = options.intent !== void 0 ? { intent: options.intent } : {};
2357
+ switch (options.type) {
2358
+ case "user_delegated": return {
2359
+ type: "user_delegated",
2360
+ user_access_token: options.userAccessToken,
2361
+ ...intent
2362
+ };
2363
+ case "autonomous": return {
2364
+ type: "autonomous",
2365
+ organization_id: options.organizationId,
2366
+ ...intent
2367
+ };
2368
+ case "agent_delegated": return {
2369
+ type: "agent_delegated",
2370
+ agent_access_token: options.agentAccessToken,
2371
+ ...intent
2372
+ };
2373
+ case "refresh": return {
2374
+ type: "refresh",
2375
+ refresh_token: options.refreshToken,
2376
+ ...intent
2377
+ };
2378
+ }
2379
+ }
2380
+ //#endregion
2169
2381
  //#region src/agents/serializers/claim-attempt.serializer.ts
2170
2382
  function serializeLinkClaimAttemptToExternalUserOptions(options) {
2171
2383
  return {
@@ -2240,6 +2452,186 @@ var Agents = class {
2240
2452
  this.workos = workos;
2241
2453
  }
2242
2454
  /**
2455
+ * Create an agent blueprint
2456
+ *
2457
+ * Creates an agent blueprint: the template describing what an agent may do
2458
+ * (its permission ceiling), who may invoke it, and the lifetimes of its
2459
+ * sessions.
2460
+ *
2461
+ * @param options - Configuration for the new agent blueprint.
2462
+ * @returns {Promise<AgentBlueprint>}
2463
+ * @throws {BadRequestException} 400
2464
+ * @throws {ConflictException} 409 - Name already in use.
2465
+ * @throws {UnprocessableEntityException} 422 - Permission, role, or organization not found.
2466
+ */
2467
+ async createBlueprint(options) {
2468
+ const { data } = await this.workos.post("/agents/blueprints", serializeCreateAgentBlueprintOptions(options));
2469
+ return deserializeAgentBlueprint(data);
2470
+ }
2471
+ /**
2472
+ * List agent blueprints
2473
+ *
2474
+ * Lists the agent blueprints in the current environment.
2475
+ *
2476
+ * @param options - Pagination options.
2477
+ * @returns {Promise<AutoPaginatable<AgentBlueprint, ListAgentBlueprintsOptions>>}
2478
+ */
2479
+ async listBlueprints(options) {
2480
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, "/agents/blueprints", deserializeAgentBlueprint, options), (params) => fetchAndDeserialize(this.workos, "/agents/blueprints", deserializeAgentBlueprint, params), options);
2481
+ }
2482
+ /**
2483
+ * Get an agent blueprint
2484
+ *
2485
+ * Retrieves an agent blueprint by ID.
2486
+ * @param agentBlueprintId - Unique identifier of the agent blueprint.
2487
+ *
2488
+ * @example
2489
+ * "agent_blueprint_01EHWNCE74X7JSDV0X3SZ3KJNY"
2490
+ *
2491
+ * @returns {Promise<AgentBlueprint>}
2492
+ * @throws {NotFoundException} 404
2493
+ */
2494
+ async getBlueprint(agentBlueprintId) {
2495
+ const { data } = await this.workos.get(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`);
2496
+ return deserializeAgentBlueprint(data);
2497
+ }
2498
+ /**
2499
+ * Update an agent blueprint
2500
+ *
2501
+ * Updates an agent blueprint. Omitted fields are left unchanged; provided
2502
+ * lists replace the existing configuration.
2503
+ *
2504
+ * @param options - Object containing the agent blueprint ID and the fields to update.
2505
+ * @returns {Promise<AgentBlueprint>}
2506
+ * @throws {BadRequestException} 400
2507
+ * @throws {NotFoundException} 404
2508
+ * @throws {ConflictException} 409 - Name already in use.
2509
+ * @throws {UnprocessableEntityException} 422 - Permission, role, or organization not found.
2510
+ */
2511
+ async updateBlueprint(options) {
2512
+ const { agentBlueprintId, ...payload } = options;
2513
+ const { data } = await this.workos.patch(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`, serializeUpdateAgentBlueprintOptions(payload));
2514
+ return deserializeAgentBlueprint(data);
2515
+ }
2516
+ /**
2517
+ * Delete an agent blueprint
2518
+ *
2519
+ * Deletes an agent blueprint by ID.
2520
+ * @param agentBlueprintId - Unique identifier of the agent blueprint.
2521
+ *
2522
+ * @example
2523
+ * "agent_blueprint_01EHWNCE74X7JSDV0X3SZ3KJNY"
2524
+ *
2525
+ * @returns {Promise<void>}
2526
+ * @throws {NotFoundException} 404
2527
+ */
2528
+ async deleteBlueprint(agentBlueprintId) {
2529
+ await this.workos.delete(`/agents/blueprints/${encodeURIComponent(agentBlueprintId)}`);
2530
+ }
2531
+ /**
2532
+ * Mint an agent token
2533
+ *
2534
+ * Mints tokens for an agent session from a blueprint. Supports
2535
+ * user-delegated, autonomous, and agent-delegated mints, as well as
2536
+ * refreshing an existing session with a refresh token.
2537
+ *
2538
+ * @param options - Object containing the agent blueprint ID, the mint type, and its credentials.
2539
+ * @returns {Promise<AgentToken>}
2540
+ * @throws {BadRequestException} 400
2541
+ * @throws {NotFoundException} 404
2542
+ */
2543
+ async mintToken(options) {
2544
+ const { data } = await this.workos.post(`/agents/blueprints/${encodeURIComponent(options.agentBlueprintId)}/tokens`, serializeMintAgentTokenOptions(options));
2545
+ return deserializeAgentToken(data);
2546
+ }
2547
+ /**
2548
+ * List agent instances
2549
+ *
2550
+ * Lists the agent instances in the current environment, optionally filtered
2551
+ * by organization or agent blueprint.
2552
+ *
2553
+ * @param options - Pagination and filter options.
2554
+ * @returns {Promise<AutoPaginatable<AgentInstance, SerializedListAgentInstancesOptions>>}
2555
+ */
2556
+ async listInstances(options) {
2557
+ 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);
2558
+ }
2559
+ /**
2560
+ * Get an agent instance
2561
+ *
2562
+ * Retrieves an agent instance by ID.
2563
+ * @param agentInstanceId - Unique identifier of the agent instance.
2564
+ *
2565
+ * @example
2566
+ * "agent_instance_01EHWNCE74X7JSDV0X3SZ3KJNY"
2567
+ *
2568
+ * @returns {Promise<AgentInstance>}
2569
+ * @throws {NotFoundException} 404
2570
+ */
2571
+ async getInstance(agentInstanceId) {
2572
+ const { data } = await this.workos.get(`/agents/instances/${encodeURIComponent(agentInstanceId)}`);
2573
+ return deserializeAgentInstance(data);
2574
+ }
2575
+ /**
2576
+ * Delete an agent instance
2577
+ *
2578
+ * Deletes an agent instance by ID.
2579
+ * @param agentInstanceId - Unique identifier of the agent instance.
2580
+ *
2581
+ * @example
2582
+ * "agent_instance_01EHWNCE74X7JSDV0X3SZ3KJNY"
2583
+ *
2584
+ * @returns {Promise<void>}
2585
+ * @throws {NotFoundException} 404
2586
+ */
2587
+ async deleteInstance(agentInstanceId) {
2588
+ await this.workos.delete(`/agents/instances/${encodeURIComponent(agentInstanceId)}`);
2589
+ }
2590
+ /**
2591
+ * List agent instance sessions
2592
+ *
2593
+ * Lists the agent instance sessions in the current environment, optionally
2594
+ * filtered by agent blueprint or agent instance.
2595
+ *
2596
+ * @param options - Pagination and filter options.
2597
+ * @returns {Promise<AutoPaginatable<AgentInstanceSession, SerializedListAgentInstanceSessionsOptions>>}
2598
+ */
2599
+ async listInstanceSessions(options) {
2600
+ 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);
2601
+ }
2602
+ /**
2603
+ * Get an agent instance session
2604
+ *
2605
+ * Retrieves an agent instance session by ID.
2606
+ * @param agentInstanceSessionId - Unique identifier of the agent instance session.
2607
+ *
2608
+ * @example
2609
+ * "agent_instance_session_01EHWNCE74X7JSDV0X3SZ3KJNY"
2610
+ *
2611
+ * @returns {Promise<AgentInstanceSession>}
2612
+ * @throws {NotFoundException} 404
2613
+ */
2614
+ async getInstanceSession(agentInstanceSessionId) {
2615
+ const { data } = await this.workos.get(`/agents/sessions/${encodeURIComponent(agentInstanceSessionId)}`);
2616
+ return deserializeAgentInstanceSession(data);
2617
+ }
2618
+ /**
2619
+ * Revoke an agent instance session
2620
+ *
2621
+ * Revokes an agent instance session by ID, invalidating its tokens.
2622
+ * @param agentInstanceSessionId - Unique identifier of the agent instance session.
2623
+ *
2624
+ * @example
2625
+ * "agent_instance_session_01EHWNCE74X7JSDV0X3SZ3KJNY"
2626
+ *
2627
+ * @returns {Promise<AgentInstanceSession>}
2628
+ * @throws {NotFoundException} 404
2629
+ */
2630
+ async revokeInstanceSession(agentInstanceSessionId) {
2631
+ const { data } = await this.workos.post(`/agents/sessions/${encodeURIComponent(agentInstanceSessionId)}/revoke`, {});
2632
+ return deserializeAgentInstanceSession(data);
2633
+ }
2634
+ /**
2243
2635
  * Link a claim attempt to an external user
2244
2636
  *
2245
2637
  * Link an external user to a claim attempt and retrieve the code needed
@@ -3049,6 +3441,88 @@ var Organizations = class {
3049
3441
  const { data } = await this.workos.put(`/organizations/${organizationId}`, serializeUpdateOrganizationOptions(payload));
3050
3442
  return deserializeOrganization(data);
3051
3443
  }
3444
+ /**
3445
+ * List IT Contacts
3446
+ *
3447
+ * Get the IT Contacts for an Organization.
3448
+ * @param options - Object containing the Organization ID.
3449
+ * @returns {Promise<List<ItContact>>}
3450
+ * @throws {AuthorizationException} 403
3451
+ * @throws {NotFoundException} 404
3452
+ */
3453
+ async listItContacts(options) {
3454
+ const { organizationId } = options;
3455
+ const { data } = await this.workos.get(`/organizations/${organizationId}/it_contacts`);
3456
+ return {
3457
+ object: data.object,
3458
+ data: data.data.map(deserializeItContact),
3459
+ listMetadata: {
3460
+ before: data.list_metadata.before,
3461
+ after: data.list_metadata.after
3462
+ }
3463
+ };
3464
+ }
3465
+ /**
3466
+ * Create an IT Contact
3467
+ *
3468
+ * Add an IT Contact to an Organization. No Admin Portal invitation is sent,
3469
+ * though the contact is notified if the Organization has a connection
3470
+ * certificate nearing expiry.
3471
+ * @param options - Object containing the Organization ID and the email address.
3472
+ * @returns {Promise<ItContact>}
3473
+ * @throws {AuthorizationException} 403
3474
+ * @throws {NotFoundException} 404
3475
+ * @throws {ConflictException} 409
3476
+ * @throws {UnprocessableEntityException} 422
3477
+ */
3478
+ async createItContact(options) {
3479
+ const { organizationId, ...payload } = options;
3480
+ const { data } = await this.workos.post(`/organizations/${organizationId}/it_contacts`, serializeCreateItContactOptions(payload));
3481
+ return deserializeItContact(data);
3482
+ }
3483
+ /**
3484
+ * Delete an IT Contact
3485
+ *
3486
+ * Remove an IT Contact from an Organization and revoke the contact's active
3487
+ * setup links.
3488
+ * @param options - Object containing the Organization ID and the IT Contact ID.
3489
+ * @returns {Promise<void>}
3490
+ * @throws {AuthorizationException} 403
3491
+ * @throws {NotFoundException} 404
3492
+ */
3493
+ async deleteItContact(options) {
3494
+ const { organizationId, contactId } = options;
3495
+ await this.workos.delete(`/organizations/${organizationId}/it_contacts/${contactId}`);
3496
+ }
3497
+ /**
3498
+ * Invite an IT Contact
3499
+ *
3500
+ * Create an Admin Portal setup link and email it to the IT Contact. An
3501
+ * Organization can have at most one active invitation.
3502
+ * @param options - Object containing the Organization ID, the IT Contact ID and the intents.
3503
+ * @returns {Promise<void>}
3504
+ * @throws {AuthorizationException} 403
3505
+ * @throws {NotFoundException} 404
3506
+ * @throws {ConflictException} 409
3507
+ * @throws {UnprocessableEntityException} 422
3508
+ */
3509
+ async inviteItContact(options) {
3510
+ const { organizationId, contactId, ...payload } = options;
3511
+ await this.workos.post(`/organizations/${organizationId}/it_contacts/${contactId}/invite`, serializeInviteItContactOptions(payload));
3512
+ }
3513
+ /**
3514
+ * Revoke an IT Contact's invitation
3515
+ *
3516
+ * Revoke the Organization's active Admin Portal invitation.
3517
+ * @param options - Object containing the Organization ID and the IT Contact ID.
3518
+ * @returns {Promise<void>}
3519
+ * @throws {AuthorizationException} 403
3520
+ * @throws {NotFoundException} 404
3521
+ */
3522
+ async revokeItContact(options) {
3523
+ const { organizationId, contactId } = options;
3524
+ await this.workos.post(`/organizations/${organizationId}/it_contacts/${contactId}/revoke`, {});
3525
+ }
3052
3526
  };
3053
3527
  //#endregion
3054
3528
  //#region src/organization-domains/serializers/create-organization-domain-options.serializer.ts
@@ -4826,6 +5300,23 @@ const serializeUpdateOrganizationMembershipOptions = (options) => ({
4826
5300
  role_slugs: options.roleSlugs
4827
5301
  });
4828
5302
  //#endregion
5303
+ //#region src/user-management/serializers/create-waitlist-entry-options.serializer.ts
5304
+ const serializeCreateWaitlistEntryOptions = (options) => ({
5305
+ email: options.email,
5306
+ additional_fields: options.additionalFields,
5307
+ send_confirmation_email: options.sendConfirmationEmail
5308
+ });
5309
+ //#endregion
5310
+ //#region src/user-management/serializers/list-waitlist-entries-options.serializer.ts
5311
+ const serializeListWaitlistEntriesOptions = (options) => ({
5312
+ state: options.state,
5313
+ email: options.email,
5314
+ limit: options.limit,
5315
+ before: options.before,
5316
+ after: options.after,
5317
+ order: options.order
5318
+ });
5319
+ //#endregion
4829
5320
  //#region src/user-management/session.ts
4830
5321
  var CookieSession = class {
4831
5322
  userManagement;
@@ -5721,6 +6212,98 @@ var UserManagement = class {
5721
6212
  return deserializeInvitation(data);
5722
6213
  }
5723
6214
  /**
6215
+ * List waitlists
6216
+ *
6217
+ * Get a list of the waitlists in the environment. All waitlists are
6218
+ * returned in a single response — this endpoint is not paginated.
6219
+ * @returns {Promise<List<Waitlist>>}
6220
+ */
6221
+ async listWaitlists() {
6222
+ const { data } = await this.workos.get("/user_management/waitlists");
6223
+ return deserializeList(data, deserializeWaitlist);
6224
+ }
6225
+ /**
6226
+ * Get a waitlist
6227
+ *
6228
+ * Get the details of an existing waitlist. The literal id `default`
6229
+ * is accepted and resolves to the environment's default waitlist.
6230
+ * @returns {Promise<Waitlist>}
6231
+ * @throws {NotFoundException} 404
6232
+ */
6233
+ async getWaitlist(waitlistId) {
6234
+ const { data } = await this.workos.get(`/user_management/waitlists/${waitlistId}`);
6235
+ return deserializeWaitlist(data);
6236
+ }
6237
+ /**
6238
+ * List waitlist entries
6239
+ *
6240
+ * Get a list of the entries on a waitlist matching the criteria specified.
6241
+ * The literal id `default` is accepted and resolves to the environment's
6242
+ * default waitlist.
6243
+ * @param waitlistId - The unique ID of the waitlist.
6244
+ * @param options - Pagination and filter options.
6245
+ * @returns {Promise<AutoPaginatable<WaitlistEntry, SerializedListWaitlistEntriesOptions>>}
6246
+ * @throws {NotFoundException} 404
6247
+ * @throws {UnprocessableEntityException} 422
6248
+ */
6249
+ async listWaitlistEntries(waitlistId, options) {
6250
+ return new AutoPaginatable(await fetchAndDeserialize(this.workos, `/user_management/waitlists/${waitlistId}/entries`, deserializeWaitlistEntry, options ? serializeListWaitlistEntriesOptions(options) : void 0), (params) => fetchAndDeserialize(this.workos, `/user_management/waitlists/${waitlistId}/entries`, deserializeWaitlistEntry, params), options ? serializeListWaitlistEntriesOptions(options) : void 0);
6251
+ }
6252
+ /**
6253
+ * Create a waitlist entry
6254
+ *
6255
+ * Add an email address to a waitlist. Adding an email address that is
6256
+ * already on the waitlist returns the existing entry unchanged. The
6257
+ * literal id `default` is accepted and resolves to the environment's
6258
+ * default waitlist.
6259
+ * @param waitlistId - The unique ID of the waitlist.
6260
+ * @param payload - Object containing email and optional fields.
6261
+ * @returns {Promise<WaitlistEntry>}
6262
+ * @throws {NotFoundException} 404
6263
+ * @throws {UnprocessableEntityException} 422
6264
+ */
6265
+ async createWaitlistEntry(waitlistId, payload) {
6266
+ const { data } = await this.workos.post(`/user_management/waitlists/${waitlistId}/entries`, serializeCreateWaitlistEntryOptions(payload));
6267
+ return deserializeWaitlistEntry(data);
6268
+ }
6269
+ /**
6270
+ * Approve a waitlist entry
6271
+ *
6272
+ * Approve a waitlist entry, create an invitation for its email address,
6273
+ * and send the invitation email.
6274
+ * @returns {Promise<WaitlistEntry>}
6275
+ * @throws {NotFoundException} 404
6276
+ * @throws {UnprocessableEntityException} 422
6277
+ */
6278
+ async approveWaitlistEntry(waitlistEntryId) {
6279
+ const { data } = await this.workos.post(`/user_management/waitlist_entries/${waitlistEntryId}/approve`, null);
6280
+ return deserializeWaitlistEntry(data);
6281
+ }
6282
+ /**
6283
+ * Deny a waitlist entry
6284
+ *
6285
+ * Deny a pending waitlist entry.
6286
+ * @returns {Promise<WaitlistEntry>}
6287
+ * @throws {NotFoundException} 404
6288
+ * @throws {UnprocessableEntityException} 422
6289
+ */
6290
+ async denyWaitlistEntry(waitlistEntryId) {
6291
+ const { data } = await this.workos.post(`/user_management/waitlist_entries/${waitlistEntryId}/deny`, null);
6292
+ return deserializeWaitlistEntry(data);
6293
+ }
6294
+ /**
6295
+ * Delete a waitlist entry
6296
+ *
6297
+ * Remove the entry from the waitlist. Its email address can join again
6298
+ * unless a user with that email now exists in the environment. Deleting
6299
+ * the entry does not revoke an invitation created by approving it.
6300
+ * @returns {Promise<void>}
6301
+ * @throws {NotFoundException} 404
6302
+ */
6303
+ async deleteWaitlistEntry(waitlistEntryId) {
6304
+ await this.workos.delete(`/user_management/waitlist_entries/${waitlistEntryId}`);
6305
+ }
6306
+ /**
5724
6307
  * Revoke Session
5725
6308
  *
5726
6309
  * Revoke a [user session](https://workos.com/docs/reference/authkit/session).
@@ -8138,7 +8721,7 @@ var Vault = class {
8138
8721
  };
8139
8722
  //#endregion
8140
8723
  //#region package.json
8141
- var version = "10.11.0";
8724
+ var version = "10.13.0";
8142
8725
  //#endregion
8143
8726
  //#region src/workos.ts
8144
8727
  const DEFAULT_HOSTNAME = "api.workos.com";
@@ -8369,7 +8952,7 @@ var WorkOS = class {
8369
8952
  const { response } = error;
8370
8953
  if (response) {
8371
8954
  const { status, data, headers } = response;
8372
- const requestID = headers["X-Request-ID"] ?? "";
8955
+ const requestID = headers.get("X-Request-ID") ?? "";
8373
8956
  const { code, error_description: errorDescription, error, errors, message } = data;
8374
8957
  switch (status) {
8375
8958
  case 401: throw new UnauthorizedException(requestID);
@@ -8381,6 +8964,7 @@ var WorkOS = class {
8381
8964
  });
8382
8965
  case 422: throw new UnprocessableEntityException({
8383
8966
  code,
8967
+ error,
8384
8968
  errors,
8385
8969
  message,
8386
8970
  requestID
@@ -8427,6 +9011,15 @@ let DomainDataState = /* @__PURE__ */ function(DomainDataState) {
8427
9011
  return DomainDataState;
8428
9012
  }({});
8429
9013
  //#endregion
9014
+ //#region src/organizations/interfaces/it-contact-options.interface.ts
9015
+ const ItContactIntent = {
9016
+ SSO: "sso",
9017
+ DirectorySync: "directory_sync",
9018
+ LogStreams: "log_streams",
9019
+ DomainVerification: "domain_verification",
9020
+ BringYourOwnKey: "bring_your_own_key"
9021
+ };
9022
+ //#endregion
8430
9023
  //#region src/organization-domains/interfaces/organization-domain.interface.ts
8431
9024
  let OrganizationDomainState = /* @__PURE__ */ function(OrganizationDomainState) {
8432
9025
  OrganizationDomainState["Verified"] = "verified";
@@ -8572,6 +9165,12 @@ Object.defineProperty(exports, "GenericServerException", {
8572
9165
  return GenericServerException;
8573
9166
  }
8574
9167
  });
9168
+ Object.defineProperty(exports, "ItContactIntent", {
9169
+ enumerable: true,
9170
+ get: function() {
9171
+ return ItContactIntent;
9172
+ }
9173
+ });
8575
9174
  Object.defineProperty(exports, "NoApiKeyProvidedException", {
8576
9175
  enumerable: true,
8577
9176
  get: function() {
@@ -8675,4 +9274,4 @@ Object.defineProperty(exports, "serializeRevokeSessionOptions", {
8675
9274
  }
8676
9275
  });
8677
9276
 
8678
- //# sourceMappingURL=factory-JdOhqH28.cjs.map
9277
+ //# sourceMappingURL=factory-BfdUyn2X.cjs.map