@versori/run 0.2.25 → 0.2.27
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/esm/src/dsl/http/versori/roundtripper.d.ts +9 -0
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +355 -38
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts +9 -0
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +0 -9
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +16 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +0 -9
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +16 -1
- package/package.json +2 -1
- package/script/src/dsl/http/versori/roundtripper.d.ts +9 -0
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +355 -38
- package/script/src/dsl/triggers/WebhookTrigger.d.ts +9 -0
- package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +0 -9
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +16 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +0 -9
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +16 -1
|
@@ -9,7 +9,6 @@ const exporter_trace_otlp_proto_1 = require("@opentelemetry/exporter-trace-otlp-
|
|
|
9
9
|
const resources_1 = require("@opentelemetry/resources");
|
|
10
10
|
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
11
11
|
const express_1 = __importDefault(require("express"));
|
|
12
|
-
const express_xml_bodyparser_1 = __importDefault(require("express-xml-bodyparser"));
|
|
13
12
|
const rxjs_1 = require("rxjs");
|
|
14
13
|
const ContextProvider_js_1 = require("../../context/ContextProvider.js");
|
|
15
14
|
const default_js_1 = require("../../dsl/http/default.js");
|
|
@@ -246,16 +245,8 @@ class MemoryInterpreter {
|
|
|
246
245
|
const port = Deno.env.get('PORT') || 3000;
|
|
247
246
|
const cronPort = Deno.env.get('CRON_PORT') || 3001;
|
|
248
247
|
const webhookApp = (0, express_1.default)();
|
|
249
|
-
webhookApp.use(express_1.default.json({ limit: '50mb' })); // Add JSON body parser middleware
|
|
250
248
|
const cronApp = (0, express_1.default)();
|
|
251
249
|
cronApp.use(express_1.default.json());
|
|
252
|
-
const xml2jsDefaults = {
|
|
253
|
-
explicitArray: false,
|
|
254
|
-
normalize: false,
|
|
255
|
-
normalizeTags: false,
|
|
256
|
-
trim: true,
|
|
257
|
-
};
|
|
258
|
-
webhookApp.use((0, express_xml_bodyparser_1.default)(xml2jsDefaults));
|
|
259
250
|
// Add health check route
|
|
260
251
|
this.webhookRouter.get('/health', (_req, res) => {
|
|
261
252
|
res.json({ status: 'healthy' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwD7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CAgSxE,CAAC"}
|
|
@@ -5,10 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.webhookCompiler = void 0;
|
|
7
7
|
const cors_1 = __importDefault(require("cors"));
|
|
8
|
+
const express_1 = __importDefault(require("express"));
|
|
8
9
|
const promises_1 = require("node:stream/promises");
|
|
9
10
|
const rxjs_1 = require("rxjs");
|
|
10
11
|
const webhookmiddleware_js_1 = require("../../../dsl/http/versori/webhookmiddleware.js");
|
|
11
12
|
const WebhookTrigger_js_1 = require("../../../dsl/triggers/WebhookTrigger.js");
|
|
13
|
+
const express_xml_bodyparser_1 = __importDefault(require("express-xml-bodyparser"));
|
|
14
|
+
const xml2jsDefaults = {
|
|
15
|
+
explicitArray: false,
|
|
16
|
+
normalize: false,
|
|
17
|
+
normalizeTags: false,
|
|
18
|
+
trim: true,
|
|
19
|
+
};
|
|
12
20
|
const DEFAULT_SYNC_ON_SUCCESS = (ctx) => new Response(JSON.stringify(ctx.data), {
|
|
13
21
|
status: 200,
|
|
14
22
|
headers: {
|
|
@@ -46,7 +54,7 @@ const DEFAULT_ASYNC_ON_ERROR = (ctx) => new Response(JSON.stringify({
|
|
|
46
54
|
exports.webhookCompiler = {
|
|
47
55
|
ctor: WebhookTrigger_js_1.WebhookTrigger,
|
|
48
56
|
compile: (ctx, trigger, signal) => {
|
|
49
|
-
const { response: { mode = 'async'
|
|
57
|
+
const { response: { mode = 'async' } = {}, cors: corsOptions } = trigger.options;
|
|
50
58
|
const isSync = mode === 'sync';
|
|
51
59
|
const isAsync = mode === 'async';
|
|
52
60
|
if (!isSync && !isAsync) {
|
|
@@ -73,6 +81,13 @@ exports.webhookCompiler = {
|
|
|
73
81
|
},
|
|
74
82
|
request: req,
|
|
75
83
|
});
|
|
84
|
+
if (!trigger.options.request?.rawBody) {
|
|
85
|
+
ctx.webhookRouter.use(express_1.default.json({ limit: '50mb' }));
|
|
86
|
+
ctx.webhookRouter.use((0, express_xml_bodyparser_1.default)(xml2jsDefaults));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
ctx.webhookRouter.use(express_1.default.raw({ type: '*/*', limit: '50mb' }));
|
|
90
|
+
}
|
|
76
91
|
return new rxjs_1.Observable((subscriber) => {
|
|
77
92
|
if (!ctx.webhookRouter) {
|
|
78
93
|
throw new Error('Router not available in compiler context');
|