Skip to content

Commit

Permalink
fix: merge router to validator branch
Browse files Browse the repository at this point in the history
  • Loading branch information
annahassel committed Nov 22, 2020
1 parent c05d1d9 commit bfb9258
Show file tree
Hide file tree
Showing 175 changed files with 3,947 additions and 4,493 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@typescript-eslint/parser": "^4.7.0",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.2",
"denque": "^1.4.1",
"eslint": "^7.13.0",
"jest": "26.6.3",
"lerna": "^3.22.1",
Expand Down
47 changes: 0 additions & 47 deletions packages/core-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {
ActionTransport,
CONNECTORS_PROPERTY,
ConnectorsTypes,
DATA_KEY_SELECTOR,
DESTRUCTORS_PROPERTY,
PLUGIN_STATUS_FAIL,
PLUGIN_STATUS_OK,
Expand Down Expand Up @@ -119,52 +118,6 @@ export type MserviceError = Error & {
toJSON(): any;
}

export interface AuthConfig {
name: string;
passAuthError: boolean;
strategy: string;
}

export type HandlerProperties = typeof CONNECTORS_PROPERTY | typeof DESTRUCTORS_PROPERTY
export type TransportTypes = $Values<typeof ActionTransport>
export type ConnectorsTypes = $Values<typeof ConnectorsTypes>
export type RequestMethods = $Keys<typeof DATA_KEY_SELECTOR>
export type GetAuthName = (req: ServiceRequest) => string
export type ServiceActionStep = (...args: any[]) => PromiseLike<any>

export declare interface ServiceAction extends ServiceActionStep {
allowed?: () => boolean | Promise<boolean>;
auth?: string | GetAuthName | AuthConfig;
passAuthError?: boolean;
schema?: string | null | boolean;
responseSchema?: string;
validateResponse: boolean;
transports: TransportTypes[];
actionName: string;
readonly?: boolean;
}

export interface ServiceRequest {
route: string;
params: any;
headers: any;
query: any;
method: RequestMethods;
transport: TransportTypes;
transportRequest: any | ClientRequest;
action: ServiceAction;
locals: any;
auth?: any;
parentSpan: any;
span: any;
log: {
trace(...args: any[]): void;
debug(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
fatal(...args: any[]): void;
};
}

export type PluginStatus = typeof PLUGIN_STATUS_OK | typeof PLUGIN_STATUS_FAIL
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"version": "17.5.3",
"scripts": {
"lint": "eslint ./src",
"test": "yarn test:unit && yarn test:e2e",
"test:unit": "TS_NODE_TRANSPILE_ONLY=true mocha ./src/**/*.spec.?s",
"test": "yarn test:e2e",
"test:e2e": "mdep test run",
"compile": "tsc -b ./tsconfig.build.json",
"prepublishOnly": "cp ../../README.md ./README.md",
Expand Down
11 changes: 0 additions & 11 deletions packages/core/schemas/router.auth.json

This file was deleted.

34 changes: 0 additions & 34 deletions packages/core/schemas/router.extensions.json

This file was deleted.

22 changes: 0 additions & 22 deletions packages/core/schemas/router.json

This file was deleted.

70 changes: 0 additions & 70 deletions packages/core/schemas/router.routes.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export {
PLUGIN_STATUS_FAIL,
PluginTypes,
PluginsPriority,
ActionTransport,
ConnectorsTypes,
ConnectorsPriority
} from '@microfleet/utils'
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/plugins/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import semver = require('semver')
import Bluebird = require('bluebird')
import prometheus = require('prom-client')

// @todo plugin-router refactoring
const usageError = `
if "prometheus" and "router" plugins are used together - you have to manually configure router handlers:
Expand Down
Loading

0 comments on commit bfb9258

Please sign in to comment.