UNPKG

3.47 kBPlain TextView Raw
1"use strict";
2
3/*************************************************************************
4 *
5 * Troven CONFIDENTIAL
6 * __________________
7 *
8 * (c) 2017-2020 Troven Pty Ltd
9 * All Rights Reserved.
10 *
11 * NOTICE: All information contained herein is, and remains
12 * the property of Troven Pty Ltd and its licensors,
13 * if any. The intellectual and technical concepts contained
14 * herein are proprietary to Troven Pty Ltd
15 * and its suppliers and may be covered by International and Regional Patents,
16 * patents in process, and are protected by trade secret or copyright law.
17 * Dissemination of this information or reproduction of this material
18 * is strictly forbidden unless prior written permission is obtained
19 * from Troven Pty Ltd.
20 */
21
22import * as core from "api-service-core";
23
24import { amqp, cors, harden, KeycloakPlugin, remote_config, prometheus, ua, render, webhooks, UMA } from "./plugins";
25export { amqp, cors, harden, KeycloakPlugin, remote_config, prometheus, ua, render, webhooks, UMA } from "./plugins";
26import { apidocs, api_config, decrypt, encrypt, local_file, redact, redirect, static_assets } from "./middleware";
27export { apidocs, api_config, decrypt, encrypt, local_file, redact, redirect, static_assets } from "./middleware";
28
29export { Chassis, IChassisPlugin, IOperation, IChassisFeature, IChassisDataStore, IChassisConfig, IChassisContext, IChassisMiddleware, IChassisLogger } from "api-service-core";
30
31/*
32 Register all our default plugins
33 These can are installed before the server starts listening
34 */
35let default_plugins = function() {
36 this.registerPlugin( new amqp );
37 this.registerPlugin( new cors );
38 this.registerPlugin( new harden );
39 this.registerPlugin( new KeycloakPlugin );
40 this.registerPlugin( new UMA );
41 this.registerPlugin( new prometheus );
42 this.registerPlugin( new ua );
43 this.registerPlugin( new render );
44 this.registerPlugin( new remote_config );
45 this.registerPlugin( new webhooks );
46
47 this.registerPlugin( new core.PipelinePlugin );
48 this.registerPlugin( new core.after );
49 this.registerPlugin( new core.before );
50 this.registerPlugin( new core.graphql );
51 this.registerPlugin( new core.logging );
52 this.registerPlugin( new core.jwt );
53 this.registerPlugin( new core.payload );
54 this.registerPlugin( new core.OpenAPIPlugin );
55}
56
57/*
58 Register all our middleware plugins
59 These can be attached as chassis:operations to Open API specs
60 */
61let default_middleware = function() {
62 this.registerFn( new core.bower_components );
63 this.registerFn( new core.debug );
64 this.registerFn( new core.DataDict );
65 this.registerFn( new core.echo );
66 this.registerFn( new core.gregarious );
67 this.registerFn( new core.heartbeat );
68 this.registerFn( new core.headers );
69 this.registerFn( new core.mock );
70 this.registerFn( new core.mount );
71 this.registerFn( new core.not_found );
72 this.registerFn( new core.proxy );
73 this.registerFn( new core.request_uuid );
74 this.registerFn( new core.sortby );
75
76 this.registerFn( new apidocs);
77 this.registerFn( new decrypt );
78 this.registerFn( new encrypt );
79 this.registerFn( new local_file );
80 this.registerFn( new api_config );
81 this.registerFn( new redact );
82 this.registerFn( new redirect );
83 this.registerFn( new static_assets );
84}
85
86export function default_features() {
87 default_plugins.apply(this);
88 default_middleware.apply(this);
89}
90