@versori/run 0.2.7 → 0.2.9
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/context/Context.d.ts +4 -4
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.d.ts +3 -3
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/dsl/http/default.d.ts +4 -4
- package/esm/src/dsl/http/default.d.ts.map +1 -1
- package/esm/src/dsl/http/default.js +3 -3
- package/esm/src/dsl/http/types.d.ts +8 -2
- package/esm/src/dsl/http/types.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.d.ts +10 -1
- package/esm/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.js +37 -0
- package/esm/src/dsl/http/versori/constants.d.ts +1 -0
- package/esm/src/dsl/http/versori/constants.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/constants.js +2 -0
- package/esm/src/dsl/http/versori/contextcredentials.d.ts +0 -4
- package/esm/src/dsl/http/versori/contextcredentials.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/cronapi.js +2 -2
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts +5 -7
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/proxyroundtripper.js +10 -24
- package/esm/src/dsl/http/versori/roundtripper.d.ts +5 -7
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +11 -24
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts +16 -0
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/webhookmiddleware.js +197 -0
- package/esm/src/dsl/tasks/HttpTask.d.ts +3 -3
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts +1 -0
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +7 -4
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +71 -21
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts +4 -2
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +2 -2
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +38 -12
- package/esm/src/observability/logging/ConsoleLogger.d.ts +1 -0
- package/esm/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/esm/src/observability/logging/ConsoleLogger.js +7 -0
- package/esm/src/observability/logging/Logger.d.ts +2 -1
- package/esm/src/observability/logging/Logger.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/src/context/Context.d.ts +4 -4
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/ContextProvider.d.ts +3 -3
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/dsl/http/default.d.ts +4 -4
- package/script/src/dsl/http/default.d.ts.map +1 -1
- package/script/src/dsl/http/default.js +3 -3
- package/script/src/dsl/http/types.d.ts +8 -2
- package/script/src/dsl/http/types.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.d.ts +10 -1
- package/script/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.js +39 -0
- package/script/src/dsl/http/versori/constants.d.ts +1 -0
- package/script/src/dsl/http/versori/constants.d.ts.map +1 -1
- package/script/src/dsl/http/versori/constants.js +3 -1
- package/script/src/dsl/http/versori/contextcredentials.d.ts +0 -4
- package/script/src/dsl/http/versori/contextcredentials.d.ts.map +1 -1
- package/script/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/script/src/dsl/http/versori/cronapi.js +1 -1
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts +5 -7
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/proxyroundtripper.js +9 -23
- package/script/src/dsl/http/versori/roundtripper.d.ts +5 -7
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +10 -23
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts +16 -0
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -0
- package/script/src/dsl/http/versori/webhookmiddleware.js +202 -0
- package/script/src/dsl/tasks/HttpTask.d.ts +3 -3
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.d.ts +1 -0
- package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +7 -4
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +71 -21
- package/script/src/interpreter/memory/ObservableCompiler.d.ts +4 -2
- package/script/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +2 -2
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +38 -12
- package/script/src/observability/logging/ConsoleLogger.d.ts +1 -0
- package/script/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/script/src/observability/logging/ConsoleLogger.js +7 -0
- package/script/src/observability/logging/Logger.d.ts +2 -1
- package/script/src/observability/logging/Logger.d.ts.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tracer } from '@opentelemetry/api';
|
|
2
2
|
import { Logger } from '../../../observability/logging/Logger.js';
|
|
3
|
-
import { DynamicFetcher, RoundTripperFactory } from '../types.js';
|
|
4
|
-
import {
|
|
3
|
+
import { ConfigReader, DynamicFetcher, RoundTripperFactory } from '../types.js';
|
|
4
|
+
import { CredentialsProvider, Token } from './contextcredentials.js';
|
|
5
5
|
import { VersoriCredentialClient } from './credentials/mod.js';
|
|
6
6
|
import { PlatformAPIClient } from './platformapi.js';
|
|
7
7
|
/**
|
|
@@ -19,23 +19,21 @@ export declare class VersoriCredentialsFactory implements RoundTripperFactory {
|
|
|
19
19
|
private tokenClient;
|
|
20
20
|
private credsBaseURL;
|
|
21
21
|
private platformAPIClient;
|
|
22
|
-
private
|
|
22
|
+
private cfgReader;
|
|
23
23
|
private log;
|
|
24
24
|
private tracer;
|
|
25
25
|
private readonly defaultDynamic;
|
|
26
|
-
constructor(credsClient: VersoriCredentialClient, credsBaseURL: string, platformAPIClient: PlatformAPIClient, logger: Logger, tracer: Tracer);
|
|
26
|
+
constructor(credsClient: VersoriCredentialClient, credsBaseURL: string, platformAPIClient: PlatformAPIClient, logger: Logger, tracer: Tracer, cfgReader: ConfigReader);
|
|
27
27
|
static fromEnv(logger: Logger, tracer: Tracer): VersoriCredentialsFactory;
|
|
28
28
|
private changeRequestInit;
|
|
29
29
|
private changeBaseUrl;
|
|
30
30
|
create(connName: string): Promise<typeof fetch | undefined>;
|
|
31
31
|
createDynamic(templateName: string): Promise<DynamicFetcher | undefined>;
|
|
32
32
|
private traceFetch;
|
|
33
|
-
credentials():
|
|
33
|
+
credentials(): CredentialsProvider;
|
|
34
34
|
getTokenByName(name: string, forceRefresh?: boolean, activationId?: string): Promise<Token>;
|
|
35
35
|
getRawByName(name: string, activationId?: string): Promise<Uint8Array>;
|
|
36
36
|
private getCredentialIDFromName;
|
|
37
|
-
private getConnectionID;
|
|
38
|
-
private getTemplateID;
|
|
39
37
|
private apiKeyFetcher;
|
|
40
38
|
private basicAuthFetcher;
|
|
41
39
|
private bearerTokenFetcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/roundtripper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,
|
|
1
|
+
{"version":3,"file":"roundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/roundtripper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,EAEH,YAAY,EAEZ,cAAc,EACd,mBAAmB,EACtB,MAAM,aAAa,CAAC;AAQrB,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;;;;;;GAUG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IACjE,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,iBAAiB,CAAoB;IAE7C,OAAO,CAAC,SAAS,CAAe;IAEhC,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;gBAGE,WAAW,EAAE,uBAAuB,EACpC,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY;IAe3B,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,yBAAyB;IAoCzE,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,aAAa;IAwBrB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,GAAG,SAAS,CAAC;IAqC3D,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAgDxE,OAAO,CAAC,UAAU;IAqClB,WAAW,IAAI,mBAAmB;IAO5B,cAAc,CAChB,IAAI,EAAE,MAAM,EACZ,YAAY,UAAQ,EACpB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,KAAK,CAAC;IAiBX,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;YAqB9D,uBAAuB;IAoDrC,OAAO,CAAC,aAAa;YAoDP,gBAAgB;YAmChB,kBAAkB;YAiClB,aAAa;YAwEb,QAAQ;CA0BzB"}
|
|
@@ -20,7 +20,7 @@ const helpers_js_1 = require("./helpers.js");
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
class VersoriCredentialsFactory {
|
|
23
|
-
constructor(credsClient, credsBaseURL, platformAPIClient, logger, tracer) {
|
|
23
|
+
constructor(credsClient, credsBaseURL, platformAPIClient, logger, tracer, cfgReader) {
|
|
24
24
|
Object.defineProperty(this, "tokenClient", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
configurable: true,
|
|
@@ -39,7 +39,7 @@ class VersoriCredentialsFactory {
|
|
|
39
39
|
writable: true,
|
|
40
40
|
value: void 0
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(this, "
|
|
42
|
+
Object.defineProperty(this, "cfgReader", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
configurable: true,
|
|
45
45
|
writable: true,
|
|
@@ -71,7 +71,7 @@ class VersoriCredentialsFactory {
|
|
|
71
71
|
this.tokenClient = credsClient;
|
|
72
72
|
this.credsBaseURL = credsBaseURL;
|
|
73
73
|
this.platformAPIClient = platformAPIClient;
|
|
74
|
-
this.
|
|
74
|
+
this.cfgReader = cfgReader;
|
|
75
75
|
this.log = logger;
|
|
76
76
|
this.tracer = tracer;
|
|
77
77
|
// lost 15 minutes because of this one
|
|
@@ -83,6 +83,7 @@ class VersoriCredentialsFactory {
|
|
|
83
83
|
const platformApiBaseURL = Deno.env.get(constants_js_1.envVarPlatformApiBaseURL);
|
|
84
84
|
const orgId = Deno.env.get(constants_js_1.envVarOrgId);
|
|
85
85
|
const envId = Deno.env.get(constants_js_1.envVarEnvId);
|
|
86
|
+
const cfgReader = configloader_js_1.VersoriConfigReader.fromEnv(logger);
|
|
86
87
|
if (!orgId || !envId || !platformApiBaseURL || !credsBaseURL) {
|
|
87
88
|
const missingVars = [];
|
|
88
89
|
if (!orgId)
|
|
@@ -98,7 +99,7 @@ class VersoriCredentialsFactory {
|
|
|
98
99
|
const log = logger || new mod_js_1.ConsoleLogger('debug');
|
|
99
100
|
const pAPIClient = new platformapi_js_1.PlatformAPIClient(platformApiBaseURL, orgId, envId, log);
|
|
100
101
|
const tokenClient = new mod_js_2.VersoriCredentialClient(credsBaseURL);
|
|
101
|
-
return new VersoriCredentialsFactory(tokenClient, credsBaseURL, pAPIClient, log, tracer);
|
|
102
|
+
return new VersoriCredentialsFactory(tokenClient, credsBaseURL, pAPIClient, log, tracer, cfgReader);
|
|
102
103
|
}
|
|
103
104
|
// takes the info and modifies the url using changeBaseUrl if necessary
|
|
104
105
|
// if a full valid URL is passed as a string, it will be returned as is
|
|
@@ -137,7 +138,7 @@ class VersoriCredentialsFactory {
|
|
|
137
138
|
return newURL.toString();
|
|
138
139
|
}
|
|
139
140
|
create(connName) {
|
|
140
|
-
const cnxId = this.getConnectionID(connName);
|
|
141
|
+
const cnxId = this.cfgReader.getConnectionID(connName);
|
|
141
142
|
if (!cnxId) {
|
|
142
143
|
this.log.debug('Connection not found in config, could be a dynamic connection', {
|
|
143
144
|
connectionName: connName,
|
|
@@ -169,7 +170,7 @@ class VersoriCredentialsFactory {
|
|
|
169
170
|
return Promise.resolve(_fn);
|
|
170
171
|
}
|
|
171
172
|
createDynamic(templateName) {
|
|
172
|
-
const template = this.getTemplateID(templateName);
|
|
173
|
+
const template = this.cfgReader.getTemplateID(templateName);
|
|
173
174
|
if (!template) {
|
|
174
175
|
this.log.debug('Template not found in config, could be a static connection', {
|
|
175
176
|
templateName: templateName,
|
|
@@ -265,7 +266,7 @@ class VersoriCredentialsFactory {
|
|
|
265
266
|
}
|
|
266
267
|
async getCredentialIDFromName(name, activationId) {
|
|
267
268
|
// fin connection config from versori file
|
|
268
|
-
const conn = this.
|
|
269
|
+
const conn = this.cfgReader.getCnxMapping(name);
|
|
269
270
|
if (!conn) {
|
|
270
271
|
return '';
|
|
271
272
|
}
|
|
@@ -296,21 +297,6 @@ class VersoriCredentialsFactory {
|
|
|
296
297
|
}
|
|
297
298
|
return staticConn.credentials[0].credential.id;
|
|
298
299
|
}
|
|
299
|
-
getConnectionID(connName) {
|
|
300
|
-
const conn = this.versoriCfg.mappings.find((c) => (c.dynamic === undefined || c.dynamic === false) &&
|
|
301
|
-
c.name.toLowerCase() === connName.toLowerCase());
|
|
302
|
-
if (!conn || !conn.connId) {
|
|
303
|
-
return '';
|
|
304
|
-
}
|
|
305
|
-
return conn.connId;
|
|
306
|
-
}
|
|
307
|
-
getTemplateID(templateName) {
|
|
308
|
-
const template = this.versoriCfg.mappings.find((c) => c.dynamic && c.name.toLowerCase() === templateName.toLowerCase());
|
|
309
|
-
if (!template || !template.templateId) {
|
|
310
|
-
return '';
|
|
311
|
-
}
|
|
312
|
-
return template.templateId;
|
|
313
|
-
}
|
|
314
300
|
apiKeyFetcher(conn, fn) {
|
|
315
301
|
const _fn = async (input, init) => {
|
|
316
302
|
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
@@ -480,7 +466,8 @@ class VersoriCredentialsFactory {
|
|
|
480
466
|
catch (error) {
|
|
481
467
|
this.log.error('unable to get credential', { error });
|
|
482
468
|
if (error instanceof connect_1.ConnectError) {
|
|
483
|
-
if (error.rawMessage.includes('connection error received: not a result of an error') &&
|
|
469
|
+
if (error.rawMessage.includes('connection error received: not a result of an error') &&
|
|
470
|
+
error.code === connect_1.Code.Internal) {
|
|
484
471
|
this.log.info('Connection error received, attempting to reconnect');
|
|
485
472
|
this.tokenClient = new mod_js_2.VersoriCredentialClient(this.credsBaseURL);
|
|
486
473
|
return await this.tokenClient.getToken(id);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextFunction, Response, Request } from 'express';
|
|
2
|
+
import { CredentialsProvider } from './contextcredentials.js';
|
|
3
|
+
import { ConfigReader, ConnectionProvider } from '../types.js';
|
|
4
|
+
import { Logger } from '../../../observability/mod.js';
|
|
5
|
+
export type CreateWebhookMiddleWareOpts = {
|
|
6
|
+
id: string;
|
|
7
|
+
connName?: string;
|
|
8
|
+
credentials: CredentialsProvider;
|
|
9
|
+
cnxProvider: ConnectionProvider;
|
|
10
|
+
cfgReader: ConfigReader;
|
|
11
|
+
log: Logger;
|
|
12
|
+
};
|
|
13
|
+
export declare function createStaticWebhookMiddleware(opts: CreateWebhookMiddleWareOpts): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
14
|
+
export declare function createActIdDynamicWebhookMiddleware(opts: CreateWebhookMiddleWareOpts): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
15
|
+
export declare function createUserIdDynamicWebhookMiddleware(opts: CreateWebhookMiddleWareOpts): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=webhookmiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookmiddleware.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/webhookmiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAwB,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGvD,MAAM,MAAM,2BAA2B,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,mBAAmB,CAAC;IACjC,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,YAAY,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,wBAAgB,6BAA6B,CACzC,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CA8DpE;AAED,wBAAgB,mCAAmC,CAC/C,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAiEpE;AAED,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAkFpE"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStaticWebhookMiddleware = createStaticWebhookMiddleware;
|
|
4
|
+
exports.createActIdDynamicWebhookMiddleware = createActIdDynamicWebhookMiddleware;
|
|
5
|
+
exports.createUserIdDynamicWebhookMiddleware = createUserIdDynamicWebhookMiddleware;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const node_buffer_1 = require("node:buffer");
|
|
8
|
+
// TODO: Refactor this so we don't have like three different middlewares for static and dynamic webhooks
|
|
9
|
+
function createStaticWebhookMiddleware(opts) {
|
|
10
|
+
if (opts.connName === undefined) {
|
|
11
|
+
opts.log.warn(`No connection ID found for webhook, accepting any requests which is unsecure!`, { webhookId: opts.id });
|
|
12
|
+
return async (_req, res, next) => {
|
|
13
|
+
const activation = await opts.cnxProvider.getStaticActivation();
|
|
14
|
+
res.locals.activation = activation;
|
|
15
|
+
next();
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return async (req, res, next) => {
|
|
19
|
+
if (!opts.connName) {
|
|
20
|
+
// This is mainly for type safety, but we should never reach this point
|
|
21
|
+
opts.log.error('Connection name is not defined for webhook middleware');
|
|
22
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const cnxId = opts.cfgReader.getConnectionID(opts.connName);
|
|
26
|
+
const conn = await opts.cnxProvider.getStaticConnection(cnxId);
|
|
27
|
+
const activation = await opts.cnxProvider.getStaticActivation();
|
|
28
|
+
if (conn === undefined || activation === undefined) {
|
|
29
|
+
opts.log.error(`Connection or activation not found for webhook: /${opts.id}`);
|
|
30
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const key = await opts.credentials.getRaw(opts.connName);
|
|
34
|
+
const asc = conn.credentials[0].authSchemeConfig;
|
|
35
|
+
if (!asc || !asc.hmac) {
|
|
36
|
+
opts.log.error('HMAC AuthSchemeConfig not found for webhook');
|
|
37
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const digest = createDigest(asc.hmac, req, key);
|
|
41
|
+
let requestDigest;
|
|
42
|
+
try {
|
|
43
|
+
requestDigest = extractDigest(asc.hmac, req);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
opts.log.error('Error extracting HMAC digest from request', { error });
|
|
47
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (digest !== requestDigest) {
|
|
51
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
res.locals.activation = activation;
|
|
55
|
+
next();
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function createActIdDynamicWebhookMiddleware(opts) {
|
|
59
|
+
if (!opts.connName) {
|
|
60
|
+
opts.log.warn(`No template ID found for webhook, accepting any requests which is unsecure!`, { webhookId: opts.id });
|
|
61
|
+
return async (req, res, next) => {
|
|
62
|
+
const activationId = req.params.activationId;
|
|
63
|
+
const activation = await opts.cnxProvider.getActivation(activationId);
|
|
64
|
+
res.locals.activation = activation;
|
|
65
|
+
next();
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return async (req, res, next) => {
|
|
69
|
+
if (!opts.connName) {
|
|
70
|
+
// This is mainly for type safety, but we should never reach this point
|
|
71
|
+
opts.log.error('Connection name is not defined for webhook middleware');
|
|
72
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const templateId = opts.cfgReader.getTemplateID(opts.connName);
|
|
76
|
+
const activationId = req.params.activationId;
|
|
77
|
+
const activation = await opts.cnxProvider.getActivation(activationId);
|
|
78
|
+
const conn = await opts.cnxProvider.getActivationConnection(templateId, activationId);
|
|
79
|
+
if (activation === undefined || conn === undefined) {
|
|
80
|
+
opts.log.error(`Activation or connection not found for webhook: /${opts.id}/activations/${activationId}`);
|
|
81
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const key = await opts.credentials.getRaw(opts.connName, activationId);
|
|
85
|
+
const asc = conn.credentials[0].authSchemeConfig;
|
|
86
|
+
if (!asc || !asc.hmac) {
|
|
87
|
+
opts.log.error('HMAC AuthSchemeConfig not found for webhook');
|
|
88
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const digest = createDigest(asc.hmac, req, key);
|
|
92
|
+
let requestDigest;
|
|
93
|
+
try {
|
|
94
|
+
requestDigest = extractDigest(asc.hmac, req);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
opts.log.error('Error extracting HMAC digest from request', { error });
|
|
98
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (digest !== requestDigest) {
|
|
102
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
res.locals.activation = activation;
|
|
106
|
+
next();
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function createUserIdDynamicWebhookMiddleware(opts) {
|
|
110
|
+
if (!opts.connName) {
|
|
111
|
+
opts.log.warn(`No template ID found for webhook, accepting any requests which is unsecure!`, { webhookId: opts.id });
|
|
112
|
+
return async (req, res, next) => {
|
|
113
|
+
const userId = req.params.userId;
|
|
114
|
+
const activations = await opts.cnxProvider.getUserActivations(userId);
|
|
115
|
+
if (activations.length === 0) {
|
|
116
|
+
opts.log.error(`No activations found for user: ${userId}`);
|
|
117
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const activation = activations[0];
|
|
121
|
+
res.locals.activation = activation;
|
|
122
|
+
next();
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return async (req, res, next) => {
|
|
126
|
+
if (!opts.connName) {
|
|
127
|
+
// This is mainly for type safety, but we should never reach this point
|
|
128
|
+
opts.log.error('Connection name is not defined for webhook middleware');
|
|
129
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const templateId = opts.cfgReader.getTemplateID(opts.connName);
|
|
133
|
+
const userId = req.params.userId;
|
|
134
|
+
const activations = await opts.cnxProvider.getUserActivations(userId);
|
|
135
|
+
if (activations.length === 0) {
|
|
136
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const activation = activations[0]; // Right now we only support a user having one activation
|
|
140
|
+
const conn = await opts.cnxProvider.getActivationConnection(templateId, activation.id);
|
|
141
|
+
if (conn === undefined) {
|
|
142
|
+
opts.log.error(`Connection not found for webhook: /${opts.id}/users/${userId}`);
|
|
143
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const key = await opts.credentials.getRaw(opts.connName, activation.id);
|
|
147
|
+
const asc = conn.credentials[0].authSchemeConfig;
|
|
148
|
+
if (!asc || !asc.hmac) {
|
|
149
|
+
opts.log.error('HMAC AuthSchemeConfig not found for webhook');
|
|
150
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const digest = createDigest(asc.hmac, req, key);
|
|
154
|
+
let requestDigest;
|
|
155
|
+
try {
|
|
156
|
+
requestDigest = extractDigest(asc.hmac, req);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
opts.log.error('Error extracting HMAC digest from request', { error });
|
|
160
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (digest !== requestDigest) {
|
|
164
|
+
res.status(401).json({ error: 'Unauthorised' });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
res.locals.activation = activation;
|
|
168
|
+
next();
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// createDigest creates a HMAC digest for the request using the provided key.
|
|
172
|
+
// Note that this assumes the request body is a JSON object, as one would normally
|
|
173
|
+
// expect for our use case.
|
|
174
|
+
// TODO: implement the case where we might want to digest the body + url or url + body
|
|
175
|
+
// or url...
|
|
176
|
+
function createDigest(asc, req, key) {
|
|
177
|
+
const hmac = (0, node_crypto_1.createHmac)(asc.algorithm, node_buffer_1.Buffer.from(key).toString('utf8'));
|
|
178
|
+
hmac.update(JSON.stringify(req.body));
|
|
179
|
+
return hmac.digest(asc.encoding);
|
|
180
|
+
}
|
|
181
|
+
function extractDigest(asc, req) {
|
|
182
|
+
switch (asc.in) {
|
|
183
|
+
case 'query':
|
|
184
|
+
if (req.query[asc.name]) {
|
|
185
|
+
return req.query[asc.name];
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case 'header':
|
|
189
|
+
if (req.headers[asc.name]) {
|
|
190
|
+
return req.headers[asc.name];
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
case 'cookie':
|
|
194
|
+
if (req.cookies[asc.name]) {
|
|
195
|
+
return req.cookies[asc.name];
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
default:
|
|
199
|
+
throw new Error(`Unsupported HMAC digest extraction method: ${asc.in}`);
|
|
200
|
+
}
|
|
201
|
+
throw new Error(`HMAC digest not found in request: ${asc.name}`);
|
|
202
|
+
}
|
|
@@ -2,7 +2,7 @@ import { Context, ContextImpl } from '../../context/Context.js';
|
|
|
2
2
|
import { KeyValue, KeyValueScope } from '../../kv/KeyValue.js';
|
|
3
3
|
import { Logger } from '../../observability/logging/Logger.js';
|
|
4
4
|
import { Activation, DynamicFetcher } from '../http/types.js';
|
|
5
|
-
import {
|
|
5
|
+
import { CredentialsProvider } from '../http/versori/contextcredentials.js';
|
|
6
6
|
import { ArrayTask, Task, Taskable, TaskType } from '../Task.js';
|
|
7
7
|
export interface HttpContext<Data, PageParams = undefined> extends Context<Data> {
|
|
8
8
|
fetch: typeof fetch;
|
|
@@ -42,9 +42,9 @@ export declare class HttpContextImpl<D, PageParams> implements HttpContext<D, Pa
|
|
|
42
42
|
get activation(): Activation | undefined;
|
|
43
43
|
get data(): D;
|
|
44
44
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
45
|
-
credentials():
|
|
45
|
+
credentials(): CredentialsProvider;
|
|
46
46
|
get fetch(): typeof globalThis.fetch;
|
|
47
|
-
nextPage(
|
|
47
|
+
nextPage(_nextParams: PageParams): Promise<void>;
|
|
48
48
|
}
|
|
49
49
|
export declare function http<In = any, Out = any, PageParams = unknown>(taskId: string, opts: HttpOptions<In, Out, PageParams>, fn: HttpContextFunc<In, Out, PageParams>): Task<In, Out>;
|
|
50
50
|
//# sourceMappingURL=HttpTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpTask.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/tasks/HttpTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HttpTask.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/tasks/HttpTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMjE,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAE,SAAQ,OAAO,CAAC,IAAI,CAAC;IAC5E,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,mBAAmB,E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AU,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzD;AAED,wBAAgB,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,UAAU,GAAG,OAAO,EAC1D,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,EACtC,EAAE,EAAE,eAAe,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GACzC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAEf"}
|
|
@@ -129,7 +129,7 @@ class HttpContextImpl {
|
|
|
129
129
|
? (0, types_js_1.wrapDynamicFetcher)(__classPrivateFieldGet(this, _HttpContextImpl_dynamicFetcher, "f"), __classPrivateFieldGet(this, _HttpContextImpl_inner, "f").activation)
|
|
130
130
|
: __classPrivateFieldGet(this, _HttpContextImpl_staticFetcher, "f") ?? globalThis.fetch;
|
|
131
131
|
}
|
|
132
|
-
async nextPage(
|
|
132
|
+
async nextPage(_nextParams) {
|
|
133
133
|
throw new Error('Method not implemented.');
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookTrigger.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/triggers/WebhookTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,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I,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAExB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;IAE7C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;CAC9C,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,qBAAa,cAAe,YAAW,OAAO,CAAC,WAAW,CAAC;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,cAAc,CAAC;IAExB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAa;gBAEtB,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IAKpD,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;CAG1D;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAElF"}
|
|
@@ -3,7 +3,7 @@ import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
|
3
3
|
import { Router } from 'express';
|
|
4
4
|
import { Observable, Subscription } from 'rxjs';
|
|
5
5
|
import { ContextProvider } from '../../context/ContextProvider.js';
|
|
6
|
-
import { ConnectionProvider, CronProvider, RoundTripperFactory } from '../../dsl/http/types.js';
|
|
6
|
+
import { ConfigReader, ConnectionProvider, CronProvider, RoundTripperFactory } from '../../dsl/http/types.js';
|
|
7
7
|
import { Workflow } from '../../dsl/Workflow.js';
|
|
8
8
|
import { ContextImpl, ContextOperatorFunction } from '../../mod.js';
|
|
9
9
|
import { Logger } from '../../observability/logging/Logger.js';
|
|
@@ -27,17 +27,20 @@ export declare class MemoryInterpreter {
|
|
|
27
27
|
private readonly compiler;
|
|
28
28
|
private readonly contextProvider;
|
|
29
29
|
private readonly roundTripperFactory;
|
|
30
|
-
private readonly
|
|
30
|
+
private readonly webhookRouter;
|
|
31
|
+
private readonly cronRouter;
|
|
31
32
|
private cronRegistry;
|
|
32
33
|
private readonly connectionProvider;
|
|
33
34
|
private readonly cronProvider;
|
|
34
35
|
private readonly tracer;
|
|
36
|
+
private readonly cfgReader;
|
|
35
37
|
private readonly otelSDK?;
|
|
36
38
|
private registeredWorkflows;
|
|
37
|
-
private
|
|
39
|
+
private webhookServer?;
|
|
40
|
+
private cronServer?;
|
|
38
41
|
private shutdownServer?;
|
|
39
42
|
private isShuttingDown;
|
|
40
|
-
constructor(log: Logger, compiler: ObservableCompiler, contextProvider: ContextProvider, roundTripperFactory: RoundTripperFactory,
|
|
43
|
+
constructor(log: Logger, compiler: ObservableCompiler, contextProvider: ContextProvider, roundTripperFactory: RoundTripperFactory, webhookRouter: Router, cronRouter: Router, cronRegistry: Map<string, string>, connectionProvider: ConnectionProvider, cronProvider: CronProvider, tracer: Tracer, cfgReader: ConfigReader, otelSDK?: NodeSDK | undefined);
|
|
41
44
|
static newInstance(options?: MemoryInterpreterOptions): Promise<MemoryInterpreter>;
|
|
42
45
|
register<O>(workflow: Workflow<O>, options?: MemoryInterpreterOptions): Registration;
|
|
43
46
|
start(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/MemoryInterpreter.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAA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