@cloudnux/local-cloud-provider 0.15.0 → 0.17.0
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/dev-console-plugin/index.d.ts +4 -4
- package/dist/dev-console-plugin/index.js +2 -2
- package/dist/dev-console-plugin/index.js.map +1 -1
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/invoke-plugin/index.d.ts +24 -0
- package/dist/invoke-plugin/index.js +23 -0
- package/dist/invoke-plugin/index.js.map +1 -0
- package/dist/queue-plugin/index.d.ts +4 -4
- package/dist/queue-plugin/index.js +1 -1
- package/dist/queue-plugin/index.js.map +1 -1
- package/dist/schedule-plugin/index.d.ts +2 -2
- package/dist/schedule-plugin/index.js +1 -1
- package/dist/schedule-plugin/index.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FastifyPluginOptions, FastifyPluginAsync } from 'fastify';
|
|
2
|
+
|
|
3
|
+
type InvokeHandlerFn = (envelop: {
|
|
4
|
+
payload?: any;
|
|
5
|
+
calledModule: string;
|
|
6
|
+
invokeTriggerName: string;
|
|
7
|
+
}) => Promise<any>;
|
|
8
|
+
interface InvokeManager {
|
|
9
|
+
register(module: string, name: string, handler: InvokeHandlerFn): void;
|
|
10
|
+
get(module: string, name: string): InvokeHandlerFn | undefined;
|
|
11
|
+
list(): string[];
|
|
12
|
+
}
|
|
13
|
+
interface InvokePluginOptions extends FastifyPluginOptions {
|
|
14
|
+
prefix?: string;
|
|
15
|
+
}
|
|
16
|
+
declare module 'fastify' {
|
|
17
|
+
interface FastifyInstance {
|
|
18
|
+
invokes: InvokeManager;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare const invokesPlugin: FastifyPluginAsync<InvokePluginOptions>;
|
|
23
|
+
|
|
24
|
+
export { type InvokeHandlerFn, type InvokeManager, type InvokePluginOptions, invokesPlugin };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/invoke-plugin/plugin.ts
|
|
2
|
+
import fsPlugin from "fastify-plugin";
|
|
3
|
+
var invokesPlugin = fsPlugin(async (app) => {
|
|
4
|
+
const registry = /* @__PURE__ */ new Map();
|
|
5
|
+
const invokeManager = {
|
|
6
|
+
register(module, name, handler) {
|
|
7
|
+
const key = `${module}:${name}`;
|
|
8
|
+
registry.set(key, handler);
|
|
9
|
+
},
|
|
10
|
+
get(module, name) {
|
|
11
|
+
const key = `${module}:${name}`;
|
|
12
|
+
return registry.get(key);
|
|
13
|
+
},
|
|
14
|
+
list() {
|
|
15
|
+
return Array.from(registry.keys());
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
app.decorate("invokes", invokeManager);
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
invokesPlugin
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/invoke-plugin/plugin.ts"],"sourcesContent":["import { FastifyInstance, FastifyPluginAsync } from \"fastify\";\nimport fsPlugin from \"fastify-plugin\";\n\nimport { InvokePluginOptions, InvokeManager, InvokeHandlerFn } from \"./types\";\n\nexport const invokesPlugin: FastifyPluginAsync<InvokePluginOptions> =\n fsPlugin(async (app: FastifyInstance) => {\n const registry = new Map<string, InvokeHandlerFn>();\n const invokeManager: InvokeManager = {\n register(module, name, handler) {\n const key = `${module}:${name}`;\n registry.set(key, handler);\n },\n get(module, name) {\n const key = `${module}:${name}`;\n return registry.get(key);\n },\n list() {\n return Array.from(registry.keys());\n },\n };\n\n app.decorate('invokes', invokeManager);\n });\n"],"mappings":";AACA,OAAO,cAAc;AAId,IAAM,gBACT,SAAS,OAAO,QAAyB;AACrC,QAAM,WAAW,oBAAI,IAA6B;AAClD,QAAM,gBAA+B;AAAA,IACjC,SAAS,QAAQ,MAAM,SAAS;AAC5B,YAAM,MAAM,GAAG,MAAM,IAAI,IAAI;AAC7B,eAAS,IAAI,KAAK,OAAO;AAAA,IAC7B;AAAA,IACA,IAAI,QAAQ,MAAM;AACd,YAAM,MAAM,GAAG,MAAM,IAAI,IAAI;AAC7B,aAAO,SAAS,IAAI,GAAG;AAAA,IAC3B;AAAA,IACA,OAAO;AACH,aAAO,MAAM,KAAK,SAAS,KAAK,CAAC;AAAA,IACrC;AAAA,EACJ;AAEA,MAAI,SAAS,WAAW,aAAa;AACzC,CAAC;","names":[]}
|
|
@@ -31,11 +31,11 @@ interface QueueConfig {
|
|
|
31
31
|
maxConcurrent: number;
|
|
32
32
|
retryBackoff: boolean;
|
|
33
33
|
persistence: {
|
|
34
|
-
enabled
|
|
34
|
+
enabled?: boolean;
|
|
35
35
|
directory: string;
|
|
36
|
-
saveInterval
|
|
37
|
-
saveOnShutdown
|
|
38
|
-
loadOnStartup
|
|
36
|
+
saveInterval?: number;
|
|
37
|
+
saveOnShutdown?: boolean;
|
|
38
|
+
loadOnStartup?: boolean;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
interface QueueSummary {
|
|
@@ -1227,7 +1227,7 @@ var createPersistenceInitializer = (config, loadAllQueueStates, saveDirtyQueueSt
|
|
|
1227
1227
|
if (config.persistence.loadOnStartup) {
|
|
1228
1228
|
await loadAllQueueStates();
|
|
1229
1229
|
}
|
|
1230
|
-
if (config.persistence.saveInterval > 0) {
|
|
1230
|
+
if (config.persistence.saveInterval && config.persistence.saveInterval > 0) {
|
|
1231
1231
|
intervalIdHolder.id = setInterval(saveDirtyQueueStates, config.persistence.saveInterval);
|
|
1232
1232
|
}
|
|
1233
1233
|
if (config.persistence.saveOnShutdown) {
|