@mastra/auth-workos 1.6.7 → 1.6.8

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/index.js CHANGED
@@ -2,7 +2,7 @@ import { verifyJwks } from "@mastra/auth";
2
2
  import { AuthService, CookieSessionStorage, sessionEncryption } from "@workos/authkit-session";
3
3
  import { GeneratePortalLinkIntent, WorkOS } from "@workos-inc/node";
4
4
  import { LRUCache } from "lru-cache";
5
- //#region ../../packages/_internal-core/dist/logger/index.js
5
+ // ../../packages/_internal-core/dist/logger/index.js
6
6
  /**
7
7
  * Export a tracked exception through the adapter sink, mirroring the
8
8
  * DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
@@ -235,8 +235,7 @@ var ConsoleLogger = class ConsoleLogger extends MastraLogger {
235
235
  };
236
236
  }
237
237
  };
238
- //#endregion
239
- //#region ../../packages/_internal-core/dist/base/index.js
238
+ // ../../packages/_internal-core/dist/base/index.js
240
239
  var MastraBase = class {
241
240
  component = RegisteredLogger.LLM;
242
241
  logger;
@@ -270,8 +269,7 @@ var MastraBase = class {
270
269
  this.logger = "child" in logger && typeof logger.child === "function" ? logger.child({ component: this.component }) : logger;
271
270
  }
272
271
  };
273
- //#endregion
274
- //#region ../../packages/_internals/auth/dist/provider/index.js
272
+ // ../../packages/_internals/auth/dist/provider/index.js
275
273
  var MastraAuthProvider = class extends MastraBase {
276
274
  protected;
277
275
  public;
@@ -283,7 +281,7 @@ var MastraAuthProvider = class extends MastraBase {
283
281
  if (options?.authorizeUser) this.authorizeUser = options.authorizeUser.bind(this);
284
282
  this.protected = options?.protected;
285
283
  this.public = options?.public;
286
- this.mapUserToResourceId = options?.mapUserToResourceId;
284
+ if (options?.mapUserToResourceId) this.mapUserToResourceId = options.mapUserToResourceId;
287
285
  }
288
286
  registerOptions(opts) {
289
287
  if (opts?.authorizeUser) this.authorizeUser = opts.authorizeUser.bind(this);
@@ -292,8 +290,7 @@ var MastraAuthProvider = class extends MastraBase {
292
290
  if (opts?.public) this.public = opts.public;
293
291
  }
294
292
  };
295
- //#endregion
296
- //#region src/session-storage.ts
293
+ // src/session-storage.ts
297
294
  /**
298
295
  * Hono/Web Request session storage adapter for WorkOS AuthKit.
299
296
  *
@@ -327,8 +324,7 @@ var WebSessionStorage = class extends CookieSessionStorage {
327
324
  }, {})[name] ?? null;
328
325
  }
329
326
  };
330
- //#endregion
331
- //#region src/types.ts
327
+ // src/types.ts
332
328
  /**
333
329
  * Maps a WorkOS User to EEUser format.
334
330
  */
@@ -345,8 +341,7 @@ function mapWorkOSUserToEEUser(user) {
345
341
  }
346
342
  };
347
343
  }
348
- //#endregion
349
- //#region src/auth-provider.ts
344
+ // src/auth-provider.ts
350
345
  function getWebRequest(request) {
351
346
  if (request instanceof Request) return request;
352
347
  return request.raw instanceof Request ? request.raw : void 0;
@@ -939,8 +934,7 @@ var MastraAuthWorkos = class extends MastraAuthProvider {
939
934
  return this.redirectUri;
940
935
  }
941
936
  };
942
- //#endregion
943
- //#region ../../packages/_internals/auth/dist/ee-XRuijAiF.js
937
+ // ../../packages/_internals/auth/dist/ee-CAe-UJ9n.js
944
938
  /**
945
939
  * FGA enforcement utility for checking fine-grained authorization.
946
940
  *
@@ -1068,8 +1062,7 @@ function resolvePermissionsFromMapping(roles, mapping) {
1068
1062
  * @license Mastra Enterprise License - see ee/LICENSE
1069
1063
  * @packageDocumentation
1070
1064
  */
1071
- //#endregion
1072
- //#region src/rbac-provider.ts
1065
+ // src/rbac-provider.ts
1073
1066
  /**
1074
1067
  * WorkOS RBAC provider that maps organization roles to Mastra permissions.
1075
1068
  *
@@ -1299,8 +1292,7 @@ var MastraRBACWorkos = class {
1299
1292
  return (this.options.organizationId ? user.memberships.filter((m) => m.organizationId === this.options.organizationId) : user.memberships).map((m) => m.role.slug);
1300
1293
  }
1301
1294
  };
1302
- //#endregion
1303
- //#region src/fga-provider.ts
1295
+ // src/fga-provider.ts
1304
1296
  /**
1305
1297
  * WorkOS FGA provider for Mastra.
1306
1298
  *
@@ -1736,8 +1728,7 @@ var MastraFGAWorkos = class {
1736
1728
  };
1737
1729
  }
1738
1730
  };
1739
- //#endregion
1740
- //#region src/directory-sync.ts
1731
+ // src/directory-sync.ts
1741
1732
  /**
1742
1733
  * WorkOSDirectorySync handles SCIM webhook events from WorkOS for automated
1743
1734
  * user provisioning and deprovisioning.
@@ -1946,8 +1937,7 @@ var WorkOSDirectorySync = class {
1946
1937
  return (await this.workos.directorySync.listGroups({ directory: directoryId })).data;
1947
1938
  }
1948
1939
  };
1949
- //#endregion
1950
- //#region src/admin-portal.ts
1940
+ // src/admin-portal.ts
1951
1941
  /**
1952
1942
  * WorkOS Admin Portal integration for customer self-service configuration.
1953
1943
  *
@@ -2040,7 +2030,6 @@ var WorkOSAdminPortal = class {
2040
2030
  })).link;
2041
2031
  }
2042
2032
  };
2043
- //#endregion
2044
2033
  export { MastraAuthWorkos, MastraFGAWorkos, MastraRBACWorkos, WebSessionStorage, WorkOSAdminPortal, WorkOSDirectorySync, WorkOSFGAMembershipResolutionError, WorkOSFGAResourceNotFoundError, mapWorkOSUserToEEUser };
2045
2034
 
2046
2035
  //# sourceMappingURL=index.js.map