Skip to content

Commit c87aef7

Browse files
authored
Merge pull request #83 from OpenFunction/refactor/plugin-system
2 parents 0004a69 + 3849597 commit c87aef7

34 files changed

+1129
-1040
lines changed

docs/generated/api.json

Lines changed: 318 additions & 65 deletions
Large diffs are not rendered by default.

docs/generated/api.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export interface LegacyEvent {
110110
// @public
111111
export interface OpenFunction {
112112
// (undocumented)
113-
(ctx: OpenFunctionRuntime, data: {}): any;
113+
(ctx: OpenFunctionRuntime, data: object): any;
114114
}
115115

116116
// @public
@@ -136,8 +136,8 @@ export interface OpenFunctionContext {
136136
name: string;
137137
outputs?: OpenFunctionBinding;
138138
port?: string;
139-
postPlugins?: Array<string | Plugin_2 | undefined>;
140-
prePlugins?: Array<string | Plugin_2 | undefined>;
139+
postPlugins?: string[];
140+
prePlugins?: string[];
141141
runtime: `${RuntimeType}` | `${Capitalize<RuntimeType>}` | `${Uppercase<RuntimeType>}`;
142142
version: string;
143143
}
@@ -146,6 +146,8 @@ export interface OpenFunctionContext {
146146
export abstract class OpenFunctionRuntime {
147147
constructor(context: OpenFunctionContext);
148148
protected readonly context: OpenFunctionContext;
149+
getPlugin(name: string): Plugin_2;
150+
readonly locals: Record<string, any>;
149151
static Parse(context: OpenFunctionContext): OpenFunctionRuntime;
150152
static ProxyContext(context: OpenFunctionContext): OpenFunctionRuntime;
151153
get req(): Request_3<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | undefined;
@@ -158,17 +160,17 @@ export abstract class OpenFunctionRuntime {
158160
};
159161
// Warning: (ae-forgotten-export) The symbol "OpenFunctionTrigger" needs to be exported by the entry point index.d.ts
160162
protected trigger?: OpenFunctionTrigger;
163+
static WrapUserFunction(userFunction: OpenFunction, context: OpenFunctionContext | OpenFunctionRuntime): (data: any) => Promise<void>;
161164
}
162165

163166
// @public
164167
class Plugin_2 {
165-
execPostHook(ctx?: OpenFunctionRuntime): Promise<void>;
166-
execPreHook(ctx?: OpenFunctionRuntime): Promise<void>;
167-
get(filedName: string): string;
168-
// (undocumented)
169-
static OFN_PLUGIN_NAME: string;
170-
// (undocumented)
171-
static OFN_PLUGIN_VERSION: string;
168+
constructor(name: string, version?: string);
169+
execPostHook(ctx: OpenFunctionRuntime | null, plugins: Record<string, Plugin_2>): Promise<void>;
170+
execPreHook(ctx: OpenFunctionRuntime | null, plugins: Record<string, Plugin_2>): Promise<void>;
171+
get(prop: string): any;
172+
readonly name: string;
173+
readonly version: string;
172174
}
173175
export { Plugin_2 as Plugin }
174176

package-lock.json

Lines changed: 57 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@
5353
"author": "OpenFunction",
5454
"license": "Apache-2.0",
5555
"devDependencies": {
56-
"@microsoft/api-extractor": "^7.28.4",
56+
"@microsoft/api-extractor": "^7.29.3",
5757
"@types/body-parser": "1.19.2",
5858
"@types/debug": "^4.1.7",
5959
"@types/express": "4.17.13",
6060
"@types/google-protobuf": "^3.15.6",
61-
"@types/lodash": "^4.14.182",
61+
"@types/lodash": "^4.14.184",
6262
"@types/minimist": "1.2.2",
6363
"@types/mocha": "9.1.1",
6464
"@types/node": "14.18.11",
6565
"@types/node-fetch": "^2.6.2",
6666
"@types/on-finished": "2.3.1",
67-
"@types/semver": "^7.3.10",
67+
"@types/semver": "^7.3.12",
6868
"@types/shelljs": "^0.8.11",
6969
"@types/sinon": "10.0.11",
7070
"@types/supertest": "2.0.12",

0 commit comments

Comments
 (0)