This commit is contained in:
Sebastian Seedorf
2020-11-16 12:40:47 +01:00
parent 2629d1e8e9
commit 936f93fb5d
12 changed files with 144 additions and 27 deletions

View File

@@ -5,7 +5,7 @@ export {AuthProxy} from './auth-proxy';
export {Resolvable, WaitForSync} from './helpers/resolvable';
export {urlJoin} from './helpers/urlJoin';
export {AutoReloader} from './auto-reload';
export {Polyfill} from './polyfill';
export {Polyfill, PolyfillOptions} from './polyfill';
export {Session} from './session';
export {Permissions} from './permissions';

View File

@@ -3,7 +3,7 @@ import {expose} from "threads/worker";
import * as fs from "fs";
import {analyze} from '@10xjs/polyfill-analyzer';
import allPolyfills from '@10xjs/polyfill-analyzer/dist/polyfills';
import {PolyfillFeatureList} from "polyfill-library";
import {PolyfillFeatureList} from 'polyfill-library';
expose(() => {
const exclude = [

View File

@@ -1,10 +1,19 @@
import {RequestHandler} from 'express';
import * as polyfillLibrary from 'polyfill-library';
import {PolyfillFeatureList, PolyfillOptions} from 'polyfill-library';
import {PolyfillFeatureList} from 'polyfill-library';
import {DefaultConfig, Logger, WaitForSync} from '.';
import {spawn, Thread, Worker} from 'threads';
import {WorkerFunction} from 'threads/dist/types/worker';
export type PolyfillOptions = {
minify: boolean,
unknown: 'polyfill'|'ignore',
features: PolyfillFeatureList,
excludes: string[],
uaString: string,
rum: boolean,
}
const features = new WaitForSync<PolyfillFeatureList>();
(async () => {

View File

@@ -1,9 +0,0 @@
declare namespace Express {
interface Request {
getUserInfo(): Promise<import('../helpers/userinfo').UserInfo|undefined>;
}
interface Response {
initLogout(): boolean;
}
}

28
src/types/extend-request.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
// extend-request.d.ts
declare global {
namespace Express {
interface UserInfo {
email: string,
email_verified: boolean,
family_name: string,
given_name: string,
groups: string[],
name: string,
preferred_username: string,
sub: string,
}
interface Request {
getUserInfo(): Promise<UserInfo|undefined>;
noLogging: boolean|undefined;
permissionDetails?: import('role-acl').Permission;
}
interface Response {
initLogout(): boolean;
}
}
}
export {};

View File

@@ -1,5 +0,0 @@
declare namespace Express {
interface Request {
noLogging: boolean|undefined;
}
}

View File

@@ -1,5 +0,0 @@
declare namespace Express {
interface Request {
permissionDetails?: import('role-acl').Permission;
}
}