@faasjs/func 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +9 -11
- package/dist/index.mjs +9 -11
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -121,14 +121,10 @@ declare class Func<TEvent = any, TContext = any, TResult = any> {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
type UseifyPlugin<T> = T & {
|
|
124
|
-
mount: (data?:
|
|
125
|
-
config?: Config;
|
|
126
|
-
}) => Promise<T>;
|
|
124
|
+
mount: (data?: MountData) => Promise<T>;
|
|
127
125
|
};
|
|
128
126
|
declare function usePlugin<T extends Plugin>(plugin: T & {
|
|
129
|
-
mount?: (data?:
|
|
130
|
-
config?: Config;
|
|
131
|
-
}) => Promise<T>;
|
|
127
|
+
mount?: (data?: MountData) => Promise<T>;
|
|
132
128
|
}): UseifyPlugin<T>;
|
|
133
129
|
/**
|
|
134
130
|
* ```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -121,14 +121,10 @@ declare class Func<TEvent = any, TContext = any, TResult = any> {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
type UseifyPlugin<T> = T & {
|
|
124
|
-
mount: (data?:
|
|
125
|
-
config?: Config;
|
|
126
|
-
}) => Promise<T>;
|
|
124
|
+
mount: (data?: MountData) => Promise<T>;
|
|
127
125
|
};
|
|
128
126
|
declare function usePlugin<T extends Plugin>(plugin: T & {
|
|
129
|
-
mount?: (data?:
|
|
130
|
-
config?: Config;
|
|
131
|
-
}) => Promise<T>;
|
|
127
|
+
mount?: (data?: MountData) => Promise<T>;
|
|
132
128
|
}): UseifyPlugin<T>;
|
|
133
129
|
/**
|
|
134
130
|
* ```ts
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,10 @@ var crypto = require('crypto');
|
|
|
6
6
|
// src/index.ts
|
|
7
7
|
|
|
8
8
|
// src/plugins/run_handler/index.ts
|
|
9
|
+
var Name = "handler";
|
|
9
10
|
var RunHandler = class {
|
|
10
|
-
type =
|
|
11
|
-
name =
|
|
11
|
+
type = Name;
|
|
12
|
+
name = Name;
|
|
12
13
|
async onInvoke(data, next) {
|
|
13
14
|
if (data.handler)
|
|
14
15
|
if (!data.runHandler) {
|
|
@@ -172,16 +173,13 @@ function usePlugin(plugin) {
|
|
|
172
173
|
if (!plugins.find((p) => p.name === plugin.name)) plugins.push(plugin);
|
|
173
174
|
if (!plugin.mount)
|
|
174
175
|
plugin.mount = async (data) => {
|
|
176
|
+
if (!data) data = /* @__PURE__ */ Object.create(null);
|
|
177
|
+
if (!data.config) data.config = /* @__PURE__ */ Object.create(null);
|
|
178
|
+
if (!data.context) data.context = /* @__PURE__ */ Object.create(null);
|
|
179
|
+
if (!data.event) data.event = /* @__PURE__ */ Object.create(null);
|
|
180
|
+
if (!data.logger) data.logger = new logger.Logger(plugin.name);
|
|
175
181
|
if (plugin.onMount)
|
|
176
|
-
await plugin.onMount(
|
|
177
|
-
{
|
|
178
|
-
config: data?.config || /* @__PURE__ */ Object.create(null),
|
|
179
|
-
event: /* @__PURE__ */ Object.create(null),
|
|
180
|
-
context: /* @__PURE__ */ Object.create(null),
|
|
181
|
-
logger: new logger.Logger(plugin.name)
|
|
182
|
-
},
|
|
183
|
-
async () => Promise.resolve()
|
|
184
|
-
);
|
|
182
|
+
await plugin.onMount(data, async () => Promise.resolve());
|
|
185
183
|
return plugin;
|
|
186
184
|
};
|
|
187
185
|
return plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -4,9 +4,10 @@ import { randomBytes } from 'node:crypto';
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
|
|
6
6
|
// src/plugins/run_handler/index.ts
|
|
7
|
+
var Name = "handler";
|
|
7
8
|
var RunHandler = class {
|
|
8
|
-
type =
|
|
9
|
-
name =
|
|
9
|
+
type = Name;
|
|
10
|
+
name = Name;
|
|
10
11
|
async onInvoke(data, next) {
|
|
11
12
|
if (data.handler)
|
|
12
13
|
if (!data.runHandler) {
|
|
@@ -170,16 +171,13 @@ function usePlugin(plugin) {
|
|
|
170
171
|
if (!plugins.find((p) => p.name === plugin.name)) plugins.push(plugin);
|
|
171
172
|
if (!plugin.mount)
|
|
172
173
|
plugin.mount = async (data) => {
|
|
174
|
+
if (!data) data = /* @__PURE__ */ Object.create(null);
|
|
175
|
+
if (!data.config) data.config = /* @__PURE__ */ Object.create(null);
|
|
176
|
+
if (!data.context) data.context = /* @__PURE__ */ Object.create(null);
|
|
177
|
+
if (!data.event) data.event = /* @__PURE__ */ Object.create(null);
|
|
178
|
+
if (!data.logger) data.logger = new Logger(plugin.name);
|
|
173
179
|
if (plugin.onMount)
|
|
174
|
-
await plugin.onMount(
|
|
175
|
-
{
|
|
176
|
-
config: data?.config || /* @__PURE__ */ Object.create(null),
|
|
177
|
-
event: /* @__PURE__ */ Object.create(null),
|
|
178
|
-
context: /* @__PURE__ */ Object.create(null),
|
|
179
|
-
logger: new Logger(plugin.name)
|
|
180
|
-
},
|
|
181
|
-
async () => Promise.resolve()
|
|
182
|
-
);
|
|
180
|
+
await plugin.onMount(data, async () => Promise.resolve());
|
|
183
181
|
return plugin;
|
|
184
182
|
};
|
|
185
183
|
return plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/func",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@faasjs/deep_merge": "3.1.
|
|
38
|
-
"@faasjs/logger": "3.1.
|
|
37
|
+
"@faasjs/deep_merge": "3.1.5",
|
|
38
|
+
"@faasjs/logger": "3.1.5"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=22.0.0",
|