@contember/engine-http 1.1.0-alpha.1 → 1.1.0-alpha.4
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/src/ProjectContainer.d.ts +6 -5
- package/dist/src/ProjectContainer.d.ts.map +1 -1
- package/dist/src/ProjectGroupContainer.d.ts +22 -0
- package/dist/src/ProjectGroupContainer.d.ts.map +1 -0
- package/dist/src/ProjectGroupContainer.js +3 -0
- package/dist/src/ProjectGroupContainer.js.map +1 -0
- package/dist/src/common/Authorizator.d.ts +21 -0
- package/dist/src/common/Authorizator.d.ts.map +1 -0
- package/dist/src/common/Authorizator.js +34 -0
- package/dist/src/common/Authorizator.js.map +1 -0
- package/dist/src/common/ErrorMiddleware.d.ts +10 -0
- package/dist/src/common/ErrorMiddleware.d.ts.map +1 -0
- package/dist/src/common/ErrorMiddleware.js +34 -0
- package/dist/src/common/ErrorMiddleware.js.map +1 -0
- package/dist/src/common/HttpError.d.ts +5 -0
- package/dist/src/common/HttpError.d.ts.map +1 -0
- package/dist/src/common/HttpError.js +11 -0
- package/dist/src/common/HttpError.js.map +1 -0
- package/dist/src/common/TimerMiddleware.d.ts +2 -1
- package/dist/src/common/TimerMiddleware.d.ts.map +1 -1
- package/dist/src/common/TimerMiddleware.js.map +1 -1
- package/dist/src/common/index.d.ts +3 -3
- package/dist/src/common/index.d.ts.map +1 -1
- package/dist/src/common/index.js +3 -3
- package/dist/src/common/index.js.map +1 -1
- package/dist/src/{ProjectConfig.d.ts → config.d.ts} +5 -3
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/{ProjectConfig.js → config.js} +1 -1
- package/dist/src/config.js.map +1 -0
- package/dist/src/content/ContentApiMiddlewareFactory.d.ts +21 -0
- package/dist/src/content/ContentApiMiddlewareFactory.d.ts.map +1 -0
- package/dist/src/content/ContentApiMiddlewareFactory.js +95 -0
- package/dist/src/content/ContentApiMiddlewareFactory.js.map +1 -0
- package/dist/src/content/ContentGraphQLContextFactory.d.ts +26 -0
- package/dist/src/content/ContentGraphQLContextFactory.d.ts.map +1 -0
- package/dist/src/content/ContentGraphQLContextFactory.js +35 -0
- package/dist/src/content/ContentGraphQLContextFactory.js.map +1 -0
- package/dist/src/content/ContentQueryHandlerFactory.d.ts +5 -11
- package/dist/src/content/ContentQueryHandlerFactory.d.ts.map +1 -1
- package/dist/src/content/ContentQueryHandlerFactory.js +5 -36
- package/dist/src/content/ContentQueryHandlerFactory.js.map +1 -1
- package/dist/src/content/GraphQlSchemaFactory.d.ts +2 -2
- package/dist/src/content/GraphQlSchemaFactory.d.ts.map +1 -1
- package/dist/src/content/GraphQlSchemaFactory.js +3 -3
- package/dist/src/content/GraphQlSchemaFactory.js.map +1 -1
- package/dist/src/content/NotModifiedChecker.d.ts +17 -0
- package/dist/src/content/NotModifiedChecker.d.ts.map +1 -0
- package/dist/src/content/NotModifiedChecker.js +32 -0
- package/dist/src/content/NotModifiedChecker.js.map +1 -0
- package/dist/src/content/index.d.ts +3 -4
- package/dist/src/content/index.d.ts.map +1 -1
- package/dist/src/content/index.js +3 -4
- package/dist/src/content/index.js.map +1 -1
- package/dist/src/graphql/execution.d.ts +9 -5
- package/dist/src/graphql/execution.d.ts.map +1 -1
- package/dist/src/graphql/execution.js +10 -11
- package/dist/src/graphql/execution.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/project-common/ProjectGroupResolver.d.ts +16 -0
- package/dist/src/project-common/ProjectGroupResolver.d.ts.map +1 -0
- package/dist/src/project-common/ProjectGroupResolver.js +50 -0
- package/dist/src/project-common/ProjectGroupResolver.js.map +1 -0
- package/dist/src/project-common/ProjectInfoMiddlewareState.d.ts +5 -0
- package/dist/src/project-common/ProjectInfoMiddlewareState.d.ts.map +1 -0
- package/dist/src/project-common/ProjectInfoMiddlewareState.js +3 -0
- package/dist/src/project-common/ProjectInfoMiddlewareState.js.map +1 -0
- package/dist/src/project-common/index.d.ts +2 -3
- package/dist/src/project-common/index.d.ts.map +1 -1
- package/dist/src/project-common/index.js +2 -3
- package/dist/src/project-common/index.js.map +1 -1
- package/dist/src/providers.d.ts +2 -9
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/providers.js +1 -17
- package/dist/src/providers.js.map +1 -1
- package/dist/src/system/SystemApiMiddlewareFactory.d.ts +17 -0
- package/dist/src/system/SystemApiMiddlewareFactory.d.ts.map +1 -0
- package/dist/src/system/SystemApiMiddlewareFactory.js +52 -0
- package/dist/src/system/SystemApiMiddlewareFactory.js.map +1 -0
- package/dist/src/system/SystemGraphQLContextFactory.d.ts +17 -0
- package/dist/src/system/SystemGraphQLContextFactory.d.ts.map +1 -0
- package/dist/src/system/SystemGraphQLContextFactory.js +18 -0
- package/dist/src/system/SystemGraphQLContextFactory.js.map +1 -0
- package/dist/src/system/SystemGraphQLHandlerFactory.d.ts +18 -0
- package/dist/src/system/SystemGraphQLHandlerFactory.d.ts.map +1 -0
- package/dist/src/system/{SystemGraphQLMiddlewareFactory.js → SystemGraphQLHandlerFactory.js} +10 -22
- package/dist/src/system/SystemGraphQLHandlerFactory.js.map +1 -0
- package/dist/src/system/index.d.ts +3 -1
- package/dist/src/system/index.d.ts.map +1 -1
- package/dist/src/system/index.js +3 -1
- package/dist/src/system/index.js.map +1 -1
- package/dist/src/tenant/TenantApiMiddlewareFactory.d.ts +17 -0
- package/dist/src/tenant/TenantApiMiddlewareFactory.d.ts.map +1 -0
- package/dist/src/tenant/TenantApiMiddlewareFactory.js +28 -0
- package/dist/src/tenant/TenantApiMiddlewareFactory.js.map +1 -0
- package/dist/src/tenant/TenantGraphQLContextFactory.d.ts +13 -0
- package/dist/src/tenant/TenantGraphQLContextFactory.d.ts.map +1 -0
- package/dist/src/tenant/TenantGraphQLContextFactory.js +17 -0
- package/dist/src/tenant/TenantGraphQLContextFactory.js.map +1 -0
- package/dist/src/tenant/TenantGraphQLHandlerFactory.d.ts +14 -0
- package/dist/src/tenant/TenantGraphQLHandlerFactory.d.ts.map +1 -0
- package/dist/src/tenant/TenantGraphQLHandlerFactory.js +35 -0
- package/dist/src/tenant/TenantGraphQLHandlerFactory.js.map +1 -0
- package/dist/src/tenant/index.d.ts +3 -1
- package/dist/src/tenant/index.d.ts.map +1 -1
- package/dist/src/tenant/index.js +3 -1
- package/dist/src/tenant/index.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/CryptoWrapper.d.ts +17 -0
- package/dist/src/utils/CryptoWrapper.d.ts.map +1 -0
- package/dist/src/utils/CryptoWrapper.js +64 -0
- package/dist/src/utils/CryptoWrapper.js.map +1 -0
- package/dist/tests/cases/unit/crypto.test.d.ts +2 -0
- package/dist/tests/cases/unit/crypto.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/crypto.test.js +90 -0
- package/dist/tests/cases/unit/crypto.test.js.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -12
- package/src/ProjectContainer.ts +7 -5
- package/src/ProjectGroupContainer.ts +32 -0
- package/src/common/Authorizator.ts +47 -0
- package/src/common/ErrorMiddleware.ts +32 -0
- package/src/common/HttpError.ts +8 -0
- package/src/common/TimerMiddleware.ts +3 -1
- package/src/common/index.ts +3 -3
- package/src/{ProjectConfig.ts → config.ts} +3 -6
- package/src/content/ContentApiMiddlewareFactory.ts +128 -0
- package/src/content/ContentGraphQLContextFactory.ts +58 -0
- package/src/content/ContentQueryHandlerFactory.ts +8 -62
- package/src/content/GraphQlSchemaFactory.ts +7 -7
- package/src/content/NotModifiedChecker.ts +43 -0
- package/src/content/index.ts +3 -4
- package/src/graphql/execution.ts +14 -18
- package/src/index.ts +4 -1
- package/src/project-common/ProjectGroupResolver.ts +56 -0
- package/src/project-common/ProjectInfoMiddlewareState.ts +4 -0
- package/src/project-common/index.ts +2 -3
- package/src/providers.ts +2 -19
- package/src/system/SystemApiMiddlewareFactory.ts +73 -0
- package/src/system/SystemGraphQLContextFactory.ts +34 -0
- package/src/system/SystemGraphQLHandlerFactory.ts +72 -0
- package/src/system/index.ts +3 -1
- package/src/tenant/TenantApiMiddlewareFactory.ts +38 -0
- package/src/tenant/TenantGraphQLContextFactory.ts +25 -0
- package/src/tenant/TenantGraphQLHandlerFactory.ts +44 -0
- package/src/tenant/index.ts +3 -1
- package/src/utils/CryptoWrapper.ts +45 -0
- package/tests/cases/unit/crypto.test.ts +78 -0
- package/tests/tsconfig.json +12 -0
- package/tsconfig.json +3 -0
- package/dist/src/ProjectConfig.d.ts.map +0 -1
- package/dist/src/ProjectConfig.js.map +0 -1
- package/dist/src/common/ApiMiddleware.d.ts +0 -12
- package/dist/src/common/ApiMiddleware.d.ts.map +0 -1
- package/dist/src/common/ApiMiddleware.js +0 -25
- package/dist/src/common/ApiMiddleware.js.map +0 -1
- package/dist/src/common/AuthMiddleware.d.ts +0 -20
- package/dist/src/common/AuthMiddleware.d.ts.map +0 -1
- package/dist/src/common/AuthMiddleware.js +0 -38
- package/dist/src/common/AuthMiddleware.js.map +0 -1
- package/dist/src/common/ErrorFactory.d.ts +0 -8
- package/dist/src/common/ErrorFactory.d.ts.map +0 -1
- package/dist/src/common/ErrorFactory.js +0 -21
- package/dist/src/common/ErrorFactory.js.map +0 -1
- package/dist/src/content/ContentQueryHandlerProvider.d.ts +0 -15
- package/dist/src/content/ContentQueryHandlerProvider.d.ts.map +0 -1
- package/dist/src/content/ContentQueryHandlerProvider.js +0 -26
- package/dist/src/content/ContentQueryHandlerProvider.js.map +0 -1
- package/dist/src/content/ContentServerMiddleware.d.ts +0 -15
- package/dist/src/content/ContentServerMiddleware.d.ts.map +0 -1
- package/dist/src/content/ContentServerMiddleware.js +0 -21
- package/dist/src/content/ContentServerMiddleware.js.map +0 -1
- package/dist/src/content/NotModifiedMiddlewareFactory.d.ts +0 -11
- package/dist/src/content/NotModifiedMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/content/NotModifiedMiddlewareFactory.js +0 -37
- package/dist/src/content/NotModifiedMiddlewareFactory.js.map +0 -1
- package/dist/src/content/StageResolveMiddlewareFactory.d.ts +0 -16
- package/dist/src/content/StageResolveMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/content/StageResolveMiddlewareFactory.js +0 -22
- package/dist/src/content/StageResolveMiddlewareFactory.js.map +0 -1
- package/dist/src/project-common/ProjectGroupMiddleware.d.ts +0 -17
- package/dist/src/project-common/ProjectGroupMiddleware.d.ts.map +0 -1
- package/dist/src/project-common/ProjectGroupMiddleware.js +0 -33
- package/dist/src/project-common/ProjectGroupMiddleware.js.map +0 -1
- package/dist/src/project-common/ProjectMemberMiddlewareFactory.d.ts +0 -25
- package/dist/src/project-common/ProjectMemberMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/project-common/ProjectMemberMiddlewareFactory.js +0 -29
- package/dist/src/project-common/ProjectMemberMiddlewareFactory.js.map +0 -1
- package/dist/src/project-common/ProjectResolveMiddlewareFactory.d.ts +0 -19
- package/dist/src/project-common/ProjectResolveMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/project-common/ProjectResolveMiddlewareFactory.js +0 -24
- package/dist/src/project-common/ProjectResolveMiddlewareFactory.js.map +0 -1
- package/dist/src/system/SystemGraphQLMiddlewareFactory.d.ts +0 -20
- package/dist/src/system/SystemGraphQLMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/system/SystemGraphQLMiddlewareFactory.js.map +0 -1
- package/dist/src/tenant/TenantGraphQLMiddlewareFactory.d.ts +0 -20
- package/dist/src/tenant/TenantGraphQLMiddlewareFactory.d.ts.map +0 -1
- package/dist/src/tenant/TenantGraphQLMiddlewareFactory.js +0 -46
- package/dist/src/tenant/TenantGraphQLMiddlewareFactory.js.map +0 -1
- package/src/common/ApiMiddleware.ts +0 -24
- package/src/common/AuthMiddleware.ts +0 -56
- package/src/common/ErrorFactory.ts +0 -21
- package/src/content/ContentQueryHandlerProvider.ts +0 -33
- package/src/content/ContentServerMiddleware.ts +0 -40
- package/src/content/NotModifiedMiddlewareFactory.ts +0 -44
- package/src/content/StageResolveMiddlewareFactory.ts +0 -39
- package/src/project-common/ProjectGroupMiddleware.ts +0 -50
- package/src/project-common/ProjectMemberMiddlewareFactory.ts +0 -53
- package/src/project-common/ProjectResolveMiddlewareFactory.ts +0 -43
- package/src/system/SystemGraphQLMiddlewareFactory.ts +0 -100
- package/src/tenant/TenantGraphQLMiddlewareFactory.ts +0 -56
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ApiKeyManager, DatabaseContext, VerifyResult } from '@contember/engine-tenant-api'
|
|
2
|
+
import { Timer } from './TimerMiddleware'
|
|
3
|
+
import { HttpError } from './HttpError'
|
|
4
|
+
import { Request } from 'koa'
|
|
5
|
+
|
|
6
|
+
export type AuthResult =
|
|
7
|
+
& VerifyResult
|
|
8
|
+
& { assumedIdentityId?: string }
|
|
9
|
+
|
|
10
|
+
export interface AuthMiddlewareState {
|
|
11
|
+
authResult: AuthResult
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const assumeIdentityHeader = 'x-contember-assume-identity'
|
|
15
|
+
|
|
16
|
+
export class Authenticator {
|
|
17
|
+
private createAuthError = (message: string) => new HttpError(`Authorization failure: ${message}`, 401)
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly tenantDatabase: DatabaseContext,
|
|
21
|
+
private readonly apiKeyManager: ApiKeyManager,
|
|
22
|
+
) {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public async authenticate({ request, timer }: { request: Request; timer: Timer }): Promise<AuthResult> {
|
|
26
|
+
const authHeader = request.get('Authorization')
|
|
27
|
+
if (typeof authHeader !== 'string' || authHeader === '') {
|
|
28
|
+
throw this.createAuthError(`Authorization header is missing`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const authHeaderPattern = /^Bearer\s+(\w+)$/i
|
|
32
|
+
|
|
33
|
+
const match = authHeader.match(authHeaderPattern)
|
|
34
|
+
if (match === null) {
|
|
35
|
+
throw this.createAuthError(`invalid Authorization header format`)
|
|
36
|
+
}
|
|
37
|
+
const [, token] = match
|
|
38
|
+
const authResult = await timer('Auth', () => this.apiKeyManager.verifyAndProlong(this.tenantDatabase, token))
|
|
39
|
+
if (!authResult.ok) {
|
|
40
|
+
throw this.createAuthError(authResult.errorMessage)
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
...authResult.result,
|
|
44
|
+
assumedIdentityId: request.get(assumeIdentityHeader) || undefined,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { KoaMiddleware } from '../koa'
|
|
2
|
+
import { HttpError } from './HttpError'
|
|
3
|
+
import { AuthResult } from './Authorizator'
|
|
4
|
+
|
|
5
|
+
export class ErrorMiddlewareFactory {
|
|
6
|
+
constructor(
|
|
7
|
+
private readonly debug: boolean,
|
|
8
|
+
) {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public create(): KoaMiddleware<{ authResult?: AuthResult }> {
|
|
12
|
+
return async (ctx, next) => {
|
|
13
|
+
try {
|
|
14
|
+
await next()
|
|
15
|
+
} catch (e) {
|
|
16
|
+
if (e instanceof HttpError) {
|
|
17
|
+
ctx.set('Content-type', 'application/json')
|
|
18
|
+
ctx.status = e.code
|
|
19
|
+
const body: any = { errors: [{ message: e.message, code: e.code }] }
|
|
20
|
+
if (this.debug && ctx.state.authResult) {
|
|
21
|
+
body.identity = {
|
|
22
|
+
roles: ctx.state.authResult.roles,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
ctx.body = JSON.stringify(body)
|
|
26
|
+
} else {
|
|
27
|
+
throw e
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -2,8 +2,10 @@ import { KoaMiddleware } from '../koa'
|
|
|
2
2
|
|
|
3
3
|
type EventTime = { label: string; start: number; duration?: number }
|
|
4
4
|
|
|
5
|
+
export type Timer = <T>(event: string, cb?: () => T) => Promise<T>
|
|
6
|
+
|
|
5
7
|
export interface TimerMiddlewareState {
|
|
6
|
-
timer:
|
|
8
|
+
timer: Timer
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const createTimerMiddleware = (): KoaMiddleware<TimerMiddlewareState> => {
|
package/src/common/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './Authorizator'
|
|
2
|
+
export * from './HttpError'
|
|
3
|
+
export * from './ErrorMiddleware'
|
|
4
4
|
export * from './ModuleInfoMiddleware'
|
|
5
5
|
export * from './PoweredByHeaderMiddleware'
|
|
6
6
|
export * from './TimerMiddleware'
|
|
@@ -5,7 +5,7 @@ export type ProjectConfig = {
|
|
|
5
5
|
readonly alias?: string[]
|
|
6
6
|
readonly name: string
|
|
7
7
|
readonly stages: StageConfig[]
|
|
8
|
-
readonly db: DatabaseCredentials
|
|
8
|
+
readonly db: DatabaseCredentials & { systemSchema?: string }
|
|
9
9
|
} & Record<string, unknown>
|
|
10
10
|
|
|
11
11
|
export interface StageConfig {
|
|
@@ -13,8 +13,5 @@ export interface StageConfig {
|
|
|
13
13
|
readonly name: string
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
additionalConfig: any,
|
|
19
|
-
secrets: Record<string, string>,
|
|
20
|
-
) => ProjectConfig
|
|
16
|
+
export type ProjectSecrets = Record<string, string>
|
|
17
|
+
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { KoaMiddleware, KoaRequestState } from '../koa'
|
|
2
|
+
import { ProjectGroupResolver, ProjectInfoMiddlewareState } from '../project-common'
|
|
3
|
+
import { AuthResult, HttpError, TimerMiddlewareState } from '../common'
|
|
4
|
+
import { StageBySlugQuery } from '@contember/engine-system-api'
|
|
5
|
+
import { NotModifiedChecker } from './NotModifiedChecker'
|
|
6
|
+
import { ContentGraphQLContextFactory } from './ContentGraphQLContextFactory'
|
|
7
|
+
import { ContentQueryHandler, ContentQueryHandlerFactory } from './ContentQueryHandlerFactory'
|
|
8
|
+
import { GraphQLSchema } from 'graphql'
|
|
9
|
+
import { GraphQLKoaState } from '../graphql'
|
|
10
|
+
|
|
11
|
+
type ContentApiMiddlewareKoaState =
|
|
12
|
+
& TimerMiddlewareState
|
|
13
|
+
& KoaRequestState
|
|
14
|
+
& GraphQLKoaState
|
|
15
|
+
& ProjectInfoMiddlewareState
|
|
16
|
+
& { authResult: AuthResult }
|
|
17
|
+
|
|
18
|
+
export class ContentApiMiddlewareFactory {
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly debug: boolean,
|
|
21
|
+
private readonly projectGroupResolver: ProjectGroupResolver,
|
|
22
|
+
private readonly notModifiedChecker: NotModifiedChecker,
|
|
23
|
+
private readonly contentGraphqlContextFactory: ContentGraphQLContextFactory,
|
|
24
|
+
private readonly handlerFactory: ContentQueryHandlerFactory,
|
|
25
|
+
) {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
create(): KoaMiddleware<ContentApiMiddlewareKoaState> {
|
|
29
|
+
const handlerCache = new WeakMap<GraphQLSchema, ContentQueryHandler>()
|
|
30
|
+
|
|
31
|
+
return async koaContext => {
|
|
32
|
+
const { request, response, state: { timer, params } } = koaContext
|
|
33
|
+
const groupContainer = await this.projectGroupResolver.resolveContainer({ request })
|
|
34
|
+
koaContext.state.projectGroup = groupContainer.slug
|
|
35
|
+
|
|
36
|
+
const authResult = await groupContainer.authenticator.authenticate({ request, timer })
|
|
37
|
+
koaContext.state.authResult = authResult
|
|
38
|
+
|
|
39
|
+
const projectSlug = params.projectSlug
|
|
40
|
+
const projectContainer = await groupContainer.projectContainerResolver.getProjectContainer(projectSlug, true)
|
|
41
|
+
if (projectContainer === undefined) {
|
|
42
|
+
throw new HttpError(`Project ${projectSlug} NOT found`, 404)
|
|
43
|
+
}
|
|
44
|
+
const project = projectContainer.project
|
|
45
|
+
koaContext.state.project = project.slug
|
|
46
|
+
|
|
47
|
+
const systemDatabase = projectContainer.systemDatabaseContextFactory.create()
|
|
48
|
+
const stage = await systemDatabase.queryHandler.fetch(new StageBySlugQuery(params.stageSlug))
|
|
49
|
+
if (!stage) {
|
|
50
|
+
throw new HttpError(`Stage ${params.stageSlug} NOT found`, 404)
|
|
51
|
+
}
|
|
52
|
+
const notModifiedRes = await this.notModifiedChecker.checkNotModified({
|
|
53
|
+
request,
|
|
54
|
+
timer,
|
|
55
|
+
systemDatabase,
|
|
56
|
+
stageSlug: stage.slug,
|
|
57
|
+
})
|
|
58
|
+
if (notModifiedRes?.isModified === false) {
|
|
59
|
+
response.status = 304
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const tenantContainer = groupContainer.tenantContainer
|
|
64
|
+
const explicitMemberships = await timer('MembershipFetch', () =>
|
|
65
|
+
tenantContainer.projectMemberManager.getProjectMemberships(
|
|
66
|
+
tenantContainer.databaseContext,
|
|
67
|
+
{ slug: project.slug },
|
|
68
|
+
{
|
|
69
|
+
id: authResult.identityId,
|
|
70
|
+
roles: authResult.roles,
|
|
71
|
+
},
|
|
72
|
+
undefined,
|
|
73
|
+
),
|
|
74
|
+
)
|
|
75
|
+
const schema = await projectContainer.contentSchemaResolver.getSchema(systemDatabase, stage.slug)
|
|
76
|
+
const implicitRoles = Object.entries(schema.acl.roles).filter(([, role]) => role.implicit).map(([name]) => name)
|
|
77
|
+
|
|
78
|
+
if (explicitMemberships.length === 0 && implicitRoles.length === 0) {
|
|
79
|
+
throw this.debug
|
|
80
|
+
? new HttpError(`You are not allowed to access project ${project.slug}`, 403)
|
|
81
|
+
: new HttpError(`Project ${project.slug} NOT found`, 404)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const explicitProjectRoles = explicitMemberships.map(it => it.role)
|
|
85
|
+
const implicitRolesToAssign = implicitRoles.filter(it => !explicitProjectRoles.includes(it))
|
|
86
|
+
const memberships = [
|
|
87
|
+
...explicitMemberships,
|
|
88
|
+
...implicitRolesToAssign.map(it => ({ role: it, variables: [] })),
|
|
89
|
+
]
|
|
90
|
+
const projectRoles = [...explicitProjectRoles, ...implicitRolesToAssign]
|
|
91
|
+
const contentDatabase = projectContainer.connection.createClient(stage.schema, { module: 'content' })
|
|
92
|
+
|
|
93
|
+
const [graphQlSchema, permissions] = await timer('GraphQLSchemaCreate', () => projectContainer.graphQlSchemaFactory.create(schema, {
|
|
94
|
+
projectRoles: projectRoles,
|
|
95
|
+
}))
|
|
96
|
+
|
|
97
|
+
const handler = await (async () => {
|
|
98
|
+
const existingHandler = handlerCache.get(graphQlSchema)
|
|
99
|
+
if (existingHandler) {
|
|
100
|
+
return existingHandler
|
|
101
|
+
}
|
|
102
|
+
const newHandler = await this.handlerFactory.create(graphQlSchema, project.slug)
|
|
103
|
+
handlerCache.set(graphQlSchema, newHandler)
|
|
104
|
+
return newHandler
|
|
105
|
+
})()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const graphqlContext = this.contentGraphqlContextFactory.create({
|
|
109
|
+
db: contentDatabase,
|
|
110
|
+
authResult,
|
|
111
|
+
memberships,
|
|
112
|
+
permissions,
|
|
113
|
+
schema,
|
|
114
|
+
timer,
|
|
115
|
+
koaContext,
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
await timer('GraphQL', () => handler({
|
|
119
|
+
request,
|
|
120
|
+
response,
|
|
121
|
+
context: graphqlContext,
|
|
122
|
+
}))
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
notModifiedRes?.setResponseHeader(response)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getArgumentValues } from 'graphql/execution/values'
|
|
2
|
+
|
|
3
|
+
import { Context, createAclVariables, ExecutionContainerFactory } from '@contember/engine-content-api'
|
|
4
|
+
import { setupSystemVariables } from '@contember/engine-system-api'
|
|
5
|
+
import { Client } from '@contember/database'
|
|
6
|
+
import { Acl, Schema } from '@contember/schema'
|
|
7
|
+
import { Membership } from '@contember/engine-tenant-api'
|
|
8
|
+
|
|
9
|
+
import { AuthResult, Timer } from '../common'
|
|
10
|
+
import { KoaContext } from '../koa'
|
|
11
|
+
import { Providers } from '../providers'
|
|
12
|
+
import { GraphQLKoaState } from '../graphql'
|
|
13
|
+
|
|
14
|
+
export type ExtendedGraphqlContext = Context & { identityId: string; koaContext: KoaContext<GraphQLKoaState> }
|
|
15
|
+
|
|
16
|
+
export class ContentGraphQLContextFactory {
|
|
17
|
+
constructor(
|
|
18
|
+
private providers: Providers,
|
|
19
|
+
) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
create({ db, schema, authResult, memberships, permissions, timer, koaContext }: {
|
|
23
|
+
db: Client
|
|
24
|
+
schema: Schema
|
|
25
|
+
permissions: Acl.Permissions
|
|
26
|
+
authResult: AuthResult
|
|
27
|
+
memberships: readonly Membership[]
|
|
28
|
+
timer: Timer
|
|
29
|
+
koaContext: KoaContext<GraphQLKoaState>
|
|
30
|
+
}): ExtendedGraphqlContext {
|
|
31
|
+
const partialContext = {
|
|
32
|
+
db,
|
|
33
|
+
identityId: authResult.identityId,
|
|
34
|
+
identityVariables: createAclVariables(schema.acl, {
|
|
35
|
+
...authResult,
|
|
36
|
+
memberships,
|
|
37
|
+
}),
|
|
38
|
+
}
|
|
39
|
+
let identityId = authResult.identityId
|
|
40
|
+
if (
|
|
41
|
+
authResult.assumedIdentityId &&
|
|
42
|
+
Object.values(schema.acl.roles).find(it => it.system?.assumeIdentity)
|
|
43
|
+
) {
|
|
44
|
+
identityId = authResult.assumedIdentityId
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const executionContainer = new ExecutionContainerFactory(schema, permissions, this.providers, getArgumentValues, db =>
|
|
48
|
+
setupSystemVariables(db, identityId, this.providers),
|
|
49
|
+
).create(partialContext)
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
...partialContext,
|
|
53
|
+
executionContainer,
|
|
54
|
+
timer,
|
|
55
|
+
koaContext,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql'
|
|
2
|
-
import { Context, createAclVariables, ExecutionContainerFactory } from '@contember/engine-content-api'
|
|
3
2
|
import {
|
|
4
3
|
createDbQueriesListener,
|
|
5
4
|
createErrorListener,
|
|
6
5
|
createGraphQLQueryHandler,
|
|
7
6
|
createGraphqlRequestInfoProviderListener,
|
|
8
7
|
ErrorLogger,
|
|
9
|
-
|
|
10
|
-
GraphQLListener,
|
|
8
|
+
GraphQLListener, GraphQLQueryHandler,
|
|
11
9
|
} from '../graphql'
|
|
12
|
-
import {
|
|
13
|
-
import { ProjectMemberMiddlewareState } from '../project-common'
|
|
14
|
-
import { getArgumentValues } from 'graphql/execution/values'
|
|
15
|
-
import { setupSystemVariables } from '@contember/engine-system-api'
|
|
16
|
-
import { v4 as uuidv4 } from 'uuid'
|
|
17
|
-
import { Acl, Schema } from '@contember/schema'
|
|
18
|
-
import { ContentServerMiddlewareState } from './ContentServerMiddleware'
|
|
19
|
-
import { AuthMiddlewareState, TimerMiddlewareState } from '../common'
|
|
10
|
+
import { ExtendedGraphqlContext } from './ContentGraphQLContextFactory'
|
|
20
11
|
|
|
21
|
-
export type
|
|
22
|
-
& ProjectMemberMiddlewareState
|
|
23
|
-
& ContentServerMiddlewareState
|
|
24
|
-
& TimerMiddlewareState
|
|
25
|
-
& AuthMiddlewareState
|
|
26
|
-
& GraphQLKoaState
|
|
27
|
-
|
|
28
|
-
type InputKoaContext = KoaContext<KoaState>
|
|
29
|
-
|
|
30
|
-
type ExtendedGraphqlContext = Context & { koaContext: KoaContext<KoaState> }
|
|
12
|
+
export type ContentQueryHandler = GraphQLQueryHandler<ExtendedGraphqlContext>
|
|
31
13
|
|
|
32
14
|
export class ContentQueryHandlerFactory {
|
|
33
15
|
constructor(
|
|
34
|
-
private readonly projectName: string,
|
|
35
16
|
private readonly debug: boolean,
|
|
36
17
|
private readonly errorLogger: ErrorLogger,
|
|
37
18
|
) {}
|
|
38
19
|
|
|
39
|
-
public create(
|
|
20
|
+
public create(graphQlSchema: GraphQLSchema, projectSlug: string): ContentQueryHandler {
|
|
40
21
|
const listeners: GraphQLListener<ExtendedGraphqlContext>[] = [
|
|
41
22
|
createErrorListener((err, ctx) => {
|
|
42
23
|
this.errorLogger(err, {
|
|
43
24
|
body: ctx.koaContext.request.body as string,
|
|
44
25
|
url: ctx.koaContext.request.originalUrl,
|
|
45
|
-
user: ctx.
|
|
26
|
+
user: ctx.identityId,
|
|
46
27
|
module: 'content',
|
|
47
|
-
project:
|
|
28
|
+
project: projectSlug,
|
|
48
29
|
})
|
|
49
30
|
}),
|
|
50
31
|
createGraphqlRequestInfoProviderListener(),
|
|
@@ -53,44 +34,9 @@ export class ContentQueryHandlerFactory {
|
|
|
53
34
|
listeners.push(createDbQueriesListener(context => context.db))
|
|
54
35
|
}
|
|
55
36
|
|
|
56
|
-
return createGraphQLQueryHandler<ExtendedGraphqlContext
|
|
57
|
-
schema:
|
|
58
|
-
contextFactory: ctx => this.createGraphqlContext(permissions, schema, ctx),
|
|
37
|
+
return createGraphQLQueryHandler<ExtendedGraphqlContext>({
|
|
38
|
+
schema: graphQlSchema,
|
|
59
39
|
listeners,
|
|
60
40
|
})
|
|
61
41
|
}
|
|
62
|
-
|
|
63
|
-
private createGraphqlContext(
|
|
64
|
-
permissions: Acl.Permissions,
|
|
65
|
-
schema: Schema,
|
|
66
|
-
ctx: InputKoaContext,
|
|
67
|
-
): ExtendedGraphqlContext {
|
|
68
|
-
const partialContext = {
|
|
69
|
-
db: ctx.state.db,
|
|
70
|
-
identityVariables: createAclVariables(schema.acl, {
|
|
71
|
-
...ctx.state.authResult,
|
|
72
|
-
memberships: ctx.state.projectMemberships,
|
|
73
|
-
}),
|
|
74
|
-
}
|
|
75
|
-
const providers = {
|
|
76
|
-
uuid: () => uuidv4(),
|
|
77
|
-
now: () => new Date(),
|
|
78
|
-
}
|
|
79
|
-
let identityId = ctx.state.authResult.identityId
|
|
80
|
-
if (
|
|
81
|
-
ctx.state.authResult.assumedIdentityId &&
|
|
82
|
-
Object.values(schema.acl.roles).find(it => it.system?.assumeIdentity)
|
|
83
|
-
) {
|
|
84
|
-
identityId = ctx.state.authResult.assumedIdentityId
|
|
85
|
-
}
|
|
86
|
-
const executionContainer = new ExecutionContainerFactory(schema, permissions, providers, getArgumentValues, db =>
|
|
87
|
-
setupSystemVariables(db, identityId, providers),
|
|
88
|
-
).create(partialContext)
|
|
89
|
-
return {
|
|
90
|
-
...partialContext,
|
|
91
|
-
executionContainer,
|
|
92
|
-
timer: ctx.state.timer,
|
|
93
|
-
koaContext: ctx,
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
42
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Acl, Schema } from '@contember/schema'
|
|
2
|
-
import { GraphQLSchema } from 'graphql'
|
|
3
1
|
import {
|
|
4
2
|
EntityRulesResolver,
|
|
5
3
|
GraphQlSchemaBuilderFactory,
|
|
6
4
|
Identity,
|
|
7
5
|
IntrospectionSchemaDefinitionFactory,
|
|
6
|
+
IntrospectionSchemaFactory,
|
|
8
7
|
PermissionsByIdentityFactory,
|
|
9
8
|
Authorizator,
|
|
10
|
-
IntrospectionSchemaFactory,
|
|
11
9
|
} from '@contember/engine-content-api'
|
|
10
|
+
import { Acl, Schema } from '@contember/schema'
|
|
11
|
+
import { GraphQLSchema } from 'graphql'
|
|
12
12
|
import { mergeSchemas } from '@graphql-tools/merge'
|
|
13
13
|
import { makeExecutableSchema } from '@graphql-tools/schema'
|
|
14
14
|
import { GraphQLSchemaContributor } from '@contember/engine-plugins'
|
|
@@ -32,10 +32,6 @@ export class GraphQlSchemaFactory {
|
|
|
32
32
|
private readonly schemaContributors: GraphQLSchemaContributor[],
|
|
33
33
|
) {}
|
|
34
34
|
|
|
35
|
-
private getContributorsCacheKey(ctx: Context): string {
|
|
36
|
-
return JSON.stringify(this.schemaContributors.map(it => it.getCacheKey(ctx)))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
35
|
public create(schema: Schema, identity: Identity): [GraphQLSchema, Acl.Permissions] {
|
|
40
36
|
let cacheEntries = this.cache.get(schema)
|
|
41
37
|
const contributorsCacheKey = this.getContributorsCacheKey({ schema, identity })
|
|
@@ -80,4 +76,8 @@ export class GraphQlSchemaFactory {
|
|
|
80
76
|
|
|
81
77
|
return [graphQlSchema, permissions]
|
|
82
78
|
}
|
|
79
|
+
|
|
80
|
+
private getContributorsCacheKey(ctx: Context): string {
|
|
81
|
+
return JSON.stringify(this.schemaContributors.map(it => it.getCacheKey(ctx)))
|
|
82
|
+
}
|
|
83
83
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DatabaseContext, LatestTransactionIdByStageQuery } from '@contember/engine-system-api'
|
|
2
|
+
import { Timer } from '../common'
|
|
3
|
+
import { Request, Response } from 'koa'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const NotModifiedHeaderName = 'x-contember-ref'
|
|
7
|
+
|
|
8
|
+
export interface NotModifiedCheckResult {
|
|
9
|
+
isModified: boolean
|
|
10
|
+
setResponseHeader: (response: Response) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class NotModifiedChecker {
|
|
14
|
+
public async checkNotModified({ request, timer, systemDatabase, stageSlug }: {
|
|
15
|
+
request: Request
|
|
16
|
+
timer: Timer
|
|
17
|
+
systemDatabase: DatabaseContext
|
|
18
|
+
stageSlug: string
|
|
19
|
+
}): Promise<NotModifiedCheckResult | null> {
|
|
20
|
+
if (request.headers[NotModifiedHeaderName] === undefined) {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
const requestRef = request.get(NotModifiedHeaderName)
|
|
24
|
+
const body = request.body
|
|
25
|
+
const isMutation = typeof body === 'object' && 'query' in body && String(body.query).includes('mutation')
|
|
26
|
+
if (isMutation) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
const latestRef = await timer('NotModifiedCheck', () => {
|
|
30
|
+
const queryHandler = systemDatabase.queryHandler
|
|
31
|
+
return queryHandler.fetch(new LatestTransactionIdByStageQuery(stageSlug))
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
isModified: latestRef !== requestRef,
|
|
36
|
+
setResponseHeader: res => {
|
|
37
|
+
if (res.status === 200) {
|
|
38
|
+
res.set(NotModifiedHeaderName, latestRef)
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/content/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
export * from './ContentApiMiddlewareFactory'
|
|
2
|
+
export * from './ContentGraphQLContextFactory'
|
|
1
3
|
export * from './ContentQueryHandlerFactory'
|
|
2
4
|
export * from './ContentSchemaResolver'
|
|
3
|
-
export * from './ContentServerMiddleware'
|
|
4
|
-
export * from './ContentQueryHandlerProvider'
|
|
5
5
|
export * from './GraphQlSchemaFactory'
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './StageResolveMiddlewareFactory'
|
|
6
|
+
export * from './NotModifiedChecker'
|
package/src/graphql/execution.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentNode, execute, GraphQLError, GraphQLSchema, parse, validate, validateSchema } from 'graphql'
|
|
2
|
-
import { KoaContext } from '../koa'
|
|
3
2
|
import LRUCache from 'lru-cache'
|
|
4
3
|
import { createHash } from 'crypto'
|
|
4
|
+
import { Request, Response } from 'koa'
|
|
5
5
|
|
|
6
6
|
export interface GraphQLListener<Context> {
|
|
7
7
|
onStart?: (ctx: {}) => Omit<GraphQLListener<Context>, 'onStart'> | void
|
|
@@ -18,13 +18,12 @@ export interface GraphQLListener<Context> {
|
|
|
18
18
|
}) => Omit<GraphQLListener<Context>, 'onStart' | 'onExecute' | 'onResponse' | 'onShutdown'> | void
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
interface FactoryArgs<Context
|
|
21
|
+
interface FactoryArgs<Context> {
|
|
22
22
|
schema: GraphQLSchema
|
|
23
|
-
contextFactory: (ctx: KoaContext<KoaState>) => Context | Promise<Context>
|
|
24
23
|
listeners: GraphQLListener<Context>[]
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
export type GraphQLQueryHandler<
|
|
26
|
+
export type GraphQLQueryHandler<Context> = (args: {request: Request; response: Response; context: Context }) => any
|
|
28
27
|
|
|
29
28
|
const hitCacheMaxAgeSeconds = 10 * 60
|
|
30
29
|
const documentCacheMaxAgeSeconds = hitCacheMaxAgeSeconds * 10
|
|
@@ -32,11 +31,10 @@ const pruneIntervalSeconds = documentCacheMaxAgeSeconds / 2
|
|
|
32
31
|
const documentCacheMax = 100
|
|
33
32
|
const hitCacheMax = documentCacheMax * 2
|
|
34
33
|
|
|
35
|
-
export const createGraphQLQueryHandler = <Context
|
|
34
|
+
export const createGraphQLQueryHandler = <Context>({
|
|
36
35
|
schema,
|
|
37
|
-
contextFactory,
|
|
38
36
|
listeners,
|
|
39
|
-
}: FactoryArgs<Context
|
|
37
|
+
}: FactoryArgs<Context>): GraphQLQueryHandler<Context> => {
|
|
40
38
|
let schemaValidated = false
|
|
41
39
|
const hitCache = new LRUCache<string, true>({
|
|
42
40
|
max: hitCacheMax,
|
|
@@ -48,14 +46,13 @@ export const createGraphQLQueryHandler = <Context, KoaState>({
|
|
|
48
46
|
})
|
|
49
47
|
let lastPrune = Date.now()
|
|
50
48
|
|
|
51
|
-
return async
|
|
49
|
+
return async ({ request, response, context }) => {
|
|
52
50
|
|
|
53
51
|
const now = Date.now()
|
|
54
52
|
if ((now - lastPrune) > pruneIntervalSeconds * 1000) {
|
|
55
53
|
documentCache.prune()
|
|
56
54
|
lastPrune = now
|
|
57
55
|
}
|
|
58
|
-
|
|
59
56
|
const listenersQueue = [...listeners]
|
|
60
57
|
|
|
61
58
|
listenersQueue.forEach(it => {
|
|
@@ -63,9 +60,9 @@ export const createGraphQLQueryHandler = <Context, KoaState>({
|
|
|
63
60
|
})
|
|
64
61
|
|
|
65
62
|
const respond = (code: number, data: any) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
response.status = code
|
|
64
|
+
response.body = JSON.stringify(data)
|
|
65
|
+
response.set('Content-type', 'application/json')
|
|
69
66
|
|
|
70
67
|
listenersQueue.forEach(it => {
|
|
71
68
|
it.onShutdown && listenersQueue.push(it.onShutdown({ response: data }) || {})
|
|
@@ -81,17 +78,17 @@ export const createGraphQLQueryHandler = <Context, KoaState>({
|
|
|
81
78
|
}
|
|
82
79
|
schemaValidated = true
|
|
83
80
|
}
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
81
|
+
const resolvedRequest = request.method === 'POST' ? (request.body as any) : request.query
|
|
82
|
+
if (!resolvedRequest.query) {
|
|
86
83
|
return respond(400, {
|
|
87
84
|
errors: { message: 'Missing request query' },
|
|
88
85
|
})
|
|
89
86
|
}
|
|
90
|
-
const queryHash = createHash('md5').update(
|
|
87
|
+
const queryHash = createHash('md5').update(resolvedRequest.query).digest('hex')
|
|
91
88
|
let doc = documentCache.get(queryHash)
|
|
92
89
|
if (!doc) {
|
|
93
90
|
try {
|
|
94
|
-
doc = parse(
|
|
91
|
+
doc = parse(resolvedRequest.query)
|
|
95
92
|
const validationResult = validate(schema, doc)
|
|
96
93
|
if (validationResult.length) {
|
|
97
94
|
return respond(400, { errors: validationResult })
|
|
@@ -109,14 +106,13 @@ export const createGraphQLQueryHandler = <Context, KoaState>({
|
|
|
109
106
|
}
|
|
110
107
|
const document = doc
|
|
111
108
|
|
|
112
|
-
const context = await contextFactory(ctx)
|
|
113
109
|
listenersQueue.forEach(it => {
|
|
114
110
|
it.onExecute && listenersQueue.push(it.onExecute({ context, document }) || {})
|
|
115
111
|
})
|
|
116
112
|
const response = await execute({
|
|
117
113
|
schema,
|
|
118
114
|
document,
|
|
119
|
-
variableValues:
|
|
115
|
+
variableValues: resolvedRequest.variables,
|
|
120
116
|
contextValue: context,
|
|
121
117
|
})
|
|
122
118
|
listenersQueue.forEach(it => {
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,11 @@ export * from './tenant'
|
|
|
7
7
|
export * from './koa'
|
|
8
8
|
export * from './providers'
|
|
9
9
|
export * from './ProjectContainer'
|
|
10
|
+
export * from './ProjectGroupContainer'
|
|
10
11
|
export * from './graphql'
|
|
11
|
-
export * from './
|
|
12
|
+
export * from './config'
|
|
13
|
+
export * from './utils/CryptoWrapper'
|
|
14
|
+
|
|
12
15
|
import Koa from 'koa'
|
|
13
16
|
|
|
14
17
|
export { Koa }
|