server相关的脚本的更新
This commit is contained in:
parent
71510cc882
commit
3cc18023ec
|
|
@ -1,4 +1,5 @@
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
import { PathLike } from 'fs';
|
import { PathLike } from 'fs';
|
||||||
import { checkFileExistsAndCreateType } from './enum';
|
import { checkFileExistsAndCreateType } from './enum';
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
/// <reference path="../../src/typings/polyfill.d.ts" />
|
/// <reference path="../../src/typings/polyfill.d.ts" />
|
||||||
import { Context, EntityDict, RowStore } from 'oak-domain/lib/types';
|
import { Context, EntityDict, RowStore } from 'oak-domain/lib/types';
|
||||||
export declare function initialize<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, dropIfExists?: boolean): Promise<void>;
|
import { MySQLConfiguration } from 'oak-db/lib/MySQL/types/Configuration';
|
||||||
|
export declare function initialize<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, dbConfig: MySQLConfiguration, dropIfExists?: boolean): Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.initialize = void 0;
|
exports.initialize = void 0;
|
||||||
/// <reference path="../typings/polyfill.d.ts" />
|
/// <reference path="../typings/polyfill.d.ts" />
|
||||||
const oak_backend_base_1 = require("oak-backend-base");
|
const oak_backend_base_1 = require("oak-backend-base");
|
||||||
async function initialize(path, contextBuilder, dropIfExists) {
|
async function initialize(path, contextBuilder, dbConfig, dropIfExists) {
|
||||||
const appLoader = new oak_backend_base_1.AppLoader(path, contextBuilder);
|
const appLoader = new oak_backend_base_1.AppLoader(path, contextBuilder, dbConfig);
|
||||||
await appLoader.mount();
|
await appLoader.mount(true);
|
||||||
await appLoader.initialize(dropIfExists);
|
await appLoader.initialize(dropIfExists);
|
||||||
await appLoader.unmount();
|
await appLoader.unmount();
|
||||||
console.log('data initialized');
|
console.log('data initialized');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
/// <reference path="../../src/typings/polyfill.d.ts" />
|
/// <reference path="../../src/typings/polyfill.d.ts" />
|
||||||
import './polyfill';
|
import './polyfill';
|
||||||
import { Connector, EntityDict, Context, RowStore } from 'oak-domain/lib/types';
|
import { Connector, EntityDict, Context, RowStore } from 'oak-domain/lib/types';
|
||||||
export declare function startup<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, connector: Connector<ED, Cxt>): Promise<void>;
|
import { MySQLConfiguration } from 'oak-db/lib/MySQL/types/Configuration';
|
||||||
|
export declare function startup<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, dbConfig: MySQLConfiguration, connector: Connector<ED, Cxt>): Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ const koa_router_1 = __importDefault(require("koa-router"));
|
||||||
const koa_body_1 = __importDefault(require("koa-body"));
|
const koa_body_1 = __importDefault(require("koa-body"));
|
||||||
const oak_backend_base_1 = require("oak-backend-base");
|
const oak_backend_base_1 = require("oak-backend-base");
|
||||||
const types_1 = require("oak-domain/lib/types");
|
const types_1 = require("oak-domain/lib/types");
|
||||||
async function startup(path, contextBuilder, connector) {
|
async function startup(path, contextBuilder, dbConfig, connector) {
|
||||||
const appLoader = new oak_backend_base_1.AppLoader(path, contextBuilder);
|
const appLoader = new oak_backend_base_1.AppLoader(path, contextBuilder, dbConfig);
|
||||||
await appLoader.mount();
|
await appLoader.mount();
|
||||||
const koa = new koa_1.default();
|
const koa = new koa_1.default();
|
||||||
koa.use((0, koa_body_1.default)({
|
koa.use((0, koa_body_1.default)({
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
/// <reference path="../typings/polyfill.d.ts" />
|
/// <reference path="../typings/polyfill.d.ts" />
|
||||||
import { AppLoader } from 'oak-backend-base';
|
import { AppLoader } from 'oak-backend-base';
|
||||||
import { Context, EntityDict, RowStore } from 'oak-domain/lib/types';
|
import { Context, EntityDict, RowStore } from 'oak-domain/lib/types';
|
||||||
|
import { MySQLConfiguration } from 'oak-db/lib/MySQL/types/Configuration';
|
||||||
|
|
||||||
export async function initialize<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, dropIfExists?: boolean) {
|
export async function initialize<ED extends EntityDict, Cxt extends Context<ED>>(
|
||||||
const appLoader = new AppLoader(path, contextBuilder);
|
path: string,
|
||||||
await appLoader.mount();
|
contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt,
|
||||||
|
dbConfig: MySQLConfiguration,
|
||||||
|
dropIfExists?: boolean) {
|
||||||
|
const appLoader = new AppLoader(path, contextBuilder, dbConfig);
|
||||||
|
await appLoader.mount(true);
|
||||||
await appLoader.initialize(dropIfExists);
|
await appLoader.initialize(dropIfExists);
|
||||||
await appLoader.unmount();
|
await appLoader.unmount();
|
||||||
console.log('data initialized');
|
console.log('data initialized');
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,16 @@ import './polyfill';
|
||||||
import Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import KoaRouter from 'koa-router';
|
import KoaRouter from 'koa-router';
|
||||||
import KoaBody from 'koa-body';
|
import KoaBody from 'koa-body';
|
||||||
import { AppLoader, BackendContext } from 'oak-backend-base';
|
import { AppLoader } from 'oak-backend-base';
|
||||||
import { OakException, Connector, EntityDict, Context, RowStore } from 'oak-domain/lib/types';
|
import { OakException, Connector, EntityDict, Context, RowStore } from 'oak-domain/lib/types';
|
||||||
|
import { MySQLConfiguration } from 'oak-db/lib/MySQL/types/Configuration';
|
||||||
|
|
||||||
export async function startup<ED extends EntityDict, Cxt extends Context<ED>>(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt, connector: Connector<ED, Cxt>) {
|
export async function startup<ED extends EntityDict, Cxt extends Context<ED>>(
|
||||||
const appLoader = new AppLoader(path, contextBuilder);
|
path: string,
|
||||||
|
contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt,
|
||||||
|
dbConfig: MySQLConfiguration,
|
||||||
|
connector: Connector<ED, Cxt>) {
|
||||||
|
const appLoader = new AppLoader(path, contextBuilder, dbConfig);
|
||||||
await appLoader.mount();
|
await appLoader.mount();
|
||||||
const koa = new Koa();
|
const koa = new Koa();
|
||||||
koa.use(KoaBody({
|
koa.use(KoaBody({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue