@workos/openapi-spec 0.6.0 → 0.8.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.
package/dist/policy.mjs CHANGED
@@ -7,6 +7,7 @@ import { toCamelCase } from "@workos/oagen";
7
7
  const operationHints = {
8
8
  "POST /radar/lists/{type}/{action}": { name: "add_list_entry" },
9
9
  "DELETE /radar/lists/{type}/{action}": { name: "remove_list_entry" },
10
+ "POST /data-integrations/{provider}/token": { name: "get_access_token" },
10
11
  "GET /sso/authorize": {
11
12
  name: "get_authorization_url",
12
13
  defaults: { response_type: "code" },
@@ -280,6 +281,7 @@ const operationHints = {
280
281
  * target unless overridden per-operation in {@link operationHints}.
281
282
  */
282
283
  const mountRules = {
284
+ Client: "ClientApi",
283
285
  MultiFactorAuthChallenges: "MultiFactorAuth",
284
286
  Permissions: "Authorization",
285
287
  WorkosConnect: "Connect",
@@ -379,6 +381,26 @@ function transformSpec(spec) {
379
381
  }
380
382
  delete schemas["UserlandUserOrganizationMembershipBaseWithUser"];
381
383
  delete schemas["UserlandUserOrganizationMembershipBaseWithUserList"];
384
+ const tokenResponse = schemas["DataIntegrationAccessTokenResponse"];
385
+ for (const variant of tokenResponse?.oneOf ?? []) {
386
+ const expiresAt = variant.properties?.access_token?.properties?.expires_at;
387
+ if (expiresAt && expiresAt.format === void 0) expiresAt.format = "date-time";
388
+ const errorEnum = variant.properties?.error?.enum;
389
+ if (Array.isArray(errorEnum) && errorEnum.length === 2 && errorEnum[0] === "needs_reauthorization" && errorEnum[1] === "not_installed") errorEnum.reverse();
390
+ }
391
+ const slugTokenPath = "/data-integrations/{slug}/token";
392
+ const providerTokenPath = "/data-integrations/{provider}/token";
393
+ const tokenPathItem = paths[slugTokenPath];
394
+ if (tokenPathItem && !paths[providerTokenPath]) {
395
+ for (const [key, member] of Object.entries(tokenPathItem)) {
396
+ const params = key === "parameters" ? member : member?.parameters;
397
+ for (const param of params ?? []) if (param.in === "path" && param.name === "slug") param.name = "provider";
398
+ }
399
+ paths[providerTokenPath] = tokenPathItem;
400
+ delete paths[slugTokenPath];
401
+ }
402
+ const orgIdProp = (paths[providerTokenPath]?.post?.requestBody?.content?.["application/json"]?.schema)?.properties?.organization_id;
403
+ if (orgIdProp && orgIdProp.type === "string") orgIdProp.type = ["string", "null"];
382
404
  if (schemas["JwtTemplate"] && !schemas["JwtTemplateResponse"]) {
383
405
  schemas["JwtTemplateResponse"] = schemas["JwtTemplate"];
384
406
  delete schemas["JwtTemplate"];
@@ -392,6 +414,11 @@ function transformSpec(spec) {
392
414
  }
393
415
  }
394
416
  }
417
+ if (schemas["ListMetadata"]) {
418
+ const groupRoleList = schemas["GroupRoleAssignmentList"];
419
+ const listMetadata = groupRoleList?.properties?.list_metadata;
420
+ if (listMetadata && !listMetadata.$ref && listMetadata.properties) groupRoleList.properties.list_metadata = { $ref: "#/components/schemas/ListMetadata" };
421
+ }
395
422
  return spec;
396
423
  }
397
424
  //#endregion