@propelauth/express
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.4
/// <reference types="qs" /> | ||
import { NextFunction, Request, Response } from "express"; | ||
import { TokenVerificationMetadata } from "./api"; | ||
import { UserMetadata } from "./user"; | ||
export declare type AuthOptions = { | ||
debugMode?: boolean; | ||
authUrl: string; | ||
apiKey: string; | ||
/** | ||
* By default, this library performs a one-time fetch on startup for | ||
* token verification metadata from your authUrl using your apiKey. | ||
* | ||
* This is usually preferred to make sure you have the most up to date information, | ||
* however, in environments like serverless, this one-time fetch becomes a | ||
* per-request fetch. | ||
* | ||
* In those environments, you can specify the token verification metadata manually, | ||
* which you can obtain from your PropelAuth project. | ||
*/ | ||
manualTokenVerificationMetadata?: TokenVerificationMetadata; | ||
}; | ||
export declare function initAuth(opts: AuthOptions): { | ||
import { BaseAuthOptions, User } from "@propelauth/node"; | ||
export declare function initAuth(opts: BaseAuthOptions): { | ||
requireUser: (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
optionalUser: (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
requireOrgMember: (args?: RequireOrgMemberArgs | undefined) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => void; | ||
fetchUserMetadataByUserId: (userId: string) => Promise<UserMetadata | null>; | ||
fetchUserMetadataByEmail: (email: string) => Promise<UserMetadata | null>; | ||
fetchUserMetadataByUsername: (username: string) => Promise<UserMetadata | null>; | ||
fetchBatchUserMetadataByUserIds: (userIds: string[]) => Promise<{ | ||
[userId: string]: UserMetadata; | ||
requireOrgMember: (args?: RequireOrgMemberArgs | undefined) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
requireOrgMemberWithMinimumRole: (args: RequireOrgMemberWithMinimumRoleArgs) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
requireOrgMemberWithExactRole: (args: RequireOrgMemberWithExactRoleArgs) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
requireOrgMemberWithPermission: (args: RequireOrgMemberWithPermissionArgs) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
requireOrgMemberWithAllPermissions: (args: RequireOrgMemberWithAllPermissionsArgs) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>; | ||
fetchUserMetadataByUserId: (userId: string, includeOrgs?: boolean | undefined) => Promise<import("@propelauth/node").UserMetadata | null>; | ||
fetchUserMetadataByEmail: (email: string, includeOrgs?: boolean | undefined) => Promise<import("@propelauth/node").UserMetadata | null>; | ||
fetchUserMetadataByUsername: (username: string, includeOrgs?: boolean | undefined) => Promise<import("@propelauth/node").UserMetadata | null>; | ||
fetchBatchUserMetadataByUserIds: (userIds: string[], includeOrgs?: boolean | undefined) => Promise<{ | ||
[userId: string]: import("@propelauth/node").UserMetadata; | ||
}>; | ||
fetchBatchUserMetadataByEmails: (emails: string[]) => Promise<{ | ||
[email: string]: UserMetadata; | ||
fetchBatchUserMetadataByEmails: (emails: string[], includeOrgs?: boolean | undefined) => Promise<{ | ||
[email: string]: import("@propelauth/node").UserMetadata; | ||
}>; | ||
fetchBatchUserMetadataByUsernames: (usernames: string[]) => Promise<{ | ||
[username: string]: UserMetadata; | ||
fetchBatchUserMetadataByUsernames: (usernames: string[], includeOrgs?: boolean | undefined) => Promise<{ | ||
[username: string]: import("@propelauth/node").UserMetadata; | ||
}>; | ||
fetchOrg: (orgId: string) => Promise<import("@propelauth/node").Org | null>; | ||
fetchOrgByQuery: (orgQuery: import("@propelauth/node").OrgQuery) => Promise<import("@propelauth/node").OrgQueryResponse>; | ||
fetchUsersByQuery: (usersQuery: import("@propelauth/node").UsersQuery) => Promise<import("@propelauth/node").UsersPagedResponse>; | ||
fetchUsersInOrg: (usersInOrgQuery: import("@propelauth/node").UsersInOrgQuery) => Promise<import("@propelauth/node").UsersPagedResponse>; | ||
createUser: (createUserRequest: import("@propelauth/node").CreateUserRequest) => Promise<User>; | ||
updateUserMetadata: (userId: string, updateUserMetadataRequest: import("@propelauth/node").UpdateUserMetadataRequest) => Promise<boolean>; | ||
updateUserEmail: (userId: string, updateUserEmailRequest: import("@propelauth/node").UpdateUserEmailRequest) => Promise<boolean>; | ||
createMagicLink: (createMagicLinkRequest: import("@propelauth/node").CreateMagicLinkRequest) => Promise<import("@propelauth/node").MagicLink>; | ||
migrateUserFromExternalSource: (migrateUserFromExternalSourceRequest: import("@propelauth/node/dist/api").MigrateUserFromExternalSourceRequest) => Promise<User>; | ||
createOrg: (createOrgRequest: import("@propelauth/node/dist/api").CreateOrgRequest) => Promise<import("@propelauth/node").Org>; | ||
addUserToOrg: (addUserToOrgRequest: import("@propelauth/node/dist/api").AddUserToOrgRequest) => Promise<boolean>; | ||
deleteUser: (userId: string) => Promise<boolean>; | ||
disableUser: (userId: string) => Promise<boolean>; | ||
enableUser: (userId: string) => Promise<boolean>; | ||
allowOrgToSetupSamlConnection: (orgId: string) => Promise<boolean>; | ||
disallowOrgToSetupSamlConnection: (orgId: string) => Promise<boolean>; | ||
}; | ||
export interface RequireOrgMemberArgs { | ||
minimumRequiredRole?: string; | ||
orgIdExtractor?: (req: Request) => string; | ||
orgNameExtractor?: (req: Request) => string; | ||
} | ||
export interface RequireOrgMemberWithMinimumRoleArgs { | ||
orgIdExtractor?: (req: Request) => string; | ||
orgNameExtractor?: (req: Request) => string; | ||
minimumRequiredRole: string; | ||
} | ||
export interface RequireOrgMemberWithExactRoleArgs { | ||
orgIdExtractor?: (req: Request) => string; | ||
orgNameExtractor?: (req: Request) => string; | ||
role: string; | ||
} | ||
export interface RequireOrgMemberWithPermissionArgs { | ||
orgIdExtractor?: (req: Request) => string; | ||
orgNameExtractor?: (req: Request) => string; | ||
permission: string; | ||
} | ||
export interface RequireOrgMemberWithAllPermissionsArgs { | ||
orgIdExtractor?: (req: Request) => string; | ||
orgNameExtractor?: (req: Request) => string; | ||
permissions: string[]; | ||
} |
@@ -1,5 +0,8 @@ | ||
import { OrgMemberInfo, User, UserMetadata } from "./user"; | ||
import { BaseAuthOptions, User, OrgMemberInfo } from "@propelauth/node"; | ||
declare type AuthOptions = BaseAuthOptions; | ||
export type { BaseAuthOptions, AuthOptions, User, OrgMemberInfo }; | ||
export { initAuth } from "./auth"; | ||
export type { AuthOptions, RequireOrgMemberArgs } from "./auth"; | ||
export type { User, UserMetadata, OrgMemberInfo }; | ||
export type { RequireOrgMemberArgs } from "./auth"; | ||
export type { TokenVerificationMetadata, OrgQueryResponse, OrgQuery, UsersQuery, UsersInOrgQuery, UsersPagedResponse, CreateUserRequest, UpdateUserMetadataRequest, UpdateUserEmailRequest, CreateMagicLinkRequest, MagicLink, } from "@propelauth/node"; | ||
export { CreateUserException, ForbiddenException, MagicLinkCreationException, UnauthorizedException, UnexpectedException, UpdateUserEmailException, UpdateUserMetadataException, Org, OrgIdToOrgMemberInfo, UserAndOrgMemberInfo, toOrgIdToOrgMemberInfo, UserMetadata, } from "@propelauth/node"; | ||
declare global { | ||
@@ -10,7 +13,4 @@ namespace Express { | ||
org?: OrgMemberInfo; | ||
roleNameToIndex?: { | ||
[role_name: string]: number; | ||
}; | ||
} | ||
} | ||
} |
@@ -7,6 +7,3 @@ { | ||
}, | ||
"version": "2.0.0-beta.1", | ||
"publishConfig": { | ||
"tag": "beta" | ||
}, | ||
"version": "2.0.0-beta.4", | ||
"license": "MIT", | ||
@@ -18,5 +15,2 @@ "keywords": [ | ||
], | ||
"dependencies": { | ||
"jsonwebtoken": "^8.5.1" | ||
}, | ||
"devDependencies": { | ||
@@ -28,6 +22,8 @@ "@rollup/plugin-commonjs": "^19.0.0", | ||
"@types/jest": "^27.0.1", | ||
"@types/jsonwebtoken": "^8.5.1", | ||
"@types/jsonwebtoken": "^8.5.8", | ||
"@types/nock": "^11.1.0", | ||
"@types/uuid": "^8.3.1", | ||
"express": "^4.17.1", | ||
"jest": "^27.0.6", | ||
"jsonwebtoken": "^8.5.1", | ||
"nock": "^13.1.2", | ||
@@ -68,3 +64,6 @@ "prettier": "^2.3.2", | ||
} | ||
}, | ||
"dependencies": { | ||
"@propelauth/node": "^2.0.0-beta.4" | ||
} | ||
} |
@@ -15,3 +15,3 @@ <p align="center"> | ||
- Full reference this library is [here](https://docs.propelauth.com/reference/frontend-apis/react.html) | ||
- Full reference this library is [here](https://docs.propelauth.com/reference/backend-apis/express/) | ||
- Getting started guides for PropelAuth are [here](https://docs.propelauth.com/) | ||
@@ -18,0 +18,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1085468
10842
20
9
+ Added@propelauth/node@2.1.22(transitive)
+ Added@propelauth/node-apis@2.1.22(transitive)
+ Addedjose@5.9.3(transitive)
- Removedjsonwebtoken@^8.5.1
- Removedbuffer-equal-constant-time@1.0.1(transitive)
- Removedecdsa-sig-formatter@1.0.11(transitive)
- Removedjsonwebtoken@8.5.1(transitive)
- Removedjwa@1.4.1(transitive)
- Removedjws@3.2.2(transitive)
- Removedlodash.includes@4.3.0(transitive)
- Removedlodash.isboolean@3.0.3(transitive)
- Removedlodash.isinteger@4.0.4(transitive)
- Removedlodash.isnumber@3.0.3(transitive)
- Removedlodash.isplainobject@4.0.6(transitive)
- Removedlodash.isstring@4.0.1(transitive)
- Removedlodash.once@4.1.1(transitive)
- Removedms@2.1.3(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@5.7.2(transitive)