@versori/run 0.2.8 → 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 +70 -20
- 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 +70 -20
- 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
|
@@ -2,6 +2,7 @@ import cors from 'cors';
|
|
|
2
2
|
import { pipeline } from 'node:stream/promises';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { WebhookTrigger } from '../../../dsl/triggers/WebhookTrigger.js';
|
|
5
|
+
import { createActIdDynamicWebhookMiddleware, createStaticWebhookMiddleware, createUserIdDynamicWebhookMiddleware } from '../../../dsl/http/versori/webhookmiddleware.js';
|
|
5
6
|
const DEFAULT_SYNC_ON_SUCCESS = (ctx) => new Response(JSON.stringify(ctx.data), {
|
|
6
7
|
status: 200,
|
|
7
8
|
headers: {
|
|
@@ -66,28 +67,35 @@ export const webhookCompiler = {
|
|
|
66
67
|
},
|
|
67
68
|
});
|
|
68
69
|
return new Observable((subscriber) => {
|
|
69
|
-
if (!ctx.
|
|
70
|
+
if (!ctx.webhookRouter) {
|
|
70
71
|
throw new Error('Router not available in compiler context');
|
|
71
72
|
}
|
|
72
73
|
// add the webhook endpoint to the router
|
|
73
74
|
ctx.log.info('webhook endpoint added:', { trigger });
|
|
74
75
|
if (corsOptions) {
|
|
75
76
|
if (typeof corsOptions === 'boolean') {
|
|
76
|
-
ctx.
|
|
77
|
+
ctx.webhookRouter.use(cors());
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
|
-
ctx.
|
|
80
|
+
ctx.webhookRouter.use(cors(corsOptions));
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
// endpoint for sans user because I'm not quite sure how the dynamic routing works
|
|
83
|
-
ctx.
|
|
84
|
+
ctx.webhookRouter.post(`/${trigger.id}`, createStaticWebhookMiddleware({
|
|
85
|
+
id: trigger.id,
|
|
86
|
+
connName: trigger.options.connection,
|
|
87
|
+
credentials: ctx.roundTripperFactory.credentials(),
|
|
88
|
+
cnxProvider: ctx.connectionProvider,
|
|
89
|
+
cfgReader: ctx.configReader,
|
|
90
|
+
log: ctx.log,
|
|
91
|
+
}), async (req, res) => {
|
|
84
92
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
85
93
|
span.setAttribute('task.id', trigger.id);
|
|
86
94
|
span.setAttribute('task.type', 'webhook');
|
|
87
95
|
let executionCtx = ctx.contextProvider.create(req.body, ctxOptionsFn(res));
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
executionCtx = executionCtx.withActivation(
|
|
96
|
+
const staticActivation = res.locals.activation;
|
|
97
|
+
if (staticActivation) {
|
|
98
|
+
executionCtx = executionCtx.withActivation(staticActivation);
|
|
91
99
|
}
|
|
92
100
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
93
101
|
try {
|
|
@@ -110,13 +118,24 @@ export const webhookCompiler = {
|
|
|
110
118
|
});
|
|
111
119
|
});
|
|
112
120
|
// this endpoint will trigger the workflow for each activation given by the external user ID
|
|
113
|
-
ctx.
|
|
121
|
+
ctx.webhookRouter.post(`/${trigger.id}/users/:userId`, createUserIdDynamicWebhookMiddleware({
|
|
122
|
+
id: trigger.id,
|
|
123
|
+
connName: trigger.options.connection,
|
|
124
|
+
credentials: ctx.roundTripperFactory.credentials(),
|
|
125
|
+
cnxProvider: ctx.connectionProvider,
|
|
126
|
+
cfgReader: ctx.configReader,
|
|
127
|
+
log: ctx.log,
|
|
128
|
+
}), async (req, res) => {
|
|
114
129
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
115
130
|
span.setAttribute('task.id', trigger.id);
|
|
116
131
|
span.setAttribute('task.type', 'webhook');
|
|
117
132
|
span.setAttribute('user.id', req.params.userId);
|
|
118
133
|
const userId = req.params.userId;
|
|
119
|
-
const
|
|
134
|
+
const activation = res.locals.activation;
|
|
135
|
+
const activations = [activation];
|
|
136
|
+
// Right now we only support a user having one activation
|
|
137
|
+
// so this will need changing when we support multiple activations per user
|
|
138
|
+
// as will the middleware
|
|
120
139
|
if (!activations || activations.length === 0) {
|
|
121
140
|
res.status(404).json({
|
|
122
141
|
status: 'error',
|
|
@@ -157,13 +176,20 @@ export const webhookCompiler = {
|
|
|
157
176
|
});
|
|
158
177
|
});
|
|
159
178
|
// this endpoint will trigger the workflow only for the activation given by its ID
|
|
160
|
-
ctx.
|
|
179
|
+
ctx.webhookRouter.post(`/${trigger.id}/activations/:activationId`, createActIdDynamicWebhookMiddleware({
|
|
180
|
+
id: trigger.id,
|
|
181
|
+
connName: trigger.options.connection,
|
|
182
|
+
credentials: ctx.roundTripperFactory.credentials(),
|
|
183
|
+
cnxProvider: ctx.connectionProvider,
|
|
184
|
+
cfgReader: ctx.configReader,
|
|
185
|
+
log: ctx.log,
|
|
186
|
+
}), async (req, res) => {
|
|
161
187
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
162
188
|
span.setAttribute('task.id', trigger.id);
|
|
163
189
|
span.setAttribute('task.type', 'webhook');
|
|
164
190
|
span.setAttribute('activation.id', req.params.activationId);
|
|
165
|
-
const
|
|
166
|
-
const
|
|
191
|
+
const activation = res.locals.activation;
|
|
192
|
+
const activationId = activation.id || req.params.activationId;
|
|
167
193
|
if (!activation) {
|
|
168
194
|
// TODO report back actual errors
|
|
169
195
|
res.status(404).json({
|
|
@@ -9,6 +9,7 @@ export declare class ConsoleLogger implements Logger {
|
|
|
9
9
|
fields: Record<string, unknown>;
|
|
10
10
|
constructor(level: LogLevel, fields?: Record<string, unknown>);
|
|
11
11
|
debug(message: string, fields?: Record<string, unknown>): void;
|
|
12
|
+
warn(message: string, fields?: Record<string, unknown>): void;
|
|
12
13
|
info(message: string, fields?: Record<string, unknown>): void;
|
|
13
14
|
error(message: string, err?: Error, fields?: Record<string, unknown>): void;
|
|
14
15
|
error(message: string, fields?: Record<string, unknown>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"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158
|
+
warn: log.getLevelByName('WARN'),
|
|
158
159
|
info: log.getLevelByName('INFO'),
|
|
159
160
|
error: log.getLevelByName('ERROR'),
|
|
160
161
|
};
|
|
@@ -192,6 +193,12 @@ export class ConsoleLogger {
|
|
|
192
193
|
...fields,
|
|
193
194
|
});
|
|
194
195
|
}
|
|
196
|
+
warn(message, fields) {
|
|
197
|
+
this.log.warn(message, {
|
|
198
|
+
...this.fields,
|
|
199
|
+
...fields,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
195
202
|
info(message, fields) {
|
|
196
203
|
this.log.info(message, {
|
|
197
204
|
...this.fields,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export type LogLevel = 'debug' | 'info' | 'error';
|
|
1
|
+
export type LogLevel = 'debug' | 'warn' | 'info' | 'error';
|
|
2
2
|
export interface Logger {
|
|
3
3
|
level: LogLevel;
|
|
4
4
|
debug(message: string, fields?: Record<string, unknown>): void;
|
|
5
|
+
warn(message: string, fields?: Record<string, unknown>): void;
|
|
5
6
|
info(message: string, fields?: Record<string, unknown>): void;
|
|
6
7
|
error(message: string, fields?: Record<string, unknown>): void;
|
|
7
8
|
child(fields: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/Logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/Logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,MAAM;IACnB,KAAK,EAAE,QAAQ,CAAC;IAEhB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE/D,KAAK,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAEjD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Activation } from '../dsl/http/types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CredentialsProvider } from '../dsl/http/versori/contextcredentials.js';
|
|
3
3
|
import { KeyValue, KeyValueProvider, KeyValueScope } from '../kv/KeyValue.js';
|
|
4
4
|
import { Logger } from '../observability/logging/Logger.js';
|
|
5
5
|
export type OnSuccessFn = (ctx: Context<any>) => void;
|
|
@@ -20,7 +20,7 @@ export interface Context<D> {
|
|
|
20
20
|
* @param scope
|
|
21
21
|
*/
|
|
22
22
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
23
|
-
credentials():
|
|
23
|
+
credentials(): CredentialsProvider;
|
|
24
24
|
}
|
|
25
25
|
export declare class ContextImpl<D, Index = void> implements Context<D> {
|
|
26
26
|
#private;
|
|
@@ -31,13 +31,13 @@ export declare class ContextImpl<D, Index = void> implements Context<D> {
|
|
|
31
31
|
idx: Index;
|
|
32
32
|
readonly kvp: KeyValueProvider;
|
|
33
33
|
readonly options: ContextOptions;
|
|
34
|
-
constructor(log: Logger, kvp: KeyValueProvider, creds:
|
|
34
|
+
constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider, executionId: string, startTime: Date, data: D, options?: ContextOptions);
|
|
35
35
|
get activation(): Activation | undefined;
|
|
36
36
|
setIndex(idx: number): ContextImpl<D, number>;
|
|
37
37
|
withActivation(activation: Activation): ContextImpl<D, Index>;
|
|
38
38
|
withData<D2>(data: D2): ContextImpl<D2, Index>;
|
|
39
39
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
40
|
-
credentials():
|
|
40
|
+
credentials(): CredentialsProvider;
|
|
41
41
|
destroy(scope: KeyValueScope): Promise<void>;
|
|
42
42
|
[Symbol.toPrimitive](): Record<string, unknown>;
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,S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EAAE,KAAK,CAAC;IAY9C,MAAM,CAAC,KAAK,GAAE,aAA2B,GAAG,QAAQ;IAepD,WAAW,IAAI,mBAAmB;IAQlC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KeyValueProvider } from '../kv/KeyValue.js';
|
|
2
2
|
import { Logger } from '../observability/logging/Logger.js';
|
|
3
3
|
import { Context, ContextImpl, ContextOptions } from './Context.js';
|
|
4
|
-
import {
|
|
4
|
+
import { CredentialsProvider } from '../dsl/http/versori/contextcredentials.js';
|
|
5
5
|
export interface ContextProvider {
|
|
6
6
|
create<D>(data: D, options?: ContextOptions): ContextImpl<D, void>;
|
|
7
7
|
destroy(ctx: Context<any>): Promise<void>;
|
|
@@ -9,8 +9,8 @@ export interface ContextProvider {
|
|
|
9
9
|
export declare class ContextProviderImpl implements ContextProvider {
|
|
10
10
|
log: Logger;
|
|
11
11
|
kvp: KeyValueProvider;
|
|
12
|
-
creds:
|
|
13
|
-
constructor(log: Logger, kvp: KeyValueProvider, creds:
|
|
12
|
+
creds: CredentialsProvider;
|
|
13
|
+
constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider);
|
|
14
14
|
create<D>(data: D, options?: ContextOptions): ContextImpl<D>;
|
|
15
15
|
destroy(ctx: Context<any>): Promise<void>;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,qBAAa,mBAAoB,YAAW,eAAe;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,KAAK,EAAE,mBAAmB,CAAC;gBAEf,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,mBAAmB;IAM1E,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,cAAmB,GAAG,WAAW,CAAC,CAAC,CAAC;IAehE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamicFetcher, RoundTripperFactory } from './types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { CredentialsProvider } from './versori/contextcredentials.js';
|
|
3
3
|
/**
|
|
4
4
|
* A factory class for creating a default round tripper.
|
|
5
5
|
* This class is used to provide a default implementation for initializing
|
|
@@ -18,8 +18,8 @@ export declare class DefaultRoundTripperFactory implements RoundTripperFactory {
|
|
|
18
18
|
* @param fn - The fetch function to be used. Defaults to the global fetch function.
|
|
19
19
|
* @returns A promise that resolves to the fetch function.
|
|
20
20
|
*/
|
|
21
|
-
create(
|
|
22
|
-
createDynamic(
|
|
23
|
-
credentials():
|
|
21
|
+
create(_connName: string): Promise<typeof fetch>;
|
|
22
|
+
createDynamic(_templateName: string): Promise<DynamicFetcher>;
|
|
23
|
+
credentials(): CredentialsProvider;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAClE;;OAEG;;IAIH;;;;;;;OAOG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC;IAIhD,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMnE,WAAW,IAAI,mBAAmB;CAUrC"}
|
|
@@ -20,11 +20,11 @@ class DefaultRoundTripperFactory {
|
|
|
20
20
|
* @param fn - The fetch function to be used. Defaults to the global fetch function.
|
|
21
21
|
* @returns A promise that resolves to the fetch function.
|
|
22
22
|
*/
|
|
23
|
-
async create(
|
|
23
|
+
async create(_connName) {
|
|
24
24
|
return globalThis.fetch;
|
|
25
25
|
}
|
|
26
|
-
async createDynamic(
|
|
27
|
-
return async (
|
|
26
|
+
async createDynamic(_templateName) {
|
|
27
|
+
return async (_activation, input, init) => {
|
|
28
28
|
return globalThis.fetch(input, init);
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialsProvider } from './versori/contextcredentials.js';
|
|
2
2
|
export type DynamicFetcher = (activation: Activation, input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
3
3
|
export interface RoundTripperFactory {
|
|
4
4
|
create(connName: string): Promise<typeof fetch | undefined>;
|
|
5
5
|
createDynamic(templateName: string): Promise<DynamicFetcher | undefined>;
|
|
6
|
-
credentials():
|
|
6
|
+
credentials(): CredentialsProvider;
|
|
7
7
|
}
|
|
8
8
|
export declare function wrapDynamicFetcher(fetcher: DynamicFetcher, activation: Activation): typeof fetch;
|
|
9
|
+
export interface ConfigReader {
|
|
10
|
+
getCnxMapping(name: string): CnxMap | undefined;
|
|
11
|
+
getConnectionID(connName: string): string;
|
|
12
|
+
getTemplateID(templateName: string): string;
|
|
13
|
+
}
|
|
9
14
|
export interface ConnectionProvider {
|
|
10
15
|
getStaticConnection(cnxId: string): Promise<Connection | undefined>;
|
|
11
16
|
getUserActivations(userId: string): Promise<Activation[]>;
|
|
@@ -105,6 +110,7 @@ export type AuthSchemeConfigHMAC = AuthSchemeConfigBase & {
|
|
|
105
110
|
in: 'query' | 'header' | 'cookie';
|
|
106
111
|
algorithm: 'sha1' | 'sha256' | 'sha512';
|
|
107
112
|
digestInputs: DigestInput[];
|
|
113
|
+
encoding: 'hex' | 'base64' | 'base64url';
|
|
108
114
|
};
|
|
109
115
|
type ParameterConfig = {
|
|
110
116
|
parameterName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logger } from '../../../observability/mod.js';
|
|
2
|
+
import { CnxMap, ConfigReader, VersoriSDKConfig } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Loads the Versori SDK configuration from a JSON file.
|
|
4
5
|
*
|
|
@@ -9,4 +10,12 @@ import { VersoriSDKConfig } from '../types.js';
|
|
|
9
10
|
* @returns {VersoriSDKConfig} The parsed configuration object.
|
|
10
11
|
*/
|
|
11
12
|
export declare function LoadConfigFromFile(): VersoriSDKConfig;
|
|
13
|
+
export declare class VersoriConfigReader implements ConfigReader {
|
|
14
|
+
private versoriCfg;
|
|
15
|
+
constructor(cfg: VersoriSDKConfig);
|
|
16
|
+
static fromEnv(log: Logger): VersoriConfigReader;
|
|
17
|
+
getCnxMapping(name: string): CnxMap | undefined;
|
|
18
|
+
getConnectionID(connName: string): string;
|
|
19
|
+
getTemplateID(templateName: string): string;
|
|
20
|
+
}
|
|
12
21
|
//# sourceMappingURL=configloader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configloader.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/configloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"configloader.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/configloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIrE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,CAUrD;AAED,qBAAa,mBAAoB,YAAW,YAAY;IACpD,OAAO,CAAC,UAAU,CAAmB;gBAEzB,GAAG,EAAE,gBAAgB;IAIjC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;IAShD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI/C,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAczC,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAW9C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersoriConfigReader = void 0;
|
|
3
4
|
exports.LoadConfigFromFile = LoadConfigFromFile;
|
|
4
5
|
const constants_js_1 = require("./constants.js");
|
|
5
6
|
/**
|
|
@@ -20,3 +21,41 @@ function LoadConfigFromFile() {
|
|
|
20
21
|
const cfg = JSON.parse(Deno.readTextFileSync(configFileName));
|
|
21
22
|
return cfg;
|
|
22
23
|
}
|
|
24
|
+
class VersoriConfigReader {
|
|
25
|
+
constructor(cfg) {
|
|
26
|
+
Object.defineProperty(this, "versoriCfg", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
this.versoriCfg = cfg;
|
|
33
|
+
}
|
|
34
|
+
static fromEnv(log) {
|
|
35
|
+
const versoriCfg = LoadConfigFromFile();
|
|
36
|
+
if (!versoriCfg) {
|
|
37
|
+
log.error('Failed to load Versori SDK configuration');
|
|
38
|
+
throw new Error('Failed to load Versori SDK configuration');
|
|
39
|
+
}
|
|
40
|
+
return new VersoriConfigReader(versoriCfg);
|
|
41
|
+
}
|
|
42
|
+
getCnxMapping(name) {
|
|
43
|
+
return this.versoriCfg.mappings.find((c) => c.name.toLowerCase() === name.toLowerCase());
|
|
44
|
+
}
|
|
45
|
+
getConnectionID(connName) {
|
|
46
|
+
const conn = this.versoriCfg.mappings.find((c) => (c.dynamic === undefined || c.dynamic === false) &&
|
|
47
|
+
c.name.toLowerCase() === connName.toLowerCase());
|
|
48
|
+
if (!conn || !conn.connId) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
return conn.connId;
|
|
52
|
+
}
|
|
53
|
+
getTemplateID(templateName) {
|
|
54
|
+
const template = this.versoriCfg.mappings.find((c) => c.dynamic && c.name.toLowerCase() === templateName.toLowerCase());
|
|
55
|
+
if (!template || !template.templateId) {
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
return template.templateId;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.VersoriConfigReader = VersoriConfigReader;
|
|
@@ -15,4 +15,5 @@ export declare const envVarClientSecret = "RUN_CLIENT_SECRET";
|
|
|
15
15
|
export declare const envVarTokenEndpoint = "RUN_TOKEN_ENDPOINT";
|
|
16
16
|
export declare const envVarInternalToken = "RUN_INTERNAL_TOKEN";
|
|
17
17
|
export declare const envVarLocalRun = "RUN_LOCAL";
|
|
18
|
+
export declare const cronPort = 3001;
|
|
18
19
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD,eAAO,MAAM,WAAW,uBA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9C,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAGxD,eAAO,MAAM,cAAc,cAAc,CAAC;AAI1C,eAAO,MAAM,QAAQ,OAAO,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.envVarLocalRun = exports.envVarInternalToken = exports.envVarTokenEndpoint = exports.envVarClientSecret = exports.envVarClientId = exports.envVarConfigFile = exports.envVarVersion = exports.envVarOtelTracesURL = exports.envVarCredsBaseURL = exports.envVarSelfRefURL = exports.envVarCronApiBaseURL = exports.envVarPlatformApiBaseURL = exports.envVarOrgSlug = exports.envVarProjectId = exports.envVarEnvironmentName = exports.envVarEnvId = exports.envVarOrgId = void 0;
|
|
3
|
+
exports.cronPort = exports.envVarLocalRun = exports.envVarInternalToken = exports.envVarTokenEndpoint = exports.envVarClientSecret = exports.envVarClientId = exports.envVarConfigFile = exports.envVarVersion = exports.envVarOtelTracesURL = exports.envVarCredsBaseURL = exports.envVarSelfRefURL = exports.envVarCronApiBaseURL = exports.envVarPlatformApiBaseURL = exports.envVarOrgSlug = exports.envVarProjectId = exports.envVarEnvironmentName = exports.envVarEnvId = exports.envVarOrgId = void 0;
|
|
4
4
|
// This file contains constants used in the Versori DSL HTTP client.
|
|
5
5
|
exports.envVarOrgId = 'RUN_ORGANISATION_ID';
|
|
6
6
|
exports.envVarEnvId = 'RUN_ENVIRONMENT_ID';
|
|
@@ -22,3 +22,5 @@ exports.envVarTokenEndpoint = 'RUN_TOKEN_ENDPOINT';
|
|
|
22
22
|
exports.envVarInternalToken = 'RUN_INTERNAL_TOKEN';
|
|
23
23
|
// The following are for running locally
|
|
24
24
|
exports.envVarLocalRun = 'RUN_LOCAL';
|
|
25
|
+
// please no changerino
|
|
26
|
+
exports.cronPort = 3001; // The port on which the cron API communicates with the service
|
|
@@ -3,10 +3,6 @@ export type Token = {
|
|
|
3
3
|
tokenType: string;
|
|
4
4
|
expiry?: Date;
|
|
5
5
|
};
|
|
6
|
-
export interface Credentials {
|
|
7
|
-
getRaw(name: string): Promise<Uint8Array>;
|
|
8
|
-
getAccessToken(name: string, forceRefresh?: boolean): Promise<Token>;
|
|
9
|
-
}
|
|
10
6
|
export interface CredentialsProvider {
|
|
11
7
|
getRaw(name: string, activationId?: string): Promise<Uint8Array>;
|
|
12
8
|
getAccessToken(name: string, forceRefresh?: boolean, activationId?: string): Promise<Token>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextcredentials.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/contextcredentials.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"contextcredentials.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/contextcredentials.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEjE,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronapi.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/cronapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cronapi.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/cronapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAY3C,KAAK,IAAI,GAAG;IACR,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,aAAc,YAAW,YAAY;IAC9C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAU;gBAEd,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAOlE,MAAM,CAAC,OAAO,IAAI,aAAa;IAmBzB,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB5D,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE;CAoB3B"}
|
|
@@ -43,7 +43,7 @@ class CronAPIClient {
|
|
|
43
43
|
throw new Error('Missing required environment variables');
|
|
44
44
|
}
|
|
45
45
|
const integrationUrl = Deno.env.get(constants_js_1.envVarSelfRefURL) ||
|
|
46
|
-
`http://svc-${projectId.toLowerCase()}-${envName.toLowerCase()}.sb-${orgSlug.toLowerCase()}.svc.cluster.local`;
|
|
46
|
+
`http://svc-${projectId.toLowerCase()}-${envName.toLowerCase()}.sb-${orgSlug.toLowerCase()}.svc.cluster.local:${constants_js_1.cronPort}`;
|
|
47
47
|
return new CronAPIClient(baseUrl, envId, integrationUrl);
|
|
48
48
|
}
|
|
49
49
|
async updateCrons(crons) {
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { DynamicFetcher, RoundTripperFactory } from '../types.js';
|
|
1
|
+
import { ConfigReader, DynamicFetcher, RoundTripperFactory } from '../types.js';
|
|
2
2
|
import { PlatformAPIClient } from './platformapi.js';
|
|
3
3
|
import { Logger } from '../../../observability/mod.js';
|
|
4
|
-
import {
|
|
4
|
+
import { CredentialsProvider } from './contextcredentials.js';
|
|
5
5
|
export declare class ProxyRoundTripper implements RoundTripperFactory {
|
|
6
6
|
private platformApiBaseUrl;
|
|
7
|
-
private
|
|
7
|
+
private cfgReader;
|
|
8
8
|
private platformApiClient;
|
|
9
9
|
private internalAuth;
|
|
10
10
|
private log;
|
|
11
|
-
constructor(log: Logger, platformApiBaseUrl: string, platformApiClient: PlatformAPIClient);
|
|
11
|
+
constructor(log: Logger, platformApiBaseUrl: string, platformApiClient: PlatformAPIClient, cfgReader: ConfigReader);
|
|
12
12
|
static fromEnv(log: Logger): ProxyRoundTripper;
|
|
13
|
-
private getConnectionID;
|
|
14
|
-
private getTemplateID;
|
|
15
13
|
private makeProxyUrlString;
|
|
16
14
|
private makeProxyInput;
|
|
17
15
|
private makeProxyInit;
|
|
18
16
|
create(connName: string): Promise<typeof fetch | undefined>;
|
|
19
17
|
createDynamic(templateName: string): Promise<DynamicFetcher | undefined>;
|
|
20
|
-
credentials():
|
|
18
|
+
credentials(): CredentialsProvider;
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=proxyroundtripper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyroundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/proxyroundtripper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"proxyroundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/proxyroundtripper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAK9D,qBAAa,iBAAkB,YAAW,mBAAmB;IACzD,OAAO,CAAC,kBAAkB,CAAS;IAEnC,OAAO,CAAC,SAAS,CAAe;IAEhC,OAAO,CAAC,iBAAiB,CAAoB;IAE7C,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,GAAG,CAAS;gBAGhB,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,MAAM,EAC1B,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,YAAY;IAS3B,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB;IA0B9C,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,cAAc;YA6BR,aAAa;IA4B3B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,GAAG,SAAS,CAAC;IAoB3D,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAqCxE,WAAW,IAAI,mBAAmB;CAcrC"}
|
|
@@ -9,14 +9,14 @@ const internalauth_js_1 = require("./internalauth.js");
|
|
|
9
9
|
// ProxyRoundTripper is a factory for creating roundtrippers that use the Versori Platform API proxy endpoints.
|
|
10
10
|
// this should allow code from the platform to be run locally.
|
|
11
11
|
class ProxyRoundTripper {
|
|
12
|
-
constructor(log, platformApiBaseUrl, platformApiClient) {
|
|
12
|
+
constructor(log, platformApiBaseUrl, platformApiClient, cfgReader) {
|
|
13
13
|
Object.defineProperty(this, "platformApiBaseUrl", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
configurable: true,
|
|
16
16
|
writable: true,
|
|
17
17
|
value: void 0
|
|
18
18
|
});
|
|
19
|
-
Object.defineProperty(this, "
|
|
19
|
+
Object.defineProperty(this, "cfgReader", {
|
|
20
20
|
enumerable: true,
|
|
21
21
|
configurable: true,
|
|
22
22
|
writable: true,
|
|
@@ -40,7 +40,7 @@ class ProxyRoundTripper {
|
|
|
40
40
|
writable: true,
|
|
41
41
|
value: void 0
|
|
42
42
|
});
|
|
43
|
-
this.
|
|
43
|
+
this.cfgReader = cfgReader;
|
|
44
44
|
this.log = log;
|
|
45
45
|
this.platformApiBaseUrl = platformApiBaseUrl;
|
|
46
46
|
this.platformApiClient = platformApiClient;
|
|
@@ -50,6 +50,7 @@ class ProxyRoundTripper {
|
|
|
50
50
|
const baseUrl = Deno.env.get(constants_js_1.envVarPlatformApiBaseURL);
|
|
51
51
|
const orgId = Deno.env.get(constants_js_1.envVarOrgId);
|
|
52
52
|
const envId = Deno.env.get(constants_js_1.envVarEnvId);
|
|
53
|
+
const cfgReader = configloader_js_1.VersoriConfigReader.fromEnv(log);
|
|
53
54
|
if (!baseUrl || !orgId || !envId) {
|
|
54
55
|
const missingVars = [];
|
|
55
56
|
if (!baseUrl)
|
|
@@ -61,22 +62,7 @@ class ProxyRoundTripper {
|
|
|
61
62
|
log.error(`Missing required environment variables: ${missingVars.join(', ')}`);
|
|
62
63
|
throw new Error('Missing required environment variables: ' + missingVars.join(', '));
|
|
63
64
|
}
|
|
64
|
-
return new ProxyRoundTripper(log, baseUrl, new platformapi_js_1.PlatformAPIClient(baseUrl, orgId, envId, log));
|
|
65
|
-
}
|
|
66
|
-
getConnectionID(connName) {
|
|
67
|
-
const conn = this.versoriCfg.mappings.find((c) => (c.dynamic === undefined || c.dynamic === false) &&
|
|
68
|
-
c.name.toLowerCase() === connName.toLowerCase());
|
|
69
|
-
if (!conn || !conn.connId) {
|
|
70
|
-
return '';
|
|
71
|
-
}
|
|
72
|
-
return conn.connId;
|
|
73
|
-
}
|
|
74
|
-
getTemplateID(templateName) {
|
|
75
|
-
const template = this.versoriCfg.mappings.find((c) => c.dynamic && c.name.toLowerCase() === templateName.toLowerCase());
|
|
76
|
-
if (!template || !template.templateId) {
|
|
77
|
-
return '';
|
|
78
|
-
}
|
|
79
|
-
return template.templateId;
|
|
65
|
+
return new ProxyRoundTripper(log, baseUrl, new platformapi_js_1.PlatformAPIClient(baseUrl, orgId, envId, log), cfgReader);
|
|
80
66
|
}
|
|
81
67
|
makeProxyUrlString(url, cnxId) {
|
|
82
68
|
if ((0, helpers_js_1.isValidURL)(url)) {
|
|
@@ -137,7 +123,7 @@ class ProxyRoundTripper {
|
|
|
137
123
|
return init;
|
|
138
124
|
}
|
|
139
125
|
create(connName) {
|
|
140
|
-
const cnxId = this.getConnectionID(connName);
|
|
126
|
+
const cnxId = this.cfgReader.getConnectionID(connName);
|
|
141
127
|
if (!cnxId) {
|
|
142
128
|
this.log.error(`Connection ${connName} not found in configuration`);
|
|
143
129
|
return Promise.resolve(undefined);
|
|
@@ -151,7 +137,7 @@ class ProxyRoundTripper {
|
|
|
151
137
|
return Promise.resolve(_fn);
|
|
152
138
|
}
|
|
153
139
|
createDynamic(templateName) {
|
|
154
|
-
const template = this.getTemplateID(templateName);
|
|
140
|
+
const template = this.cfgReader.getTemplateID(templateName);
|
|
155
141
|
if (!template) {
|
|
156
142
|
this.log.error(`Template ${templateName} not found in configuration, could be a static connection`);
|
|
157
143
|
return Promise.resolve(undefined);
|
|
@@ -171,10 +157,10 @@ class ProxyRoundTripper {
|
|
|
171
157
|
}
|
|
172
158
|
credentials() {
|
|
173
159
|
return {
|
|
174
|
-
getRaw: (_name) => {
|
|
160
|
+
getRaw: (_name, _actId) => {
|
|
175
161
|
return Promise.reject(new Error('Not implemented, getRaw is not supported in proxy mode'));
|
|
176
162
|
},
|
|
177
|
-
getAccessToken: (_name, _forceRefresh) => {
|
|
163
|
+
getAccessToken: (_name, _forceRefresh, _actId) => {
|
|
178
164
|
return Promise.reject(new Error('Not implemented, getAccessToken is not supported in proxy mode'));
|
|
179
165
|
},
|
|
180
166
|
};
|