@cloudnux/local-cloud-provider 0.16.0 → 0.18.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 +53 -18
- 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 +10 -6
- package/dist/queue-plugin/index.js +44 -14
- 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/dist/websocket-plugin/index.js +3 -2
- package/dist/websocket-plugin/index.js.map +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1850,6 +1850,15 @@ function createLocalFunctionsService() {
|
|
|
1850
1850
|
};
|
|
1851
1851
|
return [wsRequest];
|
|
1852
1852
|
},
|
|
1853
|
+
createInvokeRequest: (envelop, requestId) => {
|
|
1854
|
+
const invokeRequest = {
|
|
1855
|
+
payload: envelop.payload,
|
|
1856
|
+
calledModule: envelop.calledModule,
|
|
1857
|
+
invokeTriggerName: envelop.invokeTriggerName,
|
|
1858
|
+
requestId
|
|
1859
|
+
};
|
|
1860
|
+
return [invokeRequest];
|
|
1861
|
+
},
|
|
1853
1862
|
buildHttpResponse: (context, _, reply) => {
|
|
1854
1863
|
reply.headers(context.response.headers ?? {}).status(context.response.status).send(context.response.body);
|
|
1855
1864
|
},
|
|
@@ -1874,6 +1883,12 @@ function createLocalFunctionsService() {
|
|
|
1874
1883
|
return void 0;
|
|
1875
1884
|
}
|
|
1876
1885
|
return void 0;
|
|
1886
|
+
},
|
|
1887
|
+
buildInvokeResponse: (context) => {
|
|
1888
|
+
if (context.response.status === "error") {
|
|
1889
|
+
throw new Error(JSON.stringify(context.response.body));
|
|
1890
|
+
}
|
|
1891
|
+
return context.response.body;
|
|
1877
1892
|
}
|
|
1878
1893
|
};
|
|
1879
1894
|
}
|
|
@@ -1900,6 +1915,28 @@ function createLocalWebSocketService() {
|
|
|
1900
1915
|
};
|
|
1901
1916
|
}
|
|
1902
1917
|
|
|
1918
|
+
// src/services/invoke.ts
|
|
1919
|
+
var _manager2 = null;
|
|
1920
|
+
function setInvokeManager(manager) {
|
|
1921
|
+
_manager2 = manager;
|
|
1922
|
+
}
|
|
1923
|
+
function createLocalInvokeService() {
|
|
1924
|
+
return {
|
|
1925
|
+
async invoke(moduleName, triggerName, payload) {
|
|
1926
|
+
const handler = _manager2.get(moduleName, triggerName);
|
|
1927
|
+
if (!handler) {
|
|
1928
|
+
throw new Error(`No local invoke handler registered for: ${moduleName}:${triggerName}`);
|
|
1929
|
+
}
|
|
1930
|
+
const envelope = {
|
|
1931
|
+
calledModule: moduleName,
|
|
1932
|
+
invokeTriggerName: triggerName,
|
|
1933
|
+
payload
|
|
1934
|
+
};
|
|
1935
|
+
return await handler(envelope);
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1903
1940
|
// src/router/index.ts
|
|
1904
1941
|
import Fastify from "fastify";
|
|
1905
1942
|
import fastifyRawBody from "fastify-raw-body";
|
|
@@ -1920,6 +1957,7 @@ function createRouter(options = {}) {
|
|
|
1920
1957
|
fastify.register(fastifyPrintRoutes);
|
|
1921
1958
|
fastify.addHook("onReady", () => {
|
|
1922
1959
|
setWebSocketManager(fastify.websockets);
|
|
1960
|
+
setInvokeManager(fastify.invokes);
|
|
1923
1961
|
});
|
|
1924
1962
|
return fastify;
|
|
1925
1963
|
}
|
|
@@ -1931,7 +1969,8 @@ var localCloudProvider = {
|
|
|
1931
1969
|
createLocationService: createLocalLocationService,
|
|
1932
1970
|
createEventBrokerService: createLocalEventBrokerService,
|
|
1933
1971
|
createFunctionsService: createLocalFunctionsService,
|
|
1934
|
-
createWebSocketService: createLocalWebSocketService
|
|
1972
|
+
createWebSocketService: createLocalWebSocketService,
|
|
1973
|
+
createInvokeService: createLocalInvokeService
|
|
1935
1974
|
};
|
|
1936
1975
|
export {
|
|
1937
1976
|
createRouter,
|