dce-expresskit
Version:
Shared functions, helpers, and tools for Harvard DCE Express-based servers
46 lines (45 loc) • 2.12 kB
TypeScript
import express from 'express';
import { Collection } from 'dce-mango';
import { Log } from 'dce-reactkit';
import CrossServerCredential from '../types/CrossServerCredential';
/**
* Get log collection
* @author Gabe Abrams
* @returns log collection if one was included during launch or null if we don't
* have a log collection (yet)
*/
export declare const internalGetLogCollection: () => Collection<Log>;
/**
* Get cross-server credential collection
* @author Gabe Abrams
* @return cross-server credential collection if one was included during launch or null
* if we don't have a cross-server credential collection (yet)
*/
export declare const internalGetCrossServerCredentialCollection: () => Collection<CrossServerCredential>;
/**
* Prepare dce-reactkit to run on the server
* @author Gabe Abrams
* @param opts object containing all arguments
* @param opts.app express app from inside of the postprocessor function that
* we will add routes to
* @param opts.getLaunchInfo CACCL LTI's get launch info function
* @param [opts.logCollection] mongo collection from dce-mango to use for
* storing logs. If none is included, logs are written to the console
* @param [opts.logReviewAdmins=all] info on which admins can review
* logs from the client. If not included, all Canvas admins are allowed to
* review logs. If null, no Canvas admins are allowed to review logs.
* If an array of Canvas userIds (numbers), only Canvas admins with those
* userIds are allowed to review logs. If a dce-mango collection, only
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
* to review logs
* @param [opts.crossServerCredentialCollection] mongo collection from dce-mango to use for
* storing cross-server credentials. If none is included, cross-server credentials
* are not supported
*/
declare const initServer: (opts: {
app: express.Application;
logReviewAdmins?: (number[] | Collection<any>);
logCollection?: Collection<Log>;
crossServerCredentialCollection?: Collection<CrossServerCredential>;
}) => void;
export default initServer;